public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 2/8] Refactor type specific macros using regexes
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
                     ` (3 preceding siblings ...)
  2016-05-18 20:56   ` [PATCH 4/8] Add LIT() around literals in check_ulp in libm-tests.inc Paul E. Murphy
@ 2016-05-18 20:56   ` Paul E. Murphy
  2016-05-18 20:56   ` [PATCH 5/8] Apply LIT(x) to floating point literals in libm-test.c Paul E. Murphy
                     ` (17 subsequent siblings)
  22 siblings, 0 replies; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-18 20:56 UTC (permalink / raw)
  To: libc-alpha

NOTE: Reviewers, I've redacted the contents of the patch as it
is quite verbose.  Run the mentioned command to recreate the
contents of the patch.

Replace most of the type specific macros  with the equivalent
type-generic macro using the following sed replacement command below: 

sed -ri -e 's/defined TEST_FLOAT/TEST_COND_binary32/'       \
        -e 's/ndef TEST_FLOAT/ !TEST_COND_binary32/'        \
        -e 's/def TEST_FLOAT/ TEST_COND_binary32/'          \
        -e 's/defined TEST_DOUBLE/TEST_COND_binary64/'      \
        -e 's/ndef TEST_DOUBLE/ !TEST_COND_binary64/'       \
        -e 's/def TEST_DOUBLE/ TEST_COND_binary64/'         \
        -e 's/defined TEST_LDOUBLE/TEST_COND_gt_binary64/'  \
        -e 's/ifdef TEST_LDOUBLE/if TEST_COND_gt_binary64/' \
        -e 's/LDBL_(MIN_EXP|MAX_EXP|MANT_DIG)/TYPE_\1/g'    \
        libm-test.inc

	* math/libm-test.inc:
	[TEST_FLOAT]: Change usage to TEST_COND_binary32.
	[TEST_DOUBLE]: Change usage to TEST_COND_binary64.
	[TEST_LDOUBLE]: Change usage to TEST_COND_gt_binary64.
	[LDBL_MAX_EXP]: Change to TYPE_MAX_EXP.
	[LDBL_MIN_EXP]: Change to TYPE_MIN_EXP.
	[LDBL_MANT_DIG]: Change to TYPE_MANT_DIG.
---
 math/libm-test.inc | 686 ++++++++++++++++++++++++++---------------------------
 1 file changed, 343 insertions(+), 343 deletions(-)
-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCH 5/8] Apply LIT(x) to floating point literals in libm-test.c
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
                     ` (4 preceding siblings ...)
  2016-05-18 20:56   ` [PATCH 2/8] Refactor type specific macros using regexes Paul E. Murphy
@ 2016-05-18 20:56   ` Paul E. Murphy
  2016-05-18 21:34     ` Joseph Myers
  2016-05-18 20:56   ` [PATCH 1/8] Begin refactor of libm-test.inc Paul E. Murphy
                     ` (16 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-18 20:56 UTC (permalink / raw)
  To: libc-alpha

With the exception of the second argument of nexttoward,
any suffixes should be stripped from the test input, and
the macro LIT(x) should be applied to use the correct
suffix for the type being tested.

This applies post-processing to all of the test inputs
through gen-libm-test.pl to strip literal suffixes and
apply the LIT(x) macro, with one exception stated above.
This seems a bit cleaner than tossing the macro onto
everything albeit slightly more obfuscated.

	* math/gen-libm-test.pl: (apply_lit): New subroutine.
	(parse_args): Strip C suffix from floating point literals
	and wrap them with LIT().
---
 math/gen-libm-test.pl | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/math/gen-libm-test.pl b/math/gen-libm-test.pl
index 17f17f7..3c6980f 100755
--- a/math/gen-libm-test.pl
+++ b/math/gen-libm-test.pl
@@ -151,6 +151,23 @@ sub show_exceptions {
   }
 }
 
+# Apply the LIT(x) macro to any floating point constants.
+sub apply_lit {
+  my ($lit) = @_;
+  my $lletter = substr $lit, -1;
+
+  # If it doesn't have a period or an exponent, its not an FP literal.
+  if (index ($lit, ".") == -1 and $lit !~ /[pe]([+-])?[0-9]+/) {
+    return $lit;
+  }
+
+  # Strip any suffixes from the constant
+  if ($lletter =~ /L|l|f|F/) {
+    chop $lit;
+  }
+  return "LIT ($lit)";
+}
+
 # Parse the arguments to TEST_x_y
 sub parse_args {
   my ($file, $descr, $args) = @_;
@@ -241,7 +258,11 @@ sub parse_args {
   for ($i=0; $i <= $#descr; $i++) {
     # FLOAT, int, long int, long long int
     if ($descr[$i] =~ /f|i|l|L/) {
-      $cline .= ", $args[$current_arg]";
+      if ($descr[$i] eq "f" and not ($args[0] eq "nexttoward" and $current_arg == 2)) {
+        $cline .= ", " . &apply_lit ($args[$current_arg]);
+      } else {
+        $cline .= ", $args[$current_arg]";
+      }
       $current_arg++;
       next;
     }
@@ -251,7 +272,8 @@ sub parse_args {
     }
     # complex
     if ($descr[$i] eq 'c') {
-      $cline .= ", $args[$current_arg], $args[$current_arg+1]";
+      $cline .= ", " . &apply_lit ($args[$current_arg]);
+      $cline .= ", " . &apply_lit ($args[$current_arg+1]);
       $current_arg += 2;
       next;
     }
@@ -281,6 +303,9 @@ sub parse_args {
 	} else {
 	  $ignore_result_all = 0;
 	}
+	if ($_ eq "f") {
+	  $result = apply_lit ($result)
+	}
 	$cline_res .= ", $result";
 	$current_arg++;
       } elsif ($_ eq 'c') {
@@ -298,6 +323,8 @@ sub parse_args {
 	} else {
 	  $ignore_result_all = 0;
 	}
+	$result1 = apply_lit ($result1);
+	$result2 = apply_lit ($result2);
 	$cline_res .= ", $result1, $result2";
 	$current_arg += 2;
       } elsif ($_ eq '1') {
@@ -326,6 +353,8 @@ sub parse_args {
       my ($run_extra) = ($extra_expected ne "IGNORE" ? 1 : 0);
       if (!$run_extra) {
 	$extra_expected = "0";
+      } else {
+	$extra_expected = apply_lit ($extra_expected);
       }
       $cline_res .= ", $run_extra, $extra_expected";
     }
-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCH 7/8] Remove type specific information from auto-libm-test-in
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
  2016-05-18 20:56   ` [PATCH 8/8] Generate new format names in auto-libm-test-out Paul E. Murphy
@ 2016-05-18 20:56   ` Paul E. Murphy
  2016-05-18 21:55     ` Joseph Myers
  2016-05-18 20:56   ` [PATCH 3/8] Fixup TYPE_* substitutions Paul E. Murphy
                     ` (20 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-18 20:56 UTC (permalink / raw)
  To: libc-alpha

NOTE: Reviewers, I have redacted the verbose changes to
auto-libm-tests-out.  Rerun gen-auto-libm-tests to recreate
this portion of the patch.

Apply the following sed regexes to auto-libm-test-in in order:

s/flt-32/binary32/
s/dbl-64/binary64/
s/ldbl-96-intel/intel96/
s/ldbl-96-m68k/m68k96/
s/ldbl-128ibm/ibm128/
s/ldbl-128/binary128/

	* auto-libm-test-in:
	Replace flt-32 usage with binary32.
	Replace dbl-64 usage with binary64.
	Replace ldbl-intel-96 usage with intel96.
	Replace ldbl-m68k-96 usage with m68k96.
	Replace ldbl-128ibm usage with ibm128.
	Replace ldbl-128 usage with binary128.
	* auto-libm-test-out: Regenerate.
---
 math/auto-libm-test-in | 130 ++++++++++++++++++++++++-------------------------
 1 file changed, 65 insertions(+), 65 deletions(-)

diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
index 34a6323..d5ed0c4 100644
--- a/math/auto-libm-test-in
+++ b/math/auto-libm-test-in
@@ -1175,8 +1175,8 @@ cosh -0xd.0c03p+0
 cosh -0x3.d04328728b72cp-4
 cosh 0x1.629188p+4
 # GCC bug 59666: results on directed rounding may be incorrect.
-cosh max no-test-inline xfail-rounding:ldbl-128ibm
-cosh -max no-test-inline xfail-rounding:ldbl-128ibm
+cosh max no-test-inline xfail-rounding:ibm128
+cosh -max no-test-inline xfail-rounding:ibm128
 cosh min
 cosh -min
 cosh min_subnorm
@@ -1191,22 +1191,22 @@ cosh 0x5.96a7e8p+4
 cosh -0x5.96a7ep+4
 cosh -0x5.96a7e8p+4
 # GCC bug 59666: results on directed rounding may be incorrect.
-cosh 0x2.c679d1f73f0fap+8 xfail-rounding:ldbl-128ibm
-cosh 0x2.c679d1f73f0fcp+8 xfail-rounding:ldbl-128ibm
-cosh -0x2.c679d1f73f0fap+8 xfail-rounding:ldbl-128ibm
-cosh -0x2.c679d1f73f0fcp+8 xfail-rounding:ldbl-128ibm
-cosh 0x2.c679d1f73f0fb624d358b213a7p+8 xfail-rounding:ldbl-128ibm
-cosh 0x2.c679d1f73f0fb624d358b213a8p+8 xfail-rounding:ldbl-128ibm
-cosh -0x2.c679d1f73f0fb624d358b213a7p+8 xfail-rounding:ldbl-128ibm
-cosh -0x2.c679d1f73f0fb624d358b213a8p+8 xfail-rounding:ldbl-128ibm
-cosh 0x2.c5d37700c6bb03a4p+12 no-test-inline xfail-rounding:ldbl-128ibm
-cosh 0x2.c5d37700c6bb03a8p+12 no-test-inline xfail-rounding:ldbl-128ibm
-cosh -0x2.c5d37700c6bb03a4p+12 no-test-inline xfail-rounding:ldbl-128ibm
-cosh -0x2.c5d37700c6bb03a8p+12 no-test-inline xfail-rounding:ldbl-128ibm
-cosh 0x2.c5d37700c6bb03a6c24b6c9b494cp+12 no-test-inline xfail-rounding:ldbl-128ibm
-cosh 0x2.c5d37700c6bb03a6c24b6c9b494ep+12 no-test-inline xfail-rounding:ldbl-128ibm
-cosh -0x2.c5d37700c6bb03a6c24b6c9b494cp+12 no-test-inline xfail-rounding:ldbl-128ibm
-cosh -0x2.c5d37700c6bb03a6c24b6c9b494ep+12 no-test-inline xfail-rounding:ldbl-128ibm
+cosh 0x2.c679d1f73f0fap+8 xfail-rounding:ibm128
+cosh 0x2.c679d1f73f0fcp+8 xfail-rounding:ibm128
+cosh -0x2.c679d1f73f0fap+8 xfail-rounding:ibm128
+cosh -0x2.c679d1f73f0fcp+8 xfail-rounding:ibm128
+cosh 0x2.c679d1f73f0fb624d358b213a7p+8 xfail-rounding:ibm128
+cosh 0x2.c679d1f73f0fb624d358b213a8p+8 xfail-rounding:ibm128
+cosh -0x2.c679d1f73f0fb624d358b213a7p+8 xfail-rounding:ibm128
+cosh -0x2.c679d1f73f0fb624d358b213a8p+8 xfail-rounding:ibm128
+cosh 0x2.c5d37700c6bb03a4p+12 no-test-inline xfail-rounding:ibm128
+cosh 0x2.c5d37700c6bb03a8p+12 no-test-inline xfail-rounding:ibm128
+cosh -0x2.c5d37700c6bb03a4p+12 no-test-inline xfail-rounding:ibm128
+cosh -0x2.c5d37700c6bb03a8p+12 no-test-inline xfail-rounding:ibm128
+cosh 0x2.c5d37700c6bb03a6c24b6c9b494cp+12 no-test-inline xfail-rounding:ibm128
+cosh 0x2.c5d37700c6bb03a6c24b6c9b494ep+12 no-test-inline xfail-rounding:ibm128
+cosh -0x2.c5d37700c6bb03a6c24b6c9b494cp+12 no-test-inline xfail-rounding:ibm128
+cosh -0x2.c5d37700c6bb03a6c24b6c9b494ep+12 no-test-inline xfail-rounding:ibm128
 
 cpow 1 0 0 0 ignore-zero-inf-sign
 cpow 2 0 10 0 ignore-zero-inf-sign
@@ -1410,8 +1410,8 @@ ctan 1 47
 ctan 1 355
 ctan 1 365
 # GCC bug 59666: results on directed rounding may be incorrect.
-ctan 1 5680 xfail-rounding:ldbl-128ibm
-ctan 1 5690 xfail-rounding:ldbl-128ibm
+ctan 1 5680 xfail-rounding:ibm128
+ctan 1 5690 xfail-rounding:ibm128
 
 ctan 0x3.243f6cp-1 0
 
@@ -1420,10 +1420,10 @@ ctan 0x1p1023 1
 ctan 0x1p16383 1
 
 # GCC bug 59666: results on directed rounding may be incorrect.
-ctan 50000 50000 xfail-rounding:ldbl-128ibm
-ctan 50000 -50000 xfail-rounding:ldbl-128ibm
-ctan -50000 50000 xfail-rounding:ldbl-128ibm
-ctan -50000 -50000 xfail-rounding:ldbl-128ibm
+ctan 50000 50000 xfail-rounding:ibm128
+ctan 50000 -50000 xfail-rounding:ibm128
+ctan -50000 50000 xfail-rounding:ibm128
+ctan -50000 -50000 xfail-rounding:ibm128
 
 ctan 0x1.921fb6p+0 0x1p-149
 ctan 0x1.921fb54442d18p+0 0x1p-1074
@@ -1453,8 +1453,8 @@ ctanh 47 1
 ctanh 355 1
 ctanh 365 1
 # GCC bug 59666: results on directed rounding may be incorrect.
-ctanh 5680 1 xfail-rounding:ldbl-128ibm
-ctanh 5690 1 xfail-rounding:ldbl-128ibm
+ctanh 5680 1 xfail-rounding:ibm128
+ctanh 5690 1 xfail-rounding:ibm128
 
 ctanh 0 0x3.243f6cp-1
 
@@ -1463,10 +1463,10 @@ ctanh 1 0x1p1023
 ctanh 1 0x1p16383
 
 # GCC bug 59666: results on directed rounding may be incorrect.
-ctanh 50000 50000 xfail-rounding:ldbl-128ibm
-ctanh 50000 -50000 xfail-rounding:ldbl-128ibm
-ctanh -50000 50000 xfail-rounding:ldbl-128ibm
-ctanh -50000 -50000 xfail-rounding:ldbl-128ibm
+ctanh 50000 50000 xfail-rounding:ibm128
+ctanh 50000 -50000 xfail-rounding:ibm128
+ctanh -50000 50000 xfail-rounding:ibm128
+ctanh -50000 -50000 xfail-rounding:ibm128
 
 ctanh 0x1p-149 0x1.921fb6p+0
 ctanh 0x1p-1074 0x1.921fb54442d18p+0
@@ -1672,13 +1672,13 @@ exp 50.0
 exp 88.72269439697265625
 exp 709.75
 # GCC bug 59666: results on directed rounding may be incorrect.
-exp 1000.0 xfail-rounding:ldbl-128ibm
-exp 710 xfail-rounding:ldbl-128ibm
+exp 1000.0 xfail-rounding:ibm128
+exp 710 xfail-rounding:ibm128
 exp -1234
 # GCC bug 59666: results on directed rounding may be incorrect.
-exp 0x2.c679d1f73f0fb628p+8 xfail-rounding:ldbl-128ibm
-exp 1e5 xfail-rounding:ldbl-128ibm
-exp max xfail-rounding:ldbl-128ibm
+exp 0x2.c679d1f73f0fb628p+8 xfail-rounding:ibm128
+exp 1e5 xfail-rounding:ibm128
+exp max xfail-rounding:ibm128
 exp -7.4444006192138124e+02
 exp -0x1.75f113c30b1c8p+9
 exp -max
@@ -1757,21 +1757,21 @@ exp10 -36
 exp10 305
 exp10 -305
 # GCC bug 59666: results on directed rounding may be incorrect.
-exp10 4932 xfail-rounding:ldbl-128ibm
+exp10 4932 xfail-rounding:ibm128
 exp10 -4932
 exp10 -0x1.343793004f503232p12
 # GCC bug 59666: results on directed rounding may be incorrect.
-exp10 1e5 xfail-rounding:ldbl-128ibm
+exp10 1e5 xfail-rounding:ibm128
 exp10 -1e5
 # GCC bug 59666: results on directed rounding may be incorrect.
-exp10 1e6 xfail-rounding:ldbl-128ibm
+exp10 1e6 xfail-rounding:ibm128
 exp10 -1e6
 # GCC bug 59666: results on directed rounding may be incorrect.
-exp10 max xfail-rounding:ldbl-128ibm
+exp10 max xfail-rounding:ibm128
 exp10 -max
 exp10 0.75
 # GCC bug 59666: results on directed rounding may be incorrect.
-exp10 0x1.348e45573a1dd72cp+8 xfail-rounding:ldbl-128ibm
+exp10 0x1.348e45573a1dd72cp+8 xfail-rounding:ibm128
 exp10 -0x1.33aa03p+8
 exp10 -0x1.33ad17p+8
 exp10 -0x1.33afcap+8
@@ -1955,7 +1955,7 @@ expm1 100
 expm1 127.0
 expm1 500.0
 # GCC bug 59666: results on directed rounding may be incorrect.
-expm1 11356.25 xfail-rounding:ldbl-128ibm
+expm1 11356.25 xfail-rounding:ibm128
 expm1 -10.0
 expm1 -16.0
 expm1 -17.0
@@ -1977,8 +1977,8 @@ expm1 -1000.0
 expm1 -10000.0
 expm1 -100000.0
 # GCC bug 59666: results on directed rounding may be incorrect.
-expm1 100000.0 xfail-rounding:ldbl-128ibm
-expm1 max xfail-rounding:ldbl-128ibm
+expm1 100000.0 xfail-rounding:ibm128
+expm1 max xfail-rounding:ibm128
 expm1 -max
 expm1 0x1p-2
 expm1 -0x1p-2
@@ -2070,14 +2070,14 @@ fma -min -min -0 missing-errno
 
 # Bug 6801: errno setting may be missing.
 # Bug 13304: results on directed rounding may be incorrect.
-fma max max min missing-errno xfail-rounding:ldbl-128ibm
-fma max max -min missing-errno xfail-rounding:ldbl-128ibm
-fma max -max min missing-errno xfail-rounding:ldbl-128ibm
-fma max -max -min missing-errno xfail-rounding:ldbl-128ibm
-fma -max max min missing-errno xfail-rounding:ldbl-128ibm
-fma -max max -min missing-errno xfail-rounding:ldbl-128ibm
-fma -max -max min missing-errno xfail-rounding:ldbl-128ibm
-fma -max -max -min missing-errno xfail-rounding:ldbl-128ibm
+fma max max min missing-errno xfail-rounding:ibm128
+fma max max -min missing-errno xfail-rounding:ibm128
+fma max -max min missing-errno xfail-rounding:ibm128
+fma max -max -min missing-errno xfail-rounding:ibm128
+fma -max max min missing-errno xfail-rounding:ibm128
+fma -max max -min missing-errno xfail-rounding:ibm128
+fma -max -max min missing-errno xfail-rounding:ibm128
+fma -max -max -min missing-errno xfail-rounding:ibm128
 
 fma 0x1.7ff8p+13 0x1.000002p+0 0x1.ffffp-24
 fma 0x1.fffp+0 0x1.00001p+0 -0x1.fffp+0
@@ -2318,10 +2318,10 @@ hypot 0.75 1.25
 hypot 1.0 0x1p-61
 hypot 0x1p+0 0x1.fp-129
 hypot 0x1.23456789abcdef0123456789ab8p-500 0x1.23456789abcdef0123456789ab8p-500
-hypot 0x3p125 0x4p125 no-test-inline:flt-32
-hypot 0x1.234566p-126 0x1.234566p-126 no-test-inline:flt-32
-hypot 0x3p1021 0x4p1021 no-test-inline:dbl-64
-hypot 0x1p+0 0x0.3ep-1022 no-test-inline:dbl-64
+hypot 0x3p125 0x4p125 no-test-inline:binary32
+hypot 0x1.234566p-126 0x1.234566p-126 no-test-inline:binary32
+hypot 0x3p1021 0x4p1021 no-test-inline:binary64
+hypot 0x1p+0 0x0.3ep-1022 no-test-inline:binary64
 hypot 0x3p16381 0x4p16381 no-test-inline
 hypot 0x1p-149 0x1p-149
 hypot 0x1p-1074 0x1p-1074
@@ -2568,18 +2568,18 @@ lgamma -0x1p-16494
 # where a result inaccurate by a few ulp could differ from the ideal
 # result in whether it overflows; +/- 10ulp is sufficient for overflow
 # or its absence to be unambiguous under glibc's accuracy standards).
-# This also means the ldbl-128ibm inputs are XFAILed for dbl-64 and
-# the ldbl-128 inputs for ldbl-96, as too close to the threshold.
+# This also means the ibm128 inputs are XFAILed for binary64 and
+# the binary128 inputs for ldbl-96, as too close to the threshold.
 lgamma 0x3.12be0cp+120
 lgamma 0x3.12be6p+120
 lgamma 0x5.d53649e2d4674p+1012
 lgamma 0x5.d53649e2d46c8p+1012
-lgamma 0x5.d53649e2d469dbc1f01e99fd52p+1012 xfail:dbl-64
-lgamma 0x5.d53649e2d469dbc1f01e99fd7cp+1012 xfail:dbl-64
+lgamma 0x5.d53649e2d469dbc1f01e99fd52p+1012 xfail:binary64
+lgamma 0x5.d53649e2d469dbc1f01e99fd7cp+1012 xfail:binary64
 lgamma 0x5.c6aa645fffef5f5p+16368
 lgamma 0x5.c6aa645fffef5ff8p+16368
-lgamma 0x5.c6aa645fffef5fa912b9b480f7acp+16368 xfail:ldbl-96-intel xfail:ldbl-96-m68k
-lgamma 0x5.c6aa645fffef5fa912b9b480f8p+16368 xfail:ldbl-96-intel xfail:ldbl-96-m68k
+lgamma 0x5.c6aa645fffef5fa912b9b480f7acp+16368 xfail:intel96 xfail:m68k96
+lgamma 0x5.c6aa645fffef5fa912b9b480f8p+16368 xfail:intel96 xfail:m68k96
 
 lgamma -0x1.fa471547c2fe5p+1
 lgamma -0x1.9260dcp+1
@@ -2833,7 +2833,7 @@ lgamma -60.25
 lgamma -60.5
 lgamma -60.75
 
-# Integers +/- 1ulp for ldbl-128 (gen-auto-libm-tests will round these
+# Integers +/- 1ulp for binary128 (gen-auto-libm-tests will round these
 # to produce integers +/- 1ulp for other formats).
 lgamma -0xf.fffffffffffffffffffffffffff8p-4
 lgamma -0x1.0000000000000000000000000001p+0
@@ -4216,19 +4216,19 @@ tgamma -0x1p-127
 # IEEE semantics mean overflow very close to the threshold depends on
 # the rounding mode; gen-auto-libm-tests does not reflect that glibc
 # does not try to achieve this.
-tgamma 0x1p-128 spurious-overflow:flt-32
+tgamma 0x1p-128 spurious-overflow:binary32
 tgamma -0x1p-128
 tgamma 0x1p-149
 tgamma -0x1p-149
 tgamma 0x1p-1023
 tgamma -0x1p-1023
-tgamma 0x1p-1024 spurious-overflow:dbl-64 spurious-overflow:ldbl-128ibm
+tgamma 0x1p-1024 spurious-overflow:binary64 spurious-overflow:ibm128
 tgamma -0x1p-1024
 tgamma 0x1p-1074
 tgamma -0x1p-1074
 tgamma 0x1p-16383
 tgamma -0x1p-16383
-tgamma 0x1p-16384 spurious-overflow:ldbl-96-intel spurious-overflow:ldbl-96-m68k spurious-overflow:ldbl-128
+tgamma 0x1p-16384 spurious-overflow:intel96 spurious-overflow:m68k96 spurious-overflow:binary128
 tgamma -0x1p-16384
 tgamma 0x1p-16445
 tgamma -0x1p-16445
-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCH 4/8] Add LIT() around literals in check_ulp in libm-tests.inc
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
                     ` (2 preceding siblings ...)
  2016-05-18 20:56   ` [PATCH 3/8] Fixup TYPE_* substitutions Paul E. Murphy
