mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 20:40:05 +00:00
Start generating libm tests automatically with MPFR.
This commit is contained in:
parent
97161a9373
commit
ffb536d0ac
37
ChangeLog
37
ChangeLog
@ -1,3 +1,40 @@
|
||||
2013-11-29 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* math/gen-auto-libm-tests.c: New file.
|
||||
* math/auto-libm-test-in: Likewise.
|
||||
* math/auto-libm-test-out: New generated file.
|
||||
* math/gen-libm-test.pl ($auto_input, %auto_tests): New global
|
||||
variables.
|
||||
(%beautify): Add generated representations of zero.
|
||||
(top level): Set $auto_input and call parse_auto_input.
|
||||
(beautify): Remove trailing "f" from hex float constants.
|
||||
(parse_args): Handle XFAIL_TEST.
|
||||
(convert_condition): New function.
|
||||
(or_value): Likewise.
|
||||
(or_cond_value): Likewise.
|
||||
(generate_testfile): Handle AUTO_TESTS_* lines.
|
||||
(parse_auto_input): New function.
|
||||
* math/libm-test.inc (XFAIL_TEST): New macro.
|
||||
(ERRNO_UNCHANGED): Update value.
|
||||
(ERRNO_EDOM): Likewise.
|
||||
(ERRNO_ERANGE): Likewise.
|
||||
(IGNORE_RESULT): Likewise.
|
||||
(TEST_COND_flt_32): New macro.
|
||||
(TEST_COND_dbl_64): Likewise.
|
||||
(TEST_COND_ldbl_96_intel): Likewise.
|
||||
(TEST_COND_ldbl_96_m68k): Likewise.
|
||||
(TEST_COND_ldbl_128): Likewise.
|
||||
(TEST_COND_ldbl_128ibm): Likewise.
|
||||
(TEST_COND_long32): Likewise.
|
||||
(TEST_COND_long64): Likewise.
|
||||
(TEST_COND_before_rounding): Likewise.
|
||||
(TEST_COND_after_rounding): Likewise.
|
||||
(enable_test): Handle XFAIL_TEST flag.
|
||||
(sqrt_test_data): Use AUTO_TESTS_f_f for tests of finite inputs
|
||||
with finite results.
|
||||
* math/Makefile ($(objpfx)libm-test.stmp): Depend on
|
||||
auto-libm-test-out.
|
||||
|
||||
2013-11-29 Siddhesh Poyarekar <siddhesh@redhat.com>
|
||||
Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
|
||||
|
||||
|
@ -112,7 +112,8 @@ ulps-file = $(firstword $(wildcard $(sysdirs:%=%/libm-test-ulps)))
|
||||
|
||||
$(addprefix $(objpfx), $(libm-tests-generated)): $(objpfx)libm-test.stmp
|
||||
|
||||
$(objpfx)libm-test.stmp: $(ulps-file) libm-test.inc gen-libm-test.pl
|
||||
$(objpfx)libm-test.stmp: $(ulps-file) libm-test.inc gen-libm-test.pl \
|
||||
auto-libm-test-out
|
||||
$(make-target-directory)
|
||||
$(PERL) gen-libm-test.pl -u $< -o "$(objpfx)"
|
||||
@echo > $@
|
||||
|
27
math/auto-libm-test-in
Normal file
27
math/auto-libm-test-in
Normal file
@ -0,0 +1,27 @@
|
||||
# libm test inputs for gen-auto-libm-tests.c.
|
||||
# Copyright (C) 1997-2013 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
#
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# The GNU C Library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with the GNU C Library; if not, see
|
||||
# <http://www.gnu.org/licenses/>. */
|
||||
|
||||
sqrt 0
|
||||
sqrt -0
|
||||
sqrt 2209
|
||||
sqrt 4
|
||||
sqrt 2
|
||||
sqrt 0.25
|
||||
sqrt 6642.25
|
||||
sqrt 15190.5625
|
||||
sqrt 0.75
|
225
math/auto-libm-test-out
Normal file
225
math/auto-libm-test-out
Normal file
@ -0,0 +1,225 @@
|
||||
sqrt 0
|
||||
= sqrt downward flt-32 0x0p+0f : 0x0p+0f :
|
||||
= sqrt tonearest flt-32 0x0p+0f : 0x0p+0f :
|
||||
= sqrt towardzero flt-32 0x0p+0f : 0x0p+0f :
|
||||
= sqrt upward flt-32 0x0p+0f : 0x0p+0f :
|
||||
= sqrt downward dbl-64 0x0p+0 : 0x0p+0 :
|
||||
= sqrt tonearest dbl-64 0x0p+0 : 0x0p+0 :
|
||||
= sqrt towardzero dbl-64 0x0p+0 : 0x0p+0 :
|
||||
= sqrt upward dbl-64 0x0p+0 : 0x0p+0 :
|
||||
= sqrt downward ldbl-96-intel 0x0p+0L : 0x0p+0L :
|
||||
= sqrt tonearest ldbl-96-intel 0x0p+0L : 0x0p+0L :
|
||||
= sqrt towardzero ldbl-96-intel 0x0p+0L : 0x0p+0L :
|
||||
= sqrt upward ldbl-96-intel 0x0p+0L : 0x0p+0L :
|
||||
= sqrt downward ldbl-96-m68k 0x0p+0L : 0x0p+0L :
|
||||
= sqrt tonearest ldbl-96-m68k 0x0p+0L : 0x0p+0L :
|
||||
= sqrt towardzero ldbl-96-m68k 0x0p+0L : 0x0p+0L :
|
||||
= sqrt upward ldbl-96-m68k 0x0p+0L : 0x0p+0L :
|
||||
= sqrt downward ldbl-128 0x0p+0L : 0x0p+0L :
|
||||
= sqrt tonearest ldbl-128 0x0p+0L : 0x0p+0L :
|
||||
= sqrt towardzero ldbl-128 0x0p+0L : 0x0p+0L :
|
||||
= sqrt upward ldbl-128 0x0p+0L : 0x0p+0L :
|
||||
= sqrt downward ldbl-128ibm 0x0p+0L : 0x0p+0L :
|
||||
= sqrt tonearest ldbl-128ibm 0x0p+0L : 0x0p+0L :
|
||||
= sqrt towardzero ldbl-128ibm 0x0p+0L : 0x0p+0L :
|
||||
= sqrt upward ldbl-128ibm 0x0p+0L : 0x0p+0L :
|
||||
sqrt -0
|
||||
= sqrt downward flt-32 -0x0p+0f : -0x0p+0f :
|
||||
= sqrt tonearest flt-32 -0x0p+0f : -0x0p+0f :
|
||||
= sqrt towardzero flt-32 -0x0p+0f : -0x0p+0f :
|
||||
= sqrt upward flt-32 -0x0p+0f : -0x0p+0f :
|
||||
= sqrt downward dbl-64 -0x0p+0 : -0x0p+0 :
|
||||
= sqrt tonearest dbl-64 -0x0p+0 : -0x0p+0 :
|
||||
= sqrt towardzero dbl-64 -0x0p+0 : -0x0p+0 :
|
||||
= sqrt upward dbl-64 -0x0p+0 : -0x0p+0 :
|
||||
= sqrt downward ldbl-96-intel -0x0p+0L : -0x0p+0L :
|
||||
= sqrt tonearest ldbl-96-intel -0x0p+0L : -0x0p+0L :
|
||||
= sqrt towardzero ldbl-96-intel -0x0p+0L : -0x0p+0L :
|
||||
= sqrt upward ldbl-96-intel -0x0p+0L : -0x0p+0L :
|
||||
= sqrt downward ldbl-96-m68k -0x0p+0L : -0x0p+0L :
|
||||
= sqrt tonearest ldbl-96-m68k -0x0p+0L : -0x0p+0L :
|
||||
= sqrt towardzero ldbl-96-m68k -0x0p+0L : -0x0p+0L :
|
||||
= sqrt upward ldbl-96-m68k -0x0p+0L : -0x0p+0L :
|
||||
= sqrt downward ldbl-128 -0x0p+0L : -0x0p+0L :
|
||||
= sqrt tonearest ldbl-128 -0x0p+0L : -0x0p+0L :
|
||||
= sqrt towardzero ldbl-128 -0x0p+0L : -0x0p+0L :
|
||||
= sqrt upward ldbl-128 -0x0p+0L : -0x0p+0L :
|
||||
= sqrt downward ldbl-128ibm -0x0p+0L : -0x0p+0L :
|
||||
= sqrt tonearest ldbl-128ibm -0x0p+0L : -0x0p+0L :
|
||||
= sqrt towardzero ldbl-128ibm -0x0p+0L : -0x0p+0L :
|
||||
= sqrt upward ldbl-128ibm -0x0p+0L : -0x0p+0L :
|
||||
sqrt 2209
|
||||
= sqrt downward flt-32 0x8.a1p+8f : 0x2.fp+4f :
|
||||
= sqrt tonearest flt-32 0x8.a1p+8f : 0x2.fp+4f :
|
||||
= sqrt towardzero flt-32 0x8.a1p+8f : 0x2.fp+4f :
|
||||
= sqrt upward flt-32 0x8.a1p+8f : 0x2.fp+4f :
|
||||
= sqrt downward dbl-64 0x8.a1p+8 : 0x2.fp+4 :
|
||||
= sqrt tonearest dbl-64 0x8.a1p+8 : 0x2.fp+4 :
|
||||
= sqrt towardzero dbl-64 0x8.a1p+8 : 0x2.fp+4 :
|
||||
= sqrt upward dbl-64 0x8.a1p+8 : 0x2.fp+4 :
|
||||
= sqrt downward ldbl-96-intel 0x8.a1p+8L : 0x2.fp+4L :
|
||||
= sqrt tonearest ldbl-96-intel 0x8.a1p+8L : 0x2.fp+4L :
|
||||
= sqrt towardzero ldbl-96-intel 0x8.a1p+8L : 0x2.fp+4L :
|
||||
= sqrt upward ldbl-96-intel 0x8.a1p+8L : 0x2.fp+4L :
|
||||
= sqrt downward ldbl-96-m68k 0x8.a1p+8L : 0x2.fp+4L :
|
||||
= sqrt tonearest ldbl-96-m68k 0x8.a1p+8L : 0x2.fp+4L :
|
||||
= sqrt towardzero ldbl-96-m68k 0x8.a1p+8L : 0x2.fp+4L :
|
||||
= sqrt upward ldbl-96-m68k 0x8.a1p+8L : 0x2.fp+4L :
|
||||
= sqrt downward ldbl-128 0x8.a1p+8L : 0x2.fp+4L :
|
||||
= sqrt tonearest ldbl-128 0x8.a1p+8L : 0x2.fp+4L :
|
||||
= sqrt towardzero ldbl-128 0x8.a1p+8L : 0x2.fp+4L :
|
||||
= sqrt upward ldbl-128 0x8.a1p+8L : 0x2.fp+4L :
|
||||
= sqrt downward ldbl-128ibm 0x8.a1p+8L : 0x2.fp+4L :
|
||||
= sqrt tonearest ldbl-128ibm 0x8.a1p+8L : 0x2.fp+4L :
|
||||
= sqrt towardzero ldbl-128ibm 0x8.a1p+8L : 0x2.fp+4L :
|
||||
= sqrt upward ldbl-128ibm 0x8.a1p+8L : 0x2.fp+4L :
|
||||
sqrt 4
|
||||
= sqrt downward flt-32 0x4p+0f : 0x2p+0f :
|
||||
= sqrt tonearest flt-32 0x4p+0f : 0x2p+0f :
|
||||
= sqrt towardzero flt-32 0x4p+0f : 0x2p+0f :
|
||||
= sqrt upward flt-32 0x4p+0f : 0x2p+0f :
|
||||
= sqrt downward dbl-64 0x4p+0 : 0x2p+0 :
|
||||
= sqrt tonearest dbl-64 0x4p+0 : 0x2p+0 :
|
||||
= sqrt towardzero dbl-64 0x4p+0 : 0x2p+0 :
|
||||
= sqrt upward dbl-64 0x4p+0 : 0x2p+0 :
|
||||
= sqrt downward ldbl-96-intel 0x4p+0L : 0x2p+0L :
|
||||
= sqrt tonearest ldbl-96-intel 0x4p+0L : 0x2p+0L :
|
||||
= sqrt towardzero ldbl-96-intel 0x4p+0L : 0x2p+0L :
|
||||
= sqrt upward ldbl-96-intel 0x4p+0L : 0x2p+0L :
|
||||
= sqrt downward ldbl-96-m68k 0x4p+0L : 0x2p+0L :
|
||||
= sqrt tonearest ldbl-96-m68k 0x4p+0L : 0x2p+0L :
|
||||
= sqrt towardzero ldbl-96-m68k 0x4p+0L : 0x2p+0L :
|
||||
= sqrt upward ldbl-96-m68k 0x4p+0L : 0x2p+0L :
|
||||
= sqrt downward ldbl-128 0x4p+0L : 0x2p+0L :
|
||||
= sqrt tonearest ldbl-128 0x4p+0L : 0x2p+0L :
|
||||
= sqrt towardzero ldbl-128 0x4p+0L : 0x2p+0L :
|
||||
= sqrt upward ldbl-128 0x4p+0L : 0x2p+0L :
|
||||
= sqrt downward ldbl-128ibm 0x4p+0L : 0x2p+0L :
|
||||
= sqrt tonearest ldbl-128ibm 0x4p+0L : 0x2p+0L :
|
||||
= sqrt towardzero ldbl-128ibm 0x4p+0L : 0x2p+0L :
|
||||
= sqrt upward ldbl-128ibm 0x4p+0L : 0x2p+0L :
|
||||
sqrt 2
|
||||
= sqrt downward flt-32 0x2p+0f : 0x1.6a09e6p+0f : inexact
|
||||
= sqrt tonearest flt-32 0x2p+0f : 0x1.6a09e6p+0f : inexact
|
||||
= sqrt towardzero flt-32 0x2p+0f : 0x1.6a09e6p+0f : inexact
|
||||
= sqrt upward flt-32 0x2p+0f : 0x1.6a09e8p+0f : inexact
|
||||
= sqrt downward dbl-64 0x2p+0 : 0x1.6a09e667f3bccp+0 : inexact
|
||||
= sqrt tonearest dbl-64 0x2p+0 : 0x1.6a09e667f3bcdp+0 : inexact
|
||||
= sqrt towardzero dbl-64 0x2p+0 : 0x1.6a09e667f3bccp+0 : inexact
|
||||
= sqrt upward dbl-64 0x2p+0 : 0x1.6a09e667f3bcdp+0 : inexact
|
||||
= sqrt downward ldbl-96-intel 0x2p+0L : 0x1.6a09e667f3bcc908p+0L : inexact
|
||||
= sqrt tonearest ldbl-96-intel 0x2p+0L : 0x1.6a09e667f3bcc908p+0L : inexact
|
||||
= sqrt towardzero ldbl-96-intel 0x2p+0L : 0x1.6a09e667f3bcc908p+0L : inexact
|
||||
= sqrt upward ldbl-96-intel 0x2p+0L : 0x1.6a09e667f3bcc90ap+0L : inexact
|
||||
= sqrt downward ldbl-96-m68k 0x2p+0L : 0x1.6a09e667f3bcc908p+0L : inexact
|
||||
= sqrt tonearest ldbl-96-m68k 0x2p+0L : 0x1.6a09e667f3bcc908p+0L : inexact
|
||||
= sqrt towardzero ldbl-96-m68k 0x2p+0L : 0x1.6a09e667f3bcc908p+0L : inexact
|
||||
= sqrt upward ldbl-96-m68k 0x2p+0L : 0x1.6a09e667f3bcc90ap+0L : inexact
|
||||
= sqrt downward ldbl-128 0x2p+0L : 0x1.6a09e667f3bcc908b2fb1366ea95p+0L : inexact
|
||||
= sqrt tonearest ldbl-128 0x2p+0L : 0x1.6a09e667f3bcc908b2fb1366ea95p+0L : inexact
|
||||
= sqrt towardzero ldbl-128 0x2p+0L : 0x1.6a09e667f3bcc908b2fb1366ea95p+0L : inexact
|
||||
= sqrt upward ldbl-128 0x2p+0L : 0x1.6a09e667f3bcc908b2fb1366ea96p+0L : inexact
|
||||
= sqrt downward ldbl-128ibm 0x2p+0L : 0x1.6a09e667f3bcc908b2fb1366ea8p+0L : inexact
|
||||
= sqrt tonearest ldbl-128ibm 0x2p+0L : 0x1.6a09e667f3bcc908b2fb1366ea8p+0L : inexact
|
||||
= sqrt towardzero ldbl-128ibm 0x2p+0L : 0x1.6a09e667f3bcc908b2fb1366ea8p+0L : inexact
|
||||
= sqrt upward ldbl-128ibm 0x2p+0L : 0x1.6a09e667f3bcc908b2fb1366ebp+0L : inexact
|
||||
sqrt 0.25
|
||||
= sqrt downward flt-32 0x4p-4f : 0x8p-4f :
|
||||
= sqrt tonearest flt-32 0x4p-4f : 0x8p-4f :
|
||||
= sqrt towardzero flt-32 0x4p-4f : 0x8p-4f :
|
||||
= sqrt upward flt-32 0x4p-4f : 0x8p-4f :
|
||||
= sqrt downward dbl-64 0x4p-4 : 0x8p-4 :
|
||||
= sqrt tonearest dbl-64 0x4p-4 : 0x8p-4 :
|
||||
= sqrt towardzero dbl-64 0x4p-4 : 0x8p-4 :
|
||||
= sqrt upward dbl-64 0x4p-4 : 0x8p-4 :
|
||||
= sqrt downward ldbl-96-intel 0x4p-4L : 0x8p-4L :
|
||||
= sqrt tonearest ldbl-96-intel 0x4p-4L : 0x8p-4L :
|
||||
= sqrt towardzero ldbl-96-intel 0x4p-4L : 0x8p-4L :
|
||||
= sqrt upward ldbl-96-intel 0x4p-4L : 0x8p-4L :
|
||||
= sqrt downward ldbl-96-m68k 0x4p-4L : 0x8p-4L :
|
||||
= sqrt tonearest ldbl-96-m68k 0x4p-4L : 0x8p-4L :
|
||||
= sqrt towardzero ldbl-96-m68k 0x4p-4L : 0x8p-4L :
|
||||
= sqrt upward ldbl-96-m68k 0x4p-4L : 0x8p-4L :
|
||||
= sqrt downward ldbl-128 0x4p-4L : 0x8p-4L :
|
||||
= sqrt tonearest ldbl-128 0x4p-4L : 0x8p-4L :
|
||||
= sqrt towardzero ldbl-128 0x4p-4L : 0x8p-4L :
|
||||
= sqrt upward ldbl-128 0x4p-4L : 0x8p-4L :
|
||||
= sqrt downward ldbl-128ibm 0x4p-4L : 0x8p-4L :
|
||||
= sqrt tonearest ldbl-128ibm 0x4p-4L : 0x8p-4L :
|
||||
= sqrt towardzero ldbl-128ibm 0x4p-4L : 0x8p-4L :
|
||||
= sqrt upward ldbl-128ibm 0x4p-4L : 0x8p-4L :
|
||||
sqrt 6642.25
|
||||
= sqrt downward flt-32 0x1.9f24p+12f : 0x5.18p+4f :
|
||||
= sqrt tonearest flt-32 0x1.9f24p+12f : 0x5.18p+4f :
|
||||
= sqrt towardzero flt-32 0x1.9f24p+12f : 0x5.18p+4f :
|
||||
= sqrt upward flt-32 0x1.9f24p+12f : 0x5.18p+4f :
|
||||
= sqrt downward dbl-64 0x1.9f24p+12 : 0x5.18p+4 :
|
||||
= sqrt tonearest dbl-64 0x1.9f24p+12 : 0x5.18p+4 :
|
||||
= sqrt towardzero dbl-64 0x1.9f24p+12 : 0x5.18p+4 :
|
||||
= sqrt upward dbl-64 0x1.9f24p+12 : 0x5.18p+4 :
|
||||
= sqrt downward ldbl-96-intel 0x1.9f24p+12L : 0x5.18p+4L :
|
||||
= sqrt tonearest ldbl-96-intel 0x1.9f24p+12L : 0x5.18p+4L :
|
||||
= sqrt towardzero ldbl-96-intel 0x1.9f24p+12L : 0x5.18p+4L :
|
||||
= sqrt upward ldbl-96-intel 0x1.9f24p+12L : 0x5.18p+4L :
|
||||
= sqrt downward ldbl-96-m68k 0x1.9f24p+12L : 0x5.18p+4L :
|
||||
= sqrt tonearest ldbl-96-m68k 0x1.9f24p+12L : 0x5.18p+4L :
|
||||
= sqrt towardzero ldbl-96-m68k 0x1.9f24p+12L : 0x5.18p+4L :
|
||||
= sqrt upward ldbl-96-m68k 0x1.9f24p+12L : 0x5.18p+4L :
|
||||
= sqrt downward ldbl-128 0x1.9f24p+12L : 0x5.18p+4L :
|
||||
= sqrt tonearest ldbl-128 0x1.9f24p+12L : 0x5.18p+4L :
|
||||
= sqrt towardzero ldbl-128 0x1.9f24p+12L : 0x5.18p+4L :
|
||||
= sqrt upward ldbl-128 0x1.9f24p+12L : 0x5.18p+4L :
|
||||
= sqrt downward ldbl-128ibm 0x1.9f24p+12L : 0x5.18p+4L :
|
||||
= sqrt tonearest ldbl-128ibm 0x1.9f24p+12L : 0x5.18p+4L :
|
||||
= sqrt towardzero ldbl-128ibm 0x1.9f24p+12L : 0x5.18p+4L :
|
||||
= sqrt upward ldbl-128ibm 0x1.9f24p+12L : 0x5.18p+4L :
|
||||
sqrt 15190.5625
|
||||
= sqrt downward flt-32 0x3.b569p+12f : 0x7.b4p+4f :
|
||||
= sqrt tonearest flt-32 0x3.b569p+12f : 0x7.b4p+4f :
|
||||
= sqrt towardzero flt-32 0x3.b569p+12f : 0x7.b4p+4f :
|
||||
= sqrt upward flt-32 0x3.b569p+12f : 0x7.b4p+4f :
|
||||
= sqrt downward dbl-64 0x3.b569p+12 : 0x7.b4p+4 :
|
||||
= sqrt tonearest dbl-64 0x3.b569p+12 : 0x7.b4p+4 :
|
||||
= sqrt towardzero dbl-64 0x3.b569p+12 : 0x7.b4p+4 :
|
||||
= sqrt upward dbl-64 0x3.b569p+12 : 0x7.b4p+4 :
|
||||
= sqrt downward ldbl-96-intel 0x3.b569p+12L : 0x7.b4p+4L :
|
||||
= sqrt tonearest ldbl-96-intel 0x3.b569p+12L : 0x7.b4p+4L :
|
||||
= sqrt towardzero ldbl-96-intel 0x3.b569p+12L : 0x7.b4p+4L :
|
||||
= sqrt upward ldbl-96-intel 0x3.b569p+12L : 0x7.b4p+4L :
|
||||
= sqrt downward ldbl-96-m68k 0x3.b569p+12L : 0x7.b4p+4L :
|
||||
= sqrt tonearest ldbl-96-m68k 0x3.b569p+12L : 0x7.b4p+4L :
|
||||
= sqrt towardzero ldbl-96-m68k 0x3.b569p+12L : 0x7.b4p+4L :
|
||||
= sqrt upward ldbl-96-m68k 0x3.b569p+12L : 0x7.b4p+4L :
|
||||
= sqrt downward ldbl-128 0x3.b569p+12L : 0x7.b4p+4L :
|
||||
= sqrt tonearest ldbl-128 0x3.b569p+12L : 0x7.b4p+4L :
|
||||
= sqrt towardzero ldbl-128 0x3.b569p+12L : 0x7.b4p+4L :
|
||||
= sqrt upward ldbl-128 0x3.b569p+12L : 0x7.b4p+4L :
|
||||
= sqrt downward ldbl-128ibm 0x3.b569p+12L : 0x7.b4p+4L :
|
||||
= sqrt tonearest ldbl-128ibm 0x3.b569p+12L : 0x7.b4p+4L :
|
||||
= sqrt towardzero ldbl-128ibm 0x3.b569p+12L : 0x7.b4p+4L :
|
||||
= sqrt upward ldbl-128ibm 0x3.b569p+12L : 0x7.b4p+4L :
|
||||
sqrt 0.75
|
||||
= sqrt downward flt-32 0xcp-4f : 0xd.db3d7p-4f : inexact
|
||||
= sqrt tonearest flt-32 0xcp-4f : 0xd.db3d7p-4f : inexact
|
||||
= sqrt towardzero flt-32 0xcp-4f : 0xd.db3d7p-4f : inexact
|
||||
= sqrt upward flt-32 0xcp-4f : 0xd.db3d8p-4f : inexact
|
||||
= sqrt downward dbl-64 0xcp-4 : 0xd.db3d742c2655p-4 : inexact
|
||||
= sqrt tonearest dbl-64 0xcp-4 : 0xd.db3d742c2655p-4 : inexact
|
||||
= sqrt towardzero dbl-64 0xcp-4 : 0xd.db3d742c2655p-4 : inexact
|
||||
= sqrt upward dbl-64 0xcp-4 : 0xd.db3d742c26558p-4 : inexact
|
||||
= sqrt downward ldbl-96-intel 0xcp-4L : 0xd.db3d742c265539dp-4L : inexact
|
||||
= sqrt tonearest ldbl-96-intel 0xcp-4L : 0xd.db3d742c265539ep-4L : inexact
|
||||
= sqrt towardzero ldbl-96-intel 0xcp-4L : 0xd.db3d742c265539dp-4L : inexact
|
||||
= sqrt upward ldbl-96-intel 0xcp-4L : 0xd.db3d742c265539ep-4L : inexact
|
||||
= sqrt downward ldbl-96-m68k 0xcp-4L : 0xd.db3d742c265539dp-4L : inexact
|
||||
= sqrt tonearest ldbl-96-m68k 0xcp-4L : 0xd.db3d742c265539ep-4L : inexact
|
||||
= sqrt towardzero ldbl-96-m68k 0xcp-4L : 0xd.db3d742c265539dp-4L : inexact
|
||||
= sqrt upward ldbl-96-m68k 0xcp-4L : 0xd.db3d742c265539ep-4L : inexact
|
||||
= sqrt downward ldbl-128 0xcp-4L : 0xd.db3d742c265539d92ba16b83c5cp-4L : inexact
|
||||
= sqrt tonearest ldbl-128 0xcp-4L : 0xd.db3d742c265539d92ba16b83c5cp-4L : inexact
|
||||
= sqrt towardzero ldbl-128 0xcp-4L : 0xd.db3d742c265539d92ba16b83c5cp-4L : inexact
|
||||
= sqrt upward ldbl-128 0xcp-4L : 0xd.db3d742c265539d92ba16b83c5c8p-4L : inexact
|
||||
= sqrt downward ldbl-128ibm 0xcp-4L : 0xd.db3d742c265539d92ba16b83c4p-4L : inexact
|
||||
= sqrt tonearest ldbl-128ibm 0xcp-4L : 0xd.db3d742c265539d92ba16b83c4p-4L : inexact
|
||||
= sqrt towardzero ldbl-128ibm 0xcp-4L : 0xd.db3d742c265539d92ba16b83c4p-4L : inexact
|
||||
= sqrt upward ldbl-128ibm 0xcp-4L : 0xd.db3d742c265539d92ba16b83c8p-4L : inexact
|
1626
math/gen-auto-libm-tests.c
Normal file
1626
math/gen-auto-libm-tests.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -39,10 +39,11 @@ use Getopt::Std;
|
||||
|
||||
use strict;
|
||||
|
||||
use vars qw ($input $output);
|
||||
use vars qw ($input $output $auto_input);
|
||||
use vars qw (%results);
|
||||
use vars qw (%beautify @all_floats);
|
||||
use vars qw ($output_dir $ulps_file);
|
||||
use vars qw (%auto_tests);
|
||||
|
||||
# all_floats is sorted and contains all recognised float types
|
||||
@all_floats = ('double', 'float', 'idouble',
|
||||
@ -51,6 +52,12 @@ use vars qw ($output_dir $ulps_file);
|
||||
%beautify =
|
||||
( "minus_zero" => "-0",
|
||||
"plus_zero" => "+0",
|
||||
"-0x0p+0f" => "-0",
|
||||
"-0x0p+0" => "-0",
|
||||
"-0x0p+0L" => "-0",
|
||||
"0x0p+0f" => "+0",
|
||||
"0x0p+0" => "+0",
|
||||
"0x0p+0L" => "+0",
|
||||
"minus_infty" => "-inf",
|
||||
"plus_infty" => "inf",
|
||||
"qnan_value" => "qNaN",
|
||||
@ -99,9 +106,11 @@ $ulps_file = $opt_u if ($opt_u);
|
||||
$output_dir = $opt_o if ($opt_o);
|
||||
|
||||
$input = "libm-test.inc";
|
||||
$auto_input = "auto-libm-test-out";
|
||||
$output = "${output_dir}libm-test.c";
|
||||
|
||||
&parse_ulps ($ulps_file);
|
||||
&parse_auto_input ($auto_input);
|
||||
&generate_testfile ($input, $output) unless ($opt_n);
|
||||
&output_ulps ("${output_dir}libm-test-ulps.h", $ulps_file) unless ($opt_n);
|
||||
&print_ulps_file ("${output_dir}NewUlps") if ($opt_n);
|
||||
@ -121,6 +130,9 @@ sub beautify {
|
||||
return '-' . $beautify{$tmp};
|
||||
}
|
||||
}
|
||||
if ($arg =~ /^-?0x[0-9a-f.]*p[-+][0-9]+f$/) {
|
||||
$arg =~ s/f$//;
|
||||
}
|
||||
if ($arg =~ /[0-9]L$/) {
|
||||
$arg =~ s/L$//;
|
||||
}
|
||||
@ -218,7 +230,7 @@ sub parse_args {
|
||||
# consistency check
|
||||
if ($current_arg == $#args) {
|
||||
die ("wrong number of arguments")
|
||||
unless ($args[$current_arg] =~ /EXCEPTION|ERRNO|IGNORE_ZERO_INF_SIGN|TEST_NAN_SIGN|NO_TEST_INLINE/);
|
||||
unless ($args[$current_arg] =~ /EXCEPTION|ERRNO|IGNORE_ZERO_INF_SIGN|TEST_NAN_SIGN|NO_TEST_INLINE|XFAIL_TEST/);
|
||||
} elsif ($current_arg < $#args) {
|
||||
die ("wrong number of arguments");
|
||||
} elsif ($current_arg > ($#args+1)) {
|
||||
@ -309,17 +321,165 @@ sub parse_args {
|
||||
print $file " $cline },\n";
|
||||
}
|
||||
|
||||
# Convert a condition from auto-libm-test-out to C form.
|
||||
sub convert_condition {
|
||||
my ($cond) = @_;
|
||||
my (@conds, $ret);
|
||||
@conds = split /:/, $cond;
|
||||
foreach (@conds) {
|
||||
s/-/_/g;
|
||||
s/^/TEST_COND_/;
|
||||
}
|
||||
$ret = join " && ", @conds;
|
||||
return "($ret)";
|
||||
}
|
||||
|
||||
# Return text to OR a value into an accumulated flags string.
|
||||
sub or_value {
|
||||
my ($cond) = @_;
|
||||
if ($cond eq "0") {
|
||||
return "";
|
||||
} else {
|
||||
return " | $cond";
|
||||
}
|
||||
}
|
||||
|
||||
# Return text to OR a conditional expression between two values into
|
||||
# an accumulated flags string.
|
||||
sub or_cond_value {
|
||||
my ($cond, $if, $else) = @_;
|
||||
if ($cond eq "1") {
|
||||
return or_value ($if);
|
||||
} elsif ($cond eq "0") {
|
||||
return or_value ($else);
|
||||
} else {
|
||||
return or_value ("($cond ? $if : $else)");
|
||||
}
|
||||
}
|
||||
|
||||
# Generate libm-test.c
|
||||
sub generate_testfile {
|
||||
my ($input, $output) = @_;
|
||||
my ($lasttext);
|
||||
my (@args, $i);
|
||||
|
||||
open INPUT, $input or die ("Can't open $input: $!");
|
||||
open OUTPUT, ">$output" or die ("Can't open $output: $!");
|
||||
|
||||
# Replace the special macros
|
||||
while (<INPUT>) {
|
||||
# AUTO_TESTS (function, mode),
|
||||
if (/^\s*AUTO_TESTS_/) {
|
||||
my ($descr, $func, $mode, $auto_test, $num_auto_tests);
|
||||
($descr, $func, $mode) = ($_ =~ /AUTO_TESTS_(\w+)\s*\((\w+),\s*(\w+)\)/);
|
||||
$num_auto_tests = 0;
|
||||
foreach $auto_test (sort keys %{$auto_tests{$func}{$mode}}) {
|
||||
my ($finputs, $format, $inputs, $outputs, $flags);
|
||||
my ($format_conv, $flags_conv, @flags, %flag_cond);
|
||||
$num_auto_tests++;
|
||||
($finputs, $outputs, $flags) = split / : */, $auto_test;
|
||||
($format, $inputs) = split / /, $finputs, 2;
|
||||
$inputs =~ s/ /, /g;
|
||||
$outputs =~ s/ /, /g;
|
||||
$format_conv = convert_condition ($format);
|
||||
print OUTPUT "#if $format_conv\n";
|
||||
@flags = split / /, $flags;
|
||||
foreach (@flags) {
|
||||
if (/^([^:]*):(.*)$/) {
|
||||
my ($flag, $cond);
|
||||
$flag = $1;
|
||||
$cond = convert_condition ($2);
|
||||
if (defined ($flag_cond{$flag})) {
|
||||
if ($flag_cond{$flag} ne "1") {
|
||||
$flag_cond{$flag} .= " || $cond";
|
||||
}
|
||||
} else {
|
||||
$flag_cond{$flag} = $cond;
|
||||
}
|
||||
} else {
|
||||
$flag_cond{$_} = "1";
|
||||
}
|
||||
}
|
||||
$flags_conv = "";
|
||||
if (defined ($flag_cond{"no-test-inline"})) {
|
||||
$flags_conv .= or_cond_value ($flag_cond{"no-test-inline"},
|
||||
"NO_TEST_INLINE", "0");
|
||||
}
|
||||
if (defined ($flag_cond{"xfail"})) {
|
||||
$flags_conv .= or_cond_value ($flag_cond{"xfail"},
|
||||
"XFAIL_TEST", "0");
|
||||
}
|
||||
my (@exc_list) = qw(divbyzero inexact invalid overflow underflow);
|
||||
my ($exc);
|
||||
foreach $exc (@exc_list) {
|
||||
my ($exc_expected, $exc_ok, $no_exc);
|
||||
$exc_expected = "\U$exc\E_EXCEPTION";
|
||||
$exc_ok = "\U$exc\E_EXCEPTION_OK";
|
||||
$no_exc = "0";
|
||||
if ($exc eq "inexact") {
|
||||
$exc_ok = "0";
|
||||
$no_exc = "NO_INEXACT_EXCEPTION";
|
||||
}
|
||||
if (defined ($flag_cond{$exc})) {
|
||||
if ($flag_cond{$exc} ne "1") {
|
||||
die ("unexpected condition for $exc\n");
|
||||
}
|
||||
if (defined ($flag_cond{"$exc-ok"})) {
|
||||
$flags_conv .= or_cond_value ($flag_cond{"$exc-ok"},
|
||||
$exc_ok, $exc_expected);
|
||||
} else {
|
||||
$flags_conv .= or_value ($exc_expected);
|
||||
}
|
||||
} else {
|
||||
if (defined ($flag_cond{"$exc-ok"})) {
|
||||
$flags_conv .= or_cond_value ($flag_cond{"$exc-ok"},
|
||||
$exc_ok, $no_exc);
|
||||
} else {
|
||||
$flags_conv .= or_value ($no_exc);
|
||||
}
|
||||
}
|
||||
}
|
||||
my ($errno_expected, $errno_unknown_cond);
|
||||
if (defined ($flag_cond{"errno-edom"})) {
|
||||
if ($flag_cond{"errno-edom"} ne "1") {
|
||||
die ("unexpected condition for errno-edom");
|
||||
}
|
||||
if (defined ($flag_cond{"errno-erange"})) {
|
||||
die ("multiple errno values expected");
|
||||
}
|
||||
$errno_expected = "ERRNO_EDOM";
|
||||
} elsif (defined ($flag_cond{"errno-erange"})) {
|
||||
if ($flag_cond{"errno-erange"} ne "1") {
|
||||
die ("unexpected condition for errno-erange");
|
||||
}
|
||||
$errno_expected = "ERRNO_ERANGE";
|
||||
} else {
|
||||
$errno_expected = "ERRNO_UNCHANGED";
|
||||
}
|
||||
if (defined ($flag_cond{"errno-edom-ok"})) {
|
||||
if (defined ($flag_cond{"errno-erange-ok"})
|
||||
&& $flag_cond{"errno-erange-ok"} ne $flag_cond{"errno-edom-ok"}) {
|
||||
$errno_unknown_cond = "($flag_cond{\"errno-edom-ok\"} || $flag_cond{\"errno-erange-ok\"})";
|
||||
} else {
|
||||
$errno_unknown_cond = $flag_cond{"errno-edom-ok"};
|
||||
}
|
||||
} elsif (defined ($flag_cond{"errno-erange-ok"})) {
|
||||
$errno_unknown_cond = $flag_cond{"errno-erange-ok"};
|
||||
} else {
|
||||
$errno_unknown_cond = "0";
|
||||
}
|
||||
$flags_conv .= or_cond_value ($errno_unknown_cond,
|
||||
"0", $errno_expected);
|
||||
if ($flags_conv ne "") {
|
||||
$flags_conv =~ s/^ \|/,/;
|
||||
}
|
||||
&parse_args (\*OUTPUT, $descr,
|
||||
"$func, $inputs, $outputs$flags_conv");
|
||||
print OUTPUT "#endif\n";
|
||||
}
|
||||
if ($num_auto_tests == 0) {
|
||||
die ("no automatic tests for $func, $mode\n");
|
||||
}
|
||||
next;
|
||||
}
|
||||
|
||||
# TEST_...
|
||||
if (/^\s*TEST_/) {
|
||||
@ -573,3 +733,20 @@ sub output_ulps {
|
||||
print ULP " };\n";
|
||||
close ULP;
|
||||
}
|
||||
|
||||
# Parse auto-libm-test-out.
|
||||
sub parse_auto_input {
|
||||
my ($file) = @_;
|
||||
open AUTO, $file or die ("Can't open $file: $!");
|
||||
while (<AUTO>) {
|
||||
chop;
|
||||
next if !/^= /;
|
||||
s/^= //;
|
||||
if (/^(\S+) (\S+) (.*)$/) {
|
||||
$auto_tests{$1}{$2}{$3} = 1;
|
||||
} else {
|
||||
die ("bad automatic test line: $_\n");
|
||||
}
|
||||
}
|
||||
close AUTO;
|
||||
}
|
||||
|
@ -175,12 +175,13 @@ struct ulp_data
|
||||
#define IGNORE_ZERO_INF_SIGN 0x400
|
||||
#define TEST_NAN_SIGN 0x800
|
||||
#define NO_TEST_INLINE 0x1000
|
||||
#define XFAIL_TEST 0x2000
|
||||
/* Indicate errno settings required or disallowed. */
|
||||
#define ERRNO_UNCHANGED 0x2000
|
||||
#define ERRNO_EDOM 0x4000
|
||||
#define ERRNO_ERANGE 0x8000
|
||||
#define ERRNO_UNCHANGED 0x4000
|
||||
#define ERRNO_EDOM 0x8000
|
||||
#define ERRNO_ERANGE 0x10000
|
||||
/* Flags generated by gen-libm-test.pl, not entered here manually. */
|
||||
#define IGNORE_RESULT 0x10000
|
||||
#define IGNORE_RESULT 0x20000
|
||||
|
||||
/* Values underflowing only for float. */
|
||||
#ifdef TEST_FLOAT
|
||||
@ -225,6 +226,47 @@ struct ulp_data
|
||||
# define NO_TEST_INLINE_DOUBLE 0
|
||||
#endif
|
||||
|
||||
/* Conditions used by tests generated by gen-auto-libm-tests.c. */
|
||||
#ifdef TEST_FLOAT
|
||||
# define TEST_COND_flt_32 1
|
||||
#else
|
||||
# define TEST_COND_flt_32 0
|
||||
#endif
|
||||
#if defined TEST_DOUBLE || (defined TEST_LDOUBLE && LDBL_MANT_DIG == 53)
|
||||
# define TEST_COND_dbl_64 1
|
||||
#else
|
||||
# define TEST_COND_dbl_64 0
|
||||
#endif
|
||||
#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 64 && LDBL_MIN_EXP == -16381
|
||||
# define TEST_COND_ldbl_96_intel 1
|
||||
#else
|
||||
# define TEST_COND_ldbl_96_intel 0
|
||||
#endif
|
||||
#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 64 && LDBL_MIN_EXP == -16382
|
||||
# define TEST_COND_ldbl_96_m68k 1
|
||||
#else
|
||||
# define TEST_COND_ldbl_96_m68k 0
|
||||
#endif
|
||||
#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 113
|
||||
# define TEST_COND_ldbl_128 1
|
||||
#else
|
||||
# define TEST_COND_ldbl_128 0
|
||||
#endif
|
||||
#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 106
|
||||
# define TEST_COND_ldbl_128ibm 1
|
||||
#else
|
||||
# define TEST_COND_ldbl_128ibm 0
|
||||
#endif
|
||||
#if LONG_MAX == 0x7fffffff
|
||||
# define TEST_COND_long32 1
|
||||
# define TEST_COND_long64 0
|
||||
#else
|
||||
# define TEST_COND_long32 0
|
||||
# define TEST_COND_long64 1
|
||||
#endif
|
||||
#define TEST_COND_before_rounding (!TININESS_AFTER_ROUNDING)
|
||||
#define TEST_COND_after_rounding TININESS_AFTER_ROUNDING
|
||||
|
||||
/* Various constants (we must supply them precalculated for accuracy). */
|
||||
#define M_PI_6l .52359877559829887307710723054658383L
|
||||
#define M_E2l 7.389056098930650227230427460575008L
|
||||
@ -997,6 +1039,8 @@ check_longlong (const char *test_name, long long int computed,
|
||||
static int
|
||||
enable_test (int exceptions)
|
||||
{
|
||||
if (exceptions & XFAIL_TEST)
|
||||
return 0;
|
||||
#ifdef TEST_INLINE
|
||||
if (exceptions & NO_TEST_INLINE)
|
||||
return 0;
|
||||
@ -13707,24 +13751,15 @@ sinh_test_upward (void)
|
||||
|
||||
static const struct test_f_f_data sqrt_test_data[] =
|
||||
{
|
||||
TEST_f_f (sqrt, 0, 0, NO_INEXACT_EXCEPTION),
|
||||
TEST_f_f (sqrt, qnan_value, qnan_value, NO_INEXACT_EXCEPTION),
|
||||
TEST_f_f (sqrt, plus_infty, plus_infty, NO_INEXACT_EXCEPTION),
|
||||
|
||||
TEST_f_f (sqrt, minus_zero, minus_zero, NO_INEXACT_EXCEPTION),
|
||||
|
||||
/* sqrt (x) == qNaN plus invalid exception for x < 0. */
|
||||
TEST_f_f (sqrt, -1, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION|ERRNO_EDOM),
|
||||
TEST_f_f (sqrt, -max_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION|ERRNO_EDOM),
|
||||
TEST_f_f (sqrt, minus_infty, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION|ERRNO_EDOM),
|
||||
|
||||
TEST_f_f (sqrt, 2209, 47, NO_INEXACT_EXCEPTION),
|
||||
TEST_f_f (sqrt, 4, 2, NO_INEXACT_EXCEPTION),
|
||||
TEST_f_f (sqrt, 2, M_SQRT2l, INEXACT_EXCEPTION),
|
||||
TEST_f_f (sqrt, 0.25, 0.5, NO_INEXACT_EXCEPTION),
|
||||
TEST_f_f (sqrt, 6642.25, 81.5, NO_INEXACT_EXCEPTION),
|
||||
TEST_f_f (sqrt, 15190.5625L, 123.25L, NO_INEXACT_EXCEPTION),
|
||||
TEST_f_f (sqrt, 0.75L, 0.866025403784438646763723170752936183L, INEXACT_EXCEPTION),
|
||||
AUTO_TESTS_f_f (sqrt, tonearest),
|
||||
};
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user