@ 2016-05-18 20:56   ` Paul E. Murphy
  2016-05-18 21:24     ` Joseph Myers
  2016-05-18 20:56   ` [PATCH 2/8] Refactor type specific macros using regexes Paul E. Murphy
                     ` (18 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-18 20:56 UTC (permalink / raw)
  To: libc-alpha

	* math/libm-test.inc (check_ulp): Wrap floating point
	literals with LIT() instead of leaving them bare or
	appending the long double suffix.
---
 math/libm-test.inc | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/math/libm-test.inc b/math/libm-test.inc
index f447cf9..d5dc5fc 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -11841,14 +11841,14 @@ check_ulp (void)
    FLOAT ulps, ulpx, value;
    int i;
    /* Check ulp of zero is a subnormal value...  */
-   ulps = ulp (0x0.0p0);
+   ulps = ulp (LIT (0x0.0p0));
    if (fpclassify (ulps) != FP_SUBNORMAL)
      {
        fprintf (stderr, "ulp (0x0.0p0) is not FP_SUBNORMAL!\n");
        exit (EXIT_FAILURE);
      }
    /* Check that the ulp of one is a normal value... */
-   ulps = ulp (1.0L);
+   ulps = ulp (LIT (1.0));
    if (fpclassify (ulps) != FP_NORMAL)
      {
        fprintf (stderr, "ulp (1.0L) is not FP_NORMAL\n");
@@ -11859,8 +11859,8 @@ check_ulp (void)
       We allow +/- 1 ulp around the represented value.  */
    value = FUNC(nextafter) (0, 1);
    ulps = ULPDIFF (value, 0);
-   ulpx = ulp (1.0L);
-   if (ulps < (1.0L - ulpx) || ulps > (1.0L + ulpx))
+   ulpx = ulp (LIT (1.0));
+   if (ulps < (LIT (1.0) - ulpx) || ulps > (LIT (1.0) + ulpx))
      {
        fprintf (stderr, "Value outside of 1 +/- 1ulp.\n");
        exit (EXIT_FAILURE);
@@ -11870,8 +11870,8 @@ check_ulp (void)
       We allow +/- 1 ulp around the represented value.  */
    value = FUNC(nextafter) (10, 20);
    ulps = ULPDIFF (value, 10);
-   ulpx = ulp (1.0L);
-   if (ulps < (1.0L - ulpx) || ulps > (1.0L + ulpx))
+   ulpx = ulp (LIT (1.0));
+   if (ulps < (LIT (1.0) - ulpx) || ulps > (LIT (1.0) + ulpx))
      {
        fprintf (stderr, "Value outside of 1 +/- 1ulp.\n");
        exit (EXIT_FAILURE);
@@ -11879,8 +11879,8 @@ check_ulp (void)
    /* This gives one more ulp.  */
    value = FUNC(nextafter) (value, 20);
    ulps = ULPDIFF (value, 10);
-   ulpx = ulp (2.0L);
-   if (ulps < (2.0L - ulpx) || ulps > (2.0L + ulpx))
+   ulpx = ulp (LIT (2.0));
+   if (ulps < (LIT (2.0) - ulpx) || ulps > (LIT (2.0) + ulpx))
      {
        fprintf (stderr, "Value outside of 2 +/- 1ulp.\n");
        exit (EXIT_FAILURE);
@@ -11889,8 +11889,8 @@ check_ulp (void)
    for (i = 2; i < 100; i++)
      value = FUNC(nextafter) (value, 20);
    ulps = ULPDIFF (value, 10);
-   ulpx = ulp (100.0L);
-   if (ulps < (100.0L - ulpx) || ulps > (100.0L + ulpx))
+   ulpx = ulp (LIT (100.0));
+   if (ulps < (LIT (100.0) - ulpx) || ulps > (LIT (100.0) + ulpx))
      {
        fprintf (stderr, "Value outside of 100 +/- 1ulp.\n");
        exit (EXIT_FAILURE);
-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCH 1/8] Begin refactor of libm-test.inc
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
                     ` (5 preceding siblings ...)
  2016-05-18 20:56   ` [PATCH 5/8] Apply LIT(x) to floating point literals in libm-test.c Paul E. Murphy
@ 2016-05-18 20:56   ` Paul E. Murphy
  2016-05-18 21:18     ` Joseph Myers
  2016-05-18 21:54     ` Joseph Myers
  2016-05-18 21:17   ` [PATCH 6/8] Refactor CHOOSE() macro usage in libm-tests.inc Paul E. Murphy
                     ` (15 subsequent siblings)
  22 siblings, 2 replies; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-18 20:56 UTC (permalink / raw)
  To: libc-alpha

Attempt to creatively redefine the macros
to choose tests based on the format being
tested, not the type.

Note, TS 18661 does not define any printf
modifiers, so we need to be a little more
verbose about constructing strings to
output.

	* math/libm-test.inc:
	[MAX_EXP]: Define as (TYPE_MAX_EXP - 1) similar to how
	MANT_DIG and MIN_EXP are defined.
	(ilogb_test_data): Update usage of MAX_EXP.
	(logb_test_data): Likewise.
	[TYPE_DECIMAL_DIG]: Define per C type instead of using CHOOSE().
	[MANT_DIG]: Likewise.
	[MIN_EXP]: Likewise.
	[TYPESTR]: New macro.
	[FSTR_MAX]: Likewise.
	[TEST_COND_binary32]: Likewise.
	[TEST_COND_binary64]: Likewise.
	[TEST_COND_binary128]: Likewise.
	[TEST_COND_ibm128]: Likewise.
	[TEST_COND_intel96]: Likewise.
	[TEST_COND_m68k96]: Likewise.
	[TEST_COND_gt_binary64]: Likewise.
	[M_PI_6l]: Wrap constant with LIT.
	[M_PI_34l]: Likewise.
	[M_PI_34_LOG10El]: Likewise.
	[M_PI2_LOG10El]: Likewise.
	[M_PI4_LOG10El]: Likewise.
	[M_PI_LOG10El]: Likewise.
	[plus_zero]: Replace CHOOSE() with LIT().
	[minus_zero]: Likewise.
	[plus_infty]: Redefine as (TYPE_INF).
	[minus_infty]: Redefine as (-TYPE_INF).
	[max_value]: Redefine as TYPE_MAX.
	[min_value]: Redefine as TYPE_MIN.
	[min_subnorm_value]: Redefined as TYPE_TRUE_MIN.
	(print_float): Make string output compatible with
	strfrom functions defined by TS 18661.
	(update_stats): Likewise.
	(print_complex_function_ulps): Likewise.
	(print_max_error): Likewise.
	(print_complex_max_error): Likewise.
	(check_float_internal): Likewise.
	* math/test-double.h [FTOSTR]: New macro.
	[LIT]: Likewise.
	[TYPE_STR]: Likewise.
	[TYPE_INF]: Likewise.
	[TYPE_DECIMAL_DIG]: Likewise.
	[TYPE_MANT_DIG]: Likewise.
	[TYPE_MAX]: Likewise.
	[TYPE_MIN]: Likewise.
	[TYPE_MIN_EXP]: Likewise.
	[TYPE_TRUE_MIN]: Likewise.
	* math/test-float.h [FTOSTR]: New macro.
	[LIT]: Likewise.
	[TYPE_STR]: Likewise.
	[TYPE_INF]: Likewise.
	[TYPE_DECIMAL_DIG]: Likewise.
	[TYPE_MANT_DIG]: Likewise.
	[TYPE_MAX]: Likewise.
	[TYPE_MIN]: Likewise.
	[TYPE_MIN_EXP]: Likewise.
	[TYPE_TRUE_MIN]: Likewise.
	* math/test-ldouble.h [FTOSTR]: New macro.
	[LIT]: Likewise.
	[TYPE_STR]: Likewise.
	[TYPE_INF]: Likewise.
	[TYPE_DECIMAL_DIG]: Likewise.
	[TYPE_MANT_DIG]: Likewise.
	[TYPE_MAX]: Likewise.
	[TYPE_MIN]: Likewise.
	[TYPE_MIN_EXP]: Likewise.
	[TYPE_TRUE_MIN]: Likewise.
---
 math/libm-test.inc  | 225 ++++++++++++++++++++++++++++------------------------
 math/test-double.h  |  14 ++++
 math/test-float.h   |  14 ++++
 math/test-ldouble.h |  14 ++++
 4 files changed, 163 insertions(+), 104 deletions(-)

diff --git a/math/libm-test.inc b/math/libm-test.inc
index f1ba7dd..5fabf4d 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -184,31 +184,77 @@ struct ulp_data
 #define IGNORE_RESULT			0x20000
 #define NON_FINITE			0x40000
 
+#define MANT_DIG (TYPE_MANT_DIG - 1)
+#define MIN_EXP (TYPE_MIN_EXP - 1)
+#define MAX_EXP (TYPE_MAX_EXP - 1)
+
+/* Maximum character buffer to store a stringitized FLOAT value. */
+# define FSTR_MAX (128)
+
+#if TEST_INLINE
+# define TYPESTR "i" TYPE_STR
+#else
+# define TYPESTR TYPE_STR
+#endif
+
+/* Format specific test macros.  */
+#define TEST_COND_binary32 (TYPE_MANT_DIG == 24		\
+			    && TYPE_MIN_EXP == -125	\
+			    && TYPE_MAX_EXP == 128)
+
+#define TEST_COND_binary64 (TYPE_MANT_DIG == 53		\
+			    && TYPE_MIN_EXP == -1021	\
+			    && TYPE_MAX_EXP == 1024)
+
+#define TEST_COND_binary128 (TYPE_MANT_DIG == 113	\
+			     && TYPE_MIN_EXP == -16381	\
+			     && TYPE_MAX_EXP == 16384)
+
+#define TEST_COND_ibm128 (TYPE_MANT_DIG == 106)
+
+#define TEST_COND_intel96 (TYPE_MANT_DIG == 64		\
+			   && TYPE_MIN_EXP == -16381	\
+			   && TYPE_MAX_EXP == 16384)
+
+#define TEST_COND_m68k96 (TYPE_MANT_DIG == 64		\
+			  && TYPE_MIN_EXP == -16382	\
+			  && TYPE_MAX_EXP == 16384)
+
+/* This is a standin replacement for the usage of TEST_LDOUBLE
+   to enable certain tests for the format/type.  Instead, we
+   enable them if some trait of the format is more expressive
+   than the binary64 format.  */
+#define TEST_COND_gt_binary64 (TYPE_MANT_DIG > 53	\
+			       || TYPE_MIN_EXP < -1021	\
+			       || TYPE_MAX_EXP > 1024  )
+
 /* Values underflowing only for float.  */
-#ifdef TEST_FLOAT
+#if TEST_COND_binary32
 # define UNDERFLOW_EXCEPTION_FLOAT	UNDERFLOW_EXCEPTION
 # define UNDERFLOW_EXCEPTION_OK_FLOAT	UNDERFLOW_EXCEPTION_OK
 #else
 # define UNDERFLOW_EXCEPTION_FLOAT	0
 # define UNDERFLOW_EXCEPTION_OK_FLOAT	0
 #endif
+
 /* Values underflowing only for double or types with a larger least
    positive normal value.  */
-#if defined TEST_FLOAT || defined TEST_DOUBLE \
-  || (defined TEST_LDOUBLE && LDBL_MIN_EXP >= DBL_MIN_EXP)
+#if TEST_COND_binary32 || TEST_COND_binary64 || TEST_COND_ibm128
 # define UNDERFLOW_EXCEPTION_DOUBLE	UNDERFLOW_EXCEPTION
 # define UNDERFLOW_EXCEPTION_OK_DOUBLE	UNDERFLOW_EXCEPTION_OK
 #else
 # define UNDERFLOW_EXCEPTION_DOUBLE	0
 # define UNDERFLOW_EXCEPTION_OK_DOUBLE	0
 #endif
+
 /* Values underflowing only for IBM long double or types with a larger least
    positive normal value.  */
-#if defined TEST_FLOAT || (defined TEST_LDOUBLE && LDBL_MIN_EXP > DBL_MIN_EXP)
+#if TEST_COND_binary32 || TEST_COND_ibm128
 # define UNDERFLOW_EXCEPTION_LDOUBLE_IBM	UNDERFLOW_EXCEPTION
 #else
 # define UNDERFLOW_EXCEPTION_LDOUBLE_IBM	0
 #endif
+
 /* Values underflowing on architectures detecting tininess before
    rounding, but not on those detecting tininess after rounding.  */
 #define UNDERFLOW_EXCEPTION_BEFORE_ROUNDING	(TININESS_AFTER_ROUNDING \
@@ -228,36 +274,13 @@ struct ulp_data
 #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
+#define TEST_COND_flt_32 TEST_COND_binary32
+#define TEST_COND_dbl_64 TEST_COND_binary64
+#define TEST_COND_ldbl_96_intel TEST_COND_intel96
+#define TEST_COND_ldbl_96_m68k  TEST_COND_m68k96
+#define TEST_COND_ldbl_128 TEST_COND_binary128
+#define TEST_COND_ldbl_128ibm TEST_COND_ibm128
+
 #if LONG_MAX == 0x7fffffff
 # define TEST_COND_long32	1
 # define TEST_COND_long64	0
@@ -281,12 +304,12 @@ struct ulp_data
 #endif
 
 /* Various constants (we must supply them precalculated for accuracy).  */
-#define M_PI_6l			.52359877559829887307710723054658383L
-#define M_PI_34l		2.356194490192344928846982537459627163L	/* 3*pi/4 */
-#define M_PI_34_LOG10El		1.023282265381381010614337719073516828L
-#define M_PI2_LOG10El		0.682188176920920673742891812715677885L
-#define M_PI4_LOG10El		0.341094088460460336871445906357838943L
-#define M_PI_LOG10El		1.364376353841841347485783625431355770L
+#define M_PI_6l			LIT (.52359877559829887307710723054658383)
+#define M_PI_34l		LIT (2.356194490192344928846982537459627163) /* 3*pi/4 */
+#define M_PI_34_LOG10El		LIT (1.023282265381381010614337719073516828)
+#define M_PI2_LOG10El		LIT (0.682188176920920673742891812715677885)
+#define M_PI4_LOG10El		LIT (0.341094088460460336871445906357838943)
+#define M_PI_LOG10El		LIT (1.364376353841841347485783625431355770)
 
 #define ulps_file_name "ULPs"	/* Name of the ULPs file.  */
 static FILE *ulps_file;		/* File to document difference.  */
@@ -303,25 +326,14 @@ static int output_max_error;	/* Should the maximal errors printed?  */
 static int output_points;	/* Should the single function results printed?  */
 static int ignore_max_ulp;	/* Should we ignore max_ulp?  */
 
-#define plus_zero	CHOOSE (0.0L, 0.0, 0.0f,	\
-				0.0L, 0.0, 0.0f)
-#define minus_zero	CHOOSE (-0.0L, -0.0, -0.0f,	\
-				-0.0L, -0.0, -0.0f)
-#define plus_infty	CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF, \
-				HUGE_VALL, HUGE_VAL, HUGE_VALF)
-#define minus_infty	CHOOSE (-HUGE_VALL, -HUGE_VAL, -HUGE_VALF,	\
-				-HUGE_VALL, -HUGE_VAL, -HUGE_VALF)
+#define plus_zero	LIT (0.0)
+#define minus_zero	LIT (-0.0)
+#define plus_infty	(TYPE_INF)
+#define minus_infty	(-TYPE_INF)
 #define qnan_value	FUNC (__builtin_nan) ("")
-#define max_value	CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX,	\
-				LDBL_MAX, DBL_MAX, FLT_MAX)
-#define min_value	CHOOSE (LDBL_MIN, DBL_MIN, FLT_MIN,	\
-				LDBL_MIN, DBL_MIN, FLT_MIN)
-#define min_subnorm_value	CHOOSE (LDBL_TRUE_MIN,	\
-					DBL_TRUE_MIN,	\
-					FLT_TRUE_MIN,	\
-					LDBL_TRUE_MIN,	\
-					DBL_TRUE_MIN,	\
-					FLT_TRUE_MIN)
+#define max_value	TYPE_MAX
+#define min_value	TYPE_MIN
+#define min_subnorm_value TYPE_TRUE_MIN
 
 static FLOAT max_error, real_max_error, imag_max_error;
 
@@ -329,23 +341,11 @@ static FLOAT prev_max_error, prev_real_max_error, prev_imag_max_error;
 
 static FLOAT max_valid_error;
 
-#define MANT_DIG CHOOSE ((LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1),  \
-			 (LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1))
-#define MIN_EXP CHOOSE ((LDBL_MIN_EXP-1), (DBL_MIN_EXP-1), (FLT_MIN_EXP-1),	\
-			(LDBL_MIN_EXP-1), (DBL_MIN_EXP-1), (FLT_MIN_EXP-1))
-#define MAX_EXP CHOOSE (LDBL_MAX_EXP, DBL_MAX_EXP, FLT_MAX_EXP, \
-			LDBL_MAX_EXP, DBL_MAX_EXP, FLT_MAX_EXP)
 /* Sufficient numbers of digits to represent any floating-point value
    unambiguously (for any choice of the number of bits in the first
    hex digit, in the case of TYPE_HEX_DIG).  When used with printf
    formats where the precision counts only digits after the point, 1
    is subtracted from these values. */
-#define TYPE_DECIMAL_DIG CHOOSE (LDBL_DECIMAL_DIG,	\
-				 DBL_DECIMAL_DIG,	\
-				 FLT_DECIMAL_DIG,	\
-				 LDBL_DECIMAL_DIG,	\
-				 DBL_DECIMAL_DIG,	\
-				 FLT_DECIMAL_DIG)
 #define TYPE_HEX_DIG ((MANT_DIG + 7) / 4)
 
 /* Compare KEY (a string, with the name of a function) with ULP (a
@@ -428,8 +428,12 @@ print_float (FLOAT f)
   else if (isnan (f))
     printf ("qNaN\n");
   else
-    printf ("% .*" PRINTF_EXPR "  % .*" PRINTF_XEXPR "\n",
-	    TYPE_DECIMAL_DIG - 1, f, TYPE_HEX_DIG - 1, f);
+    {
+      char fstrn[FSTR_MAX], fstrx[FSTR_MAX];
+      FTOSTR (fstrn, FSTR_MAX, "% .*" PRINTF_EXPR, TYPE_DECIMAL_DIG - 1, f);
+      FTOSTR (fstrx, FSTR_MAX, "% .*" PRINTF_XEXPR, TYPE_HEX_DIG - 1, f);
+      printf ("%s  %s\n", fstrn, fstrx);
+    }
 }
 
 /* Should the message print to screen?  This depends on the verbose flag,
@@ -471,11 +475,10 @@ print_function_ulps (const char *function_name, FLOAT ulp)
 {
   if (output_ulps)
     {
+      char ustrn[FSTR_MAX];
+      FTOSTR (ustrn, FSTR_MAX, "%.0" PRINTF_NEXPR, FUNC (ceil) (ulp));
       fprintf (ulps_file, "Function: \"%s\":\n", function_name);
-      fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
-	       CHOOSE("ldouble", "double", "float",
-		      "ildouble", "idouble", "ifloat"),
-	       FUNC(ceil) (ulp));
+      fprintf (ulps_file, TYPESTR ": %s\n", ustrn);
     }
 }
 
@@ -486,21 +489,20 @@ print_complex_function_ulps (const char *function_name, FLOAT real_ulp,
 {
   if (output_ulps)
     {
+      char fstrn[FSTR_MAX];
       if (real_ulp != 0.0)
 	{
+	  FTOSTR (fstrn, FSTR_MAX, "%.0" PRINTF_NEXPR,
+	            FUNC (ceil) (real_ulp));
 	  fprintf (ulps_file, "Function: Real part of \"%s\":\n", function_name);
-	  fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
-		   CHOOSE("ldouble", "double", "float",
-			  "ildouble", "idouble", "ifloat"),
-		   FUNC(ceil) (real_ulp));
+	  fprintf (ulps_file, TYPESTR ": %s\n", fstrn);
 	}
       if (imag_ulp != 0.0)
 	{
+	  FTOSTR (fstrn, FSTR_MAX, "%.0" PRINTF_NEXPR,
+	            FUNC (ceil) (imag_ulp));
 	  fprintf (ulps_file, "Function: Imaginary part of \"%s\":\n", function_name);
-	  fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
-		   CHOOSE("ldouble", "double", "float",
-			  "ildouble", "idouble", "ifloat"),
-		   FUNC(ceil) (imag_ulp));
+	  fprintf (ulps_file, TYPESTR ": %s\n", fstrn);
 	}
 
 
@@ -548,10 +550,12 @@ print_max_error (const char *func_name)
 
   if (print_screen_max_error (ok))
     {
+      char mestr[FSTR_MAX], pmestr[FSTR_MAX];
+      FTOSTR (mestr, FSTR_MAX, "%.0" PRINTF_NEXPR, FUNC (ceil) (max_error));
+      FTOSTR (pmestr, FSTR_MAX, "%.0" PRINTF_NEXPR, FUNC (ceil) (prev_max_error));
       printf ("Maximal error of `%s'\n", func_name);
-      printf (" is      : %.0" PRINTF_NEXPR " ulp\n", FUNC(ceil) (max_error));
-      printf (" accepted: %.0" PRINTF_NEXPR " ulp\n",
-	      FUNC(ceil) (prev_max_error));
+      printf (" is      : %s ulp\n", mestr);
+      printf (" accepted: %s ulp\n", pmestr);
     }
 
   update_stats (ok);
@@ -584,16 +588,22 @@ print_complex_max_error (const char *func_name)
 
   if (print_screen_max_error (ok))
     {
+      char rmestr[FSTR_MAX], prmestr[FSTR_MAX];
+      char imestr[FSTR_MAX], pimestr[FSTR_MAX];
+      FTOSTR (rmestr, FSTR_MAX, "%.0" PRINTF_NEXPR,
+		FUNC (ceil) (real_max_error));
+      FTOSTR (prmestr, FSTR_MAX, "%.0" PRINTF_NEXPR,
+		FUNC (ceil) (prev_real_max_error));
+      FTOSTR (imestr, FSTR_MAX, "%.0" PRINTF_NEXPR,
+		FUNC (ceil) (imag_max_error));
+      FTOSTR (pimestr, FSTR_MAX, "%.0" PRINTF_NEXPR,
+		FUNC (ceil) (prev_imag_max_error));
       printf ("Maximal error of real part of: %s\n", func_name);
-      printf (" is      : %.0" PRINTF_NEXPR " ulp\n",
-	      FUNC(ceil) (real_max_error));
-      printf (" accepted: %.0" PRINTF_NEXPR " ulp\n",
-	      FUNC(ceil) (prev_real_max_error));
+      printf (" is      : %s ulp\n", rmestr);
+      printf (" accepted: %s ulp\n", prmestr);
       printf ("Maximal error of imaginary part of: %s\n", func_name);
-      printf (" is      : %.0" PRINTF_NEXPR " ulp\n",
-	      FUNC(ceil) (imag_max_error));
-      printf (" accepted: %.0" PRINTF_NEXPR " ulp\n",
-	      FUNC(ceil) (prev_imag_max_error));
+      printf (" is      : %s ulp\n", imestr);
+      printf (" accepted: %s ulp\n", pimestr);
     }
 
   update_stats (ok);
@@ -749,7 +759,7 @@ ulp (FLOAT value)
 	   2^(-MANT_DIG) which is too large a value to be useful. Note that we
 	   can't use ilogb(0), since that isn't a valid thing to do. As a point
 	   of comparison Java's ulp returns the next normal value e.g.
-	   2^(1 - MAX_EXP) for ulp(0), but that is not what we want for
+	   2^(1 - TYPE_MAX_EXP) for ulp(0), but that is not what we want for
 	   glibc.  */
 	/* Fall through...  */
       case FP_SUBNORMAL:
@@ -851,10 +861,17 @@ check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
       print_float (expected);
       if (print_diff)
 	{
-	  printf (" difference: % .*" PRINTF_EXPR "  % .*" PRINTF_XEXPR
-		  "\n", TYPE_DECIMAL_DIG - 1, diff, TYPE_HEX_DIG - 1, diff);
-	  printf (" ulp       : % .4" PRINTF_NEXPR "\n", ulps);
-	  printf (" max.ulp   : % .4" PRINTF_NEXPR "\n", max_ulp);
+	  char dstrn[FSTR_MAX], dstrx[FSTR_MAX];
+	  char ustrn[FSTR_MAX], mustrn[FSTR_MAX];
+	  FTOSTR (dstrn, FSTR_MAX, "% .*" PRINTF_EXPR,
+		  TYPE_DECIMAL_DIG - 1, diff);
+	  FTOSTR (dstrx, FSTR_MAX, "% .*" PRINTF_XEXPR,
+		  TYPE_HEX_DIG - 1, diff);
+	  FTOSTR (ustrn, FSTR_MAX, "% .4" PRINTF_NEXPR, ulps);
+	  FTOSTR (mustrn, FSTR_MAX, "% .4" PRINTF_NEXPR, max_ulp);
+	  printf (" difference: %s  %s\n", dstrn, dstrx);
+	  printf (" ulp       : %s\n", ustrn);
+	  printf (" max.ulp   : %s\n", mustrn);
 	}
     }
   update_stats (ok);
@@ -7897,8 +7914,8 @@ static const struct test_f_i_data ilogb_test_data[] =
     TEST_f_i (ilogb, -min_subnorm_value, MIN_EXP-MANT_DIG, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
     TEST_f_i (ilogb, min_value, MIN_EXP, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
     TEST_f_i (ilogb, -min_value, MIN_EXP, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
-    TEST_f_i (ilogb, max_value, MAX_EXP-1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
-    TEST_f_i (ilogb, -max_value, MAX_EXP-1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
+    TEST_f_i (ilogb, max_value, MAX_EXP, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
+    TEST_f_i (ilogb, -max_value, MAX_EXP, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
 
     /* ilogb (0.0) == FP_ILOGB0 plus invalid exception  */
     TEST_f_i (ilogb, 0.0, FP_ILOGB0, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION|ERRNO_EDOM),
@@ -9030,8 +9047,8 @@ static const struct test_f_f_data logb_test_data[] =
     TEST_f_f (logb, -min_subnorm_value, MIN_EXP-MANT_DIG, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
     TEST_f_f (logb, min_value, MIN_EXP, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
     TEST_f_f (logb, -min_value, MIN_EXP, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
-    TEST_f_f (logb, max_value, MAX_EXP-1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
-    TEST_f_f (logb, -max_value, MAX_EXP-1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
+    TEST_f_f (logb, max_value, MAX_EXP, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
+    TEST_f_f (logb, -max_value, MAX_EXP, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
 
     TEST_f_f (logb, 0x0.1p-127, -131, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_f (logb, 0x0.01p-127, -135, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
diff --git a/math/test-double.h b/math/test-double.h
index 16b4ce8..2fabf57 100644
--- a/math/test-double.h
+++ b/math/test-double.h
@@ -16,6 +16,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <float.h>
+
 #define FUNC(function) function
 #define FLOAT double
 #define PRINTF_EXPR "e"
@@ -23,3 +25,15 @@
 #define PRINTF_NEXPR "f"
 #define TEST_DOUBLE 1
 #define BUILD_COMPLEX(real, imag) (CMPLX ((real), (imag)))
+
+#define LIT(x) (x)
+#define FTOSTR snprintf
+#define TYPE_STR "double"
+#define TYPE_DECIMAL_DIG DBL_DECIMAL_DIG
+#define TYPE_MIN DBL_MIN
+#define TYPE_TRUE_MIN DBL_TRUE_MIN
+#define TYPE_MAX DBL_MAX
+#define TYPE_MIN_EXP DBL_MIN_EXP
+#define TYPE_MAX_EXP DBL_MAX_EXP
+#define TYPE_MANT_DIG DBL_MANT_DIG
+#define TYPE_INF HUGE_VAL
diff --git a/math/test-float.h b/math/test-float.h
index 629f6ee..a54e815 100644
--- a/math/test-float.h
+++ b/math/test-float.h
@@ -16,6 +16,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <float.h>
+
 #define FUNC(function) function ## f
 #define FLOAT float
 #define PRINTF_EXPR "e"
@@ -23,3 +25,15 @@
 #define PRINTF_NEXPR "f"
 #define TEST_FLOAT 1
 #define BUILD_COMPLEX(real, imag) (CMPLXF ((real), (imag)))
+
+#define LIT(x) (x ## f)
+#define FTOSTR snprintf
+#define TYPE_STR "float"
+#define TYPE_INF HUGE_VALF
+#define TYPE_DECIMAL_DIG FLT_DECIMAL_DIG
+#define TYPE_MANT_DIG FLT_MANT_DIG
+#define TYPE_MAX FLT_MAX
+#define TYPE_MAX_EXP FLT_MAX_EXP
+#define TYPE_MIN FLT_MIN
+#define TYPE_MIN_EXP FLT_MIN_EXP
+#define TYPE_TRUE_MIN FLT_TRUE_MIN
diff --git a/math/test-ldouble.h b/math/test-ldouble.h
index 481561f..dee158a 100644
--- a/math/test-ldouble.h
+++ b/math/test-ldouble.h
@@ -16,6 +16,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <float.h>
+
 #define FUNC(function) function##l
 #define FLOAT long double
 #define PRINTF_EXPR "Le"
@@ -23,3 +25,15 @@
 #define PRINTF_NEXPR "Lf"
 #define TEST_LDOUBLE 1
 #define BUILD_COMPLEX(real, imag) (CMPLXL ((real), (imag)))
+
+#define LIT(x) (x ## L)
+#define FTOSTR snprintf
+#define TYPE_STR "ldouble"
+#define TYPE_DECIMAL_DIG LDBL_DECIMAL_DIG
+#define TYPE_MIN LDBL_MIN
+#define TYPE_TRUE_MIN LDBL_TRUE_MIN
+#define TYPE_MAX LDBL_MAX
+#define TYPE_MIN_EXP LDBL_MIN_EXP
+#define TYPE_MAX_EXP LDBL_MAX_EXP
+#define TYPE_MANT_DIG LDBL_MANT_DIG
+#define TYPE_INF HUGE_VALL
-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCH 3/8] Fixup TYPE_* substitutions
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
  2016-05-18 20:56   ` [PATCH 8/8] Generate new format names in auto-libm-test-out Paul E. Murphy
  2016-05-18 20:56   ` [PATCH 7/8] Remove type specific information from auto-libm-test-in Paul E. Murphy
@ 2016-05-18 20:56   ` Paul E. Murphy
  2016-05-18 21:19     ` Joseph Myers
  2016-05-18 20:56   ` [PATCH 4/8] Add LIT() around literals in check_ulp in libm-tests.inc Paul E. Murphy
                     ` (19 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-18 20:56 UTC (permalink / raw)
  To: libc-alpha

nexttoward *always* takes a long double as its second
argument.  This is the one exception to the type-genericness
of libm-test.inc.

	* math/libm-test.inc (nexttoward_test_data):
	Revert TYPE_MANT_DIG changes with LDBL_MANT_DIG.
---
 math/libm-test.inc | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/math/libm-test.inc b/math/libm-test.inc
index d44c6fb..f447cf9 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -9970,6 +9970,8 @@ static const struct test_ff_f_data_nexttoward nexttoward_test_data[] =
     TEST_ff_f (nexttoward, -min_subnorm_value, 0, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_ERANGE),
     TEST_ff_f (nexttoward, -min_subnorm_value, minus_zero, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_ERANGE),
 
+    /* Note, FUNC(nexttoward) always takes a long double as a second argument.  It is also not included as part of
+       of TS 18661-3.  */
 #if TEST_COND_binary32
     TEST_ff_f (nexttoward, 1.0, 1.1L, 0x1.000002p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, 1.0, LDBL_MAX, 0x1.000002p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
@@ -9984,19 +9986,19 @@ static const struct test_ff_f_data_nexttoward nexttoward_test_data[] =
     TEST_ff_f (nexttoward, -1.0, LDBL_MAX, -0x0.ffffffp0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, -1.0, -0x0.fffffffffffff8p0, -0x0.ffffffp0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, -0x1.3p-145, -0xap-148L, -0x1.4p-145, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
-# if TYPE_MANT_DIG >= 64
+# if LDBL_MANT_DIG >= 64
     TEST_ff_f (nexttoward, 1.0, 0x1.000000000000002p0L, 0x1.000002p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, 1.0, 0x0.ffffffffffffffffp0L, 0x0.ffffffp0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, -1.0, -0x1.000000000000002p0L, -0x1.000002p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, -1.0, -0x0.ffffffffffffffffp0L, -0x0.ffffffp0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
 # endif
-# if TYPE_MANT_DIG >= 106
+# if LDBL_MANT_DIG >= 106
     TEST_ff_f (nexttoward, 1.0, 0x1.000000000000000000000000008p0L, 0x1.000002p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, 1.0, 0x0.ffffffffffffffffffffffffffcp0L, 0x0.ffffffp0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, -1.0, -0x1.000000000000000000000000008p0L, -0x1.000002p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, -1.0, -0x0.ffffffffffffffffffffffffffcp0L, -0x0.ffffffp0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
 # endif
-# if TYPE_MANT_DIG >= 113
+# if LDBL_MANT_DIG >= 113
     TEST_ff_f (nexttoward, 1.0, 0x1.0000000000000000000000000001p0L, 0x1.000002p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, 1.0, 0x0.ffffffffffffffffffffffffffff8p0L, 0x0.ffffffp0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, -1.0, -0x1.0000000000000000000000000001p0L, -0x1.000002p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
@@ -10018,19 +10020,19 @@ static const struct test_ff_f_data_nexttoward nexttoward_test_data[] =
     TEST_ff_f (nexttoward, -1.0, -0x0.fffffffffffff8p0, -0x0.fffffffffffff8p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, -1.0, -0x8.00346dc5d6388p-3L, -0x1.0000000000001p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, 0x1p-1074, 0x1p-1073L, 0x1p-1073, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
-# if TYPE_MANT_DIG >= 64
+# if LDBL_MANT_DIG >= 64
     TEST_ff_f (nexttoward, 1.0, 0x1.000000000000002p0L, 0x1.0000000000001p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, 1.0, 0x0.ffffffffffffffffp0L, 0x0.fffffffffffff8p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, -1.0, -0x1.000000000000002p0L, -0x1.0000000000001p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, -1.0, -0x0.ffffffffffffffffp0L, -0x0.fffffffffffff8p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
 # endif
-# if TYPE_MANT_DIG >= 106
+# if LDBL_MANT_DIG >= 106
     TEST_ff_f (nexttoward, 1.0, 0x1.000000000000000000000000008p0L, 0x1.0000000000001p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, 1.0, 0x0.ffffffffffffffffffffffffffcp0L, 0x0.fffffffffffff8p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, -1.0, -0x1.000000000000000000000000008p0L, -0x1.0000000000001p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, -1.0, -0x0.ffffffffffffffffffffffffffcp0L, -0x0.fffffffffffff8p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
 # endif
-# if TYPE_MANT_DIG >= 113
+# if LDBL_MANT_DIG >= 113
     TEST_ff_f (nexttoward, 1.0, 0x1.0000000000000000000000000001p0L, 0x1.0000000000001p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, 1.0, 0x0.ffffffffffffffffffffffffffff8p0L, 0x0.fffffffffffff8p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, -1.0, -0x1.0000000000000000000000000001p0L, -0x1.0000000000001p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCH 0/8] Refactor libm-tests.c and friends
@ 2016-05-18 20:56 ` Paul E. Murphy
  2016-05-18 20:56   ` [PATCH 8/8] Generate new format names in auto-libm-test-out Paul E. Murphy
                     ` (22 more replies)
  0 siblings, 23 replies; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-18 20:56 UTC (permalink / raw)
  To: libc-alpha

This patch series attempts to decouple type and format information
from the libm test machinery. I have verified the same number of
tests run on ppc64le and x86-64 (ldbl-128ibm and ldbl-96-intel).
I don't expect surprises from the other formats, but I would
welcome any assistance in testing the other formats before
submitting.

NOTE: Patches 1, 7, and 8 require a little reviewer assistance
to correctly apply as I have removed large automated changes
and verbose changes from the patch.

Paul E. Murphy (8):
  Begin refactor of libm-test.inc
  Refactor type specific macros using regexes
  Fixup TYPE_* substitutions
  Add LIT() around literals in check_ulp in libm-tests.inc
  Apply LIT(x) to floating point literals in libm-test.c
  Refactor CHOOSE() macro usage in libm-tests.inc
  Remove type specific information from auto-libm-test-in
  Generate new format names in auto-libm-test-out

 math/auto-libm-test-in     | 130 +++----
 math/gen-auto-libm-tests.c |  24 +-
 math/gen-libm-test.pl      |  84 ++++-
 math/libm-test.inc         | 922 +++++++++++++++++++++++----------------------
 math/test-double-finite.c  |   1 -
 math/test-double-vlen2.h   |   1 -
 math/test-double-vlen4.h   |   1 -
 math/test-double-vlen8.h   |   1 -
 math/test-double.c         |   1 -
 math/test-double.h         |  14 +
 math/test-float-finite.c   |   1 -
 math/test-float-vlen16.h   |   1 -
 math/test-float-vlen4.h    |   1 -
 math/test-float-vlen8.h    |   1 -
 math/test-float.c          |   1 -
 math/test-float.h          |  14 +
 math/test-idouble.c        |   1 -
 math/test-ifloat.c         |   1 -
 math/test-ildoubl.c        |   1 -
 math/test-ldouble-finite.c |   1 -
 math/test-ldouble.c        |   1 -
 math/test-ldouble.h        |  14 +
 22 files changed, 654 insertions(+), 563 deletions(-)

-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCH 8/8] Generate new format names in auto-libm-test-out
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
@ 2016-05-18 20:56   ` Paul E. Murphy
  2016-05-18 20:56   ` [PATCH 7/8] Remove type specific information from auto-libm-test-in Paul E. Murphy
                     ` (21 subsequent siblings)
  22 siblings, 0 replies; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-18 20:56 UTC (permalink / raw)
  To: libc-alpha

NOTE: Reviewers, I've redacted the changes to auto-libm-tests-out
as its some 60MB worth of boring generated changes.  Please
rerun gen-auto-libm-tests to produce this part of the patch.

This converts the inclusion macro for each test to use
the format specific macro. In addition, the format
specifier is removed as it is applied via the LIT() macro
which is itself applied when converting the auto inputs and
libm-test.inc into libm-test.c.

	* math/gen-auto-libm-test.c (fp_format_desc): remove
	suffix member.
	(output_generic_value): Remove usage of suffix member,
	and the resulting unuse of the fp_format argument.
	(output_for_one_input_case): Remove unused fp_format
	parameter.
	* math/auto-libm-test-out: Regenerate.
	* math/libm-test.inc [TEST_COND_ldbl_128ibm]: replace
	usage with TEST_COND_ibm128.
	[TEST_COND_flt_32]: Remove.
	[TEST_COND_dbl_64]: Remove.
	[TEST_COND_ldbl_96_intel]: Remove.
	[TEST_COND_ldbl_96_m68k]: Remove.
	[TEST_COND_ldbl_128]: Remove.
---
 math/gen-auto-libm-tests.c | 24 ++++++++++--------------
 math/libm-test.inc         | 14 +++-----------
 2 files changed, 13 insertions(+), 25 deletions(-)

diff --git a/math/gen-auto-libm-tests.c b/math/gen-auto-libm-tests.c
index 0a57382..0d10197 100644
--- a/math/gen-auto-libm-tests.c
+++ b/math/gen-auto-libm-tests.c
@@ -158,9 +158,6 @@ typedef struct
 {
   /* The name of the format.  */
   const char *name;
-  /* The suffix to use on floating-point constants with this
-     format.  */
-  const char *suffix;
   /* A string for the largest normal value, or NULL for IEEE formats
      where this can be determined automatically.  */
   const char *max_string;
@@ -186,12 +183,12 @@ typedef struct
    enumeration.  */
 static fp_format_desc fp_formats[fp_num_formats] =
   {
-    { "flt-32", "f", NULL, 24, 128, -125, {}, {}, {}, {}, {} },
-    { "dbl-64", "", NULL, 53, 1024, -1021, {}, {}, {}, {}, {} },
-    { "ldbl-96-intel", "L", NULL, 64, 16384, -16381, {}, {}, {}, {}, {} },
-    { "ldbl-96-m68k", "L", NULL, 64, 16384, -16382, {}, {}, {}, {}, {} },
-    { "ldbl-128", "L", NULL, 113, 16384, -16381, {}, {}, {}, {}, {} },
-    { "ldbl-128ibm", "L", "0x1.fffffffffffff7ffffffffffff8p+1023",
+    { "binary32", NULL, 24, 128, -125, {}, {}, {}, {}, {} },
+    { "binary64", NULL, 53, 1024, -1021, {}, {}, {}, {}, {} },
+    { "intel96", NULL, 64, 16384, -16381, {}, {}, {}, {}, {} },
+    { "m68k96", NULL, 64, 16384, -16382, {}, {}, {}, {}, {} },
+    { "binary128", NULL, 113, 16384, -16381, {}, {}, {}, {}, {} },
+    { "ibm128", "0x1.fffffffffffff7ffffffffffff8p+1023",
       106, 1024, -968, {}, {}, {}, {}, {} },
   };
 
@@ -1648,8 +1645,7 @@ int_fits_type (mpz_t z, arg_ret_type type, int long_bits)
 
 static void
 output_generic_value (FILE *fp, const char *filename, const generic_value *v,
-		      bool ignore, arg_ret_type type, fp_format format,
-		      int long_bits)
+		      bool ignore, arg_ret_type type, int long_bits)
 {
   if (ignore)
     {
@@ -1662,7 +1658,7 @@ output_generic_value (FILE *fp, const char *filename, const generic_value *v,
   switch (type)
     {
     case type_fp:
-      suffix = fp_formats[format].suffix;
+      suffix = "";
       break;
 
     case type_int:
@@ -1906,7 +1902,7 @@ output_for_one_input_case (FILE *fp, const char *filename, test_function *tf,
 	      /* Print inputs.  */
 	      for (size_t i = 0; i < tf->num_args; i++)
 		output_generic_value (fp, filename, &inputs[i], false,
-				      tf->arg_types[i], f, long_bits);
+				      tf->arg_types[i], long_bits);
 	      if (fputs (" :", fp) < 0)
 		error (EXIT_FAILURE, errno, "write to '%s'", filename);
 	      /* Print outputs.  */
@@ -1942,7 +1938,7 @@ output_for_one_input_case (FILE *fp, const char *filename, test_function *tf,
 		      abort ();
 		    }
 		  output_generic_value (fp, filename, &g, ignore_output[i],
-					tf->ret_types[i], f, long_bits);
+					tf->ret_types[i], long_bits);
 		  generic_value_free (&g);
 		}
 	      if (fputs (" :", fp) < 0)
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 7350c1b..00cac0c 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -272,14 +272,6 @@ struct ulp_data
 # define NO_TEST_INLINE_DOUBLE	0
 #endif
 
-/* Conditions used by tests generated by gen-auto-libm-tests.c.  */
-#define TEST_COND_flt_32 TEST_COND_binary32
-#define TEST_COND_dbl_64 TEST_COND_binary64
-#define TEST_COND_ldbl_96_intel TEST_COND_intel96
-#define TEST_COND_ldbl_96_m68k  TEST_COND_m68k96
-#define TEST_COND_ldbl_128 TEST_COND_binary128
-#define TEST_COND_ldbl_128ibm TEST_COND_ibm128
-
 #if LONG_MAX == 0x7fffffff
 # define TEST_COND_long32	1
 # define TEST_COND_long64	0
@@ -387,7 +379,7 @@ init_max_error (const char *name, int exact)
   prev_imag_max_error = find_ulps (name, func_imag_ulps,
 				   (sizeof (func_imag_ulps)
 				    / sizeof (func_imag_ulps[0])));
-#if TEST_COND_ldbl_128ibm
+#if TEST_COND_ibm128
   /* The documented accuracy of IBM long double division is 3ulp (see
      libgcc/config/rs6000/ibm-ldouble-format), so do not require
      better accuracy for libm functions that are exactly defined for
@@ -686,14 +678,14 @@ test_exceptions (const char *test_name, int exception)
 	 arithmetic.  */
 #ifdef FE_UNDERFLOW
       if ((exception & UNDERFLOW_EXCEPTION_OK) == 0
-	  && !(TEST_COND_ldbl_128ibm
+	  && !(TEST_COND_ibm128
 	       && (exception & UNDERFLOW_EXCEPTION) == 0))
 	test_single_exception (test_name, exception, UNDERFLOW_EXCEPTION,
 			       FE_UNDERFLOW, "Underflow");
 #endif
 #ifdef FE_INEXACT
       if ((exception & (INEXACT_EXCEPTION | NO_INEXACT_EXCEPTION)) != 0
-	  && !(TEST_COND_ldbl_128ibm
+	  && !(TEST_COND_ibm128
 	       && (exception & NO_INEXACT_EXCEPTION) != 0))
 	test_single_exception (test_name, exception, INEXACT_EXCEPTION,
 			       FE_INEXACT, "Inexact");
-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCH 6/8] Refactor CHOOSE() macro usage in libm-tests.inc
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
                     ` (6 preceding siblings ...)
  2016-05-18 20:56   ` [PATCH 1/8] Begin refactor of libm-test.inc Paul E. Murphy
@ 2016-05-18 21:17   ` Paul E. Murphy
  2016-05-18 21:39     ` Joseph Myers
  2016-05-18 21:44   ` [PATCH 0/8] Refactor libm-tests.c and friends Joseph Myers
                     ` (14 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-18 21:17 UTC (permalink / raw)
  To: libc-alpha

Use gen-libm-test.pl to generate these macros inside
libm-test-ulps.h as this simplifies adding new
types without having to modify a growing number of
static headers each time a type is added.

	* math/gen-libm-test.pl (parse_ulps):
	Dynamically generate type matching regex based on
	the all_floats array.
	(get_ulps): Generate the CHOOSE() macro used for each
	test based on the all_floats array.
	(output_ulps): Dynamically define the correct CHOOSE()
	macros for each type based on the all_floats array.
	* math/libm-test.inc: Remove comment about CHOOSE.
	* math/test-double-finite.c [CHOOSE]: Remove.
	* math/test-double-vlen2.h [CHOOSE]: Likewise.
	* math/test-double-vlen4.h [CHOOSE]: Likewise.
	* math/test-double-vlen8.h [CHOOSE]: Likewise.
	* math/test-double.c [CHOOSE]: Likewise.
	* math/test-float-finite.c [CHOOSE]: Likewise.
	* math/test-float-vlen16.h [CHOOSE]: Likewise.
	* math/test-float-vlen4.h [CHOOSE]: Likewise.
	* math/test-float-vlen8.h [CHOOSE]: Likewise.
	* math/test-float.c [CHOOSE]: Likewise.
	* math/test-idouble.c [CHOOSE]: Likewise.
	* math/test-ifloat.c [CHOOSE]: Likewise.
	* math/test-ildoubl.c [CHOOSE]: Likewise.
	* math/test-ldouble-finite.c [CHOOSE]: Likewise.
	* math/test-ldouble.c [CHOOSE]: Likewise.
---
 math/gen-libm-test.pl      | 46 +++++++++++++++++++++++++++++++++++-----------
 math/libm-test.inc         |  1 -
 math/test-double-finite.c  |  1 -
 math/test-double-vlen2.h   |  1 -
 math/test-double-vlen4.h   |  1 -
 math/test-double-vlen8.h   |  1 -
 math/test-double.c         |  1 -
 math/test-float-finite.c   |  1 -
 math/test-float-vlen16.h   |  1 -
 math/test-float-vlen4.h    |  1 -
 math/test-float-vlen8.h    |  1 -
 math/test-float.c          |  1 -
 math/test-idouble.c        |  1 -
 math/test-ifloat.c         |  1 -
 math/test-ildoubl.c        |  1 -
 math/test-ldouble-finite.c |  1 -
 math/test-ldouble.c        |  1 -
 17 files changed, 35 insertions(+), 27 deletions(-)

diff --git a/math/gen-libm-test.pl b/math/gen-libm-test.pl
index 2f5acc2..b252a39 100755
--- a/math/gen-libm-test.pl
+++ b/math/gen-libm-test.pl
@@ -585,7 +585,14 @@ sub generate_testfile {
 # Parse ulps file
 sub parse_ulps {
   my ($file) = @_;
-  my ($test, $type, $float, $eps);
+  my ($test, $type, $float, $eps, $float_regex);
+
+  # Build a basic regex to match type entries in the
+  # generated ULPS file.
+  foreach my $ftype (@all_floats) {
+    $float_regex .= "|" . $ftype;
+  }
+  $float_regex = "^" . substr ($float_regex, 1) . ":";
 
   # $type has the following values:
   # "normal": No complex variable
@@ -610,7 +617,7 @@ sub parse_ulps {
       ($test) = ($_ =~ /^Function:\s*\"([a-zA-Z0-9_]+)\"/);
       next;
     }
-    if (/^i?(float|double|ldouble):/) {
+    if (/$float_regex/) {
       ($float, $eps) = split /\s*:\s*/,$_,2;
 
       if ($eps eq "0") {
@@ -696,14 +703,12 @@ sub get_all_ulps_for_test {
   my ($ldouble, $double, $float, $ildouble, $idouble, $ifloat);
 
   if (exists $results{$test}{'has_ulps'}) {
-    # XXX use all_floats (change order!)
-    $ldouble = &get_ulps ($test, $type, "ldouble");
-    $double = &get_ulps ($test, $type, "double");
-    $float = &get_ulps ($test, $type, "float");
-    $ildouble = &get_ulps ($test, $type, "ildouble");
-    $idouble = &get_ulps ($test, $type, "idouble");
-    $ifloat = &get_ulps ($test, $type, "ifloat");
-    return "CHOOSE ($ldouble, $double, $float, $ildouble, $idouble, $ifloat)";
+    my $choose_str = "CHOOSE (";
+    foreach $float (@all_floats) {
+      $choose_str .= &get_ulps ($test, $type, $float) . ", ";
+    }
+    $choose_str = substr ($choose_str, 0, -2) . ")";
+    return $choose_str;
   } else {
     die "get_all_ulps_for_test called for \"$test\" with no ulps\n";
   }
@@ -712,7 +717,7 @@ sub get_all_ulps_for_test {
 # Print include file
 sub output_ulps {
   my ($file, $ulps_filename) = @_;
-  my ($i, $fct, $type, $ulp, $ulp_real, $ulp_imag);
+  my ($i, $fct, $type, $ulp, $ulp_real, $ulp_imag, $choose);
   my (%func_ulps, %func_real_ulps, %func_imag_ulps);
 
   open ULP, ">$file" or die ("Can't open $file: $!");
@@ -721,6 +726,25 @@ sub output_ulps {
   print ULP "   from $ulps_filename with gen-libm-test.pl.\n";
   print ULP "   Don't change it - change instead the master files.  */\n\n";
 
+  # Declare all the possible CHOOSE() variants based on the type being tested
+  # and whether inline functions are being tested.
+  $choose = "CHOOSE(C$all_floats[0]";
+  for ($i = 1; $i <= $#all_floats; $i++) {
+	$choose .= ", C" . $all_floats[$i];
+  }
+  $choose .= ")";
+  foreach my $type (@all_floats) {
+    if ($type =~ /^i/) {
+      $type = substr ($type, 1);
+      print ULP "#if defined TEST_" . uc ($type) . " && TEST_INLINE\n";
+      print ULP "# define " . $choose . " Ci$type\n";
+    } else {
+      print ULP "#if defined TEST_" . uc ($type) . " &&  !TEST_INLINE\n";
+      print ULP "# define " . $choose . " C$type\n";
+    }
+    print ULP "#endif\n";
+  }
+
   foreach $fct (keys %results) {
     $type = $results{$fct}{'type'};
     if ($type eq 'normal') {
diff --git a/math/libm-test.inc b/math/libm-test.inc
index d5dc5fc..7350c1b 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -26,7 +26,6 @@
    name with correct suffix (e.g. cosl or cosf)
    FLOAT:	   floating point type to test
    - TEST_MSG:	   informal message to be displayed
-   CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat):
    chooses one of the parameters as delta for testing
    equality
    PRINTF_EXPR	   Floating point conversion specification to print a variable
diff --git a/math/test-double-finite.c b/math/test-double-finite.c
index e7fa2a9..7f107aa 100644
--- a/math/test-double-finite.c
+++ b/math/test-double-finite.c
@@ -21,6 +21,5 @@
 #include "test-math-scalar.h"
 
 #define TEST_MSG "testing double (finite-math-only)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cdouble
 
 #include "libm-test.c"
diff --git a/math/test-double-vlen2.h b/math/test-double-vlen2.h
index 8a1d068..45351cb 100644
--- a/math/test-double-vlen2.h
+++ b/math/test-double-vlen2.h
@@ -21,7 +21,6 @@
 #include "test-math-vector.h"
 
 #define TEST_MSG "testing double vector math (without inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cdouble
 
 #define EXCEPTION_TESTS_double 0
 #define ROUNDING_TESTS_double(MODE) ((MODE) == FE_TONEAREST)
diff --git a/math/test-double-vlen4.h b/math/test-double-vlen4.h
index 40ab58c..7078893 100644
--- a/math/test-double-vlen4.h
+++ b/math/test-double-vlen4.h
@@ -21,7 +21,6 @@
 #include "test-math-vector.h"
 
 #define TEST_MSG "testing double vector math (without inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cdouble
 
 #define EXCEPTION_TESTS_double 0
 #define ROUNDING_TESTS_double(MODE) ((MODE) == FE_TONEAREST)
diff --git a/math/test-double-vlen8.h b/math/test-double-vlen8.h
index dddb52c..57168c5 100644
--- a/math/test-double-vlen8.h
+++ b/math/test-double-vlen8.h
@@ -21,7 +21,6 @@
 #include "test-math-vector.h"
 
 #define TEST_MSG "testing double vector math (without inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cdouble
 
 #define EXCEPTION_TESTS_double 0
 #define ROUNDING_TESTS_double(MODE) ((MODE) == FE_TONEAREST)
diff --git a/math/test-double.c b/math/test-double.c
index 2647f66..3f84f40 100644
--- a/math/test-double.c
+++ b/math/test-double.c
@@ -23,6 +23,5 @@
 #include "test-math-scalar.h"
 
 #define TEST_MSG "testing double (without inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cdouble
 
 #include "libm-test.c"
diff --git a/math/test-float-finite.c b/math/test-float-finite.c
index bd25a7b..3f5fe19 100644
--- a/math/test-float-finite.c
+++ b/math/test-float-finite.c
@@ -21,6 +21,5 @@
 #include "test-math-scalar.h"
 
 #define TEST_MSG "testing float (finite-math-only)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cfloat
 
 #include "libm-test.c"
diff --git a/math/test-float-vlen16.h b/math/test-float-vlen16.h
index a2db3a5..d31336a 100644
--- a/math/test-float-vlen16.h
+++ b/math/test-float-vlen16.h
@@ -21,7 +21,6 @@
 #include "test-math-vector.h"
 
 #define TEST_MSG "testing float vector math (without inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cfloat
 
 #define EXCEPTION_TESTS_float 0
 #define ROUNDING_TESTS_float(MODE) ((MODE) == FE_TONEAREST)
diff --git a/math/test-float-vlen4.h b/math/test-float-vlen4.h
index 164749d..5a88fb8 100644
--- a/math/test-float-vlen4.h
+++ b/math/test-float-vlen4.h
@@ -21,7 +21,6 @@
 #include "test-math-vector.h"
 
 #define TEST_MSG "testing float vector math (without inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cfloat
 
 #define EXCEPTION_TESTS_float 0
 #define ROUNDING_TESTS_float(MODE) ((MODE) == FE_TONEAREST)
diff --git a/math/test-float-vlen8.h b/math/test-float-vlen8.h
index ce32df2..d1e5e6e 100644
--- a/math/test-float-vlen8.h
+++ b/math/test-float-vlen8.h
@@ -21,7 +21,6 @@
 #include "test-math-vector.h"
 
 #define TEST_MSG "testing float vector math (without inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cfloat
 
 #define EXCEPTION_TESTS_float 0
 #define ROUNDING_TESTS_float(MODE) ((MODE) == FE_TONEAREST)
diff --git a/math/test-float.c b/math/test-float.c
index 153b9ad..6be57bb 100644
--- a/math/test-float.c
+++ b/math/test-float.c
@@ -23,6 +23,5 @@
 #include "test-math-scalar.h"
 
 #define TEST_MSG "testing float (without inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cfloat
 
 #include "libm-test.c"
diff --git a/math/test-idouble.c b/math/test-idouble.c
index fc1e8f8..10a3685 100644
--- a/math/test-idouble.c
+++ b/math/test-idouble.c
@@ -21,6 +21,5 @@
 #include "test-math-scalar.h"
 
 #define TEST_MSG "testing double (inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cinlinedouble
 
 #include "libm-test.c"
diff --git a/math/test-ifloat.c b/math/test-ifloat.c
index 72c53ad..88bb5b8 100644
--- a/math/test-ifloat.c
+++ b/math/test-ifloat.c
@@ -21,6 +21,5 @@
 #include "test-math-scalar.h"
 
 #define TEST_MSG "testing float (inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cinlinefloat
 
 #include "libm-test.c"
diff --git a/math/test-ildoubl.c b/math/test-ildoubl.c
index 08317ed..dc0efaa 100644
--- a/math/test-ildoubl.c
+++ b/math/test-ildoubl.c
@@ -21,6 +21,5 @@
 #include "test-math-scalar.h"
 
 #define TEST_MSG "testing long double (inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cinlinelongdouble
 
 #include "libm-test.c"
diff --git a/math/test-ldouble-finite.c b/math/test-ldouble-finite.c
index 4c09778..8ac2d33 100644
--- a/math/test-ldouble-finite.c
+++ b/math/test-ldouble-finite.c
@@ -21,6 +21,5 @@
 #include "test-math-scalar.h"
 
 #define TEST_MSG "testing long double (finite-math-only)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Clongdouble
 
 #include "libm-test.c"
diff --git a/math/test-ldouble.c b/math/test-ldouble.c
index 944f6dd..a705fa4 100644
--- a/math/test-ldouble.c
+++ b/math/test-ldouble.c
@@ -23,6 +23,5 @@
 #include "test-math-scalar.h"
 
 #define TEST_MSG "testing long double (without inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Clongdouble
 
 #include "libm-test.c"
-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 1/8] Begin refactor of libm-test.inc
  2016-05-18 20:56   ` [PATCH 1/8] Begin refactor of libm-test.inc Paul E. Murphy
@ 2016-05-18 21:18     ` Joseph Myers
  2016-05-18 21:54     ` Joseph Myers
  1 sibling, 0 replies; 49+ messages in thread
From: Joseph Myers @ 2016-05-18 21:18 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: libc-alpha

On Wed, 18 May 2016, Paul E. Murphy wrote:

> +#define MANT_DIG (TYPE_MANT_DIG - 1)
> +#define MIN_EXP (TYPE_MIN_EXP - 1)
> +#define MAX_EXP (TYPE_MAX_EXP - 1)

No.  All these "- 1" are gratuitous obfuscation (difference from the 
standard C macros) in the existing code; having similar macros with 
different values is particularly confusing.  The correct approach is a 
preliminary patch to change the definition and uses of MANT_DIG and 
MIN_EXP, rather than extending the use of - 1 to MAX_EXP.

And then you don't need the TYPE_ prefixes at all; just use MAX_EXP etc. 
as at present (I agree that moving away from CHOOSE makes sense).  Only 
TYPE_DECIMAL_DIG (and TYPE_HEX_DIG for consistency) needs such a prefix, 
because of the incompatible meaning of DECIMAL_DIG in <float.h>.

> +#define TYPE_DECIMAL_DIG DBL_DECIMAL_DIG
> +#define TYPE_MIN DBL_MIN
> +#define TYPE_TRUE_MIN DBL_TRUE_MIN
> +#define TYPE_MAX DBL_MAX
> +#define TYPE_MIN_EXP DBL_MIN_EXP
> +#define TYPE_MAX_EXP DBL_MAX_EXP
> +#define TYPE_MANT_DIG DBL_MANT_DIG

Apart from removing the TYPE_ prefix in most cases, I think it would be 
better for this header just to define something to the DBL prefix, and for 
libm-test.inc to deal with concatenating that with _DECIMAL_DIG, _MIN, 
etc.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 3/8] Fixup TYPE_* substitutions
  2016-05-18 20:56   ` [PATCH 3/8] Fixup TYPE_* substitutions Paul E. Murphy
@ 2016-05-18 21:19     ` Joseph Myers
  0 siblings, 0 replies; 49+ messages in thread
From: Joseph Myers @ 2016-05-18 21:19 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: libc-alpha

On Wed, 18 May 2016, Paul E. Murphy wrote:

> nexttoward *always* takes a long double as its second
> argument.  This is the one exception to the type-genericness
> of libm-test.inc.
> 
> 	* math/libm-test.inc (nexttoward_test_data):
> 	Revert TYPE_MANT_DIG changes with LDBL_MANT_DIG.

Well, each posted patch should be something not causing regressions to 
maintain bisectability.  That is, 2 and 3 can't be separate patches; there 
should be one posting, described as applying certain automatic changes 
followed by certain manual fixups, with those to go in one commit.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 4/8] Add LIT() around literals in check_ulp in libm-tests.inc
  2016-05-18 20:56   ` [PATCH 4/8] Add LIT() around literals in check_ulp in libm-tests.inc Paul E. Murphy
@ 2016-05-18 21:24     ` Joseph Myers
  0 siblings, 0 replies; 49+ messages in thread
From: Joseph Myers @ 2016-05-18 21:24 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: libc-alpha

On Wed, 18 May 2016, Paul E. Murphy wrote:

> -   ulps = ulp (0x0.0p0);
> +   ulps = ulp (LIT (0x0.0p0));

But ulp is a function and implicitly converts its argument.  You don't 
need the suffixes.  Just passing an integer 0 or 1 in these cases and 
relying on implicit conversions seems best, to make the code less 
macro-heavy.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 5/8] Apply LIT(x) to floating point literals in libm-test.c
  2016-05-18 20:56   ` [PATCH 5/8] Apply LIT(x) to floating point literals in libm-test.c Paul E. Murphy
@ 2016-05-18 21:34     ` Joseph Myers
  0 siblings, 0 replies; 49+ messages in thread
From: Joseph Myers @ 2016-05-18 21:34 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: libc-alpha

On Wed, 18 May 2016, Paul E. Murphy wrote:

> +  # If it doesn't have a period or an exponent, its not an FP literal.
> +  if (index ($lit, ".") == -1 and $lit !~ /[pe]([+-])?[0-9]+/) {
> +    return $lit;

This would interpret e.g. 0x1e2 as a floating-point literal.  It looks 
like we don't have such literals in libm-test.inc at present (we do have 
0x1fffffe, which doesn't match your regular expression), but it still 
seems too fragile.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 6/8] Refactor CHOOSE() macro usage in libm-tests.inc
  2016-05-18 21:17   ` [PATCH 6/8] Refactor CHOOSE() macro usage in libm-tests.inc Paul E. Murphy
@ 2016-05-18 21:39     ` Joseph Myers
  0 siblings, 0 replies; 49+ messages in thread
From: Joseph Myers @ 2016-05-18 21:39 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: libc-alpha

Suppose we know the constant / function suffixes, and the prefix such as 
LDBL for macros.  What do we then need CHOOSE for?

The answer seems to be:

* Generating textual names used for ulps in print_function_ulps, 
print_complex_function_ulps.

* Generating ULPs entries output by gen-libm-test.pl in libm-test-ulps.h.

The former is eliminated by your patch 1.  As for the latter, how about 
making the ulps arrays generated by libm-test-ulps.h contain the type 
names explicitly, rather than containing calls to CHOOSE (and adjust the 
binary search to match both a function name and a type name)?  That way, 
you can completely eliminate the CHOOSE macro, which seems the better 
approach.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 0/8] Refactor libm-tests.c and friends
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
                     ` (7 preceding siblings ...)
  2016-05-18 21:17   ` [PATCH 6/8] Refactor CHOOSE() macro usage in libm-tests.inc Paul E. Murphy
@ 2016-05-18 21:44   ` Joseph Myers
  2016-05-18 21:58     ` Paul E. Murphy
  2016-05-20 21:37   ` [PATCHv2 01/14] Fixup usage of MANT_DIG in libm-test.inc Paul E. Murphy
                     ` (13 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Joseph Myers @ 2016-05-18 21:44 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: libc-alpha

I don't see anything in this series to address cases where arguments or 
results in libm-test.inc are e.g. M_PI_2l.  Is that deliberately intended 
to be addressed later, or did I miss something in the series?

(It obviously *does* need to be addressed for float128; you can't use 
M_PI_2l as an expected result when long double is IBM long double and 
you're testing float128, because float128 has higher precision than long 
double in that case, so an inaccurate expected result would show spurious 
large errors.)

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 1/8] Begin refactor of libm-test.inc
  2016-05-18 20:56   ` [PATCH 1/8] Begin refactor of libm-test.inc Paul E. Murphy
  2016-05-18 21:18     ` Joseph Myers
@ 2016-05-18 21:54     ` Joseph Myers
  2016-05-18 21:57       ` Paul E. Murphy
  1 sibling, 1 reply; 49+ messages in thread
From: Joseph Myers @ 2016-05-18 21:54 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: libc-alpha

On Wed, 18 May 2016, Paul E. Murphy wrote:

> 	[TEST_COND_gt_binary64]: Likewise.

I don't like this TEST_COND_gt_binary64.

If the condition combines TEST_LDOUBLE with something about mantissa bits 
or exponents for long double, only the thing about mantissa bits or 
exponents is actually needed.  If it's TEST_LDOUBLE on its own (or 
combined with conditions on integer types rather than on long double), as 
in e.g. tests of ceil, then testing for >= 64 mantissa bits is sufficient 
(the tests may actually only require some number between 53 and 64, but 
testing for >= 64 seems reasonable).  That is, TEST_LDOUBLE on its own can 
be treated as defined TEST_LDOUBLE && LDBL_MANT_DIG >= 64.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 7/8] Remove type specific information from auto-libm-test-in
  2016-05-18 20:56   ` [PATCH 7/8] Remove type specific information from auto-libm-test-in Paul E. Murphy
@ 2016-05-18 21:55     ` Joseph Myers
  0 siblings, 0 replies; 49+ messages in thread
From: Joseph Myers @ 2016-05-18 21:55 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: libc-alpha

On Wed, 18 May 2016, Paul E. Murphy wrote:

>  # where a result inaccurate by a few ulp could differ from the ideal
>  # result in whether it overflows; +/- 10ulp is sufficient for overflow
>  # or its absence to be unambiguous under glibc's accuracy standards).
> -# This also means the ldbl-128ibm inputs are XFAILed for dbl-64 and
> -# the ldbl-128 inputs for ldbl-96, as too close to the threshold.
> +# This also means the ibm128 inputs are XFAILed for binary64 and
> +# the binary128 inputs for ldbl-96, as too close to the threshold.

You have a stray ldbl-96 reference in a comment that's not updated.  I 
think this one needs to be a combination of (automatic patch, manual fixup 
patch), unless you add a sed command specifically for this one reference.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 1/8] Begin refactor of libm-test.inc
  2016-05-18 21:54     ` Joseph Myers
@ 2016-05-18 21:57       ` Paul E. Murphy
  2016-05-19 11:05         ` Joseph Myers
  0 siblings, 1 reply; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-18 21:57 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha

On 05/18/2016 04:44 PM, Joseph Myers wrote:
> On Wed, 18 May 2016, Paul E. Murphy wrote:
> 
>> 	[TEST_COND_gt_binary64]: Likewise.
> 
> I don't like this TEST_COND_gt_binary64.
> 
> If the condition combines TEST_LDOUBLE with something about mantissa bits 
> or exponents for long double, only the thing about mantissa bits or 
> exponents is actually needed.  If it's TEST_LDOUBLE on its own (or 
> combined with conditions on integer types rather than on long double), as 
> in e.g. tests of ceil, then testing for >= 64 mantissa bits is sufficient 
> (the tests may actually only require some number between 53 and 64, but 
> testing for >= 64 seems reasonable).  That is, TEST_LDOUBLE on its own can 
> be treated as defined TEST_LDOUBLE && LDBL_MANT_DIG >= 64.

Admittedly, I scratched my head here try to find a conservative method to
replace the TEST_LDOUBLE usage.  If it is only used as a bandaid for
testing ldbl formats which are more expressive than dbl, can't it just
go away without issue?  It isn't used in isolation.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 0/8] Refactor libm-tests.c and friends
  2016-05-18 21:44   ` [PATCH 0/8] Refactor libm-tests.c and friends Joseph Myers
@ 2016-05-18 21:58     ` Paul E. Murphy
  0 siblings, 0 replies; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-18 21:58 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha



On 05/18/2016 04:39 PM, Joseph Myers wrote:
> I don't see anything in this series to address cases where arguments or 
> results in libm-test.inc are e.g. M_PI_2l.  Is that deliberately intended 
> to be addressed later, or did I miss something in the series?
> 
> (It obviously *does* need to be addressed for float128; you can't use 
> M_PI_2l as an expected result when long double is IBM long double and 
> you're testing float128, because float128 has higher precision than long 
> double in that case, so an inaccurate expected result would show spurious 
> large errors.)
> 

Thanks for catching that. Indeed, those too will require another patch.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 1/8] Begin refactor of libm-test.inc
  2016-05-18 21:57       ` Paul E. Murphy
@ 2016-05-19 11:05         ` Joseph Myers
  0 siblings, 0 replies; 49+ messages in thread
From: Joseph Myers @ 2016-05-19 11:05 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: libc-alpha

On Wed, 18 May 2016, Paul E. Murphy wrote:

> On 05/18/2016 04:44 PM, Joseph Myers wrote:
> > On Wed, 18 May 2016, Paul E. Murphy wrote:
> > 
> >> 	[TEST_COND_gt_binary64]: Likewise.
> > 
> > I don't like this TEST_COND_gt_binary64.
> > 
> > If the condition combines TEST_LDOUBLE with something about mantissa bits 
> > or exponents for long double, only the thing about mantissa bits or 
> > exponents is actually needed.  If it's TEST_LDOUBLE on its own (or 
> > combined with conditions on integer types rather than on long double), as 
> > in e.g. tests of ceil, then testing for >= 64 mantissa bits is sufficient 
> > (the tests may actually only require some number between 53 and 64, but 
> > testing for >= 64 seems reasonable).  That is, TEST_LDOUBLE on its own can 
> > be treated as defined TEST_LDOUBLE && LDBL_MANT_DIG >= 64.
> 
> Admittedly, I scratched my head here try to find a conservative method to
> replace the TEST_LDOUBLE usage.  If it is only used as a bandaid for
> testing ldbl formats which are more expressive than dbl, can't it just
> go away without issue?  It isn't used in isolation.

The aim is to replace it with a logical condition for what the tests in 
question require.

If the condition just is "#ifdef TEST_LDOUBLE" (possibly with extra 
whitespace after "#"), or just tests defined TEST_LDOUBLE without any 
MANT_DIG, MIN_EXP or MAX_EXP tests (but including e.g. the "# if LONG_MAX 
> 281474976710656 && defined TEST_LDOUBLE" condition on one test of 
lrint), then, in what follows, treat it like "defined TEST_LDOUBLE && 
LDBL_MANT_DIG >= 64".

Given a test of a combination of TEST_LDOUBLE with a test of 
LDBL_MANT_DIG, LDBL_MIN_EXP or LDBL_MAX_EXP (possibly more than one of 
those, and possibly with other tests such as LONG_MAX as well), you can 
then remove the TEST_LDOUBLE condition if you change the LDBL_* tests to 
test the macros such as MANT_DIG, MIN_EXP and MAX_EXP (with MANT_DIG and 
MIN_EXP having previously been adjusted to remove the "-1").

Perhaps this patch is doing too many things and you need some patches just 
about refactoring TEST_LDOUBLE uses.

* Adjust MANT_DIG and MIN_EXP not to use -1.

* Change TEST_LDOUBLE when it appears in conjunction with LDBL_MANT_DIG 
etc. tests to just test MANT_DIG etc.

* Change LDBL_MANT_DIG etc. conditionals inside of TEST_LDOUBLE ones 
similarly (for cases such as

#ifdef TEST_LDOUBLE
...
# if LDBL_MANT_DIG > 100
...
# endif
#endif

* Change TEST_LDOUBLE when it appears on its own to test MANT_DIG >= 64.

(Well, all but the first of those could reasonbly go together in one 
patch, if separated from the rest of the refactoring.)

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCHv2 02/14] Fixup usage of MIN_EXP in libm-test.inc
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
                     ` (10 preceding siblings ...)
  2016-05-20 21:37   ` [PATCHv2 05/14] Refactor M_ macros defined " Paul E. Murphy
@ 2016-05-20 21:37   ` Paul E. Murphy
  2016-05-23 16:02     ` Joseph Myers
  2016-05-20 21:38   ` [PATCHv2 03/14] Begin refactor of libm-test.inc Paul E. Murphy
                     ` (10 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-20 21:37 UTC (permalink / raw)
  To: libc-alpha

Make MANT_DIG shadow the types *_MIN_EXP macro. Replace
calls sites with (MIN_EXP - 1), and simplify.

	* math/libm-test.inc [MIN_EXP]: Directly define as
	[DBL|LDBL|FLT]_MIN_EXP and fixup usage.
---
 math/libm-test.inc | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/math/libm-test.inc b/math/libm-test.inc
index 583ed26..538f448 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -330,8 +330,8 @@ static FLOAT max_valid_error;
 
 #define MANT_DIG CHOOSE (LDBL_MANT_DIG, DBL_MANT_DIG, FLT_MANT_DIG,  \
 			 LDBL_MANT_DIG, DBL_MANT_DIG, FLT_MANT_DIG)
-#define MIN_EXP CHOOSE ((LDBL_MIN_EXP-1), (DBL_MIN_EXP-1), (FLT_MIN_EXP-1),	\
-			(LDBL_MIN_EXP-1), (DBL_MIN_EXP-1), (FLT_MIN_EXP-1))
+#define MIN_EXP CHOOSE (LDBL_MIN_EXP, DBL_MIN_EXP, FLT_MIN_EXP,	\
+			LDBL_MIN_EXP, DBL_MIN_EXP, FLT_MIN_EXP)
 #define MAX_EXP CHOOSE (LDBL_MAX_EXP, DBL_MAX_EXP, FLT_MAX_EXP, \
 			LDBL_MAX_EXP, DBL_MAX_EXP, FLT_MAX_EXP)
 /* Sufficient numbers of digits to represent any floating-point value
@@ -753,7 +753,7 @@ ulp (FLOAT value)
 	/* Fall through...  */
       case FP_SUBNORMAL:
         /* The next closest subnormal value is a constant distance away.  */
-	ulp = FUNC(ldexp) (1.0, MIN_EXP - MANT_DIG + 1);
+	ulp = FUNC(ldexp) (1.0, MIN_EXP - MANT_DIG);
 	break;
 
       case FP_NORMAL:
@@ -7892,10 +7892,10 @@ static const struct test_f_i_data ilogb_test_data[] =
     TEST_f_i (ilogb, -0x1.ffffffffffffffp1L, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
 #endif
 
-    TEST_f_i (ilogb, min_subnorm_value, MIN_EXP-MANT_DIG+1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
-    TEST_f_i (ilogb, -min_subnorm_value, MIN_EXP-MANT_DIG+1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
-    TEST_f_i (ilogb, min_value, MIN_EXP, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
-    TEST_f_i (ilogb, -min_value, MIN_EXP, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
+    TEST_f_i (ilogb, min_subnorm_value, MIN_EXP-MANT_DIG, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
+    TEST_f_i (ilogb, -min_subnorm_value, MIN_EXP-MANT_DIG, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
+    TEST_f_i (ilogb, min_value, MIN_EXP-1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
+    TEST_f_i (ilogb, -min_value, MIN_EXP-1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
     TEST_f_i (ilogb, max_value, MAX_EXP-1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
     TEST_f_i (ilogb, -max_value, MAX_EXP-1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
 
@@ -9025,10 +9025,10 @@ static const struct test_f_f_data logb_test_data[] =
     TEST_f_f (logb, 1024, 10, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_f (logb, -2000, 10, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
 
-    TEST_f_f (logb, min_subnorm_value, MIN_EXP-MANT_DIG+1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
-    TEST_f_f (logb, -min_subnorm_value, MIN_EXP-MANT_DIG+1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
-    TEST_f_f (logb, min_value, MIN_EXP, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
-    TEST_f_f (logb, -min_value, MIN_EXP, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
+    TEST_f_f (logb, min_subnorm_value, MIN_EXP-MANT_DIG, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
+    TEST_f_f (logb, -min_subnorm_value, MIN_EXP-MANT_DIG, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
+    TEST_f_f (logb, min_value, MIN_EXP-1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
+    TEST_f_f (logb, -min_value, MIN_EXP-1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
     TEST_f_f (logb, max_value, MAX_EXP-1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
     TEST_f_f (logb, -max_value, MAX_EXP-1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
 
-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCHv2 05/14] Refactor M_ macros defined in libm-test.inc
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
                     ` (9 preceding siblings ...)
  2016-05-20 21:37   ` [PATCHv2 01/14] Fixup usage of MANT_DIG in libm-test.inc Paul E. Murphy
@ 2016-05-20 21:37   ` Paul E. Murphy
  2016-05-20 21:37   ` [PATCHv2 02/14] Fixup usage of MIN_EXP " Paul E. Murphy
                     ` (11 subsequent siblings)
  22 siblings, 0 replies; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-20 21:37 UTC (permalink / raw)
  To: libc-alpha

These are local to the test suite.  Rename them as a macro starting
with pi and a series of postfix operations to give us a constant
starting with pi.

	* libm-test.inc [M_PI_6l] Rename to
	[pi_6_d]: New Macro.
	[M_PI_34l]: Rename to
	[pi_3_m_4_d]: New Macro.
	[M_PI_34_LOG10El]: Rename to
	[pi_3_ln10_m_4_d]: New Macro.
	[M_PI2_LOG10El]: Rename to
	[pi_2_ln10_m_d]:  New Macro.
	[M_PI4_LOG10El]: Rename to
	[pi_4_ln10_m_d]:  New Macro.
	[M_PI_LOG10El]: Rename to
	[pi_ln10_d]:  New Macro.
---
 math/libm-test.inc | 77 ++++++++++++++++++++++++++++++------------------------
 1 file changed, 43 insertions(+), 34 deletions(-)

diff --git a/math/libm-test.inc b/math/libm-test.inc
index 4b3964d..e41a2d4 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -308,13 +308,22 @@ struct ulp_data
 # define TEST_COND_x86		0
 #endif
 
-/* Various constants (we must supply them precalculated for accuracy).  */
-#define M_PI_6l			.52359877559829887307710723054658383L
-#define M_PI_34l		2.356194490192344928846982537459627163L	/* 3*pi/4 */
-#define M_PI_34_LOG10El		1.023282265381381010614337719073516828L
-#define M_PI2_LOG10El		0.682188176920920673742891812715677885L
-#define M_PI4_LOG10El		0.341094088460460336871445906357838943L
-#define M_PI_LOG10El		1.364376353841841347485783625431355770L
+/* Various constants of pi (we must supply them precalculated for accuracy).
+   They are written as a series of postfix operations to try to keep them
+   concise yet somewhat readable.  */
+
+/* pi / 6 */
+#define pi_6_d			LIT (.52359877559829887307710723054658383)
+/* (pi * 3) / 4 */
+#define pi_3_m_4_d		LIT (2.356194490192344928846982537459627163)
+/* (pi * 3 * ln(10) / 4 */
+#define pi_3_m_ln10_m_4_d	LIT (1.023282265381381010614337719073516828)
+/* pi / (2 * ln(10)) */
+#define pi_2_ln10_m_d		LIT (0.682188176920920673742891812715677885)
+/* pi / (4 * ln(10)) */
+#define pi_4_ln10_m_d		LIT (0.341094088460460336871445906357838943)
+/* pi / ln(10) */
+#define pi_ln10_d		LIT (1.364376353841841347485783625431355770)
 
 #define ulps_file_name "ULPs"	/* Name of the ULPs file.  */
 static FILE *ulps_file;		/* File to document difference.  */
@@ -1984,8 +1993,8 @@ static const struct test_ff_f_data atan2_test_data[] =
 
     TEST_ff_f (atan2, plus_infty, plus_infty, M_PI_4l, ERRNO_UNCHANGED),
     TEST_ff_f (atan2, minus_infty, plus_infty, -M_PI_4l, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, plus_infty, minus_infty, M_PI_34l, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, minus_infty, minus_infty, -M_PI_34l, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, plus_infty, minus_infty, pi_3_m_4_d, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, minus_infty, minus_infty, -pi_3_m_4_d, ERRNO_UNCHANGED),
     TEST_ff_f (atan2, qnan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (atan2, qnan_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (atan2, -qnan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
@@ -2077,8 +2086,8 @@ static const struct test_c_c_data cacos_test_data[] =
     TEST_c_c (cacos, minus_zero, minus_zero, M_PI_2l, 0.0),
     TEST_c_c (cacos, 0, minus_zero, M_PI_2l, 0.0),
 
-    TEST_c_c (cacos, minus_infty, plus_infty, M_PI_34l, minus_infty),
-    TEST_c_c (cacos, minus_infty, minus_infty, M_PI_34l, plus_infty),
+    TEST_c_c (cacos, minus_infty, plus_infty, pi_3_m_4_d, minus_infty),
+    TEST_c_c (cacos, minus_infty, minus_infty, pi_3_m_4_d, plus_infty),
 
     TEST_c_c (cacos, plus_infty, plus_infty, M_PI_4l, minus_infty),
     TEST_c_c (cacos, plus_infty, minus_infty, M_PI_4l, plus_infty),
@@ -2764,8 +2773,8 @@ static const struct test_c_c_data cacosh_test_data[] =
     TEST_c_c (cacosh, minus_zero, 0, 0.0, M_PI_2l),
     TEST_c_c (cacosh, 0, minus_zero, 0.0, -M_PI_2l),
     TEST_c_c (cacosh, minus_zero, minus_zero, 0.0, -M_PI_2l),
-    TEST_c_c (cacosh, minus_infty, plus_infty, plus_infty, M_PI_34l),
-    TEST_c_c (cacosh, minus_infty, minus_infty, plus_infty, -M_PI_34l),
+    TEST_c_c (cacosh, minus_infty, plus_infty, plus_infty, pi_3_m_4_d),
+    TEST_c_c (cacosh, minus_infty, minus_infty, plus_infty, -pi_3_m_4_d),
 
     TEST_c_c (cacosh, plus_infty, plus_infty, plus_infty, M_PI_4l),
     TEST_c_c (cacosh, plus_infty, minus_infty, plus_infty, -M_PI_4l),
@@ -3467,9 +3476,9 @@ static const struct test_c_f_data carg_test_data[] =
 
     TEST_c_f (carg, plus_infty, minus_infty, -M_PI_4l),
 
-    TEST_c_f (carg, minus_infty, plus_infty, M_PI_34l),
+    TEST_c_f (carg, minus_infty, plus_infty, pi_3_m_4_d),
 
-    TEST_c_f (carg, minus_infty, minus_infty, -M_PI_34l),
+    TEST_c_f (carg, minus_infty, minus_infty, -pi_3_m_4_d),
 
     TEST_c_f (carg, qnan_value, qnan_value, qnan_value),
 
@@ -6229,8 +6238,8 @@ static const struct test_c_c_data clog_test_data[] =
     TEST_c_c (clog, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION),
     TEST_c_c (clog, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION),
 
-    TEST_c_c (clog, minus_infty, plus_infty, plus_infty, M_PI_34l),
-    TEST_c_c (clog, minus_infty, minus_infty, plus_infty, -M_PI_34l),
+    TEST_c_c (clog, minus_infty, plus_infty, plus_infty, pi_3_m_4_d),
+    TEST_c_c (clog, minus_infty, minus_infty, plus_infty, -pi_3_m_4_d),
 
     TEST_c_c (clog, plus_infty, plus_infty, plus_infty, M_PI_4l),
     TEST_c_c (clog, plus_infty, minus_infty, plus_infty, -M_PI_4l),
@@ -6284,30 +6293,30 @@ clog_test (void)
 
 static const struct test_c_c_data clog10_test_data[] =
   {
-    TEST_c_c (clog10, minus_zero, 0, minus_infty, M_PI_LOG10El, DIVIDE_BY_ZERO_EXCEPTION),
-    TEST_c_c (clog10, minus_zero, minus_zero, minus_infty, -M_PI_LOG10El, DIVIDE_BY_ZERO_EXCEPTION),
+    TEST_c_c (clog10, minus_zero, 0, minus_infty, pi_ln10_d, DIVIDE_BY_ZERO_EXCEPTION),
+    TEST_c_c (clog10, minus_zero, minus_zero, minus_infty, -pi_ln10_d, DIVIDE_BY_ZERO_EXCEPTION),
 
     TEST_c_c (clog10, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION),
     TEST_c_c (clog10, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION),
 
-    TEST_c_c (clog10, minus_infty, plus_infty, plus_infty, M_PI_34_LOG10El),
+    TEST_c_c (clog10, minus_infty, plus_infty, plus_infty, pi_3_m_ln10_m_4_d),
 
-    TEST_c_c (clog10, plus_infty, plus_infty, plus_infty, M_PI4_LOG10El),
-    TEST_c_c (clog10, plus_infty, minus_infty, plus_infty, -M_PI4_LOG10El),
+    TEST_c_c (clog10, plus_infty, plus_infty, plus_infty, pi_4_ln10_m_d),
+    TEST_c_c (clog10, plus_infty, minus_infty, plus_infty, -pi_4_ln10_m_d),
 
-    TEST_c_c (clog10, 0, plus_infty, plus_infty, M_PI2_LOG10El),
-    TEST_c_c (clog10, 3, plus_infty, plus_infty, M_PI2_LOG10El),
-    TEST_c_c (clog10, minus_zero, plus_infty, plus_infty, M_PI2_LOG10El),
-    TEST_c_c (clog10, -3, plus_infty, plus_infty, M_PI2_LOG10El),
-    TEST_c_c (clog10, 0, minus_infty, plus_infty, -M_PI2_LOG10El),
-    TEST_c_c (clog10, 3, minus_infty, plus_infty, -M_PI2_LOG10El),
-    TEST_c_c (clog10, minus_zero, minus_infty, plus_infty, -M_PI2_LOG10El),
-    TEST_c_c (clog10, -3, minus_infty, plus_infty, -M_PI2_LOG10El),
+    TEST_c_c (clog10, 0, plus_infty, plus_infty, pi_2_ln10_m_d),
+    TEST_c_c (clog10, 3, plus_infty, plus_infty, pi_2_ln10_m_d),
+    TEST_c_c (clog10, minus_zero, plus_infty, plus_infty, pi_2_ln10_m_d),
+    TEST_c_c (clog10, -3, plus_infty, plus_infty, pi_2_ln10_m_d),
+    TEST_c_c (clog10, 0, minus_infty, plus_infty, -pi_2_ln10_m_d),
+    TEST_c_c (clog10, 3, minus_infty, plus_infty, -pi_2_ln10_m_d),
+    TEST_c_c (clog10, minus_zero, minus_infty, plus_infty, -pi_2_ln10_m_d),
+    TEST_c_c (clog10, -3, minus_infty, plus_infty, -pi_2_ln10_m_d),
 
-    TEST_c_c (clog10, minus_infty, 0, plus_infty, M_PI_LOG10El),
-    TEST_c_c (clog10, minus_infty, 1, plus_infty, M_PI_LOG10El),
-    TEST_c_c (clog10, minus_infty, minus_zero, plus_infty, -M_PI_LOG10El),
-    TEST_c_c (clog10, minus_infty, -1, plus_infty, -M_PI_LOG10El),
+    TEST_c_c (clog10, minus_infty, 0, plus_infty, pi_ln10_d),
+    TEST_c_c (clog10, minus_infty, 1, plus_infty, pi_ln10_d),
+    TEST_c_c (clog10, minus_infty, minus_zero, plus_infty, -pi_ln10_d),
+    TEST_c_c (clog10, minus_infty, -1, plus_infty, -pi_ln10_d),
 
     TEST_c_c (clog10, plus_infty, 0, plus_infty, 0.0),
     TEST_c_c (clog10, plus_infty, 1, plus_infty, 0.0),
-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCHv2 01/14] Fixup usage of MANT_DIG in libm-test.inc
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
                     ` (8 preceding siblings ...)
  2016-05-18 21:44   ` [PATCH 0/8] Refactor libm-tests.c and friends Joseph Myers
@ 2016-05-20 21:37   ` Paul E. Murphy
  2016-05-23 15:41     ` Joseph Myers
  2016-05-20 21:37   ` [PATCHv2 05/14] Refactor M_ macros defined " Paul E. Murphy
                     ` (12 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-20 21:37 UTC (permalink / raw)
  To: libc-alpha

Make MANT_DIG shadow the types *_MANT_DIG macro. Replace
calls sites with (MANT_DIG - 1), and simplify.

	* math/libm-test.inc [MANT_DIG]: Directly define as
    	[DBL|LDBL|FLT]_MANT_DIG and fixup usage.
---
 math/libm-test.inc | 92 +++++++++++++++++++++++++++---------------------------
 1 file changed, 46 insertions(+), 46 deletions(-)

diff --git a/math/libm-test.inc b/math/libm-test.inc
index b0451bd..583ed26 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -328,8 +328,8 @@ static FLOAT prev_max_error, prev_real_max_error, prev_imag_max_error;
 
 static FLOAT max_valid_error;
 
-#define MANT_DIG CHOOSE ((LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1),  \
-			 (LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1))
+#define MANT_DIG CHOOSE (LDBL_MANT_DIG, DBL_MANT_DIG, FLT_MANT_DIG,  \
+			 LDBL_MANT_DIG, DBL_MANT_DIG, FLT_MANT_DIG)
 #define MIN_EXP CHOOSE ((LDBL_MIN_EXP-1), (DBL_MIN_EXP-1), (FLT_MIN_EXP-1),	\
 			(LDBL_MIN_EXP-1), (DBL_MIN_EXP-1), (FLT_MIN_EXP-1))
 #define MAX_EXP CHOOSE (LDBL_MAX_EXP, DBL_MAX_EXP, FLT_MAX_EXP, \
@@ -345,7 +345,7 @@ static FLOAT max_valid_error;
 				 LDBL_DECIMAL_DIG,	\
 				 DBL_DECIMAL_DIG,	\
 				 FLT_DECIMAL_DIG)
-#define TYPE_HEX_DIG ((MANT_DIG + 7) / 4)
+#define TYPE_HEX_DIG ((MANT_DIG + 6) / 4)
 
 /* Compare KEY (a string, with the name of a function) with ULP (a
    pointer to a struct ulp_data structure), returning a value less
@@ -745,7 +745,7 @@ ulp (FLOAT value)
       case FP_ZERO:
 	/* We compute the distance to the next FP which is the same as the
 	   value of the smallest subnormal number. Previously we used
-	   2^(-MANT_DIG) which is too large a value to be useful. Note that we
+	   2^-(MANT_DIG - 1) which is too large a value to be useful. Note that we
 	   can't use ilogb(0), since that isn't a valid thing to do. As a point
 	   of comparison Java's ulp returns the next normal value e.g.
 	   2^(1 - MAX_EXP) for ulp(0), but that is not what we want for
@@ -753,11 +753,11 @@ ulp (FLOAT value)
 	/* Fall through...  */
       case FP_SUBNORMAL:
         /* The next closest subnormal value is a constant distance away.  */
-	ulp = FUNC(ldexp) (1.0, MIN_EXP - MANT_DIG);
+	ulp = FUNC(ldexp) (1.0, MIN_EXP - MANT_DIG + 1);
 	break;
 
       case FP_NORMAL:
-	ulp = FUNC(ldexp) (1.0, FUNC(ilogb) (value) - MANT_DIG);
+	ulp = FUNC(ldexp) (1.0, FUNC(ilogb) (value) - MANT_DIG + 1);
 	break;
 
       default:
@@ -7892,8 +7892,8 @@ static const struct test_f_i_data ilogb_test_data[] =
     TEST_f_i (ilogb, -0x1.ffffffffffffffp1L, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
 #endif
 
-    TEST_f_i (ilogb, min_subnorm_value, MIN_EXP-MANT_DIG, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
-    TEST_f_i (ilogb, -min_subnorm_value, MIN_EXP-MANT_DIG, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
+    TEST_f_i (ilogb, min_subnorm_value, MIN_EXP-MANT_DIG+1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
+    TEST_f_i (ilogb, -min_subnorm_value, MIN_EXP-MANT_DIG+1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
     TEST_f_i (ilogb, min_value, MIN_EXP, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
     TEST_f_i (ilogb, -min_value, MIN_EXP, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
     TEST_f_i (ilogb, max_value, MAX_EXP-1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
@@ -9025,8 +9025,8 @@ static const struct test_f_f_data logb_test_data[] =
     TEST_f_f (logb, 1024, 10, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_f (logb, -2000, 10, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
 
-    TEST_f_f (logb, min_subnorm_value, MIN_EXP-MANT_DIG, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
-    TEST_f_f (logb, -min_subnorm_value, MIN_EXP-MANT_DIG, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
+    TEST_f_f (logb, min_subnorm_value, MIN_EXP-MANT_DIG+1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
+    TEST_f_f (logb, -min_subnorm_value, MIN_EXP-MANT_DIG+1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
     TEST_f_f (logb, min_value, MIN_EXP, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
     TEST_f_f (logb, -min_value, MIN_EXP, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
     TEST_f_f (logb, max_value, MAX_EXP-1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
@@ -11058,27 +11058,27 @@ static const struct test_fi_f_data scalbn_test_data[] =
     TEST_fi_f (scalbn, -min_value * 0x0.ffffp0, 0, -min_value * 0x0.ffffp0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_fi_f (scalbn, min_subnorm_value, 0, min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_fi_f (scalbn, -min_subnorm_value, 0, -min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_fi_f (scalbn, min_subnorm_value, MANT_DIG, min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_fi_f (scalbn, -min_subnorm_value, MANT_DIG, -min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_fi_f (scalbn, min_subnorm_value, MANT_DIG-1, min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_fi_f (scalbn, -min_subnorm_value, MANT_DIG-1, -min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
 
-    TEST_fi_f (scalbn, min_value, -MANT_DIG, min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_fi_f (scalbn, -min_value, -MANT_DIG, -min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_fi_f (scalbn, min_value, -MANT_DIG+1, min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_fi_f (scalbn, -min_value, -MANT_DIG+1, -min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_fi_f (scalbn, min_value, -MANT_DIG, plus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_PLUS_UFLOW),
+    TEST_fi_f (scalbn, -min_value, -MANT_DIG, minus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_MINUS_UFLOW),
     TEST_fi_f (scalbn, min_value, -MANT_DIG-1, plus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_PLUS_UFLOW),
     TEST_fi_f (scalbn, -min_value, -MANT_DIG-1, minus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_MINUS_UFLOW),
-    TEST_fi_f (scalbn, min_value, -MANT_DIG-2, plus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_PLUS_UFLOW),
-    TEST_fi_f (scalbn, -min_value, -MANT_DIG-2, minus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_MINUS_UFLOW),
-    TEST_fi_f (scalbn, min_value * 1.5, -MANT_DIG, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
-    TEST_fi_f (scalbn, -min_value * 1.5, -MANT_DIG, -min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
-    TEST_fi_f (scalbn, min_value * 1.5, -MANT_DIG-1, plus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, plus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
-    TEST_fi_f (scalbn, -min_value * 1.5, -MANT_DIG-1, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
-    TEST_fi_f (scalbn, min_value * 1.5, -MANT_DIG-2, plus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_PLUS_UFLOW),
-    TEST_fi_f (scalbn, -min_value * 1.5, -MANT_DIG-2, minus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_MINUS_UFLOW),
-    TEST_fi_f (scalbn, min_value * 1.25, -MANT_DIG, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
-    TEST_fi_f (scalbn, -min_value * 1.25, -MANT_DIG, -min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
-    TEST_fi_f (scalbn, min_value * 1.25, -MANT_DIG-1, plus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, plus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
-    TEST_fi_f (scalbn, -min_value * 1.25, -MANT_DIG-1, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
-    TEST_fi_f (scalbn, min_value * 1.25, -MANT_DIG-2, plus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_PLUS_UFLOW),
-    TEST_fi_f (scalbn, -min_value * 1.25, -MANT_DIG-2, minus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_MINUS_UFLOW),
+    TEST_fi_f (scalbn, min_value * 1.5, -MANT_DIG+1, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
+    TEST_fi_f (scalbn, -min_value * 1.5, -MANT_DIG+1, -min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
+    TEST_fi_f (scalbn, min_value * 1.5, -MANT_DIG, plus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, plus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
+    TEST_fi_f (scalbn, -min_value * 1.5, -MANT_DIG, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
+    TEST_fi_f (scalbn, min_value * 1.5, -MANT_DIG-1, plus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_PLUS_UFLOW),
+    TEST_fi_f (scalbn, -min_value * 1.5, -MANT_DIG-1, minus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_MINUS_UFLOW),
+    TEST_fi_f (scalbn, min_value * 1.25, -MANT_DIG+1, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
+    TEST_fi_f (scalbn, -min_value * 1.25, -MANT_DIG+1, -min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
+    TEST_fi_f (scalbn, min_value * 1.25, -MANT_DIG, plus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, plus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
+    TEST_fi_f (scalbn, -min_value * 1.25, -MANT_DIG, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
+    TEST_fi_f (scalbn, min_value * 1.25, -MANT_DIG-1, plus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_PLUS_UFLOW),
+    TEST_fi_f (scalbn, -min_value * 1.25, -MANT_DIG-1, minus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_MINUS_UFLOW),
 
     TEST_fi_f (scalbn, 1, INT_MAX, plus_oflow, INEXACT_EXCEPTION|OVERFLOW_EXCEPTION|ERRNO_PLUS_OFLOW),
     TEST_fi_f (scalbn, 1, INT_MIN, plus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_PLUS_UFLOW),
@@ -11140,27 +11140,27 @@ static const struct test_fl_f_data scalbln_test_data[] =
     TEST_fl_f (scalbln, -min_value * 0x0.ffffp0, 0, -min_value * 0x0.ffffp0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_fl_f (scalbln, min_subnorm_value, 0, min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_fl_f (scalbln, -min_subnorm_value, 0, -min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_fl_f (scalbln, min_subnorm_value, MANT_DIG, min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_fl_f (scalbln, -min_subnorm_value, MANT_DIG, -min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_fl_f (scalbln, min_subnorm_value, MANT_DIG-1, min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_fl_f (scalbln, -min_subnorm_value, MANT_DIG-1, -min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
 
-    TEST_fl_f (scalbln, min_value, -MANT_DIG, min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_fl_f (scalbln, -min_value, -MANT_DIG, -min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_fl_f (scalbln, min_value, -MANT_DIG+1, min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_fl_f (scalbln, -min_value, -MANT_DIG+1, -min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_fl_f (scalbln, min_value, -MANT_DIG, plus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_PLUS_UFLOW),
+    TEST_fl_f (scalbln, -min_value, -MANT_DIG, minus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_MINUS_UFLOW),
     TEST_fl_f (scalbln, min_value, -MANT_DIG-1, plus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_PLUS_UFLOW),
     TEST_fl_f (scalbln, -min_value, -MANT_DIG-1, minus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_MINUS_UFLOW),
-    TEST_fl_f (scalbln, min_value, -MANT_DIG-2, plus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_PLUS_UFLOW),
-    TEST_fl_f (scalbln, -min_value, -MANT_DIG-2, minus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_MINUS_UFLOW),
-    TEST_fl_f (scalbln, min_value * 1.5, -MANT_DIG, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
-    TEST_fl_f (scalbln, -min_value * 1.5, -MANT_DIG, -min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
-    TEST_fl_f (scalbln, min_value * 1.5, -MANT_DIG-1, plus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, plus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
-    TEST_fl_f (scalbln, -min_value * 1.5, -MANT_DIG-1, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
-    TEST_fl_f (scalbln, min_value * 1.5, -MANT_DIG-2, plus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_PLUS_UFLOW),
-    TEST_fl_f (scalbln, -min_value * 1.5, -MANT_DIG-2, minus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_MINUS_UFLOW),
-    TEST_fl_f (scalbln, min_value * 1.25, -MANT_DIG, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
-    TEST_fl_f (scalbln, -min_value * 1.25, -MANT_DIG, -min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
-    TEST_fl_f (scalbln, min_value * 1.25, -MANT_DIG-1, plus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, plus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
-    TEST_fl_f (scalbln, -min_value * 1.25, -MANT_DIG-1, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
-    TEST_fl_f (scalbln, min_value * 1.25, -MANT_DIG-2, plus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_PLUS_UFLOW),
-    TEST_fl_f (scalbln, -min_value * 1.25, -MANT_DIG-2, minus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_MINUS_UFLOW),
+    TEST_fl_f (scalbln, min_value * 1.5, -MANT_DIG+1, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
+    TEST_fl_f (scalbln, -min_value * 1.5, -MANT_DIG+1, -min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
+    TEST_fl_f (scalbln, min_value * 1.5, -MANT_DIG, plus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, plus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
+    TEST_fl_f (scalbln, -min_value * 1.5, -MANT_DIG, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
+    TEST_fl_f (scalbln, min_value * 1.5, -MANT_DIG-1, plus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_PLUS_UFLOW),
+    TEST_fl_f (scalbln, -min_value * 1.5, -MANT_DIG-1, minus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_MINUS_UFLOW),
+    TEST_fl_f (scalbln, min_value * 1.25, -MANT_DIG+1, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
+    TEST_fl_f (scalbln, -min_value * 1.25, -MANT_DIG+1, -min_subnorm_value * 2, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
+    TEST_fl_f (scalbln, min_value * 1.25, -MANT_DIG, plus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, plus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
+    TEST_fl_f (scalbln, -min_value * 1.25, -MANT_DIG, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION),
+    TEST_fl_f (scalbln, min_value * 1.25, -MANT_DIG-1, plus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_PLUS_UFLOW),
+    TEST_fl_f (scalbln, -min_value * 1.25, -MANT_DIG-1, minus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_MINUS_UFLOW),
 
     TEST_fl_f (scalbln, 1, INT_MAX, plus_oflow, INEXACT_EXCEPTION|OVERFLOW_EXCEPTION|ERRNO_PLUS_OFLOW),
     TEST_fl_f (scalbln, 1, INT_MIN, plus_uflow, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_PLUS_UFLOW),
-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCHv2 14/14] Generate new format names in auto-libm-test-out
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
                     ` (18 preceding siblings ...)
  2016-05-20 21:38   ` [PATCHv2 12/14] Remove CHOOSE() macro from libm-tests.inc Paul E. Murphy
@ 2016-05-20 21:38   ` Paul E. Murphy
  2016-05-20 21:38   ` [PATCHv2 06/14] Replace M_PI2l with pi_2_d in libm-test.inc Paul E. Murphy
                     ` (2 subsequent siblings)
  22 siblings, 0 replies; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-20 21:38 UTC (permalink / raw)
  To: libc-alpha

This converts the inclusion macro for each test to use
the format specific macro. In addition, the format
specifier is removed as it is applied via the LIT() macro
which is itself applied when converting the auto inputs and
libm-test.inc into libm-test.c.

	* math/gen-auto-libm-test.c (fp_format_desc): remove
	suffix member.
	(output_generic_value): Remove usage of suffix member,
	and the resulting unuse of the fp_format argument.
	(output_for_one_input_case): Remove unused fp_format
	parameter.
	* math/auto-libm-test-out: Regenerate.
	* math/libm-test.inc [TEST_COND_ldbl_128ibm]: replace
	usage with TEST_COND_ibm128.
	[TEST_COND_flt_32]: Remove.
	[TEST_COND_dbl_64]: Remove.
	[TEST_COND_ldbl_96_intel]: Remove.
	[TEST_COND_ldbl_96_m68k]: Remove.
	[TEST_COND_ldbl_128]: Remove.
---
 math/gen-auto-libm-tests.c | 24 ++++++++++--------------
 math/libm-test.inc         | 14 +++-----------
 2 files changed, 13 insertions(+), 25 deletions(-)

diff --git a/math/gen-auto-libm-tests.c b/math/gen-auto-libm-tests.c
index 0a57382..0d10197 100644
--- a/math/gen-auto-libm-tests.c
+++ b/math/gen-auto-libm-tests.c
@@ -158,9 +158,6 @@ typedef struct
 {
   /* The name of the format.  */
   const char *name;
-  /* The suffix to use on floating-point constants with this
-     format.  */
-  const char *suffix;
   /* A string for the largest normal value, or NULL for IEEE formats
      where this can be determined automatically.  */
   const char *max_string;
@@ -186,12 +183,12 @@ typedef struct
    enumeration.  */
 static fp_format_desc fp_formats[fp_num_formats] =
   {
-    { "flt-32", "f", NULL, 24, 128, -125, {}, {}, {}, {}, {} },
-    { "dbl-64", "", NULL, 53, 1024, -1021, {}, {}, {}, {}, {} },
-    { "ldbl-96-intel", "L", NULL, 64, 16384, -16381, {}, {}, {}, {}, {} },
-    { "ldbl-96-m68k", "L", NULL, 64, 16384, -16382, {}, {}, {}, {}, {} },
-    { "ldbl-128", "L", NULL, 113, 16384, -16381, {}, {}, {}, {}, {} },
-    { "ldbl-128ibm", "L", "0x1.fffffffffffff7ffffffffffff8p+1023",
+    { "binary32", NULL, 24, 128, -125, {}, {}, {}, {}, {} },
+    { "binary64", NULL, 53, 1024, -1021, {}, {}, {}, {}, {} },
+    { "intel96", NULL, 64, 16384, -16381, {}, {}, {}, {}, {} },
+    { "m68k96", NULL, 64, 16384, -16382, {}, {}, {}, {}, {} },
+    { "binary128", NULL, 113, 16384, -16381, {}, {}, {}, {}, {} },
+    { "ibm128", "0x1.fffffffffffff7ffffffffffff8p+1023",
       106, 1024, -968, {}, {}, {}, {}, {} },
   };
 
@@ -1648,8 +1645,7 @@ int_fits_type (mpz_t z, arg_ret_type type, int long_bits)
 
 static void
 output_generic_value (FILE *fp, const char *filename, const generic_value *v,
-		      bool ignore, arg_ret_type type, fp_format format,
-		      int long_bits)
+		      bool ignore, arg_ret_type type, int long_bits)
 {
   if (ignore)
     {
@@ -1662,7 +1658,7 @@ output_generic_value (FILE *fp, const char *filename, const generic_value *v,
   switch (type)
     {
     case type_fp:
-      suffix = fp_formats[format].suffix;
+      suffix = "";
       break;
 
     case type_int:
@@ -1906,7 +1902,7 @@ output_for_one_input_case (FILE *fp, const char *filename, test_function *tf,
 	      /* Print inputs.  */
 	      for (size_t i = 0; i < tf->num_args; i++)
 		output_generic_value (fp, filename, &inputs[i], false,
-				      tf->arg_types[i], f, long_bits);
+				      tf->arg_types[i], long_bits);
 	      if (fputs (" :", fp) < 0)
 		error (EXIT_FAILURE, errno, "write to '%s'", filename);
 	      /* Print outputs.  */
@@ -1942,7 +1938,7 @@ output_for_one_input_case (FILE *fp, const char *filename, test_function *tf,
 		      abort ();
 		    }
 		  output_generic_value (fp, filename, &g, ignore_output[i],
-					tf->ret_types[i], f, long_bits);
+					tf->ret_types[i], long_bits);
 		  generic_value_free (&g);
 		}
 	      if (fputs (" :", fp) < 0)
diff --git a/math/libm-test.inc b/math/libm-test.inc
index adc1d69..442666c 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -271,14 +271,6 @@
 # define NO_TEST_INLINE_DOUBLE	0
 #endif
 
-/* Conditions used by tests generated by gen-auto-libm-tests.c.  */
-#define TEST_COND_flt_32 TEST_COND_binary32
-#define TEST_COND_dbl_64 TEST_COND_binary64
-#define TEST_COND_ldbl_96_intel TEST_COND_intel96
-#define TEST_COND_ldbl_96_m68k  TEST_COND_m68k96
-#define TEST_COND_ldbl_128 TEST_COND_binary128
-#define TEST_COND_ldbl_128ibm TEST_COND_ibm128
-
 #if LONG_MAX == 0x7fffffff
 # define TEST_COND_long32	1
 # define TEST_COND_long64	0
@@ -406,7 +398,7 @@ init_max_error (const char *name, int exact)
   prev_imag_max_error = find_ulps (name, func_imag_ulps,
 				   (sizeof (func_imag_ulps)
 				    / sizeof (func_imag_ulps[0])));
-#if TEST_COND_ldbl_128ibm
+#if TEST_COND_ibm128
   /* The documented accuracy of IBM long double division is 3ulp (see
      libgcc/config/rs6000/ibm-ldouble-format), so do not require
      better accuracy for libm functions that are exactly defined for
@@ -705,14 +697,14 @@ test_exceptions (const char *test_name, int exception)
 	 arithmetic.  */
 #ifdef FE_UNDERFLOW
       if ((exception & UNDERFLOW_EXCEPTION_OK) == 0
-	  && !(TEST_COND_ldbl_128ibm
+	  && !(TEST_COND_ibm128
 	       && (exception & UNDERFLOW_EXCEPTION) == 0))
 	test_single_exception (test_name, exception, UNDERFLOW_EXCEPTION,
 			       FE_UNDERFLOW, "Underflow");
 #endif
 #ifdef FE_INEXACT
       if ((exception & (INEXACT_EXCEPTION | NO_INEXACT_EXCEPTION)) != 0
-	  && !(TEST_COND_ldbl_128ibm
+	  && !(TEST_COND_ibm128
 	       && (exception & NO_INEXACT_EXCEPTION) != 0))
 	test_single_exception (test_name, exception, INEXACT_EXCEPTION,
 			       FE_INEXACT, "Inexact");
-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCHv2 00/14] Refactor libm-test.inc and friends
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
@ 2016-05-20 21:38 Paul E. Murphy
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
  22 siblings, 1 reply; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-20 21:38 UTC (permalink / raw)
  To: libc-alpha

On this second spin, I now fixup the awkward MIN_EXP and MANT_DIG macros
to be more sensible.

Patch 3 starts the true refactoring by defining a set of format specific
macros and updates some of the logic controlling the macros to use them.

Patch 4 replaces the bulk of the TEST_<TYPE> macros with the new format
specific macros via a series of sed commands.

Patch 5 through 10 update various glibc specific constants to be more
readable, less type specific, and more consistent with the other macros
used throughout libm-test.inc test cases.

Patch 11 modifies the gen-libm-test.pl to strip suffixes for FP values
and wrap them with LIT()

Patch 12 removes the CHOOSE macro and remaining usage of TEST_<TYPE>
macros in favor of a fully generated file.

Patch 13 and 14 refactor the auto generated test inputs to replace type
specific conditions with format specific ones.


NOTE: patches 4, 13, and 14 require some extra steps after applying.
This keeps the patch size down.  After building the sources, I ran
the following for PPC64le and x86_64:

'BUILD_DIR=/path/to/build git rebase -i --exec ./path/to/test.sh HEAD~15'

then from BUILD_DIR:

for j in "" "ulps."; do echo "checking test.${j}\$i.txt"; \
  for i in `seq 2 14`; do \
    diff -u test.${j}$((i-1)).txt test.${j}${i}.txt; done; done;

To verify nothing changed during or after these commits.

Contents of test.sh:
#!/bin/bash
cd $BUILD_DIR

i=1
while [ -e test.$i.txt ]; do let i+=1; done;

tests="math/test-float.out
       math/test-double.out
       math/test-ldouble.out
       math/test-float-finite.out
       math/test-double-finite.out
       math/test-ldouble-finite.out
       math/test-ifloat.out
       math/test-idouble.out
       math/test-ildoubl.out"

echo "Removing stale test output."
rm -f $tests

echo "Testing commit $i"

make subdirs=math -j8 check &> /dev/null

echo "Collating results of commit $i"
# Use this as heuristic to verify check
# didn't crash and burn.
for test in ${tests}; do
  if [ ! -f $test ]; then
    echo "ERROR: $test missing";
    exit 1;
  fi
done

for test in ${tests}; do cat $test; done > test.$i.txt

echo "Regenerating ULPS for commit $i"
make regen-ulps > test.ulps.$i.txt
# end of test.sh

Paul E. Murphy (14):
  Fixup usage of MANT_DIG in libm-test.inc
  Fixup usage of MIN_EXP in libm-test.inc
  Begin refactor of libm-test.inc
  Refactor type specific macros using regexes
  Refactor M_ macros defined in libm-test.inc
  Replace M_PI2l with pi_2_d in libm-test.inc
  Replace M_PIl with pi in libm-test.inc
  Replace M_PI_4l with pi_4_d in libm-test.inc
  Replace M_El with exp1 in libm-test.inc
  Add note about nexttoward test cases in libm-test.inc
  Apply LIT(x) to floating point literals in libm-test.c
  Remove CHOOSE() macro from libm-tests.inc
  Remove type specific information from auto-libm-test-in
  Generate new format names in auto-libm-test-out

 math/auto-libm-test-in     |  115 ++--
 math/gen-auto-libm-tests.c |   24 +-
 math/gen-libm-test.pl      |   90 ++-
 math/libm-test.inc         | 1536 ++++++++++++++++++++++----------------------
 math/test-double-finite.c  |    1 -
 math/test-double-vlen2.h   |    1 -
 math/test-double-vlen4.h   |    1 -
 math/test-double-vlen8.h   |    1 -
 math/test-double.c         |    1 -
 math/test-double.h         |    6 +-
 math/test-float-finite.c   |    1 -
 math/test-float-vlen16.h   |    1 -
 math/test-float-vlen4.h    |    1 -
 math/test-float-vlen8.h    |    1 -
 math/test-float.c          |    1 -
 math/test-float.h          |    6 +-
 math/test-idouble.c        |    1 -
 math/test-ifloat.c         |    1 -
 math/test-ildoubl.c        |    1 -
 math/test-ldouble-finite.c |    1 -
 math/test-ldouble.c        |    1 -
 math/test-ldouble.h        |    6 +-
 22 files changed, 943 insertions(+), 855 deletions(-)

-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCHv2 11/14] Apply LIT(x) to floating point literals in libm-test.c
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
                     ` (14 preceding siblings ...)
  2016-05-20 21:38   ` [PATCHv2 08/14] Replace M_PI_4l with pi_4_d " Paul E. Murphy
@ 2016-05-20 21:38   ` Paul E. Murphy
  2016-05-24 16:26     ` Joseph Myers
  2016-05-20 21:38   ` [PATCHv2 04/14] Refactor type specific macros using regexes Paul E. Murphy
                     ` (6 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-20 21:38 UTC (permalink / raw)
  To: libc-alpha

With the exception of the second argument of nexttoward,
any suffixes should be stripped from the test input, and
the macro LIT(x) should be applied to use the correct
suffix for the type being tested.

This applies post-processing to all of the test inputs
through gen-libm-test.pl to strip literal suffixes and
apply the LIT(x) macro, with one exception stated above.
This seems a bit cleaner than tossing the macro onto
everything albeit slightly more obfuscated.

	* math/gen-libm-test.pl: (apply_lit): New subroutine.
	(parse_args): Strip C suffix from floating point literals
	and wrap them with LIT().
---
 math/gen-libm-test.pl | 40 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 38 insertions(+), 2 deletions(-)

diff --git a/math/gen-libm-test.pl b/math/gen-libm-test.pl
index c8790e1..40839e0 100755
--- a/math/gen-libm-test.pl
+++ b/math/gen-libm-test.pl
@@ -152,6 +152,30 @@ sub show_exceptions {
   }
 }
 
+# Apply the LIT(x) macro to any floating point constants.
+sub apply_lit {
+  my ($lit) = @_;
+  my $lletter = substr $lit, -1;
+  my $exp_re = "([+-])?[[:digit:]]+";
+
+  # Don't wrap something that does not look like a:
+  # hexadecimal FP value,
+  # base 10 integer raised to a power,
+  # something with a decimal point.
+  if ($lit !~ /([+-])?0x[[:xdigit:]\.]+[pP]$exp_re/
+      and $lit !~ /[[:digit:]]+[eE]$exp_re/
+      and $lit !~ /[[:digit:]]*\.[[:digit:]]*([eE]$exp_re)?/
+     ){
+    return $lit;
+  }
+
+  # Strip any suffixes from the constant
+  if ($lletter =~ /L|l|f|F/) {
+    chop $lit;
+  }
+  return "LIT ($lit)";
+}
+
 # Parse the arguments to TEST_x_y
 sub parse_args {
   my ($file, $descr, $args) = @_;
@@ -242,7 +266,11 @@ sub parse_args {
   for ($i=0; $i <= $#descr; $i++) {
     # FLOAT, int, long int, long long int
     if ($descr[$i] =~ /f|i|l|L/) {
-      $cline .= ", $args[$current_arg]";
+      if ($descr[$i] eq "f" and not ($args[0] eq "nexttoward" and $current_arg == 2)) {
+        $cline .= ", " . &apply_lit ($args[$current_arg]);
+      } else {
+        $cline .= ", $args[$current_arg]";
+      }
       $current_arg++;
       next;
     }
@@ -252,7 +280,8 @@ sub parse_args {
     }
     # complex
     if ($descr[$i] eq 'c') {
-      $cline .= ", $args[$current_arg], $args[$current_arg+1]";
+      $cline .= ", " . &apply_lit ($args[$current_arg]);
+      $cline .= ", " . &apply_lit ($args[$current_arg+1]);
       $current_arg += 2;
       next;
     }
@@ -282,6 +311,9 @@ sub parse_args {
 	} else {
 	  $ignore_result_all = 0;
 	}
+	if ($_ eq "f") {
+	  $result = apply_lit ($result)
+	}
 	$cline_res .= ", $result";
 	$current_arg++;
       } elsif ($_ eq 'c') {
@@ -299,6 +331,8 @@ sub parse_args {
 	} else {
 	  $ignore_result_all = 0;
 	}
+	$result1 = apply_lit ($result1);
+	$result2 = apply_lit ($result2);
 	$cline_res .= ", $result1, $result2";
 	$current_arg += 2;
       } elsif ($_ eq '1') {
@@ -327,6 +361,8 @@ sub parse_args {
       my ($run_extra) = ($extra_expected ne "IGNORE" ? 1 : 0);
       if (!$run_extra) {
 	$extra_expected = "0";
+      } else {
+	$extra_expected = apply_lit ($extra_expected);
       }
       $cline_res .= ", $run_extra, $extra_expected";
     }
-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCHv2 06/14] Replace M_PI2l with pi_2_d in libm-test.inc
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
                     ` (19 preceding siblings ...)
  2016-05-20 21:38   ` [PATCHv2 14/14] Generate new format names in auto-libm-test-out Paul E. Murphy
@ 2016-05-20 21:38   ` Paul E. Murphy
  2016-05-23 16:59     ` Joseph Myers
  2016-05-20 21:45   ` [PATCHv2 07/14] Replace M_PIl with pi " Paul E. Murphy
  2016-05-20 21:52   ` [PATCHv2 09/14] Replace M_El with exp1 " Paul E. Murphy
  22 siblings, 1 reply; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-20 21:38 UTC (permalink / raw)
  To: libc-alpha

This is useful in situations where the long double type is
less precise than the type under test.

	* libm-test.inc: Replace usage of M_PI2l with
	[pi_2_d]: New macro.
---
 math/libm-test.inc | 316 +++++++++++++++++++++++++++--------------------------
 1 file changed, 159 insertions(+), 157 deletions(-)

diff --git a/math/libm-test.inc b/math/libm-test.inc
index e41a2d4..8f0a2af 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -324,6 +324,8 @@ struct ulp_data
 #define pi_4_ln10_m_d		LIT (0.341094088460460336871445906357838943)
 /* pi / ln(10) */
 #define pi_ln10_d		LIT (1.364376353841841347485783625431355770)
+/* pi / 2 */
+#define pi_2_d			LIT (1.570796326794896619231321691639751442)
 
 #define ulps_file_name "ULPs"	/* Name of the ULPs file.  */
 static FILE *ulps_file;		/* File to document difference.  */
@@ -1897,8 +1899,8 @@ asinh_test (void)
 
 static const struct test_f_f_data atan_test_data[] =
   {
-    TEST_f_f (atan, plus_infty, M_PI_2l, ERRNO_UNCHANGED),
-    TEST_f_f (atan, minus_infty, -M_PI_2l, ERRNO_UNCHANGED),
+    TEST_f_f (atan, plus_infty, pi_2_d, ERRNO_UNCHANGED),
+    TEST_f_f (atan, minus_infty, -pi_2_d, ERRNO_UNCHANGED),
     TEST_f_f (atan, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_f (atan, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
 
@@ -1954,28 +1956,28 @@ static const struct test_ff_f_data atan2_test_data[] =
     TEST_ff_f (atan2, -max_value, plus_infty, minus_zero, ERRNO_UNCHANGED),
 
     /* atan2(+inf, x) == pi/2 for finite x.  */
-    TEST_ff_f (atan2, plus_infty, 1, M_PI_2l, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, plus_infty, plus_zero, M_PI_2l, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, plus_infty, min_value, M_PI_2l, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, plus_infty, min_subnorm_value, M_PI_2l, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, plus_infty, max_value, M_PI_2l, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, plus_infty, -1, M_PI_2l, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, plus_infty, minus_zero, M_PI_2l, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, plus_infty, -min_value, M_PI_2l, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, plus_infty, -min_subnorm_value, M_PI_2l, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, plus_infty, -max_value, M_PI_2l, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, plus_infty, 1, pi_2_d, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, plus_infty, plus_zero, pi_2_d, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, plus_infty, min_value, pi_2_d, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, plus_infty, min_subnorm_value, pi_2_d, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, plus_infty, max_value, pi_2_d, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, plus_infty, -1, pi_2_d, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, plus_infty, minus_zero, pi_2_d, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, plus_infty, -min_value, pi_2_d, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, plus_infty, -min_subnorm_value, pi_2_d, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, plus_infty, -max_value, pi_2_d, ERRNO_UNCHANGED),
 
     /* atan2(-inf, x) == -pi/2 for finite x.  */
-    TEST_ff_f (atan2, minus_infty, 1, -M_PI_2l, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, minus_infty, plus_zero, -M_PI_2l, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, minus_infty, min_value, -M_PI_2l, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, minus_infty, min_subnorm_value, -M_PI_2l, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, minus_infty, max_value, -M_PI_2l, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, minus_infty, -1, -M_PI_2l, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, minus_infty, minus_zero, -M_PI_2l, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, minus_infty, -min_value, -M_PI_2l, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, minus_infty, -min_subnorm_value, -M_PI_2l, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, minus_infty, -max_value, -M_PI_2l, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, minus_infty, 1, -pi_2_d, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, minus_infty, plus_zero, -pi_2_d, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, minus_infty, min_value, -pi_2_d, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, minus_infty, min_subnorm_value, -pi_2_d, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, minus_infty, max_value, -pi_2_d, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, minus_infty, -1, -pi_2_d, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, minus_infty, minus_zero, -pi_2_d, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, minus_infty, -min_value, -pi_2_d, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, minus_infty, -min_subnorm_value, -pi_2_d, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, minus_infty, -max_value, -pi_2_d, ERRNO_UNCHANGED),
 
     /* atan2 (y,-inf) == +pi for finite y > 0 or +0.  */
     TEST_ff_f (atan2, 1, minus_infty, M_PIl, ERRNO_UNCHANGED),
@@ -2081,10 +2083,10 @@ cabs_test (void)
 
 static const struct test_c_c_data cacos_test_data[] =
   {
-    TEST_c_c (cacos, 0, 0, M_PI_2l, minus_zero),
-    TEST_c_c (cacos, minus_zero, 0, M_PI_2l, minus_zero),
-    TEST_c_c (cacos, minus_zero, minus_zero, M_PI_2l, 0.0),
-    TEST_c_c (cacos, 0, minus_zero, M_PI_2l, 0.0),
+    TEST_c_c (cacos, 0, 0, pi_2_d, minus_zero),
+    TEST_c_c (cacos, minus_zero, 0, pi_2_d, minus_zero),
+    TEST_c_c (cacos, minus_zero, minus_zero, pi_2_d, 0.0),
+    TEST_c_c (cacos, 0, minus_zero, pi_2_d, 0.0),
 
     TEST_c_c (cacos, minus_infty, plus_infty, pi_3_m_4_d, minus_infty),
     TEST_c_c (cacos, minus_infty, minus_infty, pi_3_m_4_d, plus_infty),
@@ -2092,12 +2094,12 @@ static const struct test_c_c_data cacos_test_data[] =
     TEST_c_c (cacos, plus_infty, plus_infty, M_PI_4l, minus_infty),
     TEST_c_c (cacos, plus_infty, minus_infty, M_PI_4l, plus_infty),
 
-    TEST_c_c (cacos, -10.0, plus_infty, M_PI_2l, minus_infty),
-    TEST_c_c (cacos, -10.0, minus_infty, M_PI_2l, plus_infty),
-    TEST_c_c (cacos, 0, plus_infty, M_PI_2l, minus_infty),
-    TEST_c_c (cacos, 0, minus_infty, M_PI_2l, plus_infty),
-    TEST_c_c (cacos, 0.1L, plus_infty, M_PI_2l, minus_infty),
-    TEST_c_c (cacos, 0.1L, minus_infty, M_PI_2l, plus_infty),
+    TEST_c_c (cacos, -10.0, plus_infty, pi_2_d, minus_infty),
+    TEST_c_c (cacos, -10.0, minus_infty, pi_2_d, plus_infty),
+    TEST_c_c (cacos, 0, plus_infty, pi_2_d, minus_infty),
+    TEST_c_c (cacos, 0, minus_infty, pi_2_d, plus_infty),
+    TEST_c_c (cacos, 0.1L, plus_infty, pi_2_d, minus_infty),
+    TEST_c_c (cacos, 0.1L, minus_infty, pi_2_d, plus_infty),
 
     TEST_c_c (cacos, minus_infty, 0, M_PIl, minus_infty),
     TEST_c_c (cacos, minus_infty, minus_zero, M_PIl, plus_infty),
@@ -2112,8 +2114,8 @@ static const struct test_c_c_data cacos_test_data[] =
     TEST_c_c (cacos, plus_infty, qnan_value, qnan_value, plus_infty, IGNORE_ZERO_INF_SIGN),
     TEST_c_c (cacos, minus_infty, qnan_value, qnan_value, plus_infty, IGNORE_ZERO_INF_SIGN),
 
-    TEST_c_c (cacos, 0, qnan_value, M_PI_2l, qnan_value),
-    TEST_c_c (cacos, minus_zero, qnan_value, M_PI_2l, qnan_value),
+    TEST_c_c (cacos, 0, qnan_value, pi_2_d, qnan_value),
+    TEST_c_c (cacos, minus_zero, qnan_value, pi_2_d, qnan_value),
 
     TEST_c_c (cacos, qnan_value, plus_infty, qnan_value, minus_infty),
     TEST_c_c (cacos, qnan_value, minus_infty, qnan_value, plus_infty),
@@ -2126,18 +2128,18 @@ static const struct test_c_c_data cacos_test_data[] =
 
     TEST_c_c (cacos, qnan_value, qnan_value, qnan_value, qnan_value),
 
-    TEST_c_c (cacos, plus_zero, -1.5L, M_PI_2l, 1.194763217287109304111930828519090523536L),
-    TEST_c_c (cacos, minus_zero, -1.5L, M_PI_2l, 1.194763217287109304111930828519090523536L),
-    TEST_c_c (cacos, plus_zero, -1.0L, M_PI_2l, 0.8813735870195430252326093249797923090282L),
-    TEST_c_c (cacos, minus_zero, -1.0L, M_PI_2l, 0.8813735870195430252326093249797923090282L),
-    TEST_c_c (cacos, plus_zero, -0.5L, M_PI_2l, 0.4812118250596034474977589134243684231352L),
-    TEST_c_c (cacos, minus_zero, -0.5L, M_PI_2l, 0.4812118250596034474977589134243684231352L),
-    TEST_c_c (cacos, plus_zero, 0.5L, M_PI_2l, -0.4812118250596034474977589134243684231352L),
-    TEST_c_c (cacos, minus_zero, 0.5L, M_PI_2l, -0.4812118250596034474977589134243684231352L),
-    TEST_c_c (cacos, plus_zero, 1.0L, M_PI_2l, -0.8813735870195430252326093249797923090282L),
-    TEST_c_c (cacos, minus_zero, 1.0L, M_PI_2l, -0.8813735870195430252326093249797923090282L),
-    TEST_c_c (cacos, plus_zero, 1.5L, M_PI_2l, -1.194763217287109304111930828519090523536L),
-    TEST_c_c (cacos, minus_zero, 1.5L, M_PI_2l, -1.194763217287109304111930828519090523536L),
+    TEST_c_c (cacos, plus_zero, -1.5L, pi_2_d, 1.194763217287109304111930828519090523536L),
+    TEST_c_c (cacos, minus_zero, -1.5L, pi_2_d, 1.194763217287109304111930828519090523536L),
+    TEST_c_c (cacos, plus_zero, -1.0L, pi_2_d, 0.8813735870195430252326093249797923090282L),
+    TEST_c_c (cacos, minus_zero, -1.0L, pi_2_d, 0.8813735870195430252326093249797923090282L),
+    TEST_c_c (cacos, plus_zero, -0.5L, pi_2_d, 0.4812118250596034474977589134243684231352L),
+    TEST_c_c (cacos, minus_zero, -0.5L, pi_2_d, 0.4812118250596034474977589134243684231352L),
+    TEST_c_c (cacos, plus_zero, 0.5L, pi_2_d, -0.4812118250596034474977589134243684231352L),
+    TEST_c_c (cacos, minus_zero, 0.5L, pi_2_d, -0.4812118250596034474977589134243684231352L),
+    TEST_c_c (cacos, plus_zero, 1.0L, pi_2_d, -0.8813735870195430252326093249797923090282L),
+    TEST_c_c (cacos, minus_zero, 1.0L, pi_2_d, -0.8813735870195430252326093249797923090282L),
+    TEST_c_c (cacos, plus_zero, 1.5L, pi_2_d, -1.194763217287109304111930828519090523536L),
+    TEST_c_c (cacos, minus_zero, 1.5L, pi_2_d, -1.194763217287109304111930828519090523536L),
 
     TEST_c_c (cacos, -1.5L, plus_zero, M_PIl, -0.9624236501192068949955178268487368462704L),
     TEST_c_c (cacos, -1.5L, minus_zero, M_PIl, 0.9624236501192068949955178268487368462704L),
@@ -2769,22 +2771,22 @@ cacos_test (void)
 
 static const struct test_c_c_data cacosh_test_data[] =
   {
-    TEST_c_c (cacosh, 0, 0, 0.0, M_PI_2l),
-    TEST_c_c (cacosh, minus_zero, 0, 0.0, M_PI_2l),
-    TEST_c_c (cacosh, 0, minus_zero, 0.0, -M_PI_2l),
-    TEST_c_c (cacosh, minus_zero, minus_zero, 0.0, -M_PI_2l),
+    TEST_c_c (cacosh, 0, 0, 0.0, pi_2_d),
+    TEST_c_c (cacosh, minus_zero, 0, 0.0, pi_2_d),
+    TEST_c_c (cacosh, 0, minus_zero, 0.0, -pi_2_d),
+    TEST_c_c (cacosh, minus_zero, minus_zero, 0.0, -pi_2_d),
     TEST_c_c (cacosh, minus_infty, plus_infty, plus_infty, pi_3_m_4_d),
     TEST_c_c (cacosh, minus_infty, minus_infty, plus_infty, -pi_3_m_4_d),
 
     TEST_c_c (cacosh, plus_infty, plus_infty, plus_infty, M_PI_4l),
     TEST_c_c (cacosh, plus_infty, minus_infty, plus_infty, -M_PI_4l),
 
-    TEST_c_c (cacosh, -10.0, plus_infty, plus_infty, M_PI_2l),
-    TEST_c_c (cacosh, -10.0, minus_infty, plus_infty, -M_PI_2l),
-    TEST_c_c (cacosh, 0, plus_infty, plus_infty, M_PI_2l),
-    TEST_c_c (cacosh, 0, minus_infty, plus_infty, -M_PI_2l),
-    TEST_c_c (cacosh, 0.1L, plus_infty, plus_infty, M_PI_2l),
-    TEST_c_c (cacosh, 0.1L, minus_infty, plus_infty, -M_PI_2l),
+    TEST_c_c (cacosh, -10.0, plus_infty, plus_infty, pi_2_d),
+    TEST_c_c (cacosh, -10.0, minus_infty, plus_infty, -pi_2_d),
+    TEST_c_c (cacosh, 0, plus_infty, plus_infty, pi_2_d),
+    TEST_c_c (cacosh, 0, minus_infty, plus_infty, -pi_2_d),
+    TEST_c_c (cacosh, 0.1L, plus_infty, plus_infty, pi_2_d),
+    TEST_c_c (cacosh, 0.1L, minus_infty, plus_infty, -pi_2_d),
 
     TEST_c_c (cacosh, minus_infty, 0, plus_infty, M_PIl),
     TEST_c_c (cacosh, minus_infty, minus_zero, plus_infty, -M_PIl),
@@ -2813,18 +2815,18 @@ static const struct test_c_c_data cacosh_test_data[] =
 
     TEST_c_c (cacosh, qnan_value, qnan_value, qnan_value, qnan_value),
 
-    TEST_c_c (cacosh, plus_zero, -1.5L, 1.194763217287109304111930828519090523536L, -M_PI_2l),
-    TEST_c_c (cacosh, minus_zero, -1.5L, 1.194763217287109304111930828519090523536L, -M_PI_2l),
-    TEST_c_c (cacosh, plus_zero, -1.0L, 0.8813735870195430252326093249797923090282L, -M_PI_2l),
-    TEST_c_c (cacosh, minus_zero, -1.0L, 0.8813735870195430252326093249797923090282L, -M_PI_2l),
-    TEST_c_c (cacosh, plus_zero, -0.5L, 0.4812118250596034474977589134243684231352L, -M_PI_2l),
-    TEST_c_c (cacosh, minus_zero, -0.5L, 0.4812118250596034474977589134243684231352L, -M_PI_2l),
-    TEST_c_c (cacosh, plus_zero, 0.5L, 0.4812118250596034474977589134243684231352L, M_PI_2l),
-    TEST_c_c (cacosh, minus_zero, 0.5L, 0.4812118250596034474977589134243684231352L, M_PI_2l),
-    TEST_c_c (cacosh, plus_zero, 1.0L, 0.8813735870195430252326093249797923090282L, M_PI_2l),
-    TEST_c_c (cacosh, minus_zero, 1.0L, 0.8813735870195430252326093249797923090282L, M_PI_2l),
-    TEST_c_c (cacosh, plus_zero, 1.5L, 1.194763217287109304111930828519090523536L, M_PI_2l),
-    TEST_c_c (cacosh, minus_zero, 1.5L, 1.194763217287109304111930828519090523536L, M_PI_2l),
+    TEST_c_c (cacosh, plus_zero, -1.5L, 1.194763217287109304111930828519090523536L, -pi_2_d),
+    TEST_c_c (cacosh, minus_zero, -1.5L, 1.194763217287109304111930828519090523536L, -pi_2_d),
+    TEST_c_c (cacosh, plus_zero, -1.0L, 0.8813735870195430252326093249797923090282L, -pi_2_d),
+    TEST_c_c (cacosh, minus_zero, -1.0L, 0.8813735870195430252326093249797923090282L, -pi_2_d),
+    TEST_c_c (cacosh, plus_zero, -0.5L, 0.4812118250596034474977589134243684231352L, -pi_2_d),
+    TEST_c_c (cacosh, minus_zero, -0.5L, 0.4812118250596034474977589134243684231352L, -pi_2_d),
+    TEST_c_c (cacosh, plus_zero, 0.5L, 0.4812118250596034474977589134243684231352L, pi_2_d),
+    TEST_c_c (cacosh, minus_zero, 0.5L, 0.4812118250596034474977589134243684231352L, pi_2_d),
+    TEST_c_c (cacosh, plus_zero, 1.0L, 0.8813735870195430252326093249797923090282L, pi_2_d),
+    TEST_c_c (cacosh, minus_zero, 1.0L, 0.8813735870195430252326093249797923090282L, pi_2_d),
+    TEST_c_c (cacosh, plus_zero, 1.5L, 1.194763217287109304111930828519090523536L, pi_2_d),
+    TEST_c_c (cacosh, minus_zero, 1.5L, 1.194763217287109304111930828519090523536L, pi_2_d),
 
     TEST_c_c (cacosh, -1.5L, plus_zero, 0.9624236501192068949955178268487368462704L, M_PIl),
     TEST_c_c (cacosh, -1.5L, minus_zero, 0.9624236501192068949955178268487368462704L, -M_PIl),
@@ -3461,10 +3463,10 @@ static const struct test_c_f_data carg_test_data[] =
     TEST_c_f (carg, plus_infty, -2.0, minus_zero),
 
     /* carg(x + i inf) == pi/2 for finite x.  */
-    TEST_c_f (carg, 10.0, plus_infty, M_PI_2l),
+    TEST_c_f (carg, 10.0, plus_infty, pi_2_d),
 
     /* carg(x - i inf) == -pi/2 for finite x.  */
-    TEST_c_f (carg, 10.0, minus_infty, -M_PI_2l),
+    TEST_c_f (carg, 10.0, minus_infty, -pi_2_d),
 
     /* carg (-inf + i y) == +pi for finite y > 0.  */
     TEST_c_f (carg, minus_infty, 10.0, M_PIl),
@@ -3512,15 +3514,15 @@ static const struct test_c_c_data casin_test_data[] =
     TEST_c_c (casin, 0.1L, plus_infty, 0.0, plus_infty),
     TEST_c_c (casin, 0.1L, minus_infty, 0.0, minus_infty),
 
-    TEST_c_c (casin, minus_infty, 0, -M_PI_2l, plus_infty),
-    TEST_c_c (casin, minus_infty, minus_zero, -M_PI_2l, minus_infty),
-    TEST_c_c (casin, minus_infty, 100, -M_PI_2l, plus_infty),
-    TEST_c_c (casin, minus_infty, -100, -M_PI_2l, minus_infty),
+    TEST_c_c (casin, minus_infty, 0, -pi_2_d, plus_infty),
+    TEST_c_c (casin, minus_infty, minus_zero, -pi_2_d, minus_infty),
+    TEST_c_c (casin, minus_infty, 100, -pi_2_d, plus_infty),
+    TEST_c_c (casin, minus_infty, -100, -pi_2_d, minus_infty),
 
-    TEST_c_c (casin, plus_infty, 0, M_PI_2l, plus_infty),
-    TEST_c_c (casin, plus_infty, minus_zero, M_PI_2l, minus_infty),
-    TEST_c_c (casin, plus_infty, 0.5, M_PI_2l, plus_infty),
-    TEST_c_c (casin, plus_infty, -0.5, M_PI_2l, minus_infty),
+    TEST_c_c (casin, plus_infty, 0, pi_2_d, plus_infty),
+    TEST_c_c (casin, plus_infty, minus_zero, pi_2_d, minus_infty),
+    TEST_c_c (casin, plus_infty, 0.5, pi_2_d, plus_infty),
+    TEST_c_c (casin, plus_infty, -0.5, pi_2_d, minus_infty),
 
     TEST_c_c (casin, qnan_value, plus_infty, qnan_value, plus_infty),
     TEST_c_c (casin, qnan_value, minus_infty, qnan_value, minus_infty),
@@ -3552,18 +3554,18 @@ static const struct test_c_c_data casin_test_data[] =
     TEST_c_c (casin, plus_zero, 1.5L, plus_zero, 1.194763217287109304111930828519090523536L),
     TEST_c_c (casin, minus_zero, 1.5L, minus_zero, 1.194763217287109304111930828519090523536L),
 
-    TEST_c_c (casin, -1.5L, plus_zero, -M_PI_2l, 0.9624236501192068949955178268487368462704L),
-    TEST_c_c (casin, -1.5L, minus_zero, -M_PI_2l, -0.9624236501192068949955178268487368462704L),
-    TEST_c_c (casin, -1.0L, plus_zero, -M_PI_2l, plus_zero),
-    TEST_c_c (casin, -1.0L, minus_zero, -M_PI_2l, minus_zero),
+    TEST_c_c (casin, -1.5L, plus_zero, -pi_2_d, 0.9624236501192068949955178268487368462704L),
+    TEST_c_c (casin, -1.5L, minus_zero, -pi_2_d, -0.9624236501192068949955178268487368462704L),
+    TEST_c_c (casin, -1.0L, plus_zero, -pi_2_d, plus_zero),
+    TEST_c_c (casin, -1.0L, minus_zero, -pi_2_d, minus_zero),
     TEST_c_c (casin, -0.5L, plus_zero, -0.5235987755982988730771072305465838140329L, plus_zero),
     TEST_c_c (casin, -0.5L, minus_zero, -0.5235987755982988730771072305465838140329L, minus_zero),
     TEST_c_c (casin, 0.5L, plus_zero, 0.5235987755982988730771072305465838140329L, plus_zero),
     TEST_c_c (casin, 0.5L, minus_zero, 0.5235987755982988730771072305465838140329L, minus_zero),
-    TEST_c_c (casin, 1.0L, plus_zero, M_PI_2l, plus_zero),
-    TEST_c_c (casin, 1.0L, minus_zero, M_PI_2l, minus_zero),
-    TEST_c_c (casin, 1.5L, plus_zero, M_PI_2l, 0.9624236501192068949955178268487368462704L),
-    TEST_c_c (casin, 1.5L, minus_zero, M_PI_2l, -0.9624236501192068949955178268487368462704L),
+    TEST_c_c (casin, 1.0L, plus_zero, pi_2_d, plus_zero),
+    TEST_c_c (casin, 1.0L, minus_zero, pi_2_d, minus_zero),
+    TEST_c_c (casin, 1.5L, plus_zero, pi_2_d, 0.9624236501192068949955178268487368462704L),
+    TEST_c_c (casin, 1.5L, minus_zero, pi_2_d, -0.9624236501192068949955178268487368462704L),
 
     TEST_c_c (casin, 0x1p50L, 1.0L, 1.570796326794895731052901991514519103193L, 3.535050620855721078027883819436720218708e1L),
     TEST_c_c (casin, 0x1p50L, -1.0L, 1.570796326794895731052901991514519103193L, -3.535050620855721078027883819436720218708e1L),
@@ -4193,14 +4195,14 @@ static const struct test_c_c_data casinh_test_data[] =
     TEST_c_c (casinh, minus_infty, plus_infty, minus_infty, M_PI_4l),
     TEST_c_c (casinh, minus_infty, minus_infty, minus_infty, -M_PI_4l),
 
-    TEST_c_c (casinh, -10.0, plus_infty, minus_infty, M_PI_2l),
-    TEST_c_c (casinh, -10.0, minus_infty, minus_infty, -M_PI_2l),
-    TEST_c_c (casinh, 0, plus_infty, plus_infty, M_PI_2l),
-    TEST_c_c (casinh, 0, minus_infty, plus_infty, -M_PI_2l),
-    TEST_c_c (casinh, minus_zero, plus_infty, minus_infty, M_PI_2l),
-    TEST_c_c (casinh, minus_zero, minus_infty, minus_infty, -M_PI_2l),
-    TEST_c_c (casinh, 0.1L, plus_infty, plus_infty, M_PI_2l),
-    TEST_c_c (casinh, 0.1L, minus_infty, plus_infty, -M_PI_2l),
+    TEST_c_c (casinh, -10.0, plus_infty, minus_infty, pi_2_d),
+    TEST_c_c (casinh, -10.0, minus_infty, minus_infty, -pi_2_d),
+    TEST_c_c (casinh, 0, plus_infty, plus_infty, pi_2_d),
+    TEST_c_c (casinh, 0, minus_infty, plus_infty, -pi_2_d),
+    TEST_c_c (casinh, minus_zero, plus_infty, minus_infty, pi_2_d),
+    TEST_c_c (casinh, minus_zero, minus_infty, minus_infty, -pi_2_d),
+    TEST_c_c (casinh, 0.1L, plus_infty, plus_infty, pi_2_d),
+    TEST_c_c (casinh, 0.1L, minus_infty, plus_infty, -pi_2_d),
 
     TEST_c_c (casinh, minus_infty, 0, minus_infty, 0.0),
     TEST_c_c (casinh, minus_infty, minus_zero, minus_infty, minus_zero),
@@ -4229,18 +4231,18 @@ static const struct test_c_c_data casinh_test_data[] =
 
     TEST_c_c (casinh, qnan_value, qnan_value, qnan_value, qnan_value),
 
-    TEST_c_c (casinh, plus_zero, -1.5L, 0.9624236501192068949955178268487368462704L, -M_PI_2l),
-    TEST_c_c (casinh, minus_zero, -1.5L, -0.9624236501192068949955178268487368462704L, -M_PI_2l),
-    TEST_c_c (casinh, plus_zero, -1.0L, plus_zero, -M_PI_2l),
-    TEST_c_c (casinh, minus_zero, -1.0L, minus_zero, -M_PI_2l),
+    TEST_c_c (casinh, plus_zero, -1.5L, 0.9624236501192068949955178268487368462704L, -pi_2_d),
+    TEST_c_c (casinh, minus_zero, -1.5L, -0.9624236501192068949955178268487368462704L, -pi_2_d),
+    TEST_c_c (casinh, plus_zero, -1.0L, plus_zero, -pi_2_d),
+    TEST_c_c (casinh, minus_zero, -1.0L, minus_zero, -pi_2_d),
     TEST_c_c (casinh, plus_zero, -0.5L, plus_zero, -0.5235987755982988730771072305465838140329L),
     TEST_c_c (casinh, minus_zero, -0.5L, minus_zero, -0.5235987755982988730771072305465838140329L),
     TEST_c_c (casinh, plus_zero, 0.5L, plus_zero, 0.5235987755982988730771072305465838140329L),
     TEST_c_c (casinh, minus_zero, 0.5L, minus_zero, 0.5235987755982988730771072305465838140329L),
-    TEST_c_c (casinh, plus_zero, 1.0L, plus_zero, M_PI_2l),
-    TEST_c_c (casinh, minus_zero, 1.0L, minus_zero, M_PI_2l),
-    TEST_c_c (casinh, plus_zero, 1.5L, 0.9624236501192068949955178268487368462704L, M_PI_2l),
-    TEST_c_c (casinh, minus_zero, 1.5L, -0.9624236501192068949955178268487368462704L, M_PI_2l),
+    TEST_c_c (casinh, plus_zero, 1.0L, plus_zero, pi_2_d),
+    TEST_c_c (casinh, minus_zero, 1.0L, minus_zero, pi_2_d),
+    TEST_c_c (casinh, plus_zero, 1.5L, 0.9624236501192068949955178268487368462704L, pi_2_d),
+    TEST_c_c (casinh, minus_zero, 1.5L, -0.9624236501192068949955178268487368462704L, pi_2_d),
 
     TEST_c_c (casinh, -1.5L, plus_zero, -1.194763217287109304111930828519090523536L, plus_zero),
     TEST_c_c (casinh, -1.5L, minus_zero, -1.194763217287109304111930828519090523536L, minus_zero),
@@ -4887,30 +4889,30 @@ static const struct test_c_c_data catan_test_data[] =
     TEST_c_c (catan, plus_zero, -1.0L, plus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION),
     TEST_c_c (catan, minus_zero, -1.0L, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION),
 
-    TEST_c_c (catan, plus_infty, plus_infty, M_PI_2l, 0),
-    TEST_c_c (catan, plus_infty, minus_infty, M_PI_2l, minus_zero),
-    TEST_c_c (catan, minus_infty, plus_infty, -M_PI_2l, 0),
-    TEST_c_c (catan, minus_infty, minus_infty, -M_PI_2l, minus_zero),
+    TEST_c_c (catan, plus_infty, plus_infty, pi_2_d, 0),
+    TEST_c_c (catan, plus_infty, minus_infty, pi_2_d, minus_zero),
+    TEST_c_c (catan, minus_infty, plus_infty, -pi_2_d, 0),
+    TEST_c_c (catan, minus_infty, minus_infty, -pi_2_d, minus_zero),
 
 
-    TEST_c_c (catan, plus_infty, -10.0, M_PI_2l, minus_zero),
-    TEST_c_c (catan, minus_infty, -10.0, -M_PI_2l, minus_zero),
-    TEST_c_c (catan, plus_infty, minus_zero, M_PI_2l, minus_zero),
-    TEST_c_c (catan, minus_infty, minus_zero, -M_PI_2l, minus_zero),
-    TEST_c_c (catan, plus_infty, 0.0, M_PI_2l, 0),
-    TEST_c_c (catan, minus_infty, 0.0, -M_PI_2l, 0),
-    TEST_c_c (catan, plus_infty, 0.1L, M_PI_2l, 0),
-    TEST_c_c (catan, minus_infty, 0.1L, -M_PI_2l, 0),
+    TEST_c_c (catan, plus_infty, -10.0, pi_2_d, minus_zero),
+    TEST_c_c (catan, minus_infty, -10.0, -pi_2_d, minus_zero),
+    TEST_c_c (catan, plus_infty, minus_zero, pi_2_d, minus_zero),
+    TEST_c_c (catan, minus_infty, minus_zero, -pi_2_d, minus_zero),
+    TEST_c_c (catan, plus_infty, 0.0, pi_2_d, 0),
+    TEST_c_c (catan, minus_infty, 0.0, -pi_2_d, 0),
+    TEST_c_c (catan, plus_infty, 0.1L, pi_2_d, 0),
+    TEST_c_c (catan, minus_infty, 0.1L, -pi_2_d, 0),
 
-    TEST_c_c (catan, 0.0, minus_infty, M_PI_2l, minus_zero),
-    TEST_c_c (catan, minus_zero, minus_infty, -M_PI_2l, minus_zero),
-    TEST_c_c (catan, 100.0, minus_infty, M_PI_2l, minus_zero),
-    TEST_c_c (catan, -100.0, minus_infty, -M_PI_2l, minus_zero),
+    TEST_c_c (catan, 0.0, minus_infty, pi_2_d, minus_zero),
+    TEST_c_c (catan, minus_zero, minus_infty, -pi_2_d, minus_zero),
+    TEST_c_c (catan, 100.0, minus_infty, pi_2_d, minus_zero),
+    TEST_c_c (catan, -100.0, minus_infty, -pi_2_d, minus_zero),
 
-    TEST_c_c (catan, 0.0, plus_infty, M_PI_2l, 0),
-    TEST_c_c (catan, minus_zero, plus_infty, -M_PI_2l, 0),
-    TEST_c_c (catan, 0.5, plus_infty, M_PI_2l, 0),
-    TEST_c_c (catan, -0.5, plus_infty, -M_PI_2l, 0),
+    TEST_c_c (catan, 0.0, plus_infty, pi_2_d, 0),
+    TEST_c_c (catan, minus_zero, plus_infty, -pi_2_d, 0),
+    TEST_c_c (catan, 0.5, plus_infty, pi_2_d, 0),
+    TEST_c_c (catan, -0.5, plus_infty, -pi_2_d, 0),
 
     TEST_c_c (catan, qnan_value, 0.0, qnan_value, 0),
     TEST_c_c (catan, qnan_value, minus_zero, qnan_value, minus_zero),
@@ -4921,8 +4923,8 @@ static const struct test_c_c_data catan_test_data[] =
     TEST_c_c (catan, 0.0, qnan_value, qnan_value, qnan_value),
     TEST_c_c (catan, minus_zero, qnan_value, qnan_value, qnan_value),
 
-    TEST_c_c (catan, plus_infty, qnan_value, M_PI_2l, 0, IGNORE_ZERO_INF_SIGN),
-    TEST_c_c (catan, minus_infty, qnan_value, -M_PI_2l, 0, IGNORE_ZERO_INF_SIGN),
+    TEST_c_c (catan, plus_infty, qnan_value, pi_2_d, 0, IGNORE_ZERO_INF_SIGN),
+    TEST_c_c (catan, minus_infty, qnan_value, -pi_2_d, 0, IGNORE_ZERO_INF_SIGN),
 
     TEST_c_c (catan, qnan_value, 10.5, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
     TEST_c_c (catan, qnan_value, -10.5, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
@@ -5393,29 +5395,29 @@ static const struct test_c_c_data catanh_test_data[] =
     TEST_c_c (catanh, plus_zero, -1.0L, plus_zero, -M_PI_4l),
     TEST_c_c (catanh, minus_zero, -1.0L, minus_zero, -M_PI_4l),
 
-    TEST_c_c (catanh, plus_infty, plus_infty, 0.0, M_PI_2l),
-    TEST_c_c (catanh, plus_infty, minus_infty, 0.0, -M_PI_2l),
-    TEST_c_c (catanh, minus_infty, plus_infty, minus_zero, M_PI_2l),
-    TEST_c_c (catanh, minus_infty, minus_infty, minus_zero, -M_PI_2l),
-
-    TEST_c_c (catanh, -10.0, plus_infty, minus_zero, M_PI_2l),
-    TEST_c_c (catanh, -10.0, minus_infty, minus_zero, -M_PI_2l),
-    TEST_c_c (catanh, minus_zero, plus_infty, minus_zero, M_PI_2l),
-    TEST_c_c (catanh, minus_zero, minus_infty, minus_zero, -M_PI_2l),
-    TEST_c_c (catanh, 0, plus_infty, 0.0, M_PI_2l),
-    TEST_c_c (catanh, 0, minus_infty, 0.0, -M_PI_2l),
-    TEST_c_c (catanh, 0.1L, plus_infty, 0.0, M_PI_2l),
-    TEST_c_c (catanh, 0.1L, minus_infty, 0.0, -M_PI_2l),
-
-    TEST_c_c (catanh, minus_infty, 0, minus_zero, M_PI_2l),
-    TEST_c_c (catanh, minus_infty, minus_zero, minus_zero, -M_PI_2l),
-    TEST_c_c (catanh, minus_infty, 100, minus_zero, M_PI_2l),
-    TEST_c_c (catanh, minus_infty, -100, minus_zero, -M_PI_2l),
-
-    TEST_c_c (catanh, plus_infty, 0, 0.0, M_PI_2l),
-    TEST_c_c (catanh, plus_infty, minus_zero, 0.0, -M_PI_2l),
-    TEST_c_c (catanh, plus_infty, 0.5, 0.0, M_PI_2l),
-    TEST_c_c (catanh, plus_infty, -0.5, 0.0, -M_PI_2l),
+    TEST_c_c (catanh, plus_infty, plus_infty, 0.0, pi_2_d),
+    TEST_c_c (catanh, plus_infty, minus_infty, 0.0, -pi_2_d),
+    TEST_c_c (catanh, minus_infty, plus_infty, minus_zero, pi_2_d),
+    TEST_c_c (catanh, minus_infty, minus_infty, minus_zero, -pi_2_d),
+
+    TEST_c_c (catanh, -10.0, plus_infty, minus_zero, pi_2_d),
+    TEST_c_c (catanh, -10.0, minus_infty, minus_zero, -pi_2_d),
+    TEST_c_c (catanh, minus_zero, plus_infty, minus_zero, pi_2_d),
+    TEST_c_c (catanh, minus_zero, minus_infty, minus_zero, -pi_2_d),
+    TEST_c_c (catanh, 0, plus_infty, 0.0, pi_2_d),
+    TEST_c_c (catanh, 0, minus_infty, 0.0, -pi_2_d),
+    TEST_c_c (catanh, 0.1L, plus_infty, 0.0, pi_2_d),
+    TEST_c_c (catanh, 0.1L, minus_infty, 0.0, -pi_2_d),
+
+    TEST_c_c (catanh, minus_infty, 0, minus_zero, pi_2_d),
+    TEST_c_c (catanh, minus_infty, minus_zero, minus_zero, -pi_2_d),
+    TEST_c_c (catanh, minus_infty, 100, minus_zero, pi_2_d),
+    TEST_c_c (catanh, minus_infty, -100, minus_zero, -pi_2_d),
+
+    TEST_c_c (catanh, plus_infty, 0, 0.0, pi_2_d),
+    TEST_c_c (catanh, plus_infty, minus_zero, 0.0, -pi_2_d),
+    TEST_c_c (catanh, plus_infty, 0.5, 0.0, pi_2_d),
+    TEST_c_c (catanh, plus_infty, -0.5, 0.0, -pi_2_d),
 
     TEST_c_c (catanh, 0, qnan_value, 0.0, qnan_value),
     TEST_c_c (catanh, minus_zero, qnan_value, minus_zero, qnan_value),
@@ -5426,8 +5428,8 @@ static const struct test_c_c_data catanh_test_data[] =
     TEST_c_c (catanh, qnan_value, 0, qnan_value, qnan_value),
     TEST_c_c (catanh, qnan_value, minus_zero, qnan_value, qnan_value),
 
-    TEST_c_c (catanh, qnan_value, plus_infty, 0.0, M_PI_2l, IGNORE_ZERO_INF_SIGN),
-    TEST_c_c (catanh, qnan_value, minus_infty, 0.0, -M_PI_2l, IGNORE_ZERO_INF_SIGN),
+    TEST_c_c (catanh, qnan_value, plus_infty, 0.0, pi_2_d, IGNORE_ZERO_INF_SIGN),
+    TEST_c_c (catanh, qnan_value, minus_infty, 0.0, -pi_2_d, IGNORE_ZERO_INF_SIGN),
 
     TEST_c_c (catanh, 10.5, qnan_value, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
     TEST_c_c (catanh, -10.5, qnan_value, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
@@ -6244,14 +6246,14 @@ static const struct test_c_c_data clog_test_data[] =
     TEST_c_c (clog, plus_infty, plus_infty, plus_infty, M_PI_4l),
     TEST_c_c (clog, plus_infty, minus_infty, plus_infty, -M_PI_4l),
 
-    TEST_c_c (clog, 0, plus_infty, plus_infty, M_PI_2l),
-    TEST_c_c (clog, 3, plus_infty, plus_infty, M_PI_2l),
-    TEST_c_c (clog, minus_zero, plus_infty, plus_infty, M_PI_2l),
-    TEST_c_c (clog, -3, plus_infty, plus_infty, M_PI_2l),
-    TEST_c_c (clog, 0, minus_infty, plus_infty, -M_PI_2l),
-    TEST_c_c (clog, 3, minus_infty, plus_infty, -M_PI_2l),
-    TEST_c_c (clog, minus_zero, minus_infty, plus_infty, -M_PI_2l),
-    TEST_c_c (clog, -3, minus_infty, plus_infty, -M_PI_2l),
+    TEST_c_c (clog, 0, plus_infty, plus_infty, pi_2_d),
+    TEST_c_c (clog, 3, plus_infty, plus_infty, pi_2_d),
+    TEST_c_c (clog, minus_zero, plus_infty, plus_infty, pi_2_d),
+    TEST_c_c (clog, -3, plus_infty, plus_infty, pi_2_d),
+    TEST_c_c (clog, 0, minus_infty, plus_infty, -pi_2_d),
+    TEST_c_c (clog, 3, minus_infty, plus_infty, -pi_2_d),
+    TEST_c_c (clog, minus_zero, minus_infty, plus_infty, -pi_2_d),
+    TEST_c_c (clog, -3, minus_infty, plus_infty, -pi_2_d),
 
     TEST_c_c (clog, minus_infty, 0, plus_infty, M_PIl),
     TEST_c_c (clog, minus_infty, 1, plus_infty, M_PIl),
-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCHv2 12/14] Remove CHOOSE() macro from libm-tests.inc
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
                     ` (17 preceding siblings ...)
  2016-05-20 21:38   ` [PATCHv2 13/14] Remove type specific information from auto-libm-test-in Paul E. Murphy
@ 2016-05-20 21:38   ` Paul E. Murphy
  2016-05-20 21:38   ` [PATCHv2 14/14] Generate new format names in auto-libm-test-out Paul E. Murphy
                     ` (3 subsequent siblings)
  22 siblings, 0 replies; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-20 21:38 UTC (permalink / raw)
  To: libc-alpha

Use gen-libm-test.pl to generate a list of macros
mapping to libm-test-ulps.h as this simplifies adding new
types without having to modify a growing number of
static headers each time a type is added.

This also removes the final usage of the TEST_[DOUBLE|FLOAT|LDOUBLE]
macros.  Thus, they too are removed.

	* math/gen-libm-test.pl (all_floats_pfx): New lookup table.
	(parse_ulps): Dynamically generate type name matching
	string from all_floats.
	(get_ulps): Generate the ulps as an array instead.
	(output_ulps): Dynamically compose the type based
	on the number of supported formats, and print
	the indices as type specific helper macros.
	* math/libm-test.inc: Remove comment about CHOOSE.
	(ulp_data): Generate the type in libm-test-ulps.h.
	[ULP_IDX]: New macro.
	[_ULP_IDX]: Likewise.
	[__ULP_IDX]: Likewise.
	(find_ulps): Update usage of max_ulp.
	* math/test-double-vlen2.h [CHOOSE]: Remove.
	* math/test-double-vlen4.h [CHOOSE]: Likewise.
	* math/test-double-vlen8.h [CHOOSE]: Likewise.
	* math/test-float.c [CHOOSE]: Likewise.
	* math/test-float-finite.c [CHOOSE]: Likewise.
	* math/test-double.c [CHOOSE]: Likewise.
	* math/test-double-finite.c [CHOOSE]: Likewise.
	* math/test-idouble.c [CHOOSE]: Likewise.
	* math/test-ifloat.c [CHOOSE]: Likewise.
	* math/test-ildoubl.c [CHOOSE]: Likewise.
	* math/test-ldouble-finite.c [CHOOSE]: Likewise.
	* math/test-ldouble.c [CHOOSE]: Likewise.
	* math/test-float.h [TEST_FLOAT]: Remove.
	* math/test-double.h [TEST_DOUBLE]: Remove.
	* math/test-ldouble.h [TEST_LDOUBLE]: Remove.
---
 math/gen-libm-test.pl      | 49 +++++++++++++++++++++++++++++++++++-----------
 math/libm-test.inc         | 13 +++---------
 math/test-double-finite.c  |  1 -
 math/test-double-vlen2.h   |  1 -
 math/test-double-vlen4.h   |  1 -
 math/test-double-vlen8.h   |  1 -
 math/test-double.c         |  1 -
 math/test-double.h         |  1 -
 math/test-float-finite.c   |  1 -
 math/test-float-vlen16.h   |  1 -
 math/test-float-vlen4.h    |  1 -
 math/test-float-vlen8.h    |  1 -
 math/test-float.c          |  1 -
 math/test-float.h          |  1 -
 math/test-idouble.c        |  1 -
 math/test-ifloat.c         |  1 -
 math/test-ildoubl.c        |  1 -
 math/test-ldouble-finite.c |  1 -
 math/test-ldouble.c        |  1 -
 math/test-ldouble.h        |  1 -
 20 files changed, 41 insertions(+), 39 deletions(-)

diff --git a/math/gen-libm-test.pl b/math/gen-libm-test.pl
index 40839e0..fa48f5e 100755
--- a/math/gen-libm-test.pl
+++ b/math/gen-libm-test.pl
@@ -39,7 +39,7 @@ use strict;
 
 use vars qw ($input $output $auto_input);
 use vars qw (%results);
-use vars qw (%beautify @all_floats);
+use vars qw (%beautify @all_floats %all_floats_pfx);
 use vars qw ($output_dir $ulps_file $srcdir);
 use vars qw (%auto_tests);
 
@@ -47,6 +47,13 @@ use vars qw (%auto_tests);
 @all_floats = ('double', 'float', 'idouble',
 	       'ifloat', 'ildouble', 'ldouble');
 
+# all_floats_pfx maps C types to their C like prefix for macros.
+%all_floats_pfx =
+  ( "double" => "DBL",
+    "ldouble" => "LDBL",
+    "float" => "FLT",
+  );
+
 %beautify =
   ( "minus_zero" => "-0",
     "plus_zero" => "+0",
@@ -588,7 +595,14 @@ sub generate_testfile {
 # Parse ulps file
 sub parse_ulps {
   my ($file) = @_;
-  my ($test, $type, $float, $eps);
+  my ($test, $type, $float, $eps, $float_regex);
+
+  # Build a basic regex to match type entries in the
+  # generated ULPS file.
+  foreach my $ftype (@all_floats) {
+    $float_regex .= "|" . $ftype;
+  }
+  $float_regex = "^" . substr ($float_regex, 1) . ":";
 
   # $type has the following values:
   # "normal": No complex variable
@@ -613,7 +627,7 @@ sub parse_ulps {
       ($test) = ($_ =~ /^Function:\s*\"([a-zA-Z0-9_]+)\"/);
       next;
     }
-    if (/^i?(float|double|ldouble):/) {
+    if (/$float_regex/) {
       ($float, $eps) = split /\s*:\s*/,$_,2;
 
       if ($eps eq "0") {
@@ -697,16 +711,13 @@ sub get_ulps {
 sub get_all_ulps_for_test {
   my ($test, $type) = @_;
   my ($ldouble, $double, $float, $ildouble, $idouble, $ifloat);
+  my ($ulps_str);
 
   if (exists $results{$test}{'has_ulps'}) {
-    # XXX use all_floats (change order!)
-    $ldouble = &get_ulps ($test, $type, "ldouble");
-    $double = &get_ulps ($test, $type, "double");
-    $float = &get_ulps ($test, $type, "float");
-    $ildouble = &get_ulps ($test, $type, "ildouble");
-    $idouble = &get_ulps ($test, $type, "idouble");
-    $ifloat = &get_ulps ($test, $type, "ifloat");
-    return "CHOOSE ($ldouble, $double, $float, $ildouble, $idouble, $ifloat)";
+    foreach $float (@all_floats) {
+      $ulps_str .= &get_ulps ($test, $type, $float) . ", ";
+    }
+    return "{" . substr ($ulps_str, 0, -2) . "}";
   } else {
     die "get_all_ulps_for_test called for \"$test\" with no ulps\n";
   }
@@ -724,6 +735,22 @@ sub output_ulps {
   print ULP "   from $ulps_filename with gen-libm-test.pl.\n";
   print ULP "   Don't change it - change instead the master files.  */\n\n";
 
+  print ULP "struct ulp_data\n";
+  print ULP "{\n";
+  print ULP "  const char *name;\n";
+  print ULP "  FLOAT max_ulp[" . @all_floats . "];\n";
+  print ULP "};\n\n";
+
+  for ($i = 0; $i <= $#all_floats; $i++) {
+    $type = $all_floats[$i];
+    print ULP "#define ULP_";
+    if ($type =~ /^i/) {
+      print ULP "I_";
+      $type = substr $type, 1;
+    }
+    print ULP "$all_floats_pfx{$type} $i\n";
+  }
+
   foreach $fct (keys %results) {
     $type = $results{$fct}{'type'};
     if ($type eq 'normal') {
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 3ba0b2d..adc1d69 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -26,7 +26,6 @@
    name with correct suffix (e.g. cosl or cosf)
    FLOAT:	   floating point type to test
    - TEST_MSG:	   informal message to be displayed
-   CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat):
    chooses one of the parameters as delta for testing
    equality
    PRINTF_EXPR	   Floating point conversion specification to print a variable
@@ -133,14 +132,6 @@
 #include <math-tests.h>
 #include <math-tests-arch.h>
 
-/* Structure for ulp data for a function, or the real or imaginary
-   part of a function.  */
-struct ulp_data
-{
-  const char *name;
-  FLOAT max_ulp;
-};
-
 /* This header defines func_ulps, func_real_ulps and func_imag_ulps
    arrays.  */
 #include "libm-test-ulps.h"
@@ -205,8 +196,10 @@ struct ulp_data
 # define FSTR_MAX (128)
 
 #if TEST_INLINE
+# define ULP_IDX _EXPAND (ULP_I_, PREFIX)
 # define TYPESTR "i" TSTR
 #else
+# define ULP_IDX _EXPAND (ULP_, PREFIX)
 # define TYPESTR TSTR
 #endif
 
@@ -396,7 +389,7 @@ find_ulps (const char *name, const struct ulp_data *data, size_t nmemb)
   if (entry == NULL)
     return 0;
   else
-    return entry->max_ulp;
+    return entry->max_ulp[ULP_IDX];
 }
 
 static void
diff --git a/math/test-double-finite.c b/math/test-double-finite.c
index e7fa2a9..7f107aa 100644
--- a/math/test-double-finite.c
+++ b/math/test-double-finite.c
@@ -21,6 +21,5 @@
 #include "test-math-scalar.h"
 
 #define TEST_MSG "testing double (finite-math-only)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cdouble
 
 #include "libm-test.c"
diff --git a/math/test-double-vlen2.h b/math/test-double-vlen2.h
index 8a1d068..45351cb 100644
--- a/math/test-double-vlen2.h
+++ b/math/test-double-vlen2.h
@@ -21,7 +21,6 @@
 #include "test-math-vector.h"
 
 #define TEST_MSG "testing double vector math (without inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cdouble
 
 #define EXCEPTION_TESTS_double 0
 #define ROUNDING_TESTS_double(MODE) ((MODE) == FE_TONEAREST)
diff --git a/math/test-double-vlen4.h b/math/test-double-vlen4.h
index 40ab58c..7078893 100644
--- a/math/test-double-vlen4.h
+++ b/math/test-double-vlen4.h
@@ -21,7 +21,6 @@
 #include "test-math-vector.h"
 
 #define TEST_MSG "testing double vector math (without inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cdouble
 
 #define EXCEPTION_TESTS_double 0
 #define ROUNDING_TESTS_double(MODE) ((MODE) == FE_TONEAREST)
diff --git a/math/test-double-vlen8.h b/math/test-double-vlen8.h
index dddb52c..57168c5 100644
--- a/math/test-double-vlen8.h
+++ b/math/test-double-vlen8.h
@@ -21,7 +21,6 @@
 #include "test-math-vector.h"
 
 #define TEST_MSG "testing double vector math (without inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cdouble
 
 #define EXCEPTION_TESTS_double 0
 #define ROUNDING_TESTS_double(MODE) ((MODE) == FE_TONEAREST)
diff --git a/math/test-double.c b/math/test-double.c
index 2647f66..3f84f40 100644
--- a/math/test-double.c
+++ b/math/test-double.c
@@ -23,6 +23,5 @@
 #include "test-math-scalar.h"
 
 #define TEST_MSG "testing double (without inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cdouble
 
 #include "libm-test.c"
diff --git a/math/test-double.h b/math/test-double.h
index 0ece942..06d9c7c 100644
--- a/math/test-double.h
+++ b/math/test-double.h
@@ -21,7 +21,6 @@
 #define PRINTF_EXPR "e"
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
-#define TEST_DOUBLE 1
 #define BUILD_COMPLEX(real, imag) (CMPLX ((real), (imag)))
 #define PREFIX DBL
 #define LIT(x) (x)
diff --git a/math/test-float-finite.c b/math/test-float-finite.c
index bd25a7b..3f5fe19 100644
--- a/math/test-float-finite.c
+++ b/math/test-float-finite.c
@@ -21,6 +21,5 @@
 #include "test-math-scalar.h"
 
 #define TEST_MSG "testing float (finite-math-only)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cfloat
 
 #include "libm-test.c"
diff --git a/math/test-float-vlen16.h b/math/test-float-vlen16.h
index a2db3a5..d31336a 100644
--- a/math/test-float-vlen16.h
+++ b/math/test-float-vlen16.h
@@ -21,7 +21,6 @@
 #include "test-math-vector.h"
 
 #define TEST_MSG "testing float vector math (without inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cfloat
 
 #define EXCEPTION_TESTS_float 0
 #define ROUNDING_TESTS_float(MODE) ((MODE) == FE_TONEAREST)
diff --git a/math/test-float-vlen4.h b/math/test-float-vlen4.h
index 164749d..5a88fb8 100644
--- a/math/test-float-vlen4.h
+++ b/math/test-float-vlen4.h
@@ -21,7 +21,6 @@
 #include "test-math-vector.h"
 
 #define TEST_MSG "testing float vector math (without inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cfloat
 
 #define EXCEPTION_TESTS_float 0
 #define ROUNDING_TESTS_float(MODE) ((MODE) == FE_TONEAREST)
diff --git a/math/test-float-vlen8.h b/math/test-float-vlen8.h
index ce32df2..d1e5e6e 100644
--- a/math/test-float-vlen8.h
+++ b/math/test-float-vlen8.h
@@ -21,7 +21,6 @@
 #include "test-math-vector.h"
 
 #define TEST_MSG "testing float vector math (without inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cfloat
 
 #define EXCEPTION_TESTS_float 0
 #define ROUNDING_TESTS_float(MODE) ((MODE) == FE_TONEAREST)
diff --git a/math/test-float.c b/math/test-float.c
index 153b9ad..6be57bb 100644
--- a/math/test-float.c
+++ b/math/test-float.c
@@ -23,6 +23,5 @@
 #include "test-math-scalar.h"
 
 #define TEST_MSG "testing float (without inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cfloat
 
 #include "libm-test.c"
diff --git a/math/test-float.h b/math/test-float.h
index d92612b..c576953 100644
--- a/math/test-float.h
+++ b/math/test-float.h
@@ -21,7 +21,6 @@
 #define PRINTF_EXPR "e"
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
-#define TEST_FLOAT 1
 #define BUILD_COMPLEX(real, imag) (CMPLXF ((real), (imag)))
 #define PREFIX FLT
 #define TSTR "float"
diff --git a/math/test-idouble.c b/math/test-idouble.c
index fc1e8f8..10a3685 100644
--- a/math/test-idouble.c
+++ b/math/test-idouble.c
@@ -21,6 +21,5 @@
 #include "test-math-scalar.h"
 
 #define TEST_MSG "testing double (inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cinlinedouble
 
 #include "libm-test.c"
diff --git a/math/test-ifloat.c b/math/test-ifloat.c
index 72c53ad..88bb5b8 100644
--- a/math/test-ifloat.c
+++ b/math/test-ifloat.c
@@ -21,6 +21,5 @@
 #include "test-math-scalar.h"
 
 #define TEST_MSG "testing float (inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cinlinefloat
 
 #include "libm-test.c"
diff --git a/math/test-ildoubl.c b/math/test-ildoubl.c
index 08317ed..dc0efaa 100644
--- a/math/test-ildoubl.c
+++ b/math/test-ildoubl.c
@@ -21,6 +21,5 @@
 #include "test-math-scalar.h"
 
 #define TEST_MSG "testing long double (inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cinlinelongdouble
 
 #include "libm-test.c"
diff --git a/math/test-ldouble-finite.c b/math/test-ldouble-finite.c
index 4c09778..8ac2d33 100644
--- a/math/test-ldouble-finite.c
+++ b/math/test-ldouble-finite.c
@@ -21,6 +21,5 @@
 #include "test-math-scalar.h"
 
 #define TEST_MSG "testing long double (finite-math-only)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Clongdouble
 
 #include "libm-test.c"
diff --git a/math/test-ldouble.c b/math/test-ldouble.c
index 944f6dd..a705fa4 100644
--- a/math/test-ldouble.c
+++ b/math/test-ldouble.c
@@ -23,6 +23,5 @@
 #include "test-math-scalar.h"
 
 #define TEST_MSG "testing long double (without inline functions)\n"
-#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Clongdouble
 
 #include "libm-test.c"
diff --git a/math/test-ldouble.h b/math/test-ldouble.h
index 96a3dac..897f83f 100644
--- a/math/test-ldouble.h
+++ b/math/test-ldouble.h
@@ -21,7 +21,6 @@
 #define PRINTF_EXPR "Le"
 #define PRINTF_XEXPR "La"
 #define PRINTF_NEXPR "Lf"
-#define TEST_LDOUBLE 1
 #define BUILD_COMPLEX(real, imag) (CMPLXL ((real), (imag)))
 #define PREFIX LDBL
 #define TSTR "ldouble"
-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCHv2 08/14] Replace M_PI_4l with pi_4_d in libm-test.inc
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
                     ` (13 preceding siblings ...)
  2016-05-20 21:38   ` [PATCHv2 10/14] Add note about nexttoward test cases in libm-test.inc Paul E. Murphy
@ 2016-05-20 21:38   ` Paul E. Murphy
  2016-05-20 21:38   ` [PATCHv2 11/14] Apply LIT(x) to floating point literals in libm-test.c Paul E. Murphy
                     ` (7 subsequent siblings)
  22 siblings, 0 replies; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-20 21:38 UTC (permalink / raw)
  To: libc-alpha

This is useful in situations where the long double type is
less precise than the type under test.

	* libm-test.inc: Replace usage of M_PI_4l with
	[pi_4_d]: New macro.
---
 math/libm-test.inc | 54 ++++++++++++++++++++++++++++--------------------------
 1 file changed, 28 insertions(+), 26 deletions(-)

diff --git a/math/libm-test.inc b/math/libm-test.inc
index 3dfe465..5548a6c 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -326,6 +326,8 @@ struct ulp_data
 #define pi_ln10_d		LIT (1.364376353841841347485783625431355770)
 /* pi / 2 */
 #define pi_2_d			LIT (1.570796326794896619231321691639751442)
+/* pi / 4 */
+#define pi_4_d			LIT (0.785398163397448309615660845819875721)
 /* pi */
 #define pi			LIT (3.141592653589793238462643383279502884)
 
@@ -1995,8 +1997,8 @@ static const struct test_ff_f_data atan2_test_data[] =
     TEST_ff_f (atan2, -min_subnorm_value, minus_infty, -pi, ERRNO_UNCHANGED),
     TEST_ff_f (atan2, -max_value, minus_infty, -pi, ERRNO_UNCHANGED),
 
-    TEST_ff_f (atan2, plus_infty, plus_infty, M_PI_4l, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, minus_infty, plus_infty, -M_PI_4l, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, plus_infty, plus_infty, pi_4_d, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, minus_infty, plus_infty, -pi_4_d, ERRNO_UNCHANGED),
     TEST_ff_f (atan2, plus_infty, minus_infty, pi_3_m_4_d, ERRNO_UNCHANGED),
     TEST_ff_f (atan2, minus_infty, minus_infty, -pi_3_m_4_d, ERRNO_UNCHANGED),
     TEST_ff_f (atan2, qnan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
@@ -2093,8 +2095,8 @@ static const struct test_c_c_data cacos_test_data[] =
     TEST_c_c (cacos, minus_infty, plus_infty, pi_3_m_4_d, minus_infty),
     TEST_c_c (cacos, minus_infty, minus_infty, pi_3_m_4_d, plus_infty),
 
-    TEST_c_c (cacos, plus_infty, plus_infty, M_PI_4l, minus_infty),
-    TEST_c_c (cacos, plus_infty, minus_infty, M_PI_4l, plus_infty),
+    TEST_c_c (cacos, plus_infty, plus_infty, pi_4_d, minus_infty),
+    TEST_c_c (cacos, plus_infty, minus_infty, pi_4_d, plus_infty),
 
     TEST_c_c (cacos, -10.0, plus_infty, pi_2_d, minus_infty),
     TEST_c_c (cacos, -10.0, minus_infty, pi_2_d, plus_infty),
@@ -2780,8 +2782,8 @@ static const struct test_c_c_data cacosh_test_data[] =
     TEST_c_c (cacosh, minus_infty, plus_infty, plus_infty, pi_3_m_4_d),
     TEST_c_c (cacosh, minus_infty, minus_infty, plus_infty, -pi_3_m_4_d),
 
-    TEST_c_c (cacosh, plus_infty, plus_infty, plus_infty, M_PI_4l),
-    TEST_c_c (cacosh, plus_infty, minus_infty, plus_infty, -M_PI_4l),
+    TEST_c_c (cacosh, plus_infty, plus_infty, plus_infty, pi_4_d),
+    TEST_c_c (cacosh, plus_infty, minus_infty, plus_infty, -pi_4_d),
 
     TEST_c_c (cacosh, -10.0, plus_infty, plus_infty, pi_2_d),
     TEST_c_c (cacosh, -10.0, minus_infty, plus_infty, -pi_2_d),
@@ -3476,9 +3478,9 @@ static const struct test_c_f_data carg_test_data[] =
     /* carg (-inf + i y) == -pi for finite y < 0.  */
     TEST_c_f (carg, minus_infty, -10.0, -pi),
 
-    TEST_c_f (carg, plus_infty, plus_infty, M_PI_4l),
+    TEST_c_f (carg, plus_infty, plus_infty, pi_4_d),
 
-    TEST_c_f (carg, plus_infty, minus_infty, -M_PI_4l),
+    TEST_c_f (carg, plus_infty, minus_infty, -pi_4_d),
 
     TEST_c_f (carg, minus_infty, plus_infty, pi_3_m_4_d),
 
@@ -3502,10 +3504,10 @@ static const struct test_c_c_data casin_test_data[] =
     TEST_c_c (casin, 0, minus_zero, 0.0, minus_zero),
     TEST_c_c (casin, minus_zero, minus_zero, minus_zero, minus_zero),
 
-    TEST_c_c (casin, plus_infty, plus_infty, M_PI_4l, plus_infty),
-    TEST_c_c (casin, plus_infty, minus_infty, M_PI_4l, minus_infty),
-    TEST_c_c (casin, minus_infty, plus_infty, -M_PI_4l, plus_infty),
-    TEST_c_c (casin, minus_infty, minus_infty, -M_PI_4l, minus_infty),
+    TEST_c_c (casin, plus_infty, plus_infty, pi_4_d, plus_infty),
+    TEST_c_c (casin, plus_infty, minus_infty, pi_4_d, minus_infty),
+    TEST_c_c (casin, minus_infty, plus_infty, -pi_4_d, plus_infty),
+    TEST_c_c (casin, minus_infty, minus_infty, -pi_4_d, minus_infty),
 
     TEST_c_c (casin, -10.0, plus_infty, minus_zero, plus_infty),
     TEST_c_c (casin, -10.0, minus_infty, minus_zero, minus_infty),
@@ -4192,10 +4194,10 @@ static const struct test_c_c_data casinh_test_data[] =
     TEST_c_c (casinh, 0, minus_zero, 0.0, minus_zero),
     TEST_c_c (casinh, minus_zero, minus_zero, minus_zero, minus_zero),
 
-    TEST_c_c (casinh, plus_infty, plus_infty, plus_infty, M_PI_4l),
-    TEST_c_c (casinh, plus_infty, minus_infty, plus_infty, -M_PI_4l),
-    TEST_c_c (casinh, minus_infty, plus_infty, minus_infty, M_PI_4l),
-    TEST_c_c (casinh, minus_infty, minus_infty, minus_infty, -M_PI_4l),
+    TEST_c_c (casinh, plus_infty, plus_infty, plus_infty, pi_4_d),
+    TEST_c_c (casinh, plus_infty, minus_infty, plus_infty, -pi_4_d),
+    TEST_c_c (casinh, minus_infty, plus_infty, minus_infty, pi_4_d),
+    TEST_c_c (casinh, minus_infty, minus_infty, minus_infty, -pi_4_d),
 
     TEST_c_c (casinh, -10.0, plus_infty, minus_infty, pi_2_d),
     TEST_c_c (casinh, -10.0, minus_infty, minus_infty, -pi_2_d),
@@ -4882,10 +4884,10 @@ static const struct test_c_c_data catan_test_data[] =
     TEST_c_c (catan, 0, minus_zero, 0, minus_zero),
     TEST_c_c (catan, minus_zero, minus_zero, minus_zero, minus_zero),
 
-    TEST_c_c (catan, 1.0L, plus_zero, M_PI_4l, plus_zero),
-    TEST_c_c (catan, 1.0L, minus_zero, M_PI_4l, minus_zero),
-    TEST_c_c (catan, -1.0L, plus_zero, -M_PI_4l, plus_zero),
-    TEST_c_c (catan, -1.0L, minus_zero, -M_PI_4l, minus_zero),
+    TEST_c_c (catan, 1.0L, plus_zero, pi_4_d, plus_zero),
+    TEST_c_c (catan, 1.0L, minus_zero, pi_4_d, minus_zero),
+    TEST_c_c (catan, -1.0L, plus_zero, -pi_4_d, plus_zero),
+    TEST_c_c (catan, -1.0L, minus_zero, -pi_4_d, minus_zero),
     TEST_c_c (catan, plus_zero, 1.0L, plus_zero, plus_infty, DIVIDE_BY_ZERO_EXCEPTION),
     TEST_c_c (catan, minus_zero, 1.0L, minus_zero, plus_infty, DIVIDE_BY_ZERO_EXCEPTION),
     TEST_c_c (catan, plus_zero, -1.0L, plus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION),
@@ -5392,10 +5394,10 @@ static const struct test_c_c_data catanh_test_data[] =
     TEST_c_c (catanh, 1.0L, minus_zero, plus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION),
     TEST_c_c (catanh, -1.0L, plus_zero, minus_infty, plus_zero, DIVIDE_BY_ZERO_EXCEPTION),
     TEST_c_c (catanh, -1.0L, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION),
-    TEST_c_c (catanh, plus_zero, 1.0L, plus_zero, M_PI_4l),
-    TEST_c_c (catanh, minus_zero, 1.0L, minus_zero, M_PI_4l),
-    TEST_c_c (catanh, plus_zero, -1.0L, plus_zero, -M_PI_4l),
-    TEST_c_c (catanh, minus_zero, -1.0L, minus_zero, -M_PI_4l),
+    TEST_c_c (catanh, plus_zero, 1.0L, plus_zero, pi_4_d),
+    TEST_c_c (catanh, minus_zero, 1.0L, minus_zero, pi_4_d),
+    TEST_c_c (catanh, plus_zero, -1.0L, plus_zero, -pi_4_d),
+    TEST_c_c (catanh, minus_zero, -1.0L, minus_zero, -pi_4_d),
 
     TEST_c_c (catanh, plus_infty, plus_infty, 0.0, pi_2_d),
     TEST_c_c (catanh, plus_infty, minus_infty, 0.0, -pi_2_d),
@@ -6245,8 +6247,8 @@ static const struct test_c_c_data clog_test_data[] =
     TEST_c_c (clog, minus_infty, plus_infty, plus_infty, pi_3_m_4_d),
     TEST_c_c (clog, minus_infty, minus_infty, plus_infty, -pi_3_m_4_d),
 
-    TEST_c_c (clog, plus_infty, plus_infty, plus_infty, M_PI_4l),
-    TEST_c_c (clog, plus_infty, minus_infty, plus_infty, -M_PI_4l),
+    TEST_c_c (clog, plus_infty, plus_infty, plus_infty, pi_4_d),
+    TEST_c_c (clog, plus_infty, minus_infty, plus_infty, -pi_4_d),
 
     TEST_c_c (clog, 0, plus_infty, plus_infty, pi_2_d),
     TEST_c_c (clog, 3, plus_infty, plus_infty, pi_2_d),
-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCHv2 03/14] Begin refactor of libm-test.inc
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
                     ` (11 preceding siblings ...)
  2016-05-20 21:37   ` [PATCHv2 02/14] Fixup usage of MIN_EXP " Paul E. Murphy
@ 2016-05-20 21:38   ` Paul E. Murphy
  2016-05-23 16:10     ` Joseph Myers
  2016-05-20 21:38   ` [PATCHv2 10/14] Add note about nexttoward test cases in libm-test.inc Paul E. Murphy
                     ` (9 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-20 21:38 UTC (permalink / raw)
  To: libc-alpha

Attempt to creatively redefine the macros
to choose tests based on the format being
tested, not the type.

Note, TS 18661 does not define any printf
modifiers, so we need to be a little more
verbose about constructing strings to
output.

	* math/libm-test.inc:
	[__EXPAND]: New Macro.
	[_EXPAND]: New Macro.
	[TYPE_DECIMAL_DIG]: Redefine using type supplied PREFIX macro.
	[TYPE_MIN]: Likewise.
	[TYPE_TRUE_MIN]: Likewise.
	[TYPE_MAX]: Likewise.
	[MIN_EXP]: Likewise.
	[MAX_EXP]: Likewise.
	[MANT_DIG]: Likewise.

	[FSTR_MAX]: New macro.
	[TYPESTR]: Likewise.
	[TEST_COND_binary32]: Likewise.
	[TEST_COND_binary64]: Likewise.
	[TEST_COND_binary128]: Likewise.
	[TEST_COND_ibm128]: Likewise.
	[TEST_COND_intel96]: Likewise.
	[TEST_COND_m68k96]: Likewise.

	[TEST_COND_flt_32]: Redefine as equivalent format test 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.

	[plus_zero]: Redefine using LIT macro.
	[minus_zero]: Likewise.
	[plus_infty]: Redefine as (INF).
	[minux_infty]: Redefine as (-INF).
	[max_value]: Redefine as TYPE_MAX.
	[min_value]: Redefine as TYPE_MIN.
	[min_subnorm_value]: Redefine as TYPE_TRUE_MIN.

	(print_float): Refactor to use snprintf to convert FLOAT values
	to string. This enables dropin replacement of strtof for the
	TS 18661 defined types.
	(update_stats): Likewise.
	(print_complex_function_ulps): Likewise.
	(print_max_error): Likewise.
	(print_complex_max_error): Likewise.
	(check_float_internal): Likewise.

	* math/test-float.h [PREFIX]: New macro.
	[LIT]: Likewise.
	[TSTR]: Likewise.
	[FTOSTR]: Likewise.
	[INF]: Likewise.

	* math/test-double.h [PREFIX]: New macro.
	[LIT]: Likewise.
	[TSTR]: Likewise.
	[FTOSTR]: Likewise.
	[INF]: Likewise.

	* math/test-ldouble.h [PREFIX]: New macro.
	[LIT]: Likewise.
	[TSTR]: Likewise.
	[FTOSTR]: Likewise.
	[INF]: Likewise.
---
 math/libm-test.inc  | 211 +++++++++++++++++++++++++++++-----------------------
 math/test-double.h  |   5 ++
 math/test-float.h   |   5 ++
 math/test-ldouble.h |   5 ++
 4 files changed, 132 insertions(+), 94 deletions(-)

diff --git a/math/libm-test.inc b/math/libm-test.inc
index 538f448..eb6218d 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -34,7 +34,14 @@
    the specifier, not the percent and width arguments,
    e.g. "f".
    PRINTF_XEXPR	   Like PRINTF_EXPR, but print in hexadecimal format.
-   PRINTF_NEXPR Like PRINTF_EXPR, but print nice.  */
+   PRINTF_NEXPR Like PRINTF_EXPR, but print nice.
+   PREFIX A macro which defines the prefix for common macros for the
+   type (i.e LDBL, DBL, or FLT).
+   LIT A function which appends the correct suffix to a literal.
+   TSTR A macro which defines a stringitized name of the type.
+   FTOSTR This macro defines a function similar in type to snprintf
+   which converts a FLOAT to a string.
+   INF A macro defining the positive infinite value of the type.  */
 
 /* This testsuite has currently tests for:
    acos, acosh, asin, asinh, atan, atan2, atanh,
@@ -183,31 +190,76 @@ struct ulp_data
 #define IGNORE_RESULT			0x20000
 #define NON_FINITE			0x40000
 
+#define __EXPAND(x,y) x ## y
+#define _EXPAND(x,y) __EXPAND (x,y)
+
+#define TYPE_DECIMAL_DIG _EXPAND (PREFIX, _DECIMAL_DIG)
+#define TYPE_MIN _EXPAND (PREFIX, _MIN)
+#define TYPE_TRUE_MIN _EXPAND (PREFIX, _TRUE_MIN)
+#define TYPE_MAX _EXPAND (PREFIX, _MAX)
+#define MIN_EXP _EXPAND (PREFIX, _MIN_EXP)
+#define MAX_EXP _EXPAND (PREFIX, _MAX_EXP)
+#define MANT_DIG _EXPAND (PREFIX, _MANT_DIG)
+
+/* Maximum character buffer to store a stringitized FLOAT value. */
+# define FSTR_MAX (128)
+
+#if TEST_INLINE
+# define TYPESTR "i" TSTR
+#else
+# define TYPESTR TSTR
+#endif
+
+/* Format specific test macros.  */
+#define TEST_COND_binary32 (MANT_DIG == 24	\
+			    && MIN_EXP == -125	\
+			    && MAX_EXP == 128)
+
+#define TEST_COND_binary64 (MANT_DIG == 53	\
+			    && MIN_EXP == -1021	\
+			    && MAX_EXP == 1024)
+
+#define TEST_COND_binary128 (MANT_DIG == 113		\
+			     && MIN_EXP == -16381	\
+			     && MAX_EXP == 16384)
+
+#define TEST_COND_ibm128 (MANT_DIG == 106)
+
+#define TEST_COND_intel96 (MANT_DIG == 64	\
+			   && MIN_EXP == -16381	\
+			   && MAX_EXP == 16384)
+
+#define TEST_COND_m68k96 (MANT_DIG == 64	\
+			  && MIN_EXP == -16382	\
+			  && MAX_EXP == 16384)
+
 /* Values underflowing only for float.  */
-#ifdef TEST_FLOAT
+#if TEST_COND_binary32
 # define UNDERFLOW_EXCEPTION_FLOAT	UNDERFLOW_EXCEPTION
 # define UNDERFLOW_EXCEPTION_OK_FLOAT	UNDERFLOW_EXCEPTION_OK
 #else
 # define UNDERFLOW_EXCEPTION_FLOAT	0
 # define UNDERFLOW_EXCEPTION_OK_FLOAT	0
 #endif
+
 /* Values underflowing only for double or types with a larger least
    positive normal value.  */
-#if defined TEST_FLOAT || defined TEST_DOUBLE \
-  || (defined TEST_LDOUBLE && LDBL_MIN_EXP >= DBL_MIN_EXP)
+#if TEST_COND_binary32 || TEST_COND_binary64 || TEST_COND_ibm128
 # define UNDERFLOW_EXCEPTION_DOUBLE	UNDERFLOW_EXCEPTION
 # define UNDERFLOW_EXCEPTION_OK_DOUBLE	UNDERFLOW_EXCEPTION_OK
 #else
 # define UNDERFLOW_EXCEPTION_DOUBLE	0
 # define UNDERFLOW_EXCEPTION_OK_DOUBLE	0
 #endif
+
 /* Values underflowing only for IBM long double or types with a larger least
    positive normal value.  */
-#if defined TEST_FLOAT || (defined TEST_LDOUBLE && LDBL_MIN_EXP > DBL_MIN_EXP)
+#if TEST_COND_binary32 || TEST_COND_ibm128
 # define UNDERFLOW_EXCEPTION_LDOUBLE_IBM	UNDERFLOW_EXCEPTION
 #else
 # define UNDERFLOW_EXCEPTION_LDOUBLE_IBM	0
 #endif
+
 /* Values underflowing on architectures detecting tininess before
    rounding, but not on those detecting tininess after rounding.  */
 #define UNDERFLOW_EXCEPTION_BEFORE_ROUNDING	(TININESS_AFTER_ROUNDING \
@@ -227,36 +279,13 @@ struct ulp_data
 #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
+#define TEST_COND_flt_32 TEST_COND_binary32
+#define TEST_COND_dbl_64 TEST_COND_binary64
+#define TEST_COND_ldbl_96_intel TEST_COND_intel96
+#define TEST_COND_ldbl_96_m68k  TEST_COND_m68k96
+#define TEST_COND_ldbl_128 TEST_COND_binary128
+#define TEST_COND_ldbl_128ibm TEST_COND_ibm128
+
 #if LONG_MAX == 0x7fffffff
 # define TEST_COND_long32	1
 # define TEST_COND_long64	0
@@ -302,25 +331,14 @@ static int output_max_error;	/* Should the maximal errors printed?  */
 static int output_points;	/* Should the single function results printed?  */
 static int ignore_max_ulp;	/* Should we ignore max_ulp?  */
 
-#define plus_zero	CHOOSE (0.0L, 0.0, 0.0f,	\
-				0.0L, 0.0, 0.0f)
-#define minus_zero	CHOOSE (-0.0L, -0.0, -0.0f,	\
-				-0.0L, -0.0, -0.0f)
-#define plus_infty	CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF, \
-				HUGE_VALL, HUGE_VAL, HUGE_VALF)
-#define minus_infty	CHOOSE (-HUGE_VALL, -HUGE_VAL, -HUGE_VALF,	\
-				-HUGE_VALL, -HUGE_VAL, -HUGE_VALF)
+#define plus_zero	LIT (0.0)
+#define minus_zero	LIT (-0.0)
+#define plus_infty	(INF)
+#define minus_infty	(-INF)
 #define qnan_value	FUNC (__builtin_nan) ("")
-#define max_value	CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX,	\
-				LDBL_MAX, DBL_MAX, FLT_MAX)
-#define min_value	CHOOSE (LDBL_MIN, DBL_MIN, FLT_MIN,	\
-				LDBL_MIN, DBL_MIN, FLT_MIN)
-#define min_subnorm_value	CHOOSE (LDBL_TRUE_MIN,	\
-					DBL_TRUE_MIN,	\
-					FLT_TRUE_MIN,	\
-					LDBL_TRUE_MIN,	\
-					DBL_TRUE_MIN,	\
-					FLT_TRUE_MIN)
+#define max_value	TYPE_MAX
+#define min_value	TYPE_MIN
+#define min_subnorm_value TYPE_TRUE_MIN
 
 static FLOAT max_error, real_max_error, imag_max_error;
 
@@ -328,23 +346,11 @@ static FLOAT prev_max_error, prev_real_max_error, prev_imag_max_error;
 
 static FLOAT max_valid_error;
 
-#define MANT_DIG CHOOSE (LDBL_MANT_DIG, DBL_MANT_DIG, FLT_MANT_DIG,  \
-			 LDBL_MANT_DIG, DBL_MANT_DIG, FLT_MANT_DIG)
-#define MIN_EXP CHOOSE (LDBL_MIN_EXP, DBL_MIN_EXP, FLT_MIN_EXP,	\
-			LDBL_MIN_EXP, DBL_MIN_EXP, FLT_MIN_EXP)
-#define MAX_EXP CHOOSE (LDBL_MAX_EXP, DBL_MAX_EXP, FLT_MAX_EXP, \
-			LDBL_MAX_EXP, DBL_MAX_EXP, FLT_MAX_EXP)
 /* Sufficient numbers of digits to represent any floating-point value
    unambiguously (for any choice of the number of bits in the first
    hex digit, in the case of TYPE_HEX_DIG).  When used with printf
    formats where the precision counts only digits after the point, 1
    is subtracted from these values. */
-#define TYPE_DECIMAL_DIG CHOOSE (LDBL_DECIMAL_DIG,	\
-				 DBL_DECIMAL_DIG,	\
-				 FLT_DECIMAL_DIG,	\
-				 LDBL_DECIMAL_DIG,	\
-				 DBL_DECIMAL_DIG,	\
-				 FLT_DECIMAL_DIG)
 #define TYPE_HEX_DIG ((MANT_DIG + 6) / 4)
 
 /* Compare KEY (a string, with the name of a function) with ULP (a
@@ -427,8 +433,12 @@ print_float (FLOAT f)
   else if (isnan (f))
     printf ("qNaN\n");
   else
-    printf ("% .*" PRINTF_EXPR "  % .*" PRINTF_XEXPR "\n",
-	    TYPE_DECIMAL_DIG - 1, f, TYPE_HEX_DIG - 1, f);
+    {
+      char fstrn[FSTR_MAX], fstrx[FSTR_MAX];
+      FTOSTR (fstrn, FSTR_MAX, "% .*" PRINTF_EXPR, TYPE_DECIMAL_DIG - 1, f);
+      FTOSTR (fstrx, FSTR_MAX, "% .*" PRINTF_XEXPR, TYPE_HEX_DIG - 1, f);
+      printf ("%s  %s\n", fstrn, fstrx);
+    }
 }
 
 /* Should the message print to screen?  This depends on the verbose flag,
@@ -470,11 +480,10 @@ print_function_ulps (const char *function_name, FLOAT ulp)
 {
   if (output_ulps)
     {
+      char ustrn[FSTR_MAX];
+      FTOSTR (ustrn, FSTR_MAX, "%.0" PRINTF_NEXPR, FUNC (ceil) (ulp));
       fprintf (ulps_file, "Function: \"%s\":\n", function_name);
-      fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
-	       CHOOSE("ldouble", "double", "float",
-		      "ildouble", "idouble", "ifloat"),
-	       FUNC(ceil) (ulp));
+      fprintf (ulps_file, TYPESTR ": %s\n", ustrn);
     }
 }
 
@@ -485,21 +494,20 @@ print_complex_function_ulps (const char *function_name, FLOAT real_ulp,
 {
   if (output_ulps)
     {
+      char fstrn[FSTR_MAX];
       if (real_ulp != 0.0)
 	{
+	  FTOSTR (fstrn, FSTR_MAX, "%.0" PRINTF_NEXPR,
+	            FUNC (ceil) (real_ulp));
 	  fprintf (ulps_file, "Function: Real part of \"%s\":\n", function_name);
-	  fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
-		   CHOOSE("ldouble", "double", "float",
-			  "ildouble", "idouble", "ifloat"),
-		   FUNC(ceil) (real_ulp));
+	  fprintf (ulps_file, TYPESTR ": %s\n", fstrn);
 	}
       if (imag_ulp != 0.0)
 	{
+	  FTOSTR (fstrn, FSTR_MAX, "%.0" PRINTF_NEXPR,
+	            FUNC (ceil) (imag_ulp));
 	  fprintf (ulps_file, "Function: Imaginary part of \"%s\":\n", function_name);
-	  fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
-		   CHOOSE("ldouble", "double", "float",
-			  "ildouble", "idouble", "ifloat"),
-		   FUNC(ceil) (imag_ulp));
+	  fprintf (ulps_file, TYPESTR ": %s\n", fstrn);
 	}
 
 
@@ -547,10 +555,12 @@ print_max_error (const char *func_name)
 
   if (print_screen_max_error (ok))
     {
+      char mestr[FSTR_MAX], pmestr[FSTR_MAX];
+      FTOSTR (mestr, FSTR_MAX, "%.0" PRINTF_NEXPR, FUNC (ceil) (max_error));
+      FTOSTR (pmestr, FSTR_MAX, "%.0" PRINTF_NEXPR, FUNC (ceil) (prev_max_error));
       printf ("Maximal error of `%s'\n", func_name);
-      printf (" is      : %.0" PRINTF_NEXPR " ulp\n", FUNC(ceil) (max_error));
-      printf (" accepted: %.0" PRINTF_NEXPR " ulp\n",
-	      FUNC(ceil) (prev_max_error));
+      printf (" is      : %s ulp\n", mestr);
+      printf (" accepted: %s ulp\n", pmestr);
     }
 
   update_stats (ok);
@@ -583,16 +593,22 @@ print_complex_max_error (const char *func_name)
 
   if (print_screen_max_error (ok))
     {
+      char rmestr[FSTR_MAX], prmestr[FSTR_MAX];
+      char imestr[FSTR_MAX], pimestr[FSTR_MAX];
+      FTOSTR (rmestr, FSTR_MAX, "%.0" PRINTF_NEXPR,
+		FUNC (ceil) (real_max_error));
+      FTOSTR (prmestr, FSTR_MAX, "%.0" PRINTF_NEXPR,
+		FUNC (ceil) (prev_real_max_error));
+      FTOSTR (imestr, FSTR_MAX, "%.0" PRINTF_NEXPR,
+		FUNC (ceil) (imag_max_error));
+      FTOSTR (pimestr, FSTR_MAX, "%.0" PRINTF_NEXPR,
+		FUNC (ceil) (prev_imag_max_error));
       printf ("Maximal error of real part of: %s\n", func_name);
-      printf (" is      : %.0" PRINTF_NEXPR " ulp\n",
-	      FUNC(ceil) (real_max_error));
-      printf (" accepted: %.0" PRINTF_NEXPR " ulp\n",
-	      FUNC(ceil) (prev_real_max_error));
+      printf (" is      : %s ulp\n", rmestr);
+      printf (" accepted: %s ulp\n", prmestr);
       printf ("Maximal error of imaginary part of: %s\n", func_name);
-      printf (" is      : %.0" PRINTF_NEXPR " ulp\n",
-	      FUNC(ceil) (imag_max_error));
-      printf (" accepted: %.0" PRINTF_NEXPR " ulp\n",
-	      FUNC(ceil) (prev_imag_max_error));
+      printf (" is      : %s ulp\n", imestr);
+      printf (" accepted: %s ulp\n", pimestr);
     }
 
   update_stats (ok);
@@ -850,10 +866,17 @@ check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
       print_float (expected);
       if (print_diff)
 	{
-	  printf (" difference: % .*" PRINTF_EXPR "  % .*" PRINTF_XEXPR
-		  "\n", TYPE_DECIMAL_DIG - 1, diff, TYPE_HEX_DIG - 1, diff);
-	  printf (" ulp       : % .4" PRINTF_NEXPR "\n", ulps);
-	  printf (" max.ulp   : % .4" PRINTF_NEXPR "\n", max_ulp);
+	  char dstrn[FSTR_MAX], dstrx[FSTR_MAX];
+	  char ustrn[FSTR_MAX], mustrn[FSTR_MAX];
+	  FTOSTR (dstrn, FSTR_MAX, "% .*" PRINTF_EXPR,
+		  TYPE_DECIMAL_DIG - 1, diff);
+	  FTOSTR (dstrx, FSTR_MAX, "% .*" PRINTF_XEXPR,
+		  TYPE_HEX_DIG - 1, diff);
+	  FTOSTR (ustrn, FSTR_MAX, "% .4" PRINTF_NEXPR, ulps);
+	  FTOSTR (mustrn, FSTR_MAX, "% .4" PRINTF_NEXPR, max_ulp);
+	  printf (" difference: %s  %s\n", dstrn, dstrx);
+	  printf (" ulp       : %s\n", ustrn);
+	  printf (" max.ulp   : %s\n", mustrn);
 	}
     }
   update_stats (ok);
diff --git a/math/test-double.h b/math/test-double.h
index 16b4ce8..0ece942 100644
--- a/math/test-double.h
+++ b/math/test-double.h
@@ -23,3 +23,8 @@
 #define PRINTF_NEXPR "f"
 #define TEST_DOUBLE 1
 #define BUILD_COMPLEX(real, imag) (CMPLX ((real), (imag)))
+#define PREFIX DBL
+#define LIT(x) (x)
+#define TSTR "double"
+#define FTOSTR snprintf
+#define INF HUGE_VAL
diff --git a/math/test-float.h b/math/test-float.h
index 629f6ee..d92612b 100644
--- a/math/test-float.h
+++ b/math/test-float.h
@@ -23,3 +23,8 @@
 #define PRINTF_NEXPR "f"
 #define TEST_FLOAT 1
 #define BUILD_COMPLEX(real, imag) (CMPLXF ((real), (imag)))
+#define PREFIX FLT
+#define TSTR "float"
+#define LIT(x) (x ## f)
+#define FTOSTR snprintf
+#define INF HUGE_VALF
diff --git a/math/test-ldouble.h b/math/test-ldouble.h
index 481561f..96a3dac 100644
--- a/math/test-ldouble.h
+++ b/math/test-ldouble.h
@@ -23,3 +23,8 @@
 #define PRINTF_NEXPR "Lf"
 #define TEST_LDOUBLE 1
 #define BUILD_COMPLEX(real, imag) (CMPLXL ((real), (imag)))
+#define PREFIX LDBL
+#define TSTR "ldouble"
+#define LIT(x) (x ## L)
+#define FTOSTR snprintf
+#define INF HUGE_VALL
-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCHv2 13/14] Remove type specific information from auto-libm-test-in
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
                     ` (16 preceding siblings ...)
  2016-05-20 21:38   ` [PATCHv2 04/14] Refactor type specific macros using regexes Paul E. Murphy
@ 2016-05-20 21:38   ` Paul E. Murphy
  2016-05-20 21:38   ` [PATCHv2 12/14] Remove CHOOSE() macro from libm-tests.inc Paul E. Murphy
                     ` (4 subsequent siblings)
  22 siblings, 0 replies; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-20 21:38 UTC (permalink / raw)
  To: libc-alpha

Apply the following sed regexes to auto-libm-test-in in order:

s/flt-32/binary32/
s/dbl-64/binary64/
s/ldbl-96-intel/intel96/
s/ldbl-96-m68k/m68k96/
s/ldbl-128ibm/ibm128/
s/ldbl-128/binary128/

and fixup ldbl-96 comment manually.

	* auto-libm-test-in:
	Replace flt-32 usage with binary32.
	Replace dbl-64 usage with binary64.
	Replace ldbl-intel-96 usage with intel96.
	Replace ldbl-m68k-96 usage with m68k96.
	Replace ldbl-128ibm usage with ibm128.
	Replace ldbl-128 usage with binary128.
	* auto-libm-test-out: Regenerate.
---
 math/auto-libm-test-in | 115 +++++++++++++++++++++++++------------------------
 1 file changed, 58 insertions(+), 57 deletions(-)

diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
index 72a1f3c..ffcc40a 100644
--- a/math/auto-libm-test-in
+++ b/math/auto-libm-test-in
@@ -1175,8 +1175,8 @@ cosh -0xd.0c03p+0
 cosh -0x3.d04328728b72cp-4
 cosh 0x1.629188p+4
 # GCC bug 59666: results on directed rounding may be incorrect.
-cosh max no-test-inline xfail-rounding:ldbl-128ibm
-cosh -max no-test-inline xfail-rounding:ldbl-128ibm
+cosh max no-test-inline xfail-rounding:ibm128
+cosh -max no-test-inline xfail-rounding:ibm128
 cosh min
 cosh -min
 cosh min_subnorm
@@ -1191,22 +1191,22 @@ cosh 0x5.96a7e8p+4
 cosh -0x5.96a7ep+4
 cosh -0x5.96a7e8p+4
 # GCC bug 59666: results on directed rounding may be incorrect.
-cosh 0x2.c679d1f73f0fap+8 xfail-rounding:ldbl-128ibm
-cosh 0x2.c679d1f73f0fcp+8 xfail-rounding:ldbl-128ibm
-cosh -0x2.c679d1f73f0fap+8 xfail-rounding:ldbl-128ibm
-cosh -0x2.c679d1f73f0fcp+8 xfail-rounding:ldbl-128ibm
-cosh 0x2.c679d1f73f0fb624d358b213a7p+8 xfail-rounding:ldbl-128ibm
-cosh 0x2.c679d1f73f0fb624d358b213a8p+8 xfail-rounding:ldbl-128ibm
-cosh -0x2.c679d1f73f0fb624d358b213a7p+8 xfail-rounding:ldbl-128ibm
-cosh -0x2.c679d1f73f0fb624d358b213a8p+8 xfail-rounding:ldbl-128ibm
-cosh 0x2.c5d37700c6bb03a4p+12 no-test-inline xfail-rounding:ldbl-128ibm
-cosh 0x2.c5d37700c6bb03a8p+12 no-test-inline xfail-rounding:ldbl-128ibm
-cosh -0x2.c5d37700c6bb03a4p+12 no-test-inline xfail-rounding:ldbl-128ibm
-cosh -0x2.c5d37700c6bb03a8p+12 no-test-inline xfail-rounding:ldbl-128ibm
-cosh 0x2.c5d37700c6bb03a6c24b6c9b494cp+12 no-test-inline xfail-rounding:ldbl-128ibm
-cosh 0x2.c5d37700c6bb03a6c24b6c9b494ep+12 no-test-inline xfail-rounding:ldbl-128ibm
-cosh -0x2.c5d37700c6bb03a6c24b6c9b494cp+12 no-test-inline xfail-rounding:ldbl-128ibm
-cosh -0x2.c5d37700c6bb03a6c24b6c9b494ep+12 no-test-inline xfail-rounding:ldbl-128ibm
+cosh 0x2.c679d1f73f0fap+8 xfail-rounding:ibm128
+cosh 0x2.c679d1f73f0fcp+8 xfail-rounding:ibm128
+cosh -0x2.c679d1f73f0fap+8 xfail-rounding:ibm128
+cosh -0x2.c679d1f73f0fcp+8 xfail-rounding:ibm128
+cosh 0x2.c679d1f73f0fb624d358b213a7p+8 xfail-rounding:ibm128
+cosh 0x2.c679d1f73f0fb624d358b213a8p+8 xfail-rounding:ibm128
+cosh -0x2.c679d1f73f0fb624d358b213a7p+8 xfail-rounding:ibm128
+cosh -0x2.c679d1f73f0fb624d358b213a8p+8 xfail-rounding:ibm128
+cosh 0x2.c5d37700c6bb03a4p+12 no-test-inline xfail-rounding:ibm128
+cosh 0x2.c5d37700c6bb03a8p+12 no-test-inline xfail-rounding:ibm128
+cosh -0x2.c5d37700c6bb03a4p+12 no-test-inline xfail-rounding:ibm128
+cosh -0x2.c5d37700c6bb03a8p+12 no-test-inline xfail-rounding:ibm128
+cosh 0x2.c5d37700c6bb03a6c24b6c9b494cp+12 no-test-inline xfail-rounding:ibm128
+cosh 0x2.c5d37700c6bb03a6c24b6c9b494ep+12 no-test-inline xfail-rounding:ibm128
+cosh -0x2.c5d37700c6bb03a6c24b6c9b494cp+12 no-test-inline xfail-rounding:ibm128
+cosh -0x2.c5d37700c6bb03a6c24b6c9b494ep+12 no-test-inline xfail-rounding:ibm128
 
 cpow 1 0 0 0 ignore-zero-inf-sign
 cpow 2 0 10 0 ignore-zero-inf-sign
@@ -1410,8 +1410,8 @@ ctan 1 47
 ctan 1 355
 ctan 1 365
 # GCC bug 59666: results on directed rounding may be incorrect.
-ctan 1 5680 xfail-rounding:ldbl-128ibm
-ctan 1 5690 xfail-rounding:ldbl-128ibm
+ctan 1 5680 xfail-rounding:ibm128
+ctan 1 5690 xfail-rounding:ibm128
 
 ctan 0x3.243f6cp-1 0
 
@@ -1420,10 +1420,10 @@ ctan 0x1p1023 1
 ctan 0x1p16383 1
 
 # GCC bug 59666: results on directed rounding may be incorrect.
-ctan 50000 50000 xfail-rounding:ldbl-128ibm
-ctan 50000 -50000 xfail-rounding:ldbl-128ibm
-ctan -50000 50000 xfail-rounding:ldbl-128ibm
-ctan -50000 -50000 xfail-rounding:ldbl-128ibm
+ctan 50000 50000 xfail-rounding:ibm128
+ctan 50000 -50000 xfail-rounding:ibm128
+ctan -50000 50000 xfail-rounding:ibm128
+ctan -50000 -50000 xfail-rounding:ibm128
 
 ctan 0x1.921fb6p+0 0x1p-149
 ctan 0x1.921fb54442d18p+0 0x1p-1074
@@ -1453,8 +1453,8 @@ ctanh 47 1
 ctanh 355 1
 ctanh 365 1
 # GCC bug 59666: results on directed rounding may be incorrect.
-ctanh 5680 1 xfail-rounding:ldbl-128ibm
-ctanh 5690 1 xfail-rounding:ldbl-128ibm
+ctanh 5680 1 xfail-rounding:ibm128
+ctanh 5690 1 xfail-rounding:ibm128
 
 ctanh 0 0x3.243f6cp-1
 
@@ -1463,10 +1463,10 @@ ctanh 1 0x1p1023
 ctanh 1 0x1p16383
 
 # GCC bug 59666: results on directed rounding may be incorrect.
-ctanh 50000 50000 xfail-rounding:ldbl-128ibm
-ctanh 50000 -50000 xfail-rounding:ldbl-128ibm
-ctanh -50000 50000 xfail-rounding:ldbl-128ibm
-ctanh -50000 -50000 xfail-rounding:ldbl-128ibm
+ctanh 50000 50000 xfail-rounding:ibm128
+ctanh 50000 -50000 xfail-rounding:ibm128
+ctanh -50000 50000 xfail-rounding:ibm128
+ctanh -50000 -50000 xfail-rounding:ibm128
 
 ctanh 0x1p-149 0x1.921fb6p+0
 ctanh 0x1p-1074 0x1.921fb54442d18p+0
@@ -1672,13 +1672,13 @@ exp 50.0
 exp 88.72269439697265625
 exp 709.75
 # GCC bug 59666: results on directed rounding may be incorrect.
-exp 1000.0 xfail-rounding:ldbl-128ibm
-exp 710 xfail-rounding:ldbl-128ibm
+exp 1000.0 xfail-rounding:ibm128
+exp 710 xfail-rounding:ibm128
 exp -1234
 # GCC bug 59666: results on directed rounding may be incorrect.
-exp 0x2.c679d1f73f0fb628p+8 xfail-rounding:ldbl-128ibm
-exp 1e5 xfail-rounding:ldbl-128ibm
-exp max xfail-rounding:ldbl-128ibm
+exp 0x2.c679d1f73f0fb628p+8 xfail-rounding:ibm128
+exp 1e5 xfail-rounding:ibm128
+exp max xfail-rounding:ibm128
 exp -7.4444006192138124e+02
 exp -0x1.75f113c30b1c8p+9
 exp -max
@@ -1757,21 +1757,21 @@ exp10 -36
 exp10 305
 exp10 -305
 # GCC bug 59666: results on directed rounding may be incorrect.
-exp10 4932 xfail-rounding:ldbl-128ibm
+exp10 4932 xfail-rounding:ibm128
 exp10 -4932
 exp10 -0x1.343793004f503232p12
 # GCC bug 59666: results on directed rounding may be incorrect.
-exp10 1e5 xfail-rounding:ldbl-128ibm
+exp10 1e5 xfail-rounding:ibm128
 exp10 -1e5
 # GCC bug 59666: results on directed rounding may be incorrect.
-exp10 1e6 xfail-rounding:ldbl-128ibm
+exp10 1e6 xfail-rounding:ibm128
 exp10 -1e6
 # GCC bug 59666: results on directed rounding may be incorrect.
-exp10 max xfail-rounding:ldbl-128ibm
+exp10 max xfail-rounding:ibm128
 exp10 -max
 exp10 0.75
 # GCC bug 59666: results on directed rounding may be incorrect.
-exp10 0x1.348e45573a1dd72cp+8 xfail-rounding:ldbl-128ibm
+exp10 0x1.348e45573a1dd72cp+8 xfail-rounding:ibm128
 exp10 -0x1.33aa03p+8
 exp10 -0x1.33ad17p+8
 exp10 -0x1.33afcap+8
@@ -1955,7 +1955,7 @@ expm1 100
 expm1 127.0
 expm1 500.0
 # GCC bug 59666: results on directed rounding may be incorrect.
-expm1 11356.25 xfail-rounding:ldbl-128ibm
+expm1 11356.25 xfail-rounding:ibm128
 expm1 -10.0
 expm1 -16.0
 expm1 -17.0
@@ -1977,8 +1977,8 @@ expm1 -1000.0
 expm1 -10000.0
 expm1 -100000.0
 # GCC bug 59666: results on directed rounding may be incorrect.
-expm1 100000.0 xfail-rounding:ldbl-128ibm
-expm1 max xfail-rounding:ldbl-128ibm
+expm1 100000.0 xfail-rounding:ibm128
+expm1 max xfail-rounding:ibm128
 expm1 -max
 expm1 0x1p-2
 expm1 -0x1p-2
@@ -2317,10 +2317,10 @@ hypot 0.75 1.25
 hypot 1.0 0x1p-61
 hypot 0x1p+0 0x1.fp-129
 hypot 0x1.23456789abcdef0123456789ab8p-500 0x1.23456789abcdef0123456789ab8p-500
-hypot 0x3p125 0x4p125 no-test-inline:flt-32
-hypot 0x1.234566p-126 0x1.234566p-126 no-test-inline:flt-32
-hypot 0x3p1021 0x4p1021 no-test-inline:dbl-64
-hypot 0x1p+0 0x0.3ep-1022 no-test-inline:dbl-64
+hypot 0x3p125 0x4p125 no-test-inline:binary32
+hypot 0x1.234566p-126 0x1.234566p-126 no-test-inline:binary32
+hypot 0x3p1021 0x4p1021 no-test-inline:binary64
+hypot 0x1p+0 0x0.3ep-1022 no-test-inline:binary64
 hypot 0x3p16381 0x4p16381 no-test-inline
 hypot 0x1p-149 0x1p-149
 hypot 0x1p-1074 0x1p-1074
@@ -2567,18 +2567,19 @@ lgamma -0x1p-16494
 # where a result inaccurate by a few ulp could differ from the ideal
 # result in whether it overflows; +/- 10ulp is sufficient for overflow
 # or its absence to be unambiguous under glibc's accuracy standards).
-# This also means the ldbl-128ibm inputs are XFAILed for dbl-64 and
-# the ldbl-128 inputs for ldbl-96, as too close to the threshold.
+# This also means the ibm128 inputs are XFAILed for binary64 and
+# the binary128 inputs for intel96 and m68k96, as too close to the
+# threshold.
 lgamma 0x3.12be0cp+120
 lgamma 0x3.12be6p+120
 lgamma 0x5.d53649e2d4674p+1012
 lgamma 0x5.d53649e2d46c8p+1012
-lgamma 0x5.d53649e2d469dbc1f01e99fd52p+1012 xfail:dbl-64
-lgamma 0x5.d53649e2d469dbc1f01e99fd7cp+1012 xfail:dbl-64
+lgamma 0x5.d53649e2d469dbc1f01e99fd52p+1012 xfail:binary64
+lgamma 0x5.d53649e2d469dbc1f01e99fd7cp+1012 xfail:binary64
 lgamma 0x5.c6aa645fffef5f5p+16368
 lgamma 0x5.c6aa645fffef5ff8p+16368
-lgamma 0x5.c6aa645fffef5fa912b9b480f7acp+16368 xfail:ldbl-96-intel xfail:ldbl-96-m68k
-lgamma 0x5.c6aa645fffef5fa912b9b480f8p+16368 xfail:ldbl-96-intel xfail:ldbl-96-m68k
+lgamma 0x5.c6aa645fffef5fa912b9b480f7acp+16368 xfail:intel96 xfail:m68k96
+lgamma 0x5.c6aa645fffef5fa912b9b480f8p+16368 xfail:intel96 xfail:m68k96
 
 lgamma -0x1.fa471547c2fe5p+1
 lgamma -0x1.9260dcp+1
@@ -2832,7 +2833,7 @@ lgamma -60.25
 lgamma -60.5
 lgamma -60.75
 
-# Integers +/- 1ulp for ldbl-128 (gen-auto-libm-tests will round these
+# Integers +/- 1ulp for binary128 (gen-auto-libm-tests will round these
 # to produce integers +/- 1ulp for other formats).
 lgamma -0xf.fffffffffffffffffffffffffff8p-4
 lgamma -0x1.0000000000000000000000000001p+0
@@ -4215,19 +4216,19 @@ tgamma -0x1p-127
 # IEEE semantics mean overflow very close to the threshold depends on
 # the rounding mode; gen-auto-libm-tests does not reflect that glibc
 # does not try to achieve this.
-tgamma 0x1p-128 spurious-overflow:flt-32
+tgamma 0x1p-128 spurious-overflow:binary32
 tgamma -0x1p-128
 tgamma 0x1p-149
 tgamma -0x1p-149
 tgamma 0x1p-1023
 tgamma -0x1p-1023
-tgamma 0x1p-1024 spurious-overflow:dbl-64 spurious-overflow:ldbl-128ibm
+tgamma 0x1p-1024 spurious-overflow:binary64 spurious-overflow:ibm128
 tgamma -0x1p-1024
 tgamma 0x1p-1074
 tgamma -0x1p-1074
 tgamma 0x1p-16383
 tgamma -0x1p-16383
-tgamma 0x1p-16384 spurious-overflow:ldbl-96-intel spurious-overflow:ldbl-96-m68k spurious-overflow:ldbl-128
+tgamma 0x1p-16384 spurious-overflow:intel96 spurious-overflow:m68k96 spurious-overflow:binary128
 tgamma -0x1p-16384
 tgamma 0x1p-16445
 tgamma -0x1p-16445
-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCHv2 04/14] Refactor type specific macros using regexes
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
                     ` (15 preceding siblings ...)
  2016-05-20 21:38   ` [PATCHv2 11/14] Apply LIT(x) to floating point literals in libm-test.c Paul E. Murphy
@ 2016-05-20 21:38   ` Paul E. Murphy
  2016-05-23 16:57     ` Joseph Myers
  2016-05-20 21:38   ` [PATCHv2 13/14] Remove type specific information from auto-libm-test-in Paul E. Murphy
                     ` (5 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-20 21:38 UTC (permalink / raw)
  To: libc-alpha

Replace most of the type specific macros  with the equivalent
type-generic macro using the following sed replacement command below:

sed -ri -e 's/defined TEST_FLOAT/TEST_COND_binary32/'     \
            -e 's/ndef TEST_FLOAT/ !TEST_COND_binary32/'  \
            -e 's/def TEST_FLOAT/ TEST_COND_binary32/'    \
            -e 's/defined TEST_DOUBLE/TEST_COND_binary64/'\
            -e 's/ndef TEST_DOUBLE/ !TEST_COND_binary64/' \
            -e 's/def TEST_DOUBLE/ TEST_COND_binary64/'   \
            -e 's/defined TEST_LDOUBLE && //'             \
            -e 's/ifdef TEST_LDOUBLE/if MANT_DIG >= 64/'  \
            -e 's/defined TEST_LDOUBLE/MANT_DIG >= 64/'   \
            -e '9941,10047!s/LDBL_(MIN_EXP|MAX_EXP|MANT_DIG)/\1/g'   \
            libm-test.inc

Note, TEST_LDOUBLE checks are replaced by MANT_DIG >= 64 excepting
where another property of the type is being tested.

Beware, the magic numbers of the final regex. This explicitly
avoids converting the LDBL_ macros of the nexttoward tests. This
function always takes a second long double argument.

	* math/libm-test.inc:
	[TEST_FLOAT]: Change usage to TEST_COND_binary32.
	[TEST_DOUBLE]: Change usage to TEST_COND_binary64.
	[TEST_LDOUBLE]: Change usage to TEST_COND_gt_binary64.
	[LDBL_MAX_EXP]: Change to TYPE_MAX_EXP.
	[LDBL_MIN_EXP]: Change to TYPE_MIN_EXP.
	[LDBL_MANT_DIG]: Change to TYPE_MANT_DIG, except for
	nexttoward tests.
---
 math/libm-test.inc | 674 ++++++++++++++++++++++++++---------------------------
 1 file changed, 337 insertions(+), 337 deletions(-)

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCHv2 10/14] Add note about nexttoward test cases in libm-test.inc
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
                     ` (12 preceding siblings ...)
  2016-05-20 21:38   ` [PATCHv2 03/14] Begin refactor of libm-test.inc Paul E. Murphy
@ 2016-05-20 21:38   ` Paul E. Murphy
  2016-05-23 17:07     ` Joseph Myers
  2016-05-20 21:38   ` [PATCHv2 08/14] Replace M_PI_4l with pi_4_d " Paul E. Murphy
                     ` (8 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-20 21:38 UTC (permalink / raw)
  To: libc-alpha

The second argument always takes a long double.  Leave
a note here in case someone attempts a global update
similar to the previous commit.

	* math/libm-test.inc (nexttoward_test_data):
	Add comment about long double second argument.
---
 math/libm-test.inc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/math/libm-test.inc b/math/libm-test.inc
index 6c85b40..3ba0b2d 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -9995,6 +9995,8 @@ static const struct test_ff_f_data_nexttoward nexttoward_test_data[] =
     TEST_ff_f (nexttoward, -min_subnorm_value, 0, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_ERANGE),
     TEST_ff_f (nexttoward, -min_subnorm_value, minus_zero, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_ERANGE),
 
+    /* Note, FUNC(nexttoward) always takes a long double as a second argument.  It is also not included as part of
+       of TS 18661-3.  */
 #if TEST_COND_binary32
     TEST_ff_f (nexttoward, 1.0, 1.1L, 0x1.000002p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (nexttoward, 1.0, LDBL_MAX, 0x1.000002p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCHv2 07/14] Replace M_PIl with pi in libm-test.inc
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
                     ` (20 preceding siblings ...)
  2016-05-20 21:38   ` [PATCHv2 06/14] Replace M_PI2l with pi_2_d in libm-test.inc Paul E. Murphy
@ 2016-05-20 21:45   ` Paul E. Murphy
  2016-05-20 21:52   ` [PATCHv2 09/14] Replace M_El with exp1 " Paul E. Murphy
  22 siblings, 0 replies; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-20 21:45 UTC (permalink / raw)
  To: libc-alpha

This is useful in situations where the long double type is
less precise than the type under test.

	* libm-test.inc: Replace usage of M_PIl with
	[pi]: New macro.
---
 math/libm-test.inc | 78 ++++++++++++++++++++++++++++--------------------------
 1 file changed, 40 insertions(+), 38 deletions(-)

diff --git a/math/libm-test.inc b/math/libm-test.inc
index 8f0a2af..3dfe465 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -326,6 +326,8 @@ struct ulp_data
 #define pi_ln10_d		LIT (1.364376353841841347485783625431355770)
 /* pi / 2 */
 #define pi_2_d			LIT (1.570796326794896619231321691639751442)
+/* pi */
+#define pi			LIT (3.141592653589793238462643383279502884)
 
 #define ulps_file_name "ULPs"	/* Name of the ULPs file.  */
 static FILE *ulps_file;		/* File to document difference.  */
@@ -1980,18 +1982,18 @@ static const struct test_ff_f_data atan2_test_data[] =
     TEST_ff_f (atan2, minus_infty, -max_value, -pi_2_d, ERRNO_UNCHANGED),
 
     /* atan2 (y,-inf) == +pi for finite y > 0 or +0.  */
-    TEST_ff_f (atan2, 1, minus_infty, M_PIl, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, plus_zero, minus_infty, M_PIl, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, min_value, minus_infty, M_PIl, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, min_subnorm_value, minus_infty, M_PIl, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, max_value, minus_infty, M_PIl, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, 1, minus_infty, pi, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, plus_zero, minus_infty, pi, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, min_value, minus_infty, pi, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, min_subnorm_value, minus_infty, pi, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, max_value, minus_infty, pi, ERRNO_UNCHANGED),
 
     /* atan2 (y,-inf) == -pi for finite y < 0 or -0.  */
-    TEST_ff_f (atan2, -1, minus_infty, -M_PIl, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, minus_zero, minus_infty, -M_PIl, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, -min_value, minus_infty, -M_PIl, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, -min_subnorm_value, minus_infty, -M_PIl, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, -max_value, minus_infty, -M_PIl, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, -1, minus_infty, -pi, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, minus_zero, minus_infty, -pi, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, -min_value, minus_infty, -pi, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, -min_subnorm_value, minus_infty, -pi, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, -max_value, minus_infty, -pi, ERRNO_UNCHANGED),
 
     TEST_ff_f (atan2, plus_infty, plus_infty, M_PI_4l, ERRNO_UNCHANGED),
     TEST_ff_f (atan2, minus_infty, plus_infty, -M_PI_4l, ERRNO_UNCHANGED),
@@ -2101,10 +2103,10 @@ static const struct test_c_c_data cacos_test_data[] =
     TEST_c_c (cacos, 0.1L, plus_infty, pi_2_d, minus_infty),
     TEST_c_c (cacos, 0.1L, minus_infty, pi_2_d, plus_infty),
 
-    TEST_c_c (cacos, minus_infty, 0, M_PIl, minus_infty),
-    TEST_c_c (cacos, minus_infty, minus_zero, M_PIl, plus_infty),
-    TEST_c_c (cacos, minus_infty, 100, M_PIl, minus_infty),
-    TEST_c_c (cacos, minus_infty, -100, M_PIl, plus_infty),
+    TEST_c_c (cacos, minus_infty, 0, pi, minus_infty),
+    TEST_c_c (cacos, minus_infty, minus_zero, pi, plus_infty),
+    TEST_c_c (cacos, minus_infty, 100, pi, minus_infty),
+    TEST_c_c (cacos, minus_infty, -100, pi, plus_infty),
 
     TEST_c_c (cacos, plus_infty, 0, 0.0, minus_infty),
     TEST_c_c (cacos, plus_infty, minus_zero, 0.0, plus_infty),
@@ -2141,10 +2143,10 @@ static const struct test_c_c_data cacos_test_data[] =
     TEST_c_c (cacos, plus_zero, 1.5L, pi_2_d, -1.194763217287109304111930828519090523536L),
     TEST_c_c (cacos, minus_zero, 1.5L, pi_2_d, -1.194763217287109304111930828519090523536L),
 
-    TEST_c_c (cacos, -1.5L, plus_zero, M_PIl, -0.9624236501192068949955178268487368462704L),
-    TEST_c_c (cacos, -1.5L, minus_zero, M_PIl, 0.9624236501192068949955178268487368462704L),
-    TEST_c_c (cacos, -1.0L, plus_zero, M_PIl, minus_zero),
-    TEST_c_c (cacos, -1.0L, minus_zero, M_PIl, plus_zero),
+    TEST_c_c (cacos, -1.5L, plus_zero, pi, -0.9624236501192068949955178268487368462704L),
+    TEST_c_c (cacos, -1.5L, minus_zero, pi, 0.9624236501192068949955178268487368462704L),
+    TEST_c_c (cacos, -1.0L, plus_zero, pi, minus_zero),
+    TEST_c_c (cacos, -1.0L, minus_zero, pi, plus_zero),
     TEST_c_c (cacos, -0.5L, plus_zero, 2.094395102393195492308428922186335256131L, minus_zero),
     TEST_c_c (cacos, -0.5L, minus_zero, 2.094395102393195492308428922186335256131L, plus_zero),
     TEST_c_c (cacos, 0.5L, plus_zero, 1.047197551196597746154214461093167628066L, minus_zero),
@@ -2788,10 +2790,10 @@ static const struct test_c_c_data cacosh_test_data[] =
     TEST_c_c (cacosh, 0.1L, plus_infty, plus_infty, pi_2_d),
     TEST_c_c (cacosh, 0.1L, minus_infty, plus_infty, -pi_2_d),
 
-    TEST_c_c (cacosh, minus_infty, 0, plus_infty, M_PIl),
-    TEST_c_c (cacosh, minus_infty, minus_zero, plus_infty, -M_PIl),
-    TEST_c_c (cacosh, minus_infty, 100, plus_infty, M_PIl),
-    TEST_c_c (cacosh, minus_infty, -100, plus_infty, -M_PIl),
+    TEST_c_c (cacosh, minus_infty, 0, plus_infty, pi),
+    TEST_c_c (cacosh, minus_infty, minus_zero, plus_infty, -pi),
+    TEST_c_c (cacosh, minus_infty, 100, plus_infty, pi),
+    TEST_c_c (cacosh, minus_infty, -100, plus_infty, -pi),
 
     TEST_c_c (cacosh, plus_infty, 0, plus_infty, 0.0),
     TEST_c_c (cacosh, plus_infty, minus_zero, plus_infty, minus_zero),
@@ -2828,10 +2830,10 @@ static const struct test_c_c_data cacosh_test_data[] =
     TEST_c_c (cacosh, plus_zero, 1.5L, 1.194763217287109304111930828519090523536L, pi_2_d),
     TEST_c_c (cacosh, minus_zero, 1.5L, 1.194763217287109304111930828519090523536L, pi_2_d),
 
-    TEST_c_c (cacosh, -1.5L, plus_zero, 0.9624236501192068949955178268487368462704L, M_PIl),
-    TEST_c_c (cacosh, -1.5L, minus_zero, 0.9624236501192068949955178268487368462704L, -M_PIl),
-    TEST_c_c (cacosh, -1.0L, plus_zero, plus_zero, M_PIl),
-    TEST_c_c (cacosh, -1.0L, minus_zero, plus_zero, -M_PIl),
+    TEST_c_c (cacosh, -1.5L, plus_zero, 0.9624236501192068949955178268487368462704L, pi),
+    TEST_c_c (cacosh, -1.5L, minus_zero, 0.9624236501192068949955178268487368462704L, -pi),
+    TEST_c_c (cacosh, -1.0L, plus_zero, plus_zero, pi),
+    TEST_c_c (cacosh, -1.0L, minus_zero, plus_zero, -pi),
     TEST_c_c (cacosh, -0.5L, plus_zero, plus_zero, 2.094395102393195492308428922186335256131L),
     TEST_c_c (cacosh, -0.5L, minus_zero, plus_zero, -2.094395102393195492308428922186335256131L),
     TEST_c_c (cacosh, 0.5L, plus_zero, plus_zero, 1.047197551196597746154214461093167628066L),
@@ -3469,10 +3471,10 @@ static const struct test_c_f_data carg_test_data[] =
     TEST_c_f (carg, 10.0, minus_infty, -pi_2_d),
 
     /* carg (-inf + i y) == +pi for finite y > 0.  */
-    TEST_c_f (carg, minus_infty, 10.0, M_PIl),
+    TEST_c_f (carg, minus_infty, 10.0, pi),
 
     /* carg (-inf + i y) == -pi for finite y < 0.  */
-    TEST_c_f (carg, minus_infty, -10.0, -M_PIl),
+    TEST_c_f (carg, minus_infty, -10.0, -pi),
 
     TEST_c_f (carg, plus_infty, plus_infty, M_PI_4l),
 
@@ -6025,8 +6027,8 @@ static const struct test_f_f_data ceil_test_data[] =
     TEST_f_f (ceil, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
 
     /* Bug 15479: spurious "inexact" exception may occur.  */
-    TEST_f_f (ceil, M_PIl, 4.0, ERRNO_UNCHANGED),
-    TEST_f_f (ceil, -M_PIl, -3.0, ERRNO_UNCHANGED),
+    TEST_f_f (ceil, pi, 4.0, ERRNO_UNCHANGED),
+    TEST_f_f (ceil, -pi, -3.0, ERRNO_UNCHANGED),
     TEST_f_f (ceil, min_subnorm_value, 1.0, ERRNO_UNCHANGED),
     TEST_f_f (ceil, min_value, 1.0, ERRNO_UNCHANGED),
     TEST_f_f (ceil, 0.1, 1.0, ERRNO_UNCHANGED),
@@ -6234,8 +6236,8 @@ cimag_test (void)
 
 static const struct test_c_c_data clog_test_data[] =
   {
-    TEST_c_c (clog, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION),
-    TEST_c_c (clog, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION),
+    TEST_c_c (clog, minus_zero, 0, minus_infty, pi, DIVIDE_BY_ZERO_EXCEPTION),
+    TEST_c_c (clog, minus_zero, minus_zero, minus_infty, -pi, DIVIDE_BY_ZERO_EXCEPTION),
 
     TEST_c_c (clog, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION),
     TEST_c_c (clog, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION),
@@ -6255,10 +6257,10 @@ static const struct test_c_c_data clog_test_data[] =
     TEST_c_c (clog, minus_zero, minus_infty, plus_infty, -pi_2_d),
     TEST_c_c (clog, -3, minus_infty, plus_infty, -pi_2_d),
 
-    TEST_c_c (clog, minus_infty, 0, plus_infty, M_PIl),
-    TEST_c_c (clog, minus_infty, 1, plus_infty, M_PIl),
-    TEST_c_c (clog, minus_infty, minus_zero, plus_infty, -M_PIl),
-    TEST_c_c (clog, minus_infty, -1, plus_infty, -M_PIl),
+    TEST_c_c (clog, minus_infty, 0, plus_infty, pi),
+    TEST_c_c (clog, minus_infty, 1, plus_infty, pi),
+    TEST_c_c (clog, minus_infty, minus_zero, plus_infty, -pi),
+    TEST_c_c (clog, minus_infty, -1, plus_infty, -pi),
 
     TEST_c_c (clog, plus_infty, 0, plus_infty, 0.0),
     TEST_c_c (clog, plus_infty, 1, plus_infty, 0.0),
@@ -7168,8 +7170,8 @@ static const struct test_f_f_data floor_test_data[] =
     TEST_f_f (floor, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
 
     /* Bug 15479: spurious "inexact" exception may occur.  */
-    TEST_f_f (floor, M_PIl, 3.0, ERRNO_UNCHANGED),
-    TEST_f_f (floor, -M_PIl, -4.0, ERRNO_UNCHANGED),
+    TEST_f_f (floor, pi, 3.0, ERRNO_UNCHANGED),
+    TEST_f_f (floor, -pi, -4.0, ERRNO_UNCHANGED),
     TEST_f_f (floor, min_subnorm_value, 0.0, ERRNO_UNCHANGED),
     TEST_f_f (floor, min_value, 0.0, ERRNO_UNCHANGED),
     TEST_f_f (floor, 0.1, 0.0, ERRNO_UNCHANGED),
-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCHv2 09/14] Replace M_El with exp1 in libm-test.inc
  2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
                     ` (21 preceding siblings ...)
  2016-05-20 21:45   ` [PATCHv2 07/14] Replace M_PIl with pi " Paul E. Murphy
@ 2016-05-20 21:52   ` Paul E. Murphy
  22 siblings, 0 replies; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-20 21:52 UTC (permalink / raw)
  To: libc-alpha

This is useful in situations where the long double type is
less precise than the type under test.

	* gen-libm-test.pl (beautify): Add beautifier for
	exp1 => e.
    	* libm-test.inc: Replace usage of M_El with
    	[exp1]: New macro.
---
 math/gen-libm-test.pl |  1 +
 math/libm-test.inc    | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/math/gen-libm-test.pl b/math/gen-libm-test.pl
index 17f17f7..c8790e1 100755
--- a/math/gen-libm-test.pl
+++ b/math/gen-libm-test.pl
@@ -59,6 +59,7 @@ use vars qw (%auto_tests);
     "minus_infty" => "-inf",
     "plus_infty" => "inf",
     "qnan_value" => "qNaN",
+    "exp1" => "e",
   );
 
 
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 5548a6c..6c85b40 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -331,6 +331,11 @@ struct ulp_data
 /* pi */
 #define pi			LIT (3.141592653589793238462643383279502884)
 
+/* Other useful constants.  */
+
+/* e (expressed as exp1).  */
+#define exp1			LIT(2.718281828459045235360287471352662498)
+
 #define ulps_file_name "ULPs"	/* Name of the ULPs file.  */
 static FILE *ulps_file;		/* File to document difference.  */
 static int output_ulps;		/* Should ulps printed?  */
@@ -7087,7 +7092,7 @@ static const struct test_f_f_data fabs_test_data[] =
     TEST_f_f (fabs, -min_value, min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_f (fabs, -max_value, max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_f (fabs, 38.0, 38.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_f_f (fabs, -M_El, M_El, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_f_f (fabs, -exp1, exp1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
   };
 
 static void
@@ -7919,7 +7924,7 @@ hypot_test (void)
 static const struct test_f_i_data ilogb_test_data[] =
   {
     TEST_f_i (ilogb, 1, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_f_i (ilogb, M_El, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_f_i (ilogb, exp1, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_i (ilogb, 1024, 10, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_i (ilogb, -2000, 10, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_i (ilogb, 0.5, -1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED);
@@ -9059,7 +9064,7 @@ static const struct test_f_f_data logb_test_data[] =
     TEST_f_f (logb, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
 
     TEST_f_f (logb, 1, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_f_f (logb, M_El, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_f_f (logb, exp1, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_f (logb, 1024, 10, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_f (logb, -2000, 10, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
 
-- 
2.4.11

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCHv2 01/14] Fixup usage of MANT_DIG in libm-test.inc
  2016-05-20 21:37   ` [PATCHv2 01/14] Fixup usage of MANT_DIG in libm-test.inc Paul E. Murphy
@ 2016-05-23 15:41     ` Joseph Myers
  2016-05-24 20:45       ` Paul E. Murphy
  0 siblings, 1 reply; 49+ messages in thread
From: Joseph Myers @ 2016-05-23 15:41 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: libc-alpha

On Fri, 20 May 2016, Paul E. Murphy wrote:

> Make MANT_DIG shadow the types *_MANT_DIG macro. Replace
> calls sites with (MANT_DIG - 1), and simplify.
> 
> 	* math/libm-test.inc [MANT_DIG]: Directly define as
>     	[DBL|LDBL|FLT]_MANT_DIG and fixup usage.

OK, but the ChangeLog formatting is incorrect.  Names of entities changed 
go in () not []; [] is for #if conditions.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCHv2 02/14] Fixup usage of MIN_EXP in libm-test.inc
  2016-05-20 21:37   ` [PATCHv2 02/14] Fixup usage of MIN_EXP " Paul E. Murphy
@ 2016-05-23 16:02     ` Joseph Myers
  2016-05-24 20:50       ` Paul E. Murphy
  0 siblings, 1 reply; 49+ messages in thread
From: Joseph Myers @ 2016-05-23 16:02 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: libc-alpha

On Fri, 20 May 2016, Paul E. Murphy wrote:

> Make MANT_DIG shadow the types *_MIN_EXP macro. Replace
> calls sites with (MIN_EXP - 1), and simplify.
> 
> 	* math/libm-test.inc [MIN_EXP]: Directly define as
> 	[DBL|LDBL|FLT]_MIN_EXP and fixup usage.

OK, again with ChangeLog formatting corrected.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCHv2 03/14] Begin refactor of libm-test.inc
  2016-05-20 21:38   ` [PATCHv2 03/14] Begin refactor of libm-test.inc Paul E. Murphy
@ 2016-05-23 16:10     ` Joseph Myers
  0 siblings, 0 replies; 49+ messages in thread
From: Joseph Myers @ 2016-05-23 16:10 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: libc-alpha

On Fri, 20 May 2016, Paul E. Murphy wrote:

> +   INF A macro defining the positive infinite value of the type.  */

This should not be needed.  Just define plus_infty and minus_infty like 
qnan_value is defined, using FUNC (__builtin_inf) (), so reducing the 
numbers of definitions needed in the type-specific headers.  You can 
assume those built-in functions for all compilers supported for building 
glibc.

(Well, for float128 you may need to split FUNC into separate macros, since 
the public API will be *f128 but existing built-in functions are e.g. 
__builtin_infq.  But you could always name the functions __builtin_inff128 
etc. on powerpc from the start to avoid that issue and leave x86 to work 
around the different naming.  It looks like you should add built-in 
functions __builtin_nan<something>, __builtin_nans<something>, for use in 
tests, that are currently missing on x86 for TFmode; I've filed GCC bugs 
71241 and 71242 for the absence of such functions for x86 and ia64.)

>  /* Sufficient numbers of digits to represent any floating-point value
>     unambiguously (for any choice of the number of bits in the first
>     hex digit, in the case of TYPE_HEX_DIG).  When used with printf
>     formats where the precision counts only digits after the point, 1
>     is subtracted from these values. */
> -#define TYPE_DECIMAL_DIG CHOOSE (LDBL_DECIMAL_DIG,	\
> -				 DBL_DECIMAL_DIG,	\
> -				 FLT_DECIMAL_DIG,	\
> -				 LDBL_DECIMAL_DIG,	\
> -				 DBL_DECIMAL_DIG,	\
> -				 FLT_DECIMAL_DIG)
>  #define TYPE_HEX_DIG ((MANT_DIG + 6) / 4)

This comment is meant to apply to both TYPE_DECIMAL_DIG and TYPE_HEX_DIG.  
Thus, the new TYPE_DECIMAL_DIG definition should go here rather than 
elsewhere in the file.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCHv2 04/14] Refactor type specific macros using regexes
  2016-05-20 21:38   ` [PATCHv2 04/14] Refactor type specific macros using regexes Paul E. Murphy
@ 2016-05-23 16:57     ` Joseph Myers
  0 siblings, 0 replies; 49+ messages in thread
From: Joseph Myers @ 2016-05-23 16:57 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: libc-alpha

On Fri, 20 May 2016, Paul E. Murphy wrote:

> Replace most of the type specific macros  with the equivalent
> type-generic macro using the following sed replacement command below:
> 
> sed -ri -e 's/defined TEST_FLOAT/TEST_COND_binary32/'     \
>             -e 's/ndef TEST_FLOAT/ !TEST_COND_binary32/'  \
>             -e 's/def TEST_FLOAT/ TEST_COND_binary32/'    \
>             -e 's/defined TEST_DOUBLE/TEST_COND_binary64/'\
>             -e 's/ndef TEST_DOUBLE/ !TEST_COND_binary64/' \
>             -e 's/def TEST_DOUBLE/ TEST_COND_binary64/'   \
>             -e 's/defined TEST_LDOUBLE && //'             \
>             -e 's/ifdef TEST_LDOUBLE/if MANT_DIG >= 64/'  \
>             -e 's/defined TEST_LDOUBLE/MANT_DIG >= 64/'   \
>             -e '9941,10047!s/LDBL_(MIN_EXP|MAX_EXP|MANT_DIG)/\1/g'   \
>             libm-test.inc
> 
> Note, TEST_LDOUBLE checks are replaced by MANT_DIG >= 64 excepting
> where another property of the type is being tested.
> 
> Beware, the magic numbers of the final regex. This explicitly
> avoids converting the LDBL_ macros of the nexttoward tests. This
> function always takes a second long double argument.

You can avoid magic numbers by using a range matching regular expressions 
for suitable lines before and after the nexttoward tests, which would make 
this command more robust to changes in libm-test.inc / earlier patches.

> 	[TEST_LDOUBLE]: Change usage to TEST_COND_gt_binary64.
> 	[LDBL_MAX_EXP]: Change to TYPE_MAX_EXP.
> 	[LDBL_MIN_EXP]: Change to TYPE_MIN_EXP.
> 	[LDBL_MANT_DIG]: Change to TYPE_MANT_DIG, except for
> 	nexttoward tests.

This part of the ChangeLog entries obviously needs rewriting.

I think in this case it *does* make sense to include the generated changes 
for review in the patch submission.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCHv2 06/14] Replace M_PI2l with pi_2_d in libm-test.inc
  2016-05-20 21:38   ` [PATCHv2 06/14] Replace M_PI2l with pi_2_d in libm-test.inc Paul E. Murphy
@ 2016-05-23 16:59     ` Joseph Myers
  2016-05-23 20:02       ` Paul E. Murphy
  0 siblings, 1 reply; 49+ messages in thread
From: Joseph Myers @ 2016-05-23 16:59 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: libc-alpha

On Fri, 20 May 2016, Paul E. Murphy wrote:

> This is useful in situations where the long double type is
> less precise than the type under test.
> 
> 	* libm-test.inc: Replace usage of M_PI2l with
> 	[pi_2_d]: New macro.

I'm not convinced that adding several extra local constants is the right 
approach here.

For the API for float128 to be feature-complete compared to long double, 
it should include constants such as M_PI_2f128 for all the long double 
constants in <math.h>.  Which means that there is always a constant from 
<math.h> that can be used in these cases; you don't need yet another copy 
of the digits of this constant.  You might, for example, have a macro MCST 
defined for each type and use MCST (PI_2) here (which would expand to 
M_PI_2 for float and double - there aren't float versions of these 
<math.h> constants - M_PI_2l for long double, M_PI_2f128 for float128).

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCHv2 10/14] Add note about nexttoward test cases in libm-test.inc
  2016-05-20 21:38   ` [PATCHv2 10/14] Add note about nexttoward test cases in libm-test.inc Paul E. Murphy
@ 2016-05-23 17:07     ` Joseph Myers
  2016-05-23 18:20       ` Zack Weinberg
  0 siblings, 1 reply; 49+ messages in thread
From: Joseph Myers @ 2016-05-23 17:07 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: libc-alpha

On Fri, 20 May 2016, Paul E. Murphy wrote:

> +    /* Note, FUNC(nexttoward) always takes a long double as a second argument.  It is also not included as part of
> +       of TS 18661-3.  */

Lines in comments should not exceed 79 columns.  (This is a general rule 
for all lines in source files unless there is some clear reason not to 
wrap things - as is the case for the actual *tests* in libm-test.inc, 
where gen-libm-test.pl relies on each test being on a single line.)

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCHv2 10/14] Add note about nexttoward test cases in libm-test.inc
  2016-05-23 17:07     ` Joseph Myers
@ 2016-05-23 18:20       ` Zack Weinberg
  0 siblings, 0 replies; 49+ messages in thread
From: Zack Weinberg @ 2016-05-23 18:20 UTC (permalink / raw)
  To: Joseph Myers; +Cc: Paul E. Murphy, GNU C Library

On Mon, May 23, 2016 at 5:58 PM, Joseph Myers <joseph@codesourcery.com> wrote:
> On Fri, 20 May 2016, Paul E. Murphy wrote:
>
>> +    /* Note, FUNC(nexttoward) always takes a long double as a second argument.  It is also not included as part of
>> +       of TS 18661-3.  */
>
> Lines in comments should not exceed 79 columns.

Also, as will be more obvious once the comment is rewrapped, you've
got an "of of" in there.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCHv2 06/14] Replace M_PI2l with pi_2_d in libm-test.inc
  2016-05-23 16:59     ` Joseph Myers
@ 2016-05-23 20:02       ` Paul E. Murphy
  2016-05-23 20:34         ` Joseph Myers
  0 siblings, 1 reply; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-23 20:02 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha



On 05/23/2016 11:56 AM, Joseph Myers wrote:
> On Fri, 20 May 2016, Paul E. Murphy wrote:
> 
>> This is useful in situations where the long double type is
>> less precise than the type under test.
>>
>> 	* libm-test.inc: Replace usage of M_PI2l with
>> 	[pi_2_d]: New macro.
> 
> I'm not convinced that adding several extra local constants is the right 
> approach here.
> 
> For the API for float128 to be feature-complete compared to long double, 
> it should include constants such as M_PI_2f128 for all the long double 
> constants in <math.h>.  Which means that there is always a constant from 
> <math.h> that can be used in these cases; you don't need yet another copy 
> of the digits of this constant.  You might, for example, have a macro MCST 
> defined for each type and use MCST (PI_2) here (which would expand to 
> M_PI_2 for float and double - there aren't float versions of these 
> <math.h> constants - M_PI_2l for long double, M_PI_2f128 for float128).

Are you suggesting removing the new constants entirely, or just redefining
these macros in terms of existing macros?

I'd prefer to keep the M prefixed constants out of the individual test cases,
and maintain consistency with the other lower case constants.  It's too easy
to overlook them otherwise.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCHv2 06/14] Replace M_PI2l with pi_2_d in libm-test.inc
  2016-05-23 20:02       ` Paul E. Murphy
@ 2016-05-23 20:34         ` Joseph Myers
  2016-05-23 21:36           ` Paul E. Murphy
  0 siblings, 1 reply; 49+ messages in thread
From: Joseph Myers @ 2016-05-23 20:34 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: libc-alpha

On Mon, 23 May 2016, Paul E. Murphy wrote:

> > For the API for float128 to be feature-complete compared to long double, 
> > it should include constants such as M_PI_2f128 for all the long double 
> > constants in <math.h>.  Which means that there is always a constant from 
> > <math.h> that can be used in these cases; you don't need yet another copy 
> > of the digits of this constant.  You might, for example, have a macro MCST 
> > defined for each type and use MCST (PI_2) here (which would expand to 
> > M_PI_2 for float and double - there aren't float versions of these 
> > <math.h> constants - M_PI_2l for long double, M_PI_2f128 for float128).
> 
> Are you suggesting removing the new constants entirely, or just redefining
> these macros in terms of existing macros?

My suggestion was removing them entirely (and using MCST (PI_2) etc. in 
individual tests), but I suppose you could define them in terms of 
existing macros.

> I'd prefer to keep the M prefixed constants out of the individual test cases,
> and maintain consistency with the other lower case constants.  It's too easy
> to overlook them otherwise.

Actually, I think there is a case for the following: the individual tests 
all use names that are not M_*, for both the constants that are in 
<math.h> and the local ones - but those names all have some common prefix 
in place of M_, rather than being like the other lower-case constants 
without any fixed prefix.

Rationale: these constants are logically different from those such as 
min_value, in that, when used as expected results, the ideal result would 
depend on the rounding mode.  So having a unique prefix would facilitate 
hypothetical future gen-libm-test.pl enhancements to detect such constants 
in expected results and replace them by references to per-rounding-mode 
macros, where the values of those macros are automatically generated for 
each format and rounding modes by gen-auto-libm-tests.c or similar.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCHv2 06/14] Replace M_PI2l with pi_2_d in libm-test.inc
  2016-05-23 20:34         ` Joseph Myers
@ 2016-05-23 21:36           ` Paul E. Murphy
  2016-05-23 23:11             ` Joseph Myers
  0 siblings, 1 reply; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-23 21:36 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha



On 05/23/2016 03:16 PM, Joseph Myers wrote:
> On Mon, 23 May 2016, Paul E. Murphy wrote:
> 
>>> For the API for float128 to be feature-complete compared to long double, 
>>> it should include constants such as M_PI_2f128 for all the long double 
>>> constants in <math.h>.  Which means that there is always a constant from 
>>> <math.h> that can be used in these cases; you don't need yet another copy 
>>> of the digits of this constant.  You might, for example, have a macro MCST 
>>> defined for each type and use MCST (PI_2) here (which would expand to 
>>> M_PI_2 for float and double - there aren't float versions of these 
>>> <math.h> constants - M_PI_2l for long double, M_PI_2f128 for float128).
>>
>> Are you suggesting removing the new constants entirely, or just redefining
>> these macros in terms of existing macros?
> 
> My suggestion was removing them entirely (and using MCST (PI_2) etc. in 
> individual tests), but I suppose you could define them in terms of 
> existing macros.
> 
>> I'd prefer to keep the M prefixed constants out of the individual test cases,
>> and maintain consistency with the other lower case constants.  It's too easy
>> to overlook them otherwise.
> 
> Actually, I think there is a case for the following: the individual tests 
> all use names that are not M_*, for both the constants that are in 
> <math.h> and the local ones - but those names all have some common prefix 
> in place of M_, rather than being like the other lower-case constants 
> without any fixed prefix.
> 
> Rationale: these constants are logically different from those such as 
> min_value, in that, when used as expected results, the ideal result would 
> depend on the rounding mode.  So having a unique prefix would facilitate 
> hypothetical future gen-libm-test.pl enhancements to detect such constants 
> in expected results and replace them by references to per-rounding-mode 
> macros, where the values of those macros are automatically generated for 
> each format and rounding modes by gen-auto-libm-tests.c or similar.

That seems reasonable.  Though, wouldn't it be much simpler to punt
these tests to auto-libm-test-in/gen-auto-libm-tests.c and have it more
accurately compute correctly rounded constants for each format and
rounding mode?  That also seems to imply the inputs may also be
sensitive to rounding mode.

Anyhow, the next patchset will append the "lit_" prefix to new macro
constants to support such changes.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCHv2 06/14] Replace M_PI2l with pi_2_d in libm-test.inc
  2016-05-23 21:36           ` Paul E. Murphy
@ 2016-05-23 23:11             ` Joseph Myers
  0 siblings, 0 replies; 49+ messages in thread
From: Joseph Myers @ 2016-05-23 23:11 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: libc-alpha

On Mon, 23 May 2016, Paul E. Murphy wrote:

> That seems reasonable.  Though, wouldn't it be much simpler to punt
> these tests to auto-libm-test-in/gen-auto-libm-tests.c and have it more
> accurately compute correctly rounded constants for each format and
> rounding mode?  That also seems to imply the inputs may also be
> sensitive to rounding mode.

These are[*] tests with infinities and NaNs as inputs, or as at least one 
exact part of a complex result.  gen-auto-libm-tests doesn't currently 
handle infinities or NaNs as inputs or exact results (as opposed to 
overflowing results), and I'm not particularly confident that MPC handles 
all such cases the way we want (taking due account of changes in C11 and 
in DRs).

[*] Except for tests of complex inverse trig and hyperbolic functions with 
finite inputs and results, not moved to auto-libm-test-in because the MPC 
functions are very slow in some cases and so moving them would make 
gen-auto-libm-tests take probably hours to run.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCHv2 11/14] Apply LIT(x) to floating point literals in libm-test.c
  2016-05-20 21:38   ` [PATCHv2 11/14] Apply LIT(x) to floating point literals in libm-test.c Paul E. Murphy
@ 2016-05-24 16:26     ` Joseph Myers
  0 siblings, 0 replies; 49+ messages in thread
From: Joseph Myers @ 2016-05-24 16:26 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: libc-alpha

On Fri, 20 May 2016, Paul E. Murphy wrote:

>      if ($descr[$i] =~ /f|i|l|L/) {
> -      $cline .= ", $args[$current_arg]";
> +      if ($descr[$i] eq "f" and not ($args[0] eq "nexttoward" and $current_arg == 2)) {

Rather than specially checking for the name "nexttoward" here, I think it 
would be cleaner to use something other than "f" as the argument 
descriptor for the case where the argument is always long double, and 
rename struct test_ff_f_data_nexttoward accordingly.  (Strictly you don't 
need to create another macro like RUN_TEST_LOOP_ff_f with the 
corresponding name and use it for the nexttoward tests, but it's probably 
cleaner to do so as well.)

(Nothing should actually be using the first argument to TEST_* any more; 
it's a relic from when TEST_* generated code rather than data, which 
hasn't been cleaned up yet.)

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCHv2 01/14] Fixup usage of MANT_DIG in libm-test.inc
  2016-05-23 15:41     ` Joseph Myers
@ 2016-05-24 20:45       ` Paul E. Murphy
  0 siblings, 0 replies; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-24 20:45 UTC (permalink / raw)
  To: libc-alpha



On 05/23/2016 10:40 AM, Joseph Myers wrote:
> On Fri, 20 May 2016, Paul E. Murphy wrote:
> 
>> Make MANT_DIG shadow the types *_MANT_DIG macro. Replace
>> calls sites with (MANT_DIG - 1), and simplify.
>>
>> 	* math/libm-test.inc [MANT_DIG]: Directly define as
>>     	[DBL|LDBL|FLT]_MANT_DIG and fixup usage.
> 
> OK, but the ChangeLog formatting is incorrect.  Names of entities changed 
> go in () not []; [] is for #if conditions.
> 

Change log updated and committed as 7e9ae82.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCHv2 02/14] Fixup usage of MIN_EXP in libm-test.inc
  2016-05-23 16:02     ` Joseph Myers
@ 2016-05-24 20:50       ` Paul E. Murphy
  0 siblings, 0 replies; 49+ messages in thread
From: Paul E. Murphy @ 2016-05-24 20:50 UTC (permalink / raw)
  To: libc-alpha



On 05/23/2016 10:41 AM, Joseph Myers wrote:
> On Fri, 20 May 2016, Paul E. Murphy wrote:
> 
>> Make MANT_DIG shadow the types *_MIN_EXP macro. Replace
>> calls sites with (MIN_EXP - 1), and simplify.
>>
>> 	* math/libm-test.inc [MIN_EXP]: Directly define as
>> 	[DBL|LDBL|FLT]_MIN_EXP and fixup usage.
> 
> OK, again with ChangeLog formatting corrected.
> 

Change log updated and committed as 7cfcb77.

^ permalink raw reply	[flat|nested] 49+ messages in thread

end of thread, other threads:[~2016-05-24 20:45 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-20 21:38 [PATCHv2 00/14] Refactor libm-test.inc and friends Paul E. Murphy
2016-05-18 20:56 ` [PATCH 0/8] Refactor libm-tests.c " Paul E. Murphy
2016-05-18 20:56   ` [PATCH 8/8] Generate new format names in auto-libm-test-out Paul E. Murphy
2016-05-18 20:56   ` [PATCH 7/8] Remove type specific information from auto-libm-test-in Paul E. Murphy
2016-05-18 21:55     ` Joseph Myers
2016-05-18 20:56   ` [PATCH 3/8] Fixup TYPE_* substitutions Paul E. Murphy
2016-05-18 21:19     ` Joseph Myers
2016-05-18 20:56   ` [PATCH 4/8] Add LIT() around literals in check_ulp in libm-tests.inc Paul E. Murphy
2016-05-18 21:24     ` Joseph Myers
2016-05-18 20:56   ` [PATCH 2/8] Refactor type specific macros using regexes Paul E. Murphy
2016-05-18 20:56   ` [PATCH 5/8] Apply LIT(x) to floating point literals in libm-test.c Paul E. Murphy
2016-05-18 21:34     ` Joseph Myers
2016-05-18 20:56   ` [PATCH 1/8] Begin refactor of libm-test.inc Paul E. Murphy
2016-05-18 21:18     ` Joseph Myers
2016-05-18 21:54     ` Joseph Myers
2016-05-18 21:57       ` Paul E. Murphy
2016-05-19 11:05         ` Joseph Myers
2016-05-18 21:17   ` [PATCH 6/8] Refactor CHOOSE() macro usage in libm-tests.inc Paul E. Murphy
2016-05-18 21:39     ` Joseph Myers
2016-05-18 21:44   ` [PATCH 0/8] Refactor libm-tests.c and friends Joseph Myers
2016-05-18 21:58     ` Paul E. Murphy
2016-05-20 21:37   ` [PATCHv2 01/14] Fixup usage of MANT_DIG in libm-test.inc Paul E. Murphy
2016-05-23 15:41     ` Joseph Myers
2016-05-24 20:45       ` Paul E. Murphy
2016-05-20 21:37   ` [PATCHv2 05/14] Refactor M_ macros defined " Paul E. Murphy
2016-05-20 21:37   ` [PATCHv2 02/14] Fixup usage of MIN_EXP " Paul E. Murphy
2016-05-23 16:02     ` Joseph Myers
2016-05-24 20:50       ` Paul E. Murphy
2016-05-20 21:38   ` [PATCHv2 03/14] Begin refactor of libm-test.inc Paul E. Murphy
2016-05-23 16:10     ` Joseph Myers
2016-05-20 21:38   ` [PATCHv2 10/14] Add note about nexttoward test cases in libm-test.inc Paul E. Murphy
2016-05-23 17:07     ` Joseph Myers
2016-05-23 18:20       ` Zack Weinberg
2016-05-20 21:38   ` [PATCHv2 08/14] Replace M_PI_4l with pi_4_d " Paul E. Murphy
2016-05-20 21:38   ` [PATCHv2 11/14] Apply LIT(x) to floating point literals in libm-test.c Paul E. Murphy
2016-05-24 16:26     ` Joseph Myers
2016-05-20 21:38   ` [PATCHv2 04/14] Refactor type specific macros using regexes Paul E. Murphy
2016-05-23 16:57     ` Joseph Myers
2016-05-20 21:38   ` [PATCHv2 13/14] Remove type specific information from auto-libm-test-in Paul E. Murphy
2016-05-20 21:38   ` [PATCHv2 12/14] Remove CHOOSE() macro from libm-tests.inc Paul E. Murphy
2016-05-20 21:38   ` [PATCHv2 14/14] Generate new format names in auto-libm-test-out Paul E. Murphy
2016-05-20 21:38   ` [PATCHv2 06/14] Replace M_PI2l with pi_2_d in libm-test.inc Paul E. Murphy
2016-05-23 16:59     ` Joseph Myers
2016-05-23 20:02       ` Paul E. Murphy
2016-05-23 20:34         ` Joseph Myers
2016-05-23 21:36           ` Paul E. Murphy
2016-05-23 23:11             ` Joseph Myers
2016-05-20 21:45   ` [PATCHv2 07/14] Replace M_PIl with pi " Paul E. Murphy
2016-05-20 21:52   ` [PATCHv2 09/14] Replace M_El with exp1 " Paul E. Murphy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).