[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commits] r22970 - in /fsf/trunk/libc: ./ benchtests/ math/ scripts/ sysdeps/i386/fpu/ sysdeps/ieee754/dbl-64/ sysdeps/powerpc/fpu/ sy...



Author: eglibc
Date: Wed May  1 00:02:09 2013
New Revision: 22970

Log:
Import glibc-mainline for 2013-05-01

Removed:
    fsf/trunk/libc/benchtests/slowatan-inputs
    fsf/trunk/libc/benchtests/slowatan.c
    fsf/trunk/libc/benchtests/slowcos-inputs
    fsf/trunk/libc/benchtests/slowcos.c
    fsf/trunk/libc/benchtests/slowexp-inputs
    fsf/trunk/libc/benchtests/slowexp.c
    fsf/trunk/libc/benchtests/slowpow-inputs
    fsf/trunk/libc/benchtests/slowpow.c
    fsf/trunk/libc/benchtests/slowsin-inputs
    fsf/trunk/libc/benchtests/slowsin.c
    fsf/trunk/libc/benchtests/slowtan-inputs
    fsf/trunk/libc/benchtests/slowtan.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/benchtests/Makefile
    fsf/trunk/libc/benchtests/atan-inputs
    fsf/trunk/libc/benchtests/bench-modf.c
    fsf/trunk/libc/benchtests/bench-skeleton.c
    fsf/trunk/libc/benchtests/cos-inputs
    fsf/trunk/libc/benchtests/exp-inputs
    fsf/trunk/libc/benchtests/pow-inputs
    fsf/trunk/libc/benchtests/sin-inputs
    fsf/trunk/libc/benchtests/tan-inputs
    fsf/trunk/libc/math/libm-test.inc
    fsf/trunk/libc/math/s_catan.c
    fsf/trunk/libc/math/s_catanf.c
    fsf/trunk/libc/math/s_catanh.c
    fsf/trunk/libc/math/s_catanhf.c
    fsf/trunk/libc/math/s_catanhl.c
    fsf/trunk/libc/math/s_catanl.c
    fsf/trunk/libc/scripts/bench.pl
    fsf/trunk/libc/sysdeps/i386/fpu/libm-test-ulps
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_sin.c
    fsf/trunk/libc/sysdeps/powerpc/fpu/libm-test-ulps
    fsf/trunk/libc/sysdeps/x86_64/fpu/libm-test-ulps

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Wed May  1 00:02:09 2013
@@ -1,3 +1,61 @@
+2013-04-30  Adhemerval Zanella  <azanella@xxxxxxxxxxxxxxxxxx>
+
+	* sysdeps/powerpc/fpu/libm-test-ulps: Update.
+
+2013-04-30  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	[BZ #15416]
+	* math/s_catan.c (__catan): Compute expressions 1 - x^2 - y^2 more
+	accurately for denominator in atan2.
+	* math/s_catanf.c (__catanf): Likewise.
+	* math/s_catanh.c (__catanh): Likewise.
+	* math/s_catanhf.c (__catanhf): Likewise.
+	* math/s_catanhl.c (__catanhl): Likewise.
+	* math/s_catanl.c (__catanl): Likewise.
+	* math/libm-test.inc (catan_test): Add more tests.
+	(catanh_test): Likewise.
+	* sysdeps/i386/fpu/libm-test-ulps: Update.
+	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
+
+2013-04-30  Siddhesh Poyarekar  <siddhesh@xxxxxxxxxx>
+
+	* sysdeps/ieee754/dbl-64/s_sin.c: Format code.
+
+	* benchtests/Makefile (bench): Remove slow benchmarks.
+	* benchtests/atan-inputs: Add slow benchmark inputs.
+	* benchtests/bench-modf.c (NUM_VARIANTS): Define.
+	(BENCH_FUNC): Accept variant offset.
+	(VARIANT): Define.
+	* benchtests/bench-skeleton.c (main): Run benchmark for each
+	variant.
+	* benchtests/cos-inputs: Add slow benchmark inputs.
+	* benchtests/exp-inputs: Likewise.
+	* benchtests/pow-inputs: Likewise.
+	* benchtests/sin-inputs: Likewise.
+	* benchtests/slowatan-inputs: Remove.
+	* benchtests/slowatan.c: Remove.
+	* benchtests/slowcos-inputs: Remove.
+	* benchtests/slowcos.c: Remove.
+	* benchtests/slowexp-inputs: Remove.
+	* benchtests/slowexp.c: Remove.
+	* benchtests/slowpow-inputs: Remove.
+	* benchtests/slowpow.c: Remove.
+	* benchtests/slowsin-inputs: Remove.
+	* benchtests/slowsin.c: Remove.
+	* benchtests/slowtan-inputs: Remove.
+	* benchtests/slowtan.c: Remove.
+	* benchtests/tan-inputs: Add slow benchmark inputs.
+	* scripts/bench.pl: Parse comments and directives.
+
+	* benchtests/Makefile: Remove *-ITER.  Define BENCH_DURATION
+	in CPPFLAGS.
+	($(objpfx)bench-%.c): Remove *-ITER.
+	* benchtests/bench-modf.c: Remove definition of ITER.
+	* benchtests/bench-skeleton.c (TIMESPEC_AFTER): New macro.
+	(main): Loop for DURATION seconds instead of fixed number of
+	iterations.
+	* scripts/bench.pl: Don't expect iterations in parameters.
+
 2013-04-29  Roland McGrath  <roland@xxxxxxxxxxxxx>
 
 	* io/fchdir.c (__fchdir): Renamed from fchdir.

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Wed May  1 00:02:09 2013
@@ -15,7 +15,7 @@
   15006, 15007, 15020, 15023, 15036, 15054, 15055, 15062, 15078, 15084,
   15085, 15086, 15160, 15214, 15221, 15232, 15234, 15283, 15285, 15287,
   15304, 15305, 15307, 15309, 15327, 15330, 15335, 15336, 15337, 15342,
-  15346, 15361, 15366, 15380, 15394, 15405, 15406, 15409.
+  15346, 15361, 15366, 15380, 15394, 15405, 15406, 15409, 15416.
 
 * CVE-2013-0242 Buffer overrun in regexp matcher has been fixed (Bugzilla
   #15078).

Modified: fsf/trunk/libc/benchtests/Makefile
==============================================================================
--- fsf/trunk/libc/benchtests/Makefile (original)
+++ fsf/trunk/libc/benchtests/Makefile Wed May  1 00:02:09 2013
@@ -23,12 +23,6 @@
 
 # - Append the function name to the bench variable
 
-# - Define foo-ITER with the number of iterations you want to run.  Keep it
-#   high enough that the overhead of clock_gettime is only a small fraction of
-#   the total run time of the test.  A good idea would be to keep the run time
-#   of each test at around 10 seconds for x86_64.  That is just a guideline,
-#   since some scenarios may require higher run times.
-
 # - Define foo-ARGLIST as a colon separated list of types of the input
 #   arguments.  Use `void` if function does not take any inputs.  Put in quotes
 #   if the input argument is a pointer, e.g.:
@@ -45,91 +39,35 @@
 #   See pow-inputs for an example.
 
 subdir := benchtests
-bench := exp pow rint sin cos tan atan modf \
-	 slowexp slowpow slowsin slowcos slowtan slowatan
+bench := exp pow rint sin cos tan atan modf
 
-# exp function fast path: sysdeps/ieee754/dbl-64/e_exp.c
-exp-ITER = 5e8
 exp-ARGLIST = double
 exp-RET = double
 LDFLAGS-bench-exp = -lm
 
-# pow function fast path: sysdeps/ieee754/dbl-64/e_pow.c
-pow-ITER = 2e8
 pow-ARGLIST = double:double
 pow-RET = double
 LDFLAGS-bench-pow = -lm
 
-rint-ITER = 250000000
 rint-ARGLIST = double
 rint-RET = double
 LDFLAGS-bench-rint = -lm
 
-# exp function slowest path: sysdeps/ieee754/dbl-64/mpexp.c
-slowexp-ITER = 3e5
-slowexp-ARGLIST = double
-slowexp-RET = double
-slowexp-INCLUDE = slowexp.c
-LDFLAGS-bench-slowexp = -lm
-
-# sin function fast path: sysdeps/ieee754/dbl-64/s_sin.c
-sin-ITER = 3e9
 sin-ARGLIST = double
 sin-RET = double
 LDFLAGS-bench-sin = -lm
 
-# cos function fast path: sysdeps/ieee754/dbl-64/s_sin.c
-cos-ITER = 3e9
 cos-ARGLIST = double
 cos-RET = double
 LDFLAGS-bench-cos = -lm
 
-# tan function fast path: sysdeps/ieee754/dbl-64/s_tan.c
-tan-ITER = 3e9
 tan-ARGLIST = double
 tan-RET = double
 LDFLAGS-bench-tan = -lm
 
-# atan function fast path: sysdeps/ieee754/dbl-64/s_atan.c
-atan-ITER = 6e9
 atan-ARGLIST = double
 atan-RET = double
 LDFLAGS-bench-atan = -lm
-
-# pow function slowest path: sysdeps/ieee754/dbl-64/slowpow.c
-slowpow-ITER = 1e5
-slowpow-ARGLIST = double:double
-slowpow-RET = double
-slowpow-INCLUDE = slowpow.c
-LDFLAGS-bench-slowpow = -lm
-
-# sin function slowest path: sysdeps/ieee754/dbl-64/sincos32.c
-slowsin-ITER = 3e7
-slowsin-ARGLIST = double
-slowsin-RET = double
-slowsin-INCLUDE = slowsin.c
-LDFLAGS-bench-slowsin = -lm
-
-# cos function slowest path: sysdeps/ieee754/dbl-64/sincos32.c
-slowcos-ITER = 3e7
-slowcos-ARGLIST = double
-slowcos-RET = double
-slowcos-INCLUDE = slowcos.c
-LDFLAGS-bench-slowcos = -lm
-
-# tan function slowest path: sysdeps/ieee754/dbl-64/mptan.c
-slowtan-ITER = 3e7
-slowtan-ARGLIST = double
-slowtan-RET = double
-slowtan-INCLUDE = slowtan.c
-LDFLAGS-bench-slowtan = -lm
-
-# atan function slowest path: sysdeps/ieee754/dbl-64/mpatan.c
-slowatan-ITER = 3e8
-slowatan-ARGLIST = double
-slowatan-RET = double
-slowatan-INCLUDE = slowatan.c
-LDFLAGS-bench-slowatan = -lm
 
 
 
@@ -140,6 +78,13 @@
 include ../Rules
 
 binaries-bench := $(addprefix $(objpfx)bench-,$(bench))
+
+# The default duration: 10 seconds.
+ifndef BENCH_DURATION
+BENCH_DURATION := 10
+endif
+
+CPPFLAGS-nonlib = -DDURATION=$(BENCH_DURATION)
 
 # This makes sure CPPFLAGS-nonlib and CFLAGS-nonlib are passed
 # for all these modules.
@@ -176,5 +121,5 @@
 	  cat $($*-INCLUDE); \
 	fi; \
 	$(..)scripts/bench.pl $(patsubst %-inputs,%,$<) \
-	  $($*-ITER) $($*-ARGLIST) $($*-RET); } > $@-tmp
+	  $($*-ARGLIST) $($*-RET); } > $@-tmp
 	mv -f $@-tmp $@

Modified: fsf/trunk/libc/benchtests/atan-inputs
==============================================================================
--- fsf/trunk/libc/benchtests/atan-inputs (original)
+++ fsf/trunk/libc/benchtests/atan-inputs Wed May  1 00:02:09 2013
@@ -1,3 +1,9 @@
 0x1.000000c5cba86p0
 0x1.000001883003ap0
 0x1.00000dfb2b674p0
+# atan slowest path at 768 bits
+# Implemented in sysdeps/ieee754/dbl-64/mpatan.c
+## name: 768bits
+0x1.000000c5cba87p0
+0x1.000001883003bp0
+0x1.00000dfb2b675p0

Modified: fsf/trunk/libc/benchtests/bench-modf.c
==============================================================================
--- fsf/trunk/libc/benchtests/bench-modf.c (original)
+++ fsf/trunk/libc/benchtests/bench-modf.c Wed May  1 00:02:09 2013
@@ -17,7 +17,7 @@
 
 extern double modf (double, double *);
 
-#define CALL_BENCH_FUNC(j, i) modf ( in[j].arg0, &i);
+#define CALL_BENCH_FUNC(j, i) modf (in[j].arg0, &i);
 
 struct args
 {
@@ -28,12 +28,17 @@
   { -42.42 }
 };
 
-#define NUM_SAMPLES (sizeof (in) / sizeof (struct args))
+#define NUM_VARIANTS 1
+#define NUM_SAMPLES(v) (sizeof (in) / sizeof (struct args))
 
 static volatile double ret = 0.0;
-#define BENCH_FUNC(j) ({double iptr; ret =  CALL_BENCH_FUNC (j, iptr);})
+#define BENCH_FUNC(v, j) \
+({									      \
+  double iptr;								      \
+  ret =  CALL_BENCH_FUNC (j, iptr);					      \
+})
 
-#define ITER 250000000
 #define FUNCNAME "modf"
+#define VARIANT(v) FUNCNAME "()"
 
 #include "bench-skeleton.c"

Modified: fsf/trunk/libc/benchtests/bench-skeleton.c
==============================================================================
--- fsf/trunk/libc/benchtests/bench-skeleton.c (original)
+++ fsf/trunk/libc/benchtests/bench-skeleton.c Wed May  1 00:02:09 2013
@@ -22,13 +22,17 @@
 #include <time.h>
 #include <inttypes.h>
 
+#define TIMESPEC_AFTER(a, b) \
+  (((a).tv_sec == (b).tv_sec) ?						      \
+     ((a).tv_nsec > (b).tv_nsec) :					      \
+	((a).tv_sec > (b).tv_sec))
 int
 main (int argc, char **argv)
 {
-  unsigned long i, j, k;
-  uint64_t total = 0, max = 0, min = 0x7fffffffffffffff;
-  struct timespec start, end;
+  unsigned long i, k;
+  struct timespec start, end, runtime;
 
+  memset (&runtime, 0, sizeof (runtime));
   memset (&start, 0, sizeof (start));
   memset (&end, 0, sizeof (end));
 
@@ -39,37 +43,58 @@
      Measurements close to the minimum clock resolution won't make much sense,
      but it's better than having nothing at all.  */
   unsigned long iters = 1000 * start.tv_nsec;
-  unsigned long total_iters = ITER / iters;
 
-  for (i = 0; i < NUM_SAMPLES; i++)
+  for (int v = 0; v < NUM_VARIANTS; v++)
     {
-      for (j = 0; j < total_iters; j ++)
+      /* Run for approximately DURATION seconds.  */
+      clock_gettime (CLOCK_MONOTONIC_RAW, &runtime);
+      runtime.tv_sec += DURATION;
+
+      double d_total_i = 0;
+      uint64_t total = 0, max = 0, min = 0x7fffffffffffffff;
+      while (1)
 	{
-	  clock_gettime (CLOCK_PROCESS_CPUTIME_ID, &start);
-	  for (k = 0; k < iters; k++)
-	    BENCH_FUNC(i);
-	  clock_gettime (CLOCK_PROCESS_CPUTIME_ID, &end);
+	  for (i = 0; i < NUM_SAMPLES (v); i++)
+	    {
+	      clock_gettime (CLOCK_PROCESS_CPUTIME_ID, &start);
+	      for (k = 0; k < iters; k++)
+		BENCH_FUNC (v, i);
+	      clock_gettime (CLOCK_PROCESS_CPUTIME_ID, &end);
 
-	  uint64_t cur = (end.tv_nsec - start.tv_nsec
-			 + ((end.tv_sec - start.tv_sec)
-			    * (uint64_t) 1000000000));
+	      uint64_t cur = (end.tv_nsec - start.tv_nsec
+			      + ((end.tv_sec - start.tv_sec)
+				 * (uint64_t) 1000000000));
 
-	  if (cur > max)
-	    max = cur;
+	      if (cur > max)
+		max = cur;
 
-	  if (cur < min)
-	    min = cur;
+	      if (cur < min)
+		min = cur;
 
-	  total += cur;
+	      total += cur;
+
+	      d_total_i += iters;
+	    }
+	  struct timespec curtime;
+
+	  memset (&curtime, 0, sizeof (curtime));
+	  clock_gettime (CLOCK_MONOTONIC_RAW, &curtime);
+	  if (TIMESPEC_AFTER (curtime, runtime))
+	    goto done;
 	}
+
+      double d_total_s;
+      double d_iters;
+
+    done:
+      d_total_s = total * 1e-9;
+      d_iters = iters;
+
+      printf ("%s: ITERS:%g: TOTAL:%gs, MAX:%gns, MIN:%gns, %g iter/s\n",
+	      VARIANT (v),
+	      d_total_i, d_total_s, max / d_iters, min / d_iters,
+	      d_total_i / d_total_s);
     }
-
-  double d_total_s = total * 1e-9;
-  double d_iters = iters;
-  double d_total_i = (double)ITER * NUM_SAMPLES;
-  printf (FUNCNAME ": ITERS:%g: TOTAL:%gs, MAX:%gns, MIN:%gns, %g iter/s\n",
-	  d_total_i, d_total_s, max / d_iters, min / d_iters,
-	  d_total_i / d_total_s);
 
   return 0;
 }

Modified: fsf/trunk/libc/benchtests/cos-inputs
==============================================================================
--- fsf/trunk/libc/benchtests/cos-inputs (original)
+++ fsf/trunk/libc/benchtests/cos-inputs Wed May  1 00:02:09 2013
@@ -3,3 +3,11 @@
 0x1.00000162a932ap0
 0x1.000002d452a11p0
 0x1.000005bc7d86cp0
+# cos slow path at 768 bits
+# Implemented in sysdeps/ieee754/dbl-64/sincos32.c
+## name: 768bits
+0x1.000000cf4a2a2p0
+0x1.0000010b239a9p0
+0x1.00000162a932bp0
+0x1.000002d452a10p0
+0x1.000005bc7d86dp0

Modified: fsf/trunk/libc/benchtests/exp-inputs
==============================================================================
--- fsf/trunk/libc/benchtests/exp-inputs (original)
+++ fsf/trunk/libc/benchtests/exp-inputs Wed May  1 00:02:09 2013
@@ -1,1 +1,5 @@
 42
+# Slowest path with computation in 768 bit precision.
+# Implemented in: sysdeps/ieee754/dbl-64/mpexp.c
+## name: 768bits
+708.00096423260981737257679924368858

Modified: fsf/trunk/libc/benchtests/pow-inputs
==============================================================================
--- fsf/trunk/libc/benchtests/pow-inputs (original)
+++ fsf/trunk/libc/benchtests/pow-inputs Wed May  1 00:02:09 2013
@@ -1,1 +1,5 @@
 42.0, 42.0
+# pow slowest path at 768 bits
+# Implemented in sysdeps/ieee754/dbl-64/slowpow.c
+## name: 768bits
+1.0000000000000020, 1.5

Modified: fsf/trunk/libc/benchtests/sin-inputs
==============================================================================
--- fsf/trunk/libc/benchtests/sin-inputs (original)
+++ fsf/trunk/libc/benchtests/sin-inputs Wed May  1 00:02:09 2013
@@ -5,3 +5,13 @@
 4.0
 4.7
 5.9
+# sin slowest path at 768 bits
+# Implemented in sysdeps/ieee754/dbl-64/sincos32.c
+## name: 768bits
+0.93340582292648832662962377071381
+2.3328432680770916363144351635128
+3.7439477503636453548097051680088
+3.9225160069792437411706487182528
+4.0711651639931289992091478779912
+4.7858438478542097982426639646292
+5.9840767662578002727968851104379

Removed: fsf/trunk/libc/benchtests/slowatan-inputs
==============================================================================
--- fsf/trunk/libc/benchtests/slowatan-inputs (original)
+++ fsf/trunk/libc/benchtests/slowatan-inputs (removed)
@@ -1,3 +1,0 @@
-0x1.000000c5cba87p0
-0x1.000001883003bp0
-0x1.00000dfb2b675p0

Removed: fsf/trunk/libc/benchtests/slowatan.c
==============================================================================
--- fsf/trunk/libc/benchtests/slowatan.c (original)
+++ fsf/trunk/libc/benchtests/slowatan.c (removed)
@@ -1,19 +1,0 @@
-/* Define slowatan.
-   Copyright (C) 2013 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define slowatan atan

Removed: fsf/trunk/libc/benchtests/slowcos-inputs
==============================================================================
--- fsf/trunk/libc/benchtests/slowcos-inputs (original)
+++ fsf/trunk/libc/benchtests/slowcos-inputs (removed)
@@ -1,5 +1,0 @@
-0x1.000000cf4a2a2p0
-0x1.0000010b239a9p0
-0x1.00000162a932bp0
-0x1.000002d452a10p0
-0x1.000005bc7d86dp0

Removed: fsf/trunk/libc/benchtests/slowcos.c
==============================================================================
--- fsf/trunk/libc/benchtests/slowcos.c (original)
+++ fsf/trunk/libc/benchtests/slowcos.c (removed)
@@ -1,19 +1,0 @@
-/* Define slowcos.
-   Copyright (C) 2013 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define slowcos cos

Removed: fsf/trunk/libc/benchtests/slowexp-inputs
==============================================================================
--- fsf/trunk/libc/benchtests/slowexp-inputs (original)
+++ fsf/trunk/libc/benchtests/slowexp-inputs (removed)
@@ -1,1 +1,0 @@
-708.00096423260981737257679924368858

Removed: fsf/trunk/libc/benchtests/slowexp.c
==============================================================================
--- fsf/trunk/libc/benchtests/slowexp.c (original)
+++ fsf/trunk/libc/benchtests/slowexp.c (removed)
@@ -1,19 +1,0 @@
-/* Define slowexp.
-   Copyright (C) 2013 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define slowexp exp

Removed: fsf/trunk/libc/benchtests/slowpow-inputs
==============================================================================
--- fsf/trunk/libc/benchtests/slowpow-inputs (original)
+++ fsf/trunk/libc/benchtests/slowpow-inputs (removed)
@@ -1,1 +1,0 @@
-1.0000000000000020, 1.5

Removed: fsf/trunk/libc/benchtests/slowpow.c
==============================================================================
--- fsf/trunk/libc/benchtests/slowpow.c (original)
+++ fsf/trunk/libc/benchtests/slowpow.c (removed)
@@ -1,19 +1,0 @@
-/* Define slowpow.
-   Copyright (C) 2013 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define slowpow pow

Removed: fsf/trunk/libc/benchtests/slowsin-inputs
==============================================================================
--- fsf/trunk/libc/benchtests/slowsin-inputs (original)
+++ fsf/trunk/libc/benchtests/slowsin-inputs (removed)
@@ -1,7 +1,0 @@
-0.93340582292648832662962377071381
-2.3328432680770916363144351635128
-3.7439477503636453548097051680088
-3.9225160069792437411706487182528
-4.0711651639931289992091478779912
-4.7858438478542097982426639646292
-5.9840767662578002727968851104379

Removed: fsf/trunk/libc/benchtests/slowsin.c
==============================================================================
--- fsf/trunk/libc/benchtests/slowsin.c (original)
+++ fsf/trunk/libc/benchtests/slowsin.c (removed)
@@ -1,19 +1,0 @@
-/* Define slowsin.
-   Copyright (C) 2013 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define slowsin sin

Removed: fsf/trunk/libc/benchtests/slowtan-inputs
==============================================================================
--- fsf/trunk/libc/benchtests/slowtan-inputs (original)
+++ fsf/trunk/libc/benchtests/slowtan-inputs (removed)
@@ -1,1 +1,0 @@
-0x1.dffffffffff1fp-22

Removed: fsf/trunk/libc/benchtests/slowtan.c
==============================================================================
--- fsf/trunk/libc/benchtests/slowtan.c (original)
+++ fsf/trunk/libc/benchtests/slowtan.c (removed)
@@ -1,19 +1,0 @@
-/* Define slowtan.
-   Copyright (C) 2013 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define slowtan tan

Modified: fsf/trunk/libc/benchtests/tan-inputs
==============================================================================
--- fsf/trunk/libc/benchtests/tan-inputs (original)
+++ fsf/trunk/libc/benchtests/tan-inputs Wed May  1 00:02:09 2013
@@ -1,1 +1,5 @@
 0x1.dffffffffff1ep-22
+# tan slowest path at 768 bits
+# Implemented in sysdeps/ieee754/dbl-64/mptan.c
+## name: 768bits
+0x1.dffffffffff1fp-22

Modified: fsf/trunk/libc/math/libm-test.inc
==============================================================================
--- fsf/trunk/libc/math/libm-test.inc (original)
+++ fsf/trunk/libc/math/libm-test.inc Wed May  1 00:02:09 2013
@@ -4483,6 +4483,134 @@
   TEST_c_c (catan, -0x1.fp16383L, 0x1.fp16383L, -1.570796326794896619231321691639751442099L, 4.338197604015604524209906861060325938836e-4933L, UNDERFLOW_EXCEPTION);
   TEST_c_c (catan, -0x1.fp16383L, -0x1.fp16383L, -1.570796326794896619231321691639751442099L, -4.338197604015604524209906861060325938836e-4933L, UNDERFLOW_EXCEPTION);
 #endif
+  TEST_c_c (catan, 0x1p-13L, 1.0L, 7.854286809755354140031716771044626356262e-1L, 4.852030264850939738801379894163661227127L);
+  TEST_c_c (catan, 0x1p-13L, -1.0L, 7.854286809755354140031716771044626356262e-1L, -4.852030264850939738801379894163661227127L);
+  TEST_c_c (catan, -0x1p-13L, 1.0L, -7.854286809755354140031716771044626356262e-1L, 4.852030264850939738801379894163661227127L);
+  TEST_c_c (catan, -0x1p-13L, -1.0L, -7.854286809755354140031716771044626356262e-1L, -4.852030264850939738801379894163661227127L);
+  TEST_c_c (catan, 1.0L, 0x1p-13L, 7.853981671227386080775748393881580082970e-1L, 6.103515609841754902688560615027452023669e-5L);
+  TEST_c_c (catan, -1.0L, 0x1p-13L, -7.853981671227386080775748393881580082970e-1L, 6.103515609841754902688560615027452023669e-5L);
+  TEST_c_c (catan, 1.0L, -0x1p-13L, 7.853981671227386080775748393881580082970e-1L, -6.103515609841754902688560615027452023669e-5L);
+  TEST_c_c (catan, -1.0L, -0x1p-13L, -7.853981671227386080775748393881580082970e-1L, -6.103515609841754902688560615027452023669e-5L);
+  TEST_c_c (catan, 0x1p-27L, 1.0L, 7.853981652600934588466178684534110069553e-1L, 9.704060527839234335310696652368086117807L);
+  TEST_c_c (catan, 0x1p-27L, -1.0L, 7.853981652600934588466178684534110069553e-1L, -9.704060527839234335310696652368086117807L);
+  TEST_c_c (catan, -0x1p-27L, 1.0L, -7.853981652600934588466178684534110069553e-1L, 9.704060527839234335310696652368086117807L);
+  TEST_c_c (catan, -0x1p-27L, -1.0L, -7.853981652600934588466178684534110069553e-1L, -9.704060527839234335310696652368086117807L);
+  TEST_c_c (catan, 1.0L, 0x1p-27L, 7.853981633974483234934486536343324763447e-1L, 3.725290298461914028034141143623846306386e-9L);
+  TEST_c_c (catan, -1.0L, 0x1p-27L, -7.853981633974483234934486536343324763447e-1L, 3.725290298461914028034141143623846306386e-9L);
+  TEST_c_c (catan, 1.0L, -0x1p-27L, 7.853981633974483234934486536343324763447e-1L, -3.725290298461914028034141143623846306386e-9L);
+  TEST_c_c (catan, -1.0L, -0x1p-27L, -7.853981633974483234934486536343324763447e-1L, -3.725290298461914028034141143623846306386e-9L);
+  TEST_c_c (catan, 0x1p-33L, 1.0L, 7.853981634265521400723945494331241018449e-1L, 1.178350206951907026009379309773625595762e1L);
+  TEST_c_c (catan, 0x1p-33L, -1.0L, 7.853981634265521400723945494331241018449e-1L, -1.178350206951907026009379309773625595762e1L);
+  TEST_c_c (catan, -0x1p-33L, 1.0L, -7.853981634265521400723945494331241018449e-1L, 1.178350206951907026009379309773625595762e1L);
+  TEST_c_c (catan, -0x1p-33L, -1.0L, -7.853981634265521400723945494331241018449e-1L, -1.178350206951907026009379309773625595762e1L);
+  TEST_c_c (catan, 1.0L, 0x1p-33L, 7.853981633974483096190489776088929224056e-1L, 5.820766091346740722643102318246316469910e-11L);
+  TEST_c_c (catan, -1.0L, 0x1p-33L, -7.853981633974483096190489776088929224056e-1L, 5.820766091346740722643102318246316469910e-11L);
+  TEST_c_c (catan, 1.0L, -0x1p-33L, 7.853981633974483096190489776088929224056e-1L, -5.820766091346740722643102318246316469910e-11L);
+  TEST_c_c (catan, -1.0L, -0x1p-33L, -7.853981633974483096190489776088929224056e-1L, -5.820766091346740722643102318246316469910e-11L);
+  TEST_c_c (catan, 0x1p-54L, 1.0L, 7.853981633974483234934486536343324763447e-1L, 1.906154746539849600897388334009985581467e1L);
+  TEST_c_c (catan, 0x1p-54L, -1.0L, 7.853981633974483234934486536343324763447e-1L, -1.906154746539849600897388334009985581467e1L);
+  TEST_c_c (catan, -0x1p-54L, 1.0L, -7.853981633974483234934486536343324763447e-1L, 1.906154746539849600897388334009985581467e1L);
+  TEST_c_c (catan, -0x1p-54L, -1.0L, -7.853981633974483234934486536343324763447e-1L, -1.906154746539849600897388334009985581467e1L);
+  TEST_c_c (catan, 1.0L, 0x1p-54L, 7.853981633974483096156608458198764914213e-1L, 2.775557561562891351059079170227049355775e-17L);
+  TEST_c_c (catan, -1.0L, 0x1p-54L, -7.853981633974483096156608458198764914213e-1L, 2.775557561562891351059079170227049355775e-17L);
+  TEST_c_c (catan, 1.0L, -0x1p-54L, 7.853981633974483096156608458198764914213e-1L, -2.775557561562891351059079170227049355775e-17L);
+  TEST_c_c (catan, -1.0L, -0x1p-54L, -7.853981633974483096156608458198764914213e-1L, -2.775557561562891351059079170227049355775e-17L);
+  TEST_c_c (catan, 0x1p-57L, 1.0L, 7.853981633974483113503843217966828154612e-1L, 2.010126823623841397309973152228712047720e1L);
+  TEST_c_c (catan, 0x1p-57L, -1.0L, 7.853981633974483113503843217966828154612e-1L, -2.010126823623841397309973152228712047720e1L);
+  TEST_c_c (catan, -0x1p-57L, 1.0L, -7.853981633974483113503843217966828154612e-1L, 2.010126823623841397309973152228712047720e1L);
+  TEST_c_c (catan, -0x1p-57L, -1.0L, -7.853981633974483113503843217966828154612e-1L, -2.010126823623841397309973152228712047720e1L);
+  TEST_c_c (catan, 1.0L, 0x1p-57L, 7.853981633974483096156608458198757330864e-1L, 3.469446951953614188823848962783813448721e-18L);
+  TEST_c_c (catan, -1.0L, 0x1p-57L, -7.853981633974483096156608458198757330864e-1L, 3.469446951953614188823848962783813448721e-18L);
+  TEST_c_c (catan, 1.0L, -0x1p-57L, 7.853981633974483096156608458198757330864e-1L, -3.469446951953614188823848962783813448721e-18L);
+  TEST_c_c (catan, -1.0L, -0x1p-57L, -7.853981633974483096156608458198757330864e-1L, -3.469446951953614188823848962783813448721e-18L);
+  TEST_c_c (catan, 0x1p-13L, 0x1.000002p0L, 7.859169620684960844300240092596908675974e-1L, 4.852030056234795712498957387213592193975L);
+  TEST_c_c (catan, 0x1p-13L, -0x1.000002p0L, 7.859169620684960844300240092596908675974e-1L, -4.852030056234795712498957387213592193975L);
+  TEST_c_c (catan, -0x1p-13L, 0x1.000002p0L, -7.859169620684960844300240092596908675974e-1L, 4.852030056234795712498957387213592193975L);
+  TEST_c_c (catan, -0x1p-13L, -0x1.000002p0L, -7.859169620684960844300240092596908675974e-1L, -4.852030056234795712498957387213592193975L);
+  TEST_c_c (catan, 0x1.000002p0L, 0x1p-13L, 7.853982267273793866654490522673596014524e-1L, 6.103514882246036852433556327261700380577e-5L);
+  TEST_c_c (catan, -0x1.000002p0L, 0x1p-13L, -7.853982267273793866654490522673596014524e-1L, 6.103514882246036852433556327261700380577e-5L);
+  TEST_c_c (catan, 0x1.000002p0L, -0x1p-13L, 7.853982267273793866654490522673596014524e-1L, -6.103514882246036852433556327261700380577e-5L);
+  TEST_c_c (catan, -0x1.000002p0L, -0x1p-13L, -7.853982267273793866654490522673596014524e-1L, -6.103514882246036852433556327261700380577e-5L);
+  TEST_c_c (catan, 0x1p-13L, 0x0.ffffffp0L, 7.851845403708474595909269086711426246675e-1L, 4.852030190345140708455871037447717761868L);
+  TEST_c_c (catan, 0x1p-13L, -0x0.ffffffp0L, 7.851845403708474595909269086711426246675e-1L, -4.852030190345140708455871037447717761868L);
+  TEST_c_c (catan, -0x1p-13L, 0x0.ffffffp0L, -7.851845403708474595909269086711426246675e-1L, 4.852030190345140708455871037447717761868L);
+  TEST_c_c (catan, -0x1p-13L, -0x0.ffffffp0L, -7.851845403708474595909269086711426246675e-1L, -4.852030190345140708455871037447717761868L);
+  TEST_c_c (catan, 0x0.ffffffp0L, 0x1p-13L, 7.853981373204155542484315721351697277336e-1L, 6.103515973639646453881721999956617260502e-5L);
+  TEST_c_c (catan, -0x0.ffffffp0L, 0x1p-13L, -7.853981373204155542484315721351697277336e-1L, 6.103515973639646453881721999956617260502e-5L);
+  TEST_c_c (catan, 0x0.ffffffp0L, -0x1p-13L, 7.853981373204155542484315721351697277336e-1L, -6.103515973639646453881721999956617260502e-5L);
+  TEST_c_c (catan, -0x0.ffffffp0L, -0x1p-13L, -7.853981373204155542484315721351697277336e-1L, -6.103515973639646453881721999956617260502e-5L);
+#ifndef TEST_FLOAT
+  TEST_c_c (catan, 0x1p-27L, 0x1.0000000000001p0L, 7.853981801612546526942695000283242525531e-1L, 9.704060527839234168777242958594699810015L);
+  TEST_c_c (catan, 0x1p-27L, -0x1.0000000000001p0L, 7.853981801612546526942695000283242525531e-1L, -9.704060527839234168777242958594699810015L);
+  TEST_c_c (catan, -0x1p-27L, 0x1.0000000000001p0L, -7.853981801612546526942695000283242525531e-1L, 9.704060527839234168777242958594699810015L);
+  TEST_c_c (catan, -0x1p-27L, -0x1.0000000000001p0L, -7.853981801612546526942695000283242525531e-1L, -9.704060527839234168777242958594699810015L);
+  TEST_c_c (catan, 0x1.0000000000001p0L, 0x1p-27L, 7.853981633974484345157511161499711112683e-1L, 3.725290298461913200853528590596263270474e-9L);
+  TEST_c_c (catan, -0x1.0000000000001p0L, 0x1p-27L, -7.853981633974484345157511161499711112683e-1L, 3.725290298461913200853528590596263270474e-9L);
+  TEST_c_c (catan, 0x1.0000000000001p0L, -0x1p-27L, 7.853981633974484345157511161499711112683e-1L, -3.725290298461913200853528590596263270474e-9L);
+  TEST_c_c (catan, -0x1.0000000000001p0L, -0x1p-27L, -7.853981633974484345157511161499711112683e-1L, -3.725290298461913200853528590596263270474e-9L);
+  TEST_c_c (catan, 0x1p-27L, 0x0.fffffffffffff8p0L, 7.853981578095128619227903983047292781021e-1L, 9.704060527839234252043969805481351363824L);
+  TEST_c_c (catan, 0x1p-27L, -0x0.fffffffffffff8p0L, 7.853981578095128619227903983047292781021e-1L, -9.704060527839234252043969805481351363824L);
+  TEST_c_c (catan, -0x1p-27L, 0x0.fffffffffffff8p0L, -7.853981578095128619227903983047292781021e-1L, 9.704060527839234252043969805481351363824L);
+  TEST_c_c (catan, -0x1p-27L, -0x0.fffffffffffff8p0L, -7.853981578095128619227903983047292781021e-1L, -9.704060527839234252043969805481351363824L);
+  TEST_c_c (catan, 0x0.fffffffffffff8p0L, 0x1p-27L, 7.853981633974482679822974223765039144191e-1L, 3.725290298461914441624447420137706700965e-9L);
+  TEST_c_c (catan, -0x0.fffffffffffff8p0L, 0x1p-27L, -7.853981633974482679822974223765039144191e-1L, 3.725290298461914441624447420137706700965e-9L);
+  TEST_c_c (catan, 0x0.fffffffffffff8p0L, -0x1p-27L, 7.853981633974482679822974223765039144191e-1L, -3.725290298461914441624447420137706700965e-9L);
+  TEST_c_c (catan, -0x0.fffffffffffff8p0L, -0x1p-27L, -7.853981633974482679822974223765039144191e-1L, -3.725290298461914441624447420137706700965e-9L);
+#endif
+#if defined TEST_LDOUBLE && LDBL_MANT_DIG >= 64
+  TEST_c_c (catan, 0x1p-33L, 0x1.0000000000000002p0L, 7.853981638922134273801338071094141188767e-1L, 1.178350206951907025990405771755129268176e1L);
+  TEST_c_c (catan, 0x1p-33L, -0x1.0000000000000002p0L, 7.853981638922134273801338071094141188767e-1L, -1.178350206951907025990405771755129268176e1L);
+  TEST_c_c (catan, -0x1p-33L, 0x1.0000000000000002p0L, -7.853981638922134273801338071094141188767e-1L, 1.178350206951907025990405771755129268176e1L);
+  TEST_c_c (catan, -0x1p-33L, -0x1.0000000000000002p0L, -7.853981638922134273801338071094141188767e-1L, -1.178350206951907025990405771755129268176e1L);
+  TEST_c_c (catan, 0x1.0000000000000002p0L, 0x1p-33L, 7.853981633974483096732590862331681441026e-1L, 5.820766091346740722012013594069507025615e-11L);
+  TEST_c_c (catan, -0x1.0000000000000002p0L, 0x1p-33L, -7.853981633974483096732590862331681441026e-1L, 5.820766091346740722012013594069507025615e-11L);
+  TEST_c_c (catan, 0x1.0000000000000002p0L, -0x1p-33L, 7.853981633974483096732590862331681441026e-1L, -5.820766091346740722012013594069507025615e-11L);
+  TEST_c_c (catan, -0x1.0000000000000002p0L, -0x1p-33L, -7.853981633974483096732590862331681441026e-1L, -5.820766091346740722012013594069507025615e-11L);
+  TEST_c_c (catan, 0x1p-33L, 0x0.ffffffffffffffffp0L, 7.853981631937214964185249205444919953948e-1L, 1.178350206951907026002603046195591193050e1L);
+  TEST_c_c (catan, 0x1p-33L, -0x0.ffffffffffffffffp0L, 7.853981631937214964185249205444919953948e-1L, -1.178350206951907026002603046195591193050e1L);
+  TEST_c_c (catan, -0x1p-33L, 0x0.ffffffffffffffffp0L, -7.853981631937214964185249205444919953948e-1L, 1.178350206951907026002603046195591193050e1L);
+  TEST_c_c (catan, -0x1p-33L, -0x0.ffffffffffffffffp0L, -7.853981631937214964185249205444919953948e-1L, -1.178350206951907026002603046195591193050e1L);
+  TEST_c_c (catan, 0x0.ffffffffffffffffp0L, 0x1p-33L, 7.853981633974483095919439232967553115548e-1L, 5.820766091346740722958646680334721192083e-11L);
+  TEST_c_c (catan, -0x0.ffffffffffffffffp0L, 0x1p-33L, -7.853981633974483095919439232967553115548e-1L, 5.820766091346740722958646680334721192083e-11L);
+  TEST_c_c (catan, 0x0.ffffffffffffffffp0L, -0x1p-33L, 7.853981633974483095919439232967553115548e-1L, -5.820766091346740722958646680334721192083e-11L);
+  TEST_c_c (catan, -0x0.ffffffffffffffffp0L, -0x1p-33L, -7.853981633974483095919439232967553115548e-1L, -5.820766091346740722958646680334721192083e-11L);
+#endif
+#if defined TEST_LDOUBLE && LDBL_MANT_DIG >= 106
+  TEST_c_c (catan, 0x1p-54L, 0x1.000000000000000000000000008p0L, 7.853981633974485455380535786656405610710e-1L, 1.906154746539849600897388334009981267384e1L);
+  TEST_c_c (catan, 0x1p-54L, -0x1.000000000000000000000000008p0L, 7.853981633974485455380535786656405610710e-1L, -1.906154746539849600897388334009981267384e1L);
+  TEST_c_c (catan, -0x1p-54L, 0x1.000000000000000000000000008p0L, -7.853981633974485455380535786656405610710e-1L, 1.906154746539849600897388334009981267384e1L);
+  TEST_c_c (catan, -0x1p-54L, -0x1.000000000000000000000000008p0L, -7.853981633974485455380535786656405610710e-1L, -1.906154746539849600897388334009981267384e1L);
+  TEST_c_c (catan, 0x1.000000000000000000000000008p0L, 0x1p-54L, 7.853981633974483096156608458198888173729e-1L, 2.775557561562891351059079170226980932999e-17L);
+  TEST_c_c (catan, -0x1.000000000000000000000000008p0L, 0x1p-54L, -7.853981633974483096156608458198888173729e-1L, 2.775557561562891351059079170226980932999e-17L);
+  TEST_c_c (catan, 0x1.000000000000000000000000008p0L, -0x1p-54L, 7.853981633974483096156608458198888173729e-1L, -2.775557561562891351059079170226980932999e-17L);
+  TEST_c_c (catan, -0x1.000000000000000000000000008p0L, -0x1p-54L, -7.853981633974483096156608458198888173729e-1L, -2.775557561562891351059079170226980932999e-17L);
+  TEST_c_c (catan, 0x1p-54L, 0x0.ffffffffffffffffffffffffffcp0L, 7.853981633974482124711461911186784339815e-1L, 1.906154746539849600897388334009984040723e1L);
+  TEST_c_c (catan, 0x1p-54L, -0x0.ffffffffffffffffffffffffffcp0L, 7.853981633974482124711461911186784339815e-1L, -1.906154746539849600897388334009984040723e1L);
+  TEST_c_c (catan, -0x1p-54L, 0x0.ffffffffffffffffffffffffffcp0L, -7.853981633974482124711461911186784339815e-1L, 1.906154746539849600897388334009984040723e1L);
+  TEST_c_c (catan, -0x1p-54L, -0x0.ffffffffffffffffffffffffffcp0L, -7.853981633974482124711461911186784339815e-1L, -1.906154746539849600897388334009984040723e1L);
+  TEST_c_c (catan, 0x0.ffffffffffffffffffffffffffcp0L, 0x1p-54L, 7.853981633974483096156608458198703284454e-1L, 2.775557561562891351059079170227083567164e-17L);
+  TEST_c_c (catan, -0x0.ffffffffffffffffffffffffffcp0L, 0x1p-54L, -7.853981633974483096156608458198703284454e-1L, 2.775557561562891351059079170227083567164e-17L);
+  TEST_c_c (catan, 0x0.ffffffffffffffffffffffffffcp0L, -0x1p-54L, 7.853981633974483096156608458198703284454e-1L, -2.775557561562891351059079170227083567164e-17L);
+  TEST_c_c (catan, -0x0.ffffffffffffffffffffffffffcp0L, -0x1p-54L, -7.853981633974483096156608458198703284454e-1L, -2.775557561562891351059079170227083567164e-17L);
+#endif
+#if defined TEST_LDOUBLE && LDBL_MANT_DIG >= 113
+  TEST_c_c (catan, 0x1p-57L, 0x1.0000000000000000000000000001p0L, 7.853981633974483252281721296111395707566e-1L, 2.010126823623841397309973152228712033275e1L);
+  TEST_c_c (catan, 0x1p-57L, -0x1.0000000000000000000000000001p0L, 7.853981633974483252281721296111395707566e-1L, -2.010126823623841397309973152228712033275e1L);
+  TEST_c_c (catan, -0x1p-57L, 0x1.0000000000000000000000000001p0L, -7.853981633974483252281721296111395707566e-1L, 2.010126823623841397309973152228712033275e1L);
+  TEST_c_c (catan, -0x1p-57L, -0x1.0000000000000000000000000001p0L, -7.853981633974483252281721296111395707566e-1L, -2.010126823623841397309973152228712033275e1L);
+  TEST_c_c (catan, 0x1.0000000000000000000000000001p0L, 0x1p-57L, 7.853981633974483096156608458198758293829e-1L, 3.469446951953614188823848962783812780530e-18L);
+  TEST_c_c (catan, -0x1.0000000000000000000000000001p0L, 0x1p-57L, -7.853981633974483096156608458198758293829e-1L, 3.469446951953614188823848962783812780530e-18L);
+  TEST_c_c (catan, 0x1.0000000000000000000000000001p0L, -0x1p-57L, 7.853981633974483096156608458198758293829e-1L, -3.469446951953614188823848962783812780530e-18L);
+  TEST_c_c (catan, -0x1.0000000000000000000000000001p0L, -0x1p-57L, -7.853981633974483096156608458198758293829e-1L, -3.469446951953614188823848962783812780530e-18L);
+  TEST_c_c (catan, 0x1p-57L, 0x0.ffffffffffffffffffffffffffff8p0L, 7.853981633974483044114904178894544378135e-1L, 2.010126823623841397309973152228712040498e1L);
+  TEST_c_c (catan, 0x1p-57L, -0x0.ffffffffffffffffffffffffffff8p0L, 7.853981633974483044114904178894544378135e-1L, -2.010126823623841397309973152228712040498e1L);
+  TEST_c_c (catan, -0x1p-57L, 0x0.ffffffffffffffffffffffffffff8p0L, -7.853981633974483044114904178894544378135e-1L, 2.010126823623841397309973152228712040498e1L);
+  TEST_c_c (catan, -0x1p-57L, -0x0.ffffffffffffffffffffffffffff8p0L, -7.853981633974483044114904178894544378135e-1L, -2.010126823623841397309973152228712040498e1L);
+  TEST_c_c (catan, 0x0.ffffffffffffffffffffffffffff8p0L, 0x1p-57L, 7.853981633974483096156608458198756849381e-1L, 3.469446951953614188823848962783813782817e-18L);
+  TEST_c_c (catan, -0x0.ffffffffffffffffffffffffffff8p0L, 0x1p-57L, -7.853981633974483096156608458198756849381e-1L, 3.469446951953614188823848962783813782817e-18L);
+  TEST_c_c (catan, 0x0.ffffffffffffffffffffffffffff8p0L, -0x1p-57L, 7.853981633974483096156608458198756849381e-1L, -3.469446951953614188823848962783813782817e-18L);
+  TEST_c_c (catan, -0x0.ffffffffffffffffffffffffffff8p0L, -0x1p-57L, -7.853981633974483096156608458198756849381e-1L, -3.469446951953614188823848962783813782817e-18L);
+#endif
 
   TEST_c_c (catan, 0.75L, 1.25L, 1.10714871779409050301706546017853704L, 0.549306144334054845697622618461262852L);
   TEST_c_c (catan, -2, -3, -1.4099210495965755225306193844604208L, -0.22907268296853876629588180294200276L);
@@ -4678,6 +4806,134 @@
   TEST_c_c (catanh, 0x1.fp16383L, -0x1.fp16383L, 4.338197604015604524209906861060325938836e-4933L, -1.570796326794896619231321691639751442099L, UNDERFLOW_EXCEPTION);
   TEST_c_c (catanh, -0x1.fp16383L, 0x1.fp16383L, -4.338197604015604524209906861060325938836e-4933L, 1.570796326794896619231321691639751442099L, UNDERFLOW_EXCEPTION);
   TEST_c_c (catanh, -0x1.fp16383L, -0x1.fp16383L, -4.338197604015604524209906861060325938836e-4933L, -1.570796326794896619231321691639751442099L, UNDERFLOW_EXCEPTION);
+#endif
+  TEST_c_c (catanh, 0x1p-13L, 1.0L, 6.103515609841754902688560615027452023669e-5L, 7.853981671227386080775748393881580082970e-1L);
+  TEST_c_c (catanh, 0x1p-13L, -1.0L, 6.103515609841754902688560615027452023669e-5L, -7.853981671227386080775748393881580082970e-1L);
+  TEST_c_c (catanh, -0x1p-13L, 1.0L, -6.103515609841754902688560615027452023669e-5L, 7.853981671227386080775748393881580082970e-1L);
+  TEST_c_c (catanh, -0x1p-13L, -1.0L, -6.103515609841754902688560615027452023669e-5L, -7.853981671227386080775748393881580082970e-1L);
+  TEST_c_c (catanh, 1.0L, 0x1p-13L, 4.852030264850939738801379894163661227127L, 7.854286809755354140031716771044626356262e-1L);
+  TEST_c_c (catanh, -1.0L, 0x1p-13L, -4.852030264850939738801379894163661227127L, 7.854286809755354140031716771044626356262e-1L);
+  TEST_c_c (catanh, 1.0L, -0x1p-13L, 4.852030264850939738801379894163661227127L, -7.854286809755354140031716771044626356262e-1L);
+  TEST_c_c (catanh, -1.0L, -0x1p-13L, -4.852030264850939738801379894163661227127L, -7.854286809755354140031716771044626356262e-1L);
+  TEST_c_c (catanh, 0x1p-27L, 1.0L, 3.725290298461914028034141143623846306386e-9L, 7.853981633974483234934486536343324763447e-1L);
+  TEST_c_c (catanh, 0x1p-27L, -1.0L, 3.725290298461914028034141143623846306386e-9L, -7.853981633974483234934486536343324763447e-1L);
+  TEST_c_c (catanh, -0x1p-27L, 1.0L, -3.725290298461914028034141143623846306386e-9L, 7.853981633974483234934486536343324763447e-1L);
+  TEST_c_c (catanh, -0x1p-27L, -1.0L, -3.725290298461914028034141143623846306386e-9L, -7.853981633974483234934486536343324763447e-1L);
+  TEST_c_c (catanh, 1.0L, 0x1p-27L, 9.704060527839234335310696652368086117807L, 7.853981652600934588466178684534110069553e-1L);
+  TEST_c_c (catanh, -1.0L, 0x1p-27L, -9.704060527839234335310696652368086117807L, 7.853981652600934588466178684534110069553e-1L);
+  TEST_c_c (catanh, 1.0L, -0x1p-27L, 9.704060527839234335310696652368086117807L, -7.853981652600934588466178684534110069553e-1L);
+  TEST_c_c (catanh, -1.0L, -0x1p-27L, -9.704060527839234335310696652368086117807L, -7.853981652600934588466178684534110069553e-1L);
+  TEST_c_c (catanh, 0x1p-33L, 1.0L, 5.820766091346740722643102318246316469910e-11L, 7.853981633974483096190489776088929224056e-1L);
+  TEST_c_c (catanh, 0x1p-33L, -1.0L, 5.820766091346740722643102318246316469910e-11L, -7.853981633974483096190489776088929224056e-1L);
+  TEST_c_c (catanh, -0x1p-33L, 1.0L, -5.820766091346740722643102318246316469910e-11L, 7.853981633974483096190489776088929224056e-1L);
+  TEST_c_c (catanh, -0x1p-33L, -1.0L, -5.820766091346740722643102318246316469910e-11L, -7.853981633974483096190489776088929224056e-1L);
+  TEST_c_c (catanh, 1.0L, 0x1p-33L, 1.178350206951907026009379309773625595762e1L, 7.853981634265521400723945494331241018449e-1L);
+  TEST_c_c (catanh, -1.0L, 0x1p-33L, -1.178350206951907026009379309773625595762e1L, 7.853981634265521400723945494331241018449e-1L);
+  TEST_c_c (catanh, 1.0L, -0x1p-33L, 1.178350206951907026009379309773625595762e1L, -7.853981634265521400723945494331241018449e-1L);
+  TEST_c_c (catanh, -1.0L, -0x1p-33L, -1.178350206951907026009379309773625595762e1L, -7.853981634265521400723945494331241018449e-1L);
+  TEST_c_c (catanh, 0x1p-54L, 1.0L, 2.775557561562891351059079170227049355775e-17L, 7.853981633974483096156608458198764914213e-1L);
+  TEST_c_c (catanh, 0x1p-54L, -1.0L, 2.775557561562891351059079170227049355775e-17L, -7.853981633974483096156608458198764914213e-1L);
+  TEST_c_c (catanh, -0x1p-54L, 1.0L, -2.775557561562891351059079170227049355775e-17L, 7.853981633974483096156608458198764914213e-1L);
+  TEST_c_c (catanh, -0x1p-54L, -1.0L, -2.775557561562891351059079170227049355775e-17L, -7.853981633974483096156608458198764914213e-1L);
+  TEST_c_c (catanh, 1.0L, 0x1p-54L, 1.906154746539849600897388334009985581467e1L, 7.853981633974483234934486536343324763447e-1L);
+  TEST_c_c (catanh, -1.0L, 0x1p-54L, -1.906154746539849600897388334009985581467e1L, 7.853981633974483234934486536343324763447e-1L);
+  TEST_c_c (catanh, 1.0L, -0x1p-54L, 1.906154746539849600897388334009985581467e1L, -7.853981633974483234934486536343324763447e-1L);
+  TEST_c_c (catanh, -1.0L, -0x1p-54L, -1.906154746539849600897388334009985581467e1L, -7.853981633974483234934486536343324763447e-1L);
+  TEST_c_c (catanh, 0x1p-57L, 1.0L, 3.469446951953614188823848962783813448721e-18L, 7.853981633974483096156608458198757330864e-1L);
+  TEST_c_c (catanh, 0x1p-57L, -1.0L, 3.469446951953614188823848962783813448721e-18L, -7.853981633974483096156608458198757330864e-1L);
+  TEST_c_c (catanh, -0x1p-57L, 1.0L, -3.469446951953614188823848962783813448721e-18L, 7.853981633974483096156608458198757330864e-1L);
+  TEST_c_c (catanh, -0x1p-57L, -1.0L, -3.469446951953614188823848962783813448721e-18L, -7.853981633974483096156608458198757330864e-1L);
+  TEST_c_c (catanh, 1.0L, 0x1p-57L, 2.010126823623841397309973152228712047720e1L, 7.853981633974483113503843217966828154612e-1L);
+  TEST_c_c (catanh, -1.0L, 0x1p-57L, -2.010126823623841397309973152228712047720e1L, 7.853981633974483113503843217966828154612e-1L);
+  TEST_c_c (catanh, 1.0L, -0x1p-57L, 2.010126823623841397309973152228712047720e1L, -7.853981633974483113503843217966828154612e-1L);
+  TEST_c_c (catanh, -1.0L, -0x1p-57L, -2.010126823623841397309973152228712047720e1L, -7.853981633974483113503843217966828154612e-1L);
+  TEST_c_c (catanh, 0x1p-13L, 0x1.000002p0L, 6.103514882246036852433556327261700380577e-5L, 7.853982267273793866654490522673596014524e-1L);
+  TEST_c_c (catanh, 0x1p-13L, -0x1.000002p0L, 6.103514882246036852433556327261700380577e-5L, -7.853982267273793866654490522673596014524e-1L);
+  TEST_c_c (catanh, -0x1p-13L, 0x1.000002p0L, -6.103514882246036852433556327261700380577e-5L, 7.853982267273793866654490522673596014524e-1L);
+  TEST_c_c (catanh, -0x1p-13L, -0x1.000002p0L, -6.103514882246036852433556327261700380577e-5L, -7.853982267273793866654490522673596014524e-1L);
+  TEST_c_c (catanh, 0x1.000002p0L, 0x1p-13L, 4.852030056234795712498957387213592193975L, 7.859169620684960844300240092596908675974e-1L);
+  TEST_c_c (catanh, -0x1.000002p0L, 0x1p-13L, -4.852030056234795712498957387213592193975L, 7.859169620684960844300240092596908675974e-1L);
+  TEST_c_c (catanh, 0x1.000002p0L, -0x1p-13L, 4.852030056234795712498957387213592193975L, -7.859169620684960844300240092596908675974e-1L);
+  TEST_c_c (catanh, -0x1.000002p0L, -0x1p-13L, -4.852030056234795712498957387213592193975L, -7.859169620684960844300240092596908675974e-1L);
+  TEST_c_c (catanh, 0x1p-13L, 0x0.ffffffp0L, 6.103515973639646453881721999956617260502e-5L, 7.853981373204155542484315721351697277336e-1L);
+  TEST_c_c (catanh, 0x1p-13L, -0x0.ffffffp0L, 6.103515973639646453881721999956617260502e-5L, -7.853981373204155542484315721351697277336e-1L);
+  TEST_c_c (catanh, -0x1p-13L, 0x0.ffffffp0L, -6.103515973639646453881721999956617260502e-5L, 7.853981373204155542484315721351697277336e-1L);
+  TEST_c_c (catanh, -0x1p-13L, -0x0.ffffffp0L, -6.103515973639646453881721999956617260502e-5L, -7.853981373204155542484315721351697277336e-1L);
+  TEST_c_c (catanh, 0x0.ffffffp0L, 0x1p-13L, 4.852030190345140708455871037447717761868L, 7.851845403708474595909269086711426246675e-1L);
+  TEST_c_c (catanh, -0x0.ffffffp0L, 0x1p-13L, -4.852030190345140708455871037447717761868L, 7.851845403708474595909269086711426246675e-1L);
+  TEST_c_c (catanh, 0x0.ffffffp0L, -0x1p-13L, 4.852030190345140708455871037447717761868L, -7.851845403708474595909269086711426246675e-1L);
+  TEST_c_c (catanh, -0x0.ffffffp0L, -0x1p-13L, -4.852030190345140708455871037447717761868L, -7.851845403708474595909269086711426246675e-1L);
+#ifndef TEST_FLOAT
+  TEST_c_c (catanh, 0x1p-27L, 0x1.0000000000001p0L, 3.725290298461913200853528590596263270474e-9L, 7.853981633974484345157511161499711112683e-1L);
+  TEST_c_c (catanh, 0x1p-27L, -0x1.0000000000001p0L, 3.725290298461913200853528590596263270474e-9L, -7.853981633974484345157511161499711112683e-1L);
+  TEST_c_c (catanh, -0x1p-27L, 0x1.0000000000001p0L, -3.725290298461913200853528590596263270474e-9L, 7.853981633974484345157511161499711112683e-1L);
+  TEST_c_c (catanh, -0x1p-27L, -0x1.0000000000001p0L, -3.725290298461913200853528590596263270474e-9L, -7.853981633974484345157511161499711112683e-1L);
+  TEST_c_c (catanh, 0x1.0000000000001p0L, 0x1p-27L, 9.704060527839234168777242958594699810015L, 7.853981801612546526942695000283242525531e-1L);
+  TEST_c_c (catanh, -0x1.0000000000001p0L, 0x1p-27L, -9.704060527839234168777242958594699810015L, 7.853981801612546526942695000283242525531e-1L);
+  TEST_c_c (catanh, 0x1.0000000000001p0L, -0x1p-27L, 9.704060527839234168777242958594699810015L, -7.853981801612546526942695000283242525531e-1L);
+  TEST_c_c (catanh, -0x1.0000000000001p0L, -0x1p-27L, -9.704060527839234168777242958594699810015L, -7.853981801612546526942695000283242525531e-1L);
+  TEST_c_c (catanh, 0x1p-27L, 0x0.fffffffffffff8p0L, 3.725290298461914441624447420137706700965e-9L, 7.853981633974482679822974223765039144191e-1L);
+  TEST_c_c (catanh, 0x1p-27L, -0x0.fffffffffffff8p0L, 3.725290298461914441624447420137706700965e-9L, -7.853981633974482679822974223765039144191e-1L);
+  TEST_c_c (catanh, -0x1p-27L, 0x0.fffffffffffff8p0L, -3.725290298461914441624447420137706700965e-9L, 7.853981633974482679822974223765039144191e-1L);
+  TEST_c_c (catanh, -0x1p-27L, -0x0.fffffffffffff8p0L, -3.725290298461914441624447420137706700965e-9L, -7.853981633974482679822974223765039144191e-1L);
+  TEST_c_c (catanh, 0x0.fffffffffffff8p0L, 0x1p-27L, 9.704060527839234252043969805481351363824L, 7.853981578095128619227903983047292781021e-1L);
+  TEST_c_c (catanh, -0x0.fffffffffffff8p0L, 0x1p-27L, -9.704060527839234252043969805481351363824L, 7.853981578095128619227903983047292781021e-1L);
+  TEST_c_c (catanh, 0x0.fffffffffffff8p0L, -0x1p-27L, 9.704060527839234252043969805481351363824L, -7.853981578095128619227903983047292781021e-1L);
+  TEST_c_c (catanh, -0x0.fffffffffffff8p0L, -0x1p-27L, -9.704060527839234252043969805481351363824L, -7.853981578095128619227903983047292781021e-1L);
+#endif
+#if defined TEST_LDOUBLE && LDBL_MANT_DIG >= 64
+  TEST_c_c (catanh, 0x1p-33L, 0x1.0000000000000002p0L, 5.820766091346740722012013594069507025615e-11L, 7.853981633974483096732590862331681441026e-1L);
+  TEST_c_c (catanh, 0x1p-33L, -0x1.0000000000000002p0L, 5.820766091346740722012013594069507025615e-11L, -7.853981633974483096732590862331681441026e-1L);
+  TEST_c_c (catanh, -0x1p-33L, 0x1.0000000000000002p0L, -5.820766091346740722012013594069507025615e-11L, 7.853981633974483096732590862331681441026e-1L);
+  TEST_c_c (catanh, -0x1p-33L, -0x1.0000000000000002p0L, -5.820766091346740722012013594069507025615e-11L, -7.853981633974483096732590862331681441026e-1L);
+  TEST_c_c (catanh, 0x1.0000000000000002p0L, 0x1p-33L, 1.178350206951907025990405771755129268176e1L, 7.853981638922134273801338071094141188767e-1L);
+  TEST_c_c (catanh, -0x1.0000000000000002p0L, 0x1p-33L, -1.178350206951907025990405771755129268176e1L, 7.853981638922134273801338071094141188767e-1L);
+  TEST_c_c (catanh, 0x1.0000000000000002p0L, -0x1p-33L, 1.178350206951907025990405771755129268176e1L, -7.853981638922134273801338071094141188767e-1L);
+  TEST_c_c (catanh, -0x1.0000000000000002p0L, -0x1p-33L, -1.178350206951907025990405771755129268176e1L, -7.853981638922134273801338071094141188767e-1L);
+  TEST_c_c (catanh, 0x1p-33L, 0x0.ffffffffffffffffp0L, 5.820766091346740722958646680334721192083e-11L, 7.853981633974483095919439232967553115548e-1L);
+  TEST_c_c (catanh, 0x1p-33L, -0x0.ffffffffffffffffp0L, 5.820766091346740722958646680334721192083e-11L, -7.853981633974483095919439232967553115548e-1L);
+  TEST_c_c (catanh, -0x1p-33L, 0x0.ffffffffffffffffp0L, -5.820766091346740722958646680334721192083e-11L, 7.853981633974483095919439232967553115548e-1L);
+  TEST_c_c (catanh, -0x1p-33L, -0x0.ffffffffffffffffp0L, -5.820766091346740722958646680334721192083e-11L, -7.853981633974483095919439232967553115548e-1L);
+  TEST_c_c (catanh, 0x0.ffffffffffffffffp0L, 0x1p-33L, 1.178350206951907026002603046195591193050e1L, 7.853981631937214964185249205444919953948e-1L);
+  TEST_c_c (catanh, -0x0.ffffffffffffffffp0L, 0x1p-33L, -1.178350206951907026002603046195591193050e1L, 7.853981631937214964185249205444919953948e-1L);
+  TEST_c_c (catanh, 0x0.ffffffffffffffffp0L, -0x1p-33L, 1.178350206951907026002603046195591193050e1L, -7.853981631937214964185249205444919953948e-1L);
+  TEST_c_c (catanh, -0x0.ffffffffffffffffp0L, -0x1p-33L, -1.178350206951907026002603046195591193050e1L, -7.853981631937214964185249205444919953948e-1L);
+#endif
+#if defined TEST_LDOUBLE && LDBL_MANT_DIG >= 106
+  TEST_c_c (catanh, 0x1p-54L, 0x1.000000000000000000000000008p0L, 2.775557561562891351059079170226980932999e-17L, 7.853981633974483096156608458198888173729e-1L);
+  TEST_c_c (catanh, 0x1p-54L, -0x1.000000000000000000000000008p0L, 2.775557561562891351059079170226980932999e-17L, -7.853981633974483096156608458198888173729e-1L);
+  TEST_c_c (catanh, -0x1p-54L, 0x1.000000000000000000000000008p0L, -2.775557561562891351059079170226980932999e-17L, 7.853981633974483096156608458198888173729e-1L);
+  TEST_c_c (catanh, -0x1p-54L, -0x1.000000000000000000000000008p0L, -2.775557561562891351059079170226980932999e-17L, -7.853981633974483096156608458198888173729e-1L);
+  TEST_c_c (catanh, 0x1.000000000000000000000000008p0L, 0x1p-54L, 1.906154746539849600897388334009981267384e1L, 7.853981633974485455380535786656405610710e-1L);
+  TEST_c_c (catanh, -0x1.000000000000000000000000008p0L, 0x1p-54L, -1.906154746539849600897388334009981267384e1L, 7.853981633974485455380535786656405610710e-1L);
+  TEST_c_c (catanh, 0x1.000000000000000000000000008p0L, -0x1p-54L, 1.906154746539849600897388334009981267384e1L, -7.853981633974485455380535786656405610710e-1L);
+  TEST_c_c (catanh, -0x1.000000000000000000000000008p0L, -0x1p-54L, -1.906154746539849600897388334009981267384e1L, -7.853981633974485455380535786656405610710e-1L);
+  TEST_c_c (catanh, 0x1p-54L, 0x0.ffffffffffffffffffffffffffcp0L, 2.775557561562891351059079170227083567164e-17L, 7.853981633974483096156608458198703284454e-1L);
+  TEST_c_c (catanh, 0x1p-54L, -0x0.ffffffffffffffffffffffffffcp0L, 2.775557561562891351059079170227083567164e-17L, -7.853981633974483096156608458198703284454e-1L);
+  TEST_c_c (catanh, -0x1p-54L, 0x0.ffffffffffffffffffffffffffcp0L, -2.775557561562891351059079170227083567164e-17L, 7.853981633974483096156608458198703284454e-1L);
+  TEST_c_c (catanh, -0x1p-54L, -0x0.ffffffffffffffffffffffffffcp0L, -2.775557561562891351059079170227083567164e-17L, -7.853981633974483096156608458198703284454e-1L);
+  TEST_c_c (catanh, 0x0.ffffffffffffffffffffffffffcp0L, 0x1p-54L, 1.906154746539849600897388334009984040723e1L, 7.853981633974482124711461911186784339815e-1L);
+  TEST_c_c (catanh, -0x0.ffffffffffffffffffffffffffcp0L, 0x1p-54L, -1.906154746539849600897388334009984040723e1L, 7.853981633974482124711461911186784339815e-1L);
+  TEST_c_c (catanh, 0x0.ffffffffffffffffffffffffffcp0L, -0x1p-54L, 1.906154746539849600897388334009984040723e1L, -7.853981633974482124711461911186784339815e-1L);
+  TEST_c_c (catanh, -0x0.ffffffffffffffffffffffffffcp0L, -0x1p-54L, -1.906154746539849600897388334009984040723e1L, -7.853981633974482124711461911186784339815e-1L);
+#endif
+#if defined TEST_LDOUBLE && LDBL_MANT_DIG >= 113
+  TEST_c_c (catanh, 0x1p-57L, 0x1.0000000000000000000000000001p0L, 3.469446951953614188823848962783812780530e-18L, 7.853981633974483096156608458198758293829e-1L);
+  TEST_c_c (catanh, 0x1p-57L, -0x1.0000000000000000000000000001p0L, 3.469446951953614188823848962783812780530e-18L, -7.853981633974483096156608458198758293829e-1L);
+  TEST_c_c (catanh, -0x1p-57L, 0x1.0000000000000000000000000001p0L, -3.469446951953614188823848962783812780530e-18L, 7.853981633974483096156608458198758293829e-1L);
+  TEST_c_c (catanh, -0x1p-57L, -0x1.0000000000000000000000000001p0L, -3.469446951953614188823848962783812780530e-18L, -7.853981633974483096156608458198758293829e-1L);
+  TEST_c_c (catanh, 0x1.0000000000000000000000000001p0L, 0x1p-57L, 2.010126823623841397309973152228712033275e1L, 7.853981633974483252281721296111395707566e-1L);
+  TEST_c_c (catanh, -0x1.0000000000000000000000000001p0L, 0x1p-57L, -2.010126823623841397309973152228712033275e1L, 7.853981633974483252281721296111395707566e-1L);
+  TEST_c_c (catanh, 0x1.0000000000000000000000000001p0L, -0x1p-57L, 2.010126823623841397309973152228712033275e1L, -7.853981633974483252281721296111395707566e-1L);
+  TEST_c_c (catanh, -0x1.0000000000000000000000000001p0L, -0x1p-57L, -2.010126823623841397309973152228712033275e1L, -7.853981633974483252281721296111395707566e-1L);
+  TEST_c_c (catanh, 0x1p-57L, 0x0.ffffffffffffffffffffffffffff8p0L, 3.469446951953614188823848962783813782817e-18L, 7.853981633974483096156608458198756849381e-1L);
+  TEST_c_c (catanh, 0x1p-57L, -0x0.ffffffffffffffffffffffffffff8p0L, 3.469446951953614188823848962783813782817e-18L, -7.853981633974483096156608458198756849381e-1L);
+  TEST_c_c (catanh, -0x1p-57L, 0x0.ffffffffffffffffffffffffffff8p0L, -3.469446951953614188823848962783813782817e-18L, 7.853981633974483096156608458198756849381e-1L);
+  TEST_c_c (catanh, -0x1p-57L, -0x0.ffffffffffffffffffffffffffff8p0L, -3.469446951953614188823848962783813782817e-18L, -7.853981633974483096156608458198756849381e-1L);
+  TEST_c_c (catanh, 0x0.ffffffffffffffffffffffffffff8p0L, 0x1p-57L, 2.010126823623841397309973152228712040498e1L, 7.853981633974483044114904178894544378135e-1L);
+  TEST_c_c (catanh, -0x0.ffffffffffffffffffffffffffff8p0L, 0x1p-57L, -2.010126823623841397309973152228712040498e1L, 7.853981633974483044114904178894544378135e-1L);
+  TEST_c_c (catanh, 0x0.ffffffffffffffffffffffffffff8p0L, -0x1p-57L, 2.010126823623841397309973152228712040498e1L, -7.853981633974483044114904178894544378135e-1L);
+  TEST_c_c (catanh, -0x0.ffffffffffffffffffffffffffff8p0L, -0x1p-57L, -2.010126823623841397309973152228712040498e1L, -7.853981633974483044114904178894544378135e-1L);
 #endif
 
   TEST_c_c (catanh, 0.75L, 1.25L, 0.261492138795671927078652057366532140L, 0.996825126463918666098902241310446708L);

Modified: fsf/trunk/libc/math/s_catan.c
==============================================================================
--- fsf/trunk/libc/math/s_catan.c (original)
+++ fsf/trunk/libc/math/s_catan.c Wed May  1 00:02:09 2013
@@ -77,13 +77,29 @@
 	}
       else
 	{
-	  double r2, num, den, f;
+	  double r2, num, den, f, absx, absy;
+
+	  absx = fabs (__real__ x);
+	  absy = fabs (__imag__ x);
+	  if (absx < absy)
+	    {
+	      double t = absx;
+	      absx = absy;
+	      absy = t;
+	    }
+
+	  if (absx >= 1.0)
+	    den = (1.0 - absx) * (1.0 + absx) - absy * absy;
+	  else if (absx >= 0.75 && absy < DBL_EPSILON / 2.0)
+	    den = (1.0 - absx) * (1.0 + absx);
+	  else if (absx >= 0.75 || absy >= 0.5)
+	    den = -__x2y2m1 (absx, absy);
+	  else
+	    den = (1.0 - absx) * (1.0 + absx) - absy * absy;
+
+	  __real__ res = 0.5 * __ieee754_atan2 (2.0 * __real__ x, den);
 
 	  r2 = __real__ x * __real__ x;
-
-	  den = 1 - r2 - __imag__ x * __imag__ x;
-
-	  __real__ res = 0.5 * __ieee754_atan2 (2.0 * __real__ x, den);
 
 	  num = __imag__ x + 1.0;
 	  num = r2 + num * num;

Modified: fsf/trunk/libc/math/s_catanf.c
==============================================================================
--- fsf/trunk/libc/math/s_catanf.c (original)
+++ fsf/trunk/libc/math/s_catanf.c Wed May  1 00:02:09 2013
@@ -78,13 +78,29 @@
 	}
       else
 	{
-	  float r2, num, den, f;
+	  float r2, num, den, f, absx, absy;
+
+	  absx = fabsf (__real__ x);
+	  absy = fabsf (__imag__ x);
+	  if (absx < absy)
+	    {
+	      float t = absx;
+	      absx = absy;
+	      absy = t;
+	    }
+
+	  if (absx >= 1.0f)
+	    den = (1.0f - absx) * (1.0f + absx) - absy * absy;
+	  else if (absx >= 0.75f && absy < FLT_EPSILON / 2.0f)
+	    den = (1.0f - absx) * (1.0f + absx);
+	  else if (absx >= 0.75f || absy >= 0.5f)
+	    den = -__x2y2m1f (absx, absy);
+	  else
+	    den = (1.0f - absx) * (1.0f + absx) - absy * absy;
+
+	  __real__ res = 0.5f * __ieee754_atan2f (2.0f * __real__ x, den);
 
 	  r2 = __real__ x * __real__ x;
-
-	  den = 1 - r2 - __imag__ x * __imag__ x;
-
-	  __real__ res = 0.5f * __ieee754_atan2f (2.0f * __real__ x, den);
 
 	  num = __imag__ x + 1.0f;
 	  num = r2 + num * num;

Modified: fsf/trunk/libc/math/s_catanh.c
==============================================================================
--- fsf/trunk/libc/math/s_catanh.c (original)
+++ fsf/trunk/libc/math/s_catanh.c Wed May  1 00:02:09 2013
@@ -89,7 +89,25 @@
 	      __real__ res = 0.25 * __log1p (num / den);
 	    }
 
-	  den = 1 - __real__ x * __real__ x - i2;
+	  double absx, absy;
+
+	  absx = fabs (__real__ x);
+	  absy = fabs (__imag__ x);
+	  if (absx < absy)
+	    {
+	      double t = absx;
+	      absx = absy;
+	      absy = t;
+	    }
+
+	  if (absx >= 1.0)
+	    den = (1.0 - absx) * (1.0 + absx) - absy * absy;
+	  else if (absx >= 0.75 && absy < DBL_EPSILON / 2.0)
+	    den = (1.0 - absx) * (1.0 + absx);
+	  else if (absx >= 0.75 || absy >= 0.5)
+	    den = -__x2y2m1 (absx, absy);
+	  else
+	    den = (1.0 - absx) * (1.0 + absx) - absy * absy;
 
 	  __imag__ res = 0.5 * __ieee754_atan2 (2.0 * __imag__ x, den);
 	}

Modified: fsf/trunk/libc/math/s_catanhf.c
==============================================================================
--- fsf/trunk/libc/math/s_catanhf.c (original)
+++ fsf/trunk/libc/math/s_catanhf.c Wed May  1 00:02:09 2013
@@ -90,7 +90,25 @@
 	      __real__ res = 0.25f * __log1pf (num / den);
 	    }
 
-	  den = 1 - __real__ x * __real__ x - i2;
+	  float absx, absy;
+
+	  absx = fabsf (__real__ x);
+	  absy = fabsf (__imag__ x);
+	  if (absx < absy)
+	    {
+	      float t = absx;
+	      absx = absy;
+	      absy = t;
+	    }
+
+	  if (absx >= 1.0f)
+	    den = (1.0f - absx) * (1.0f + absx) - absy * absy;
+	  else if (absx >= 0.75f && absy < FLT_EPSILON / 2.0f)
+	    den = (1.0f - absx) * (1.0f + absx);
+	  else if (absx >= 0.75f || absy >= 0.5f)
+	    den = -__x2y2m1f (absx, absy);
+	  else
+	    den = (1.0f - absx) * (1.0f + absx) - absy * absy;
 
 	  __imag__ res = 0.5f * __ieee754_atan2f (2.0f * __imag__ x, den);
 	}

Modified: fsf/trunk/libc/math/s_catanhl.c
==============================================================================
--- fsf/trunk/libc/math/s_catanhl.c (original)
+++ fsf/trunk/libc/math/s_catanhl.c Wed May  1 00:02:09 2013
@@ -97,7 +97,25 @@
 	      __real__ res = 0.25L * __log1pl (num / den);
 	    }
 
-	  den = 1 - __real__ x * __real__ x - i2;
+	  long double absx, absy;
+
+	  absx = fabsl (__real__ x);
+	  absy = fabsl (__imag__ x);
+	  if (absx < absy)
+	    {
+	      long double t = absx;
+	      absx = absy;
+	      absy = t;
+	    }
+
+	  if (absx >= 1.0L)
+	    den = (1.0L - absx) * (1.0L + absx) - absy * absy;
+	  else if (absx >= 0.75 && absy < LDBL_EPSILON / 2.0L)
+	    den = (1.0L - absx) * (1.0L + absx);
+	  else if (absx >= 0.75L || absy >= 0.5L)
+	    den = -__x2y2m1l (absx, absy);
+	  else
+	    den = (1.0L - absx) * (1.0L + absx) - absy * absy;
 
 	  __imag__ res = 0.5L * __ieee754_atan2l (2.0L * __imag__ x, den);
 	}

Modified: fsf/trunk/libc/math/s_catanl.c
==============================================================================
--- fsf/trunk/libc/math/s_catanl.c (original)
+++ fsf/trunk/libc/math/s_catanl.c Wed May  1 00:02:09 2013
@@ -85,13 +85,29 @@
 	}
       else
 	{
-	  long double r2, num, den, f;
+	  long double r2, num, den, f, absx, absy;
+
+	  absx = fabsl (__real__ x);
+	  absy = fabsl (__imag__ x);
+	  if (absx < absy)
+	    {
+	      long double t = absx;
+	      absx = absy;
+	      absy = t;
+	    }
+
+	  if (absx >= 1.0L)
+	    den = (1.0L - absx) * (1.0L + absx) - absy * absy;
+	  else if (absx >= 0.75L && absy < LDBL_EPSILON / 2.0L)
+	    den = (1.0L - absx) * (1.0L + absx);
+	  else if (absx >= 0.75L || absy >= 0.5L)
+	    den = -__x2y2m1l (absx, absy);
+	  else
+	    den = (1.0L - absx) * (1.0L + absx) - absy * absy;
+
+	  __real__ res = 0.5L * __ieee754_atan2l (2.0L * __real__ x, den);
 
 	  r2 = __real__ x * __real__ x;
-
-	  den = 1 - r2 - __imag__ x * __imag__ x;
-
-	  __real__ res = 0.5L * __ieee754_atan2l (2.0L * __real__ x, den);
 
 	  num = __imag__ x + 1.0L;
 	  num = r2 + num * num;

Modified: fsf/trunk/libc/scripts/bench.pl
==============================================================================
--- fsf/trunk/libc/scripts/bench.pl (original)
+++ fsf/trunk/libc/scripts/bench.pl Wed May  1 00:02:09 2013
@@ -22,36 +22,48 @@
 # Generate a benchmark source file for a given input.
 
 if (@ARGV < 2) {
-  die "Usage: bench.pl <function> <iterations> [parameter types] [return type]"
+  die "Usage: bench.pl <function> [parameter types] [return type]"
 }
 
 my $arg;
 my $func = $ARGV[0];
-my $iters = $ARGV[1];
 my @args;
 my $ret = "void";
 my $getret = "";
 my $retval = "";
 
-if (@ARGV >= 3) {
-  @args = split(':', $ARGV[2]);
+if (@ARGV >= 2) {
+  @args = split(':', $ARGV[1]);
 }
 
-if (@ARGV == 4) {
-  $ret = $ARGV[3];
+if (@ARGV == 3) {
+  $ret = $ARGV[2];
 }
 
 my $decl = "extern $ret $func (";
 
+# Function has no arguments.
 if (@args == 0 || $args[0] eq "void") {
   print "$decl void);\n";
-  print "#define CALL_BENCH_FUNC(j) $func();\n";
-  print "#define NUM_SAMPLES (1)\n";
+  print "#define CALL_BENCH_FUNC(i,j) $func();\n";
+  print "#define NUM_VARIANTS (1)\n";
+  print "#define NUM_SAMPLES(v) (1)\n";
+  print "#define VARIANT(v) FUNCNAME \"()\"\n"
 }
+# The function has arguments, so parse them and populate the inputs.
 else {
   my $num = 0;
-  my $bench_func = "#define CALL_BENCH_FUNC(j) $func (";
-  my $struct = "struct args {";
+  my $bench_func = "#define CALL_BENCH_FUNC(v, i) $func (";
+
+  my $struct =
+    "struct _variants
+    {
+      const char *name;
+      int count;
+      struct args *in;
+    };\n";
+
+  my $arg_struct = "struct args {";
 
   foreach $arg (@args) {
     if ($num > 0) {
@@ -59,24 +71,87 @@
       $decl = "$decl,";
     }
 
-    $struct = "$struct $arg arg$num;";
-    $bench_func = "$bench_func in[j].arg$num";
+    $arg_struct = "$arg_struct $arg arg$num;";
+    $bench_func = "$bench_func variants[v].in[i].arg$num";
     $decl = "$decl $arg";
     $num = $num + 1;
   }
 
-  print "$decl);\n";
-  print "$bench_func);\n";
-  print "$struct } in[] = {";
+  $arg_struct = $arg_struct . "};\n";
+  $decl = $decl . ");\n";
+  $bench_func = $bench_func . ");\n";
+
+  # We create a hash of inputs for each variant of the test.
+  my $variant = "";
+  my @curvals;
+  my %vals;
 
   open INPUTS, "<$func-inputs" or die $!;
 
-  while (<INPUTS>) {
+  LINE:while (<INPUTS>) {
     chomp;
-    print "{$_},\n";
+
+    # New variant.
+    if (/^## (\w+): (\w+)/) {
+      #We only identify Name for now.
+      if ($1 ne "name") {
+        next LINE;
+      }
+
+      # Save values in the last variant.
+      my @copy = @curvals;
+      $vals{$variant} = \@copy;
+
+      # Prepare for the next.
+      $variant=$2;
+      undef @curvals;
+      next LINE;
+    }
+
+    # Skip over comments.
+    if (/^#/) {
+      next LINE;
+    }
+    push (@curvals, $_);
   }
-  print "};\n";
-  print "#define NUM_SAMPLES (sizeof (in) / sizeof (struct args))\n"
+
+  $vals{$variant} = \@curvals;
+
+  # Print the definitions and macros.
+  print $decl;
+  print $bench_func;
+  print $arg_struct;
+  print $struct;
+
+  my $c = 0;
+  my $key;
+
+  # Print the input arrays.
+  foreach $key (keys %vals) {
+    my @arr = @{$vals{$key}};
+
+    print "struct args in" . $c . "[" . @arr . "] = {\n";
+    foreach (@arr) {
+      print "{$_},\n";
+    }
+    print "};\n\n";
+    $c += 1;
+  }
+
+  # The variants.  Each variant then points to the appropriate input array we
+  # defined above.
+  print "struct _variants variants[" . (keys %vals) . "] = {\n";
+  $c = 0;
+  foreach $key (keys %vals) {
+    print "{\"$func($key)\", " . @{$vals{$key}} . ", in$c},\n";
+    $c += 1;
+  }
+  print "};\n\n";
+
+  # Finally, print the last set of macros.
+  print "#define NUM_VARIANTS $c\n";
+  print "#define NUM_SAMPLES(i) (variants[i].count)\n";
+  print "#define VARIANT(i) (variants[i].name)\n";
 }
 
 # In some cases not storing a return value seems to result in the function call
@@ -86,8 +161,8 @@
   $getret = "ret = ";
 }
 
-print "#define BENCH_FUNC(j) ({$getret CALL_BENCH_FUNC (j);})\n";
+# And we're done.
+print "#define BENCH_FUNC(i, j) ({$getret CALL_BENCH_FUNC (i, j);})\n";
 
-print "#define ITER $iters\n";
 print "#define FUNCNAME \"$func\"\n";
 print "#include \"bench-skeleton.c\"\n";

Modified: fsf/trunk/libc/sysdeps/i386/fpu/libm-test-ulps
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/fpu/libm-test-ulps (original)
+++ fsf/trunk/libc/sysdeps/i386/fpu/libm-test-ulps Wed May  1 00:02:09 2013
@@ -3480,6 +3480,23 @@
 idouble: 1
 
 # catan
+Test "Imaginary part of: catan (-0x0.fffffffffffff8p0 + 0x1p-27 i) == -7.853981633974482679822974223765039144191e-1 + 3.725290298461914441624447420137706700965e-9 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: catan (-0x0.ffffffffffffffffp0 + 0x1p-33 i) == -7.853981633974483095919439232967553115548e-1 + 5.820766091346740722958646680334721192083e-11 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: catan (-0x0.ffffffp0 + 0x1p-13 i) == -7.853981373204155542484315721351697277336e-1 + 6.103515973639646453881721999956617260502e-5 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: catan (-0x1.0000000000001p0 + 0x1p-27 i) == -7.853981633974484345157511161499711112683e-1 + 3.725290298461913200853528590596263270474e-9 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: catan (-0x1.000002p0 - 0x1p-13 i) == -7.853982267273793866654490522673596014524e-1 - 6.103514882246036852433556327261700380577e-5 i":
+double: 1
+idouble: 1
 Test "Imaginary part of: catan (-0x1.fp1023 + 0x1.fp1023 i) == -1.570796326794896619231321691639751442099 + 2.871063043235098558826106732041811695767e-309 i":
 ildouble: 1
 ldouble: 1
@@ -3492,11 +3509,37 @@
 Test "Imaginary part of: catan (-0x1.fp127 - 0x1.fp127 i) == -1.570796326794896619231321691639751442097 - 1.516766904286822590927401983512575068153e-39 i":
 ildouble: 1
 ldouble: 1
+Test "Imaginary part of: catan (-0x1p-33 + 0x0.ffffffffffffffffp0 i) == -7.853981631937214964185249205444919953948e-1 + 1.178350206951907026002603046195591193050e1 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: catan (-0x1p-33 - 0x0.ffffffffffffffffp0 i) == -7.853981631937214964185249205444919953948e-1 - 1.178350206951907026002603046195591193050e1 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: catan (-1.0 - 0x1p-13 i) == -7.853981671227386080775748393881580082970e-1 - 6.103515609841754902688560615027452023669e-5 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+Test "Imaginary part of: catan (0x0.fffffffffffff8p0 + 0x1p-27 i) == 7.853981633974482679822974223765039144191e-1 + 3.725290298461914441624447420137706700965e-9 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: catan (0x0.ffffffffffffffffp0 + 0x1p-33 i) == 7.853981633974483095919439232967553115548e-1 + 5.820766091346740722958646680334721192083e-11 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: catan (0x0.ffffffp0 + 0x1p-13 i) == 7.853981373204155542484315721351697277336e-1 + 6.103515973639646453881721999956617260502e-5 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: catan (0x1.0000000000001p0 + 0x1p-27 i) == 7.853981633974484345157511161499711112683e-1 + 3.725290298461913200853528590596263270474e-9 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: catan (0x1.000002p0 - 0x1p-13 i) == 7.853982267273793866654490522673596014524e-1 - 6.103514882246036852433556327261700380577e-5 i":
+double: 1
+idouble: 1
 Test "Imaginary part of: catan (0x1.fp1023 + 0x1.fp1023 i) == 1.570796326794896619231321691639751442099 + 2.871063043235098558826106732041811695767e-309 i":
 ildouble: 1
 ldouble: 1
@@ -3509,8 +3552,23 @@
 Test "Imaginary part of: catan (0x1.fp127 - 0x1.fp127 i) == 1.570796326794896619231321691639751442097 - 1.516766904286822590927401983512575068153e-39 i":
 ildouble: 1
 ldouble: 1
+Test "Imaginary part of: catan (0x1p-33 + 0x0.ffffffffffffffffp0 i) == 7.853981631937214964185249205444919953948e-1 + 1.178350206951907026002603046195591193050e1 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: catan (0x1p-33 - 0x0.ffffffffffffffffp0 i) == 7.853981631937214964185249205444919953948e-1 - 1.178350206951907026002603046195591193050e1 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: catan (1.0 - 0x1p-13 i) == 7.853981671227386080775748393881580082970e-1 - 6.103515609841754902688560615027452023669e-5 i":
+ildouble: 1
+ldouble: 1
 
 # catanh
+Test "Real part of: catanh (-0x0.ffffffffffffffffp0 + 0x1p-33 i) == -1.178350206951907026002603046195591193050e1 + 7.853981631937214964185249205444919953948e-1 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: catanh (-0x0.ffffffffffffffffp0 - 0x1p-33 i) == -1.178350206951907026002603046195591193050e1 - 7.853981631937214964185249205444919953948e-1 i":
+ildouble: 1
+ldouble: 1
 Test "Real part of: catanh (-0x1.fp1023 + 0x1.fp1023 i) == -2.871063043235098558826106732041811695767e-309 + 1.570796326794896619231321691639751442099 i":
 ildouble: 1
 ldouble: 1
@@ -3521,6 +3579,18 @@
 ildouble: 1
 ldouble: 1
 Test "Real part of: catanh (-0x1.fp127 - 0x1.fp127 i) == -1.516766904286822590927401983512575068153e-39 - 1.570796326794896619231321691639751442097 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: catanh (-0x1p-13 + 0x1.000002p0 i) == -6.103514882246036852433556327261700380577e-5 + 7.853982267273793866654490522673596014524e-1 i":
+double: 1
+idouble: 1
+Test "Real part of: catanh (-0x1p-13 + 1.0 i) == -6.103515609841754902688560615027452023669e-5 + 7.853981671227386080775748393881580082970e-1 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: catanh (-0x1p-13 - 0x1.000002p0 i) == -6.103514882246036852433556327261700380577e-5 - 7.853982267273793866654490522673596014524e-1 i":
+double: 1
+idouble: 1
+Test "Real part of: catanh (-0x1p-13 - 1.0 i) == -6.103515609841754902688560615027452023669e-5 - 7.853981671227386080775748393881580082970e-1 i":
 ildouble: 1
 ldouble: 1
 Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
@@ -3535,6 +3605,12 @@
 idouble: 1
 ildouble: 1
 ldouble: 1
+Test "Real part of: catanh (0x0.ffffffffffffffffp0 + 0x1p-33 i) == 1.178350206951907026002603046195591193050e1 + 7.853981631937214964185249205444919953948e-1 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: catanh (0x0.ffffffffffffffffp0 - 0x1p-33 i) == 1.178350206951907026002603046195591193050e1 - 7.853981631937214964185249205444919953948e-1 i":
+ildouble: 1
+ldouble: 1
 Test "Real part of: catanh (0x1.fp1023 + 0x1.fp1023 i) == 2.871063043235098558826106732041811695767e-309 + 1.570796326794896619231321691639751442099 i":
 ildouble: 1
 ldouble: 1
@@ -3545,6 +3621,34 @@
 ildouble: 1
 ldouble: 1
 Test "Real part of: catanh (0x1.fp127 - 0x1.fp127 i) == 1.516766904286822590927401983512575068153e-39 - 1.570796326794896619231321691639751442097 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: catanh (0x1p-13 + 0x0.ffffffp0 i) == 6.103515973639646453881721999956617260502e-5 + 7.853981373204155542484315721351697277336e-1 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: catanh (0x1p-13 - 0x0.ffffffp0 i) == 6.103515973639646453881721999956617260502e-5 - 7.853981373204155542484315721351697277336e-1 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: catanh (0x1p-27 + 0x0.fffffffffffff8p0 i) == 3.725290298461914441624447420137706700965e-9 + 7.853981633974482679822974223765039144191e-1 i":
+double: 1
+idouble: 1
+Test "Real part of: catanh (0x1p-27 + 0x1.0000000000001p0 i) == 3.725290298461913200853528590596263270474e-9 + 7.853981633974484345157511161499711112683e-1 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: catanh (0x1p-27 - 0x0.fffffffffffff8p0 i) == 3.725290298461914441624447420137706700965e-9 - 7.853981633974482679822974223765039144191e-1 i":
+double: 1
+idouble: 1
+Test "Real part of: catanh (0x1p-27 - 0x1.0000000000001p0 i) == 3.725290298461913200853528590596263270474e-9 - 7.853981633974484345157511161499711112683e-1 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: catanh (0x1p-33 + 0x0.ffffffffffffffffp0 i) == 5.820766091346740722958646680334721192083e-11 + 7.853981633974483095919439232967553115548e-1 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: catanh (0x1p-33 - 0x0.ffffffffffffffffp0 i) == 5.820766091346740722958646680334721192083e-11 - 7.853981633974483095919439232967553115548e-1 i":
 ildouble: 1
 ldouble: 1
 

Modified: fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_sin.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_sin.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/s_sin.c Wed May  1 00:02:09 2013
@@ -66,299 +66,359 @@
 } __sincostab attribute_hidden;
 
 static const double
-	  sn3 = -1.66666666666664880952546298448555E-01,
-	  sn5 =  8.33333214285722277379541354343671E-03,
-	  cs2 =  4.99999999999999999999950396842453E-01,
-	  cs4 = -4.16666666666664434524222570944589E-02,
-	  cs6 =  1.38888874007937613028114285595617E-03;
-
-void __dubsin(double x, double dx, double w[]);
-void __docos(double x, double dx, double w[]);
-double __mpsin(double x, double dx);
-double __mpcos(double x, double dx);
-double __mpsin1(double x);
-double __mpcos1(double x);
-static double slow(double x);
-static double slow1(double x);
-static double slow2(double x);
-static double sloww(double x, double dx, double orig);
-static double sloww1(double x, double dx, double orig);
-static double sloww2(double x, double dx, double orig, int n);
-static double bsloww(double x, double dx, double orig, int n);
-static double bsloww1(double x, double dx, double orig, int n);
-static double bsloww2(double x, double dx, double orig, int n);
-int __branred(double x, double *a, double *aa);
-static double cslow2(double x);
-static double csloww(double x, double dx, double orig);
-static double csloww1(double x, double dx, double orig);
-static double csloww2(double x, double dx, double orig, int n);
+  sn3 = -1.66666666666664880952546298448555E-01,
+  sn5 = 8.33333214285722277379541354343671E-03,
+  cs2 = 4.99999999999999999999950396842453E-01,
+  cs4 = -4.16666666666664434524222570944589E-02,
+  cs6 = 1.38888874007937613028114285595617E-03;
+
+void __dubsin (double x, double dx, double w[]);
+void __docos (double x, double dx, double w[]);
+double __mpsin (double x, double dx);
+double __mpcos (double x, double dx);
+double __mpsin1 (double x);
+double __mpcos1 (double x);
+static double slow (double x);
+static double slow1 (double x);
+static double slow2 (double x);
+static double sloww (double x, double dx, double orig);
+static double sloww1 (double x, double dx, double orig);
+static double sloww2 (double x, double dx, double orig, int n);
+static double bsloww (double x, double dx, double orig, int n);
+static double bsloww1 (double x, double dx, double orig, int n);
+static double bsloww2 (double x, double dx, double orig, int n);
+int __branred (double x, double *a, double *aa);
+static double cslow2 (double x);
+static double csloww (double x, double dx, double orig);
+static double csloww1 (double x, double dx, double orig);
+static double csloww2 (double x, double dx, double orig, int n);
+
 /*******************************************************************/
 /* An ultimate sin routine. Given an IEEE double machine number x   */
 /* it computes the correctly rounded (to nearest) value of sin(x)  */
 /*******************************************************************/
 double
 SECTION
-__sin(double x){
-	double xx,res,t,cor,y,s,c,sn,ssn,cs,ccs,xn,a,da,db,eps,xn1,xn2;
-	mynumber u,v;
-	int4 k,m,n;
-	double retval = 0;
-
-	SET_RESTORE_ROUND_53BIT (FE_TONEAREST);
-
-	u.x = x;
-	m = u.i[HIGH_HALF];
-	k = 0x7fffffff&m;              /* no sign           */
-	if (k < 0x3e500000)            /* if x->0 =>sin(x)=x */
-	  { retval = x; goto ret; }
+__sin (double x)
+{
+  double xx, res, t, cor, y, s, c, sn, ssn, cs, ccs, xn, a, da, db, eps, xn1,
+    xn2;
+  mynumber u, v;
+  int4 k, m, n;
+  double retval = 0;
+
+  SET_RESTORE_ROUND_53BIT (FE_TONEAREST);
+
+  u.x = x;
+  m = u.i[HIGH_HALF];
+  k = 0x7fffffff & m;		/* no sign           */
+  if (k < 0x3e500000)		/* if x->0 =>sin(x)=x */
+    {
+      retval = x;
+      goto ret;
+    }
  /*---------------------------- 2^-26 < |x|< 0.25 ----------------------*/
-	else  if (k < 0x3fd00000){
-	  xx = x*x;
-	  /*Taylor series */
-	  t = ((((s5.x*xx + s4.x)*xx + s3.x)*xx + s2.x)*xx + s1.x)*(xx*x);
-	  res = x+t;
-	  cor = (x-res)+t;
-	  retval = (res == res + 1.07*cor)? res : slow(x);
+  else if (k < 0x3fd00000)
+    {
+      xx = x * x;
+      /*Taylor series.  */
+      t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx + s1.x)
+	   * (xx * x));
+      res = x + t;
+      cor = (x - res) + t;
+      retval = (res == res + 1.07 * cor) ? res : slow (x);
+      goto ret;
+    }				/*  else  if (k < 0x3fd00000)    */
+/*---------------------------- 0.25<|x|< 0.855469---------------------- */
+  else if (k < 0x3feb6000)
+    {
+      u.x = (m > 0) ? big.x + x : big.x - x;
+      y = (m > 0) ? x - (u.x - big.x) : x + (u.x - big.x);
+      xx = y * y;
+      s = y + y * xx * (sn3 + xx * sn5);
+      c = xx * (cs2 + xx * (cs4 + xx * cs6));
+      k = u.i[LOW_HALF] << 2;
+      sn = (m > 0) ? __sincostab.x[k] : -__sincostab.x[k];
+      ssn = (m > 0) ? __sincostab.x[k + 1] : -__sincostab.x[k + 1];
+      cs = __sincostab.x[k + 2];
+      ccs = __sincostab.x[k + 3];
+      cor = (ssn + s * ccs - sn * c) + cs * s;
+      res = sn + cor;
+      cor = (sn - res) + cor;
+      retval = (res == res + 1.096 * cor) ? res : slow1 (x);
+      goto ret;
+    }				/*   else  if (k < 0x3feb6000)    */
+
+/*----------------------- 0.855469  <|x|<2.426265  ----------------------*/
+  else if (k < 0x400368fd)
+    {
+
+      y = (m > 0) ? hp0.x - x : hp0.x + x;
+      if (y >= 0)
+	{
+	  u.x = big.x + y;
+	  y = (y - (u.x - big.x)) + hp1.x;
+	}
+      else
+	{
+	  u.x = big.x - y;
+	  y = (-hp1.x) - (y + (u.x - big.x));
+	}
+      xx = y * y;
+      s = y + y * xx * (sn3 + xx * sn5);
+      c = xx * (cs2 + xx * (cs4 + xx * cs6));
+      k = u.i[LOW_HALF] << 2;
+      sn = __sincostab.x[k];
+      ssn = __sincostab.x[k + 1];
+      cs = __sincostab.x[k + 2];
+      ccs = __sincostab.x[k + 3];
+      cor = (ccs - s * ssn - cs * c) - sn * s;
+      res = cs + cor;
+      cor = (cs - res) + cor;
+      retval = (res == res + 1.020 * cor) ? ((m > 0) ? res : -res) : slow2 (x);
+      goto ret;
+    }				/*   else  if (k < 0x400368fd)    */
+
+/*-------------------------- 2.426265<|x|< 105414350 ----------------------*/
+  else if (k < 0x419921FB)
+    {
+      t = (x * hpinv.x + toint.x);
+      xn = t - toint.x;
+      v.x = t;
+      y = (x - xn * mp1.x) - xn * mp2.x;
+      n = v.i[LOW_HALF] & 3;
+      da = xn * mp3.x;
+      a = y - da;
+      da = (y - a) - da;
+      eps = ABS (x) * 1.2e-30;
+
+      switch (n)
+	{			/* quarter of unit circle */
+	case 0:
+	case 2:
+	  xx = a * a;
+	  if (n)
+	    {
+	      a = -a;
+	      da = -da;
+	    }
+	  if (xx < 0.01588)
+	    {
+	      /*Taylor series */
+	      t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx
+		    + s1.x) * a - 0.5 * da) * xx + da;
+	      res = a + t;
+	      cor = (a - res) + t;
+	      cor = (cor > 0) ? 1.02 * cor + eps : 1.02 * cor - eps;
+	      retval = (res == res + cor) ? res : sloww (a, da, x);
+	      goto ret;
+	    }
+	  else
+	    {
+	      if (a > 0)
+		{
+		  m = 1;
+		  t = a;
+		  db = da;
+		}
+	      else
+		{
+		  m = 0;
+		  t = -a;
+		  db = -da;
+		}
+	      u.x = big.x + t;
+	      y = t - (u.x - big.x);
+	      xx = y * y;
+	      s = y + (db + y * xx * (sn3 + xx * sn5));
+	      c = y * db + xx * (cs2 + xx * (cs4 + xx * cs6));
+	      k = u.i[LOW_HALF] << 2;
+	      sn = __sincostab.x[k];
+	      ssn = __sincostab.x[k + 1];
+	      cs = __sincostab.x[k + 2];
+	      ccs = __sincostab.x[k + 3];
+	      cor = (ssn + s * ccs - sn * c) + cs * s;
+	      res = sn + cor;
+	      cor = (sn - res) + cor;
+	      cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
+	      retval = ((res == res + cor) ? ((m) ? res : -res)
+			: sloww1 (a, da, x));
+	      goto ret;
+	    }
+	  break;
+
+	case 1:
+	case 3:
+	  if (a < 0)
+	    {
+	      a = -a;
+	      da = -da;
+	    }
+	  u.x = big.x + a;
+	  y = a - (u.x - big.x) + da;
+	  xx = y * y;
+	  k = u.i[LOW_HALF] << 2;
+	  sn = __sincostab.x[k];
+	  ssn = __sincostab.x[k + 1];
+	  cs = __sincostab.x[k + 2];
+	  ccs = __sincostab.x[k + 3];
+	  s = y + y * xx * (sn3 + xx * sn5);
+	  c = xx * (cs2 + xx * (cs4 + xx * cs6));
+	  cor = (ccs - s * ssn - cs * c) - sn * s;
+	  res = cs + cor;
+	  cor = (cs - res) + cor;
+	  cor = (cor > 0) ? 1.025 * cor + eps : 1.025 * cor - eps;
+	  retval = ((res == res + cor) ? ((n & 2) ? -res : res)
+		    : sloww2 (a, da, x, n));
 	  goto ret;
-	}    /*  else  if (k < 0x3fd00000)    */
-/*---------------------------- 0.25<|x|< 0.855469---------------------- */
-	else if (k < 0x3feb6000)  {
-	  u.x=(m>0)?big.x+x:big.x-x;
-	  y=(m>0)?x-(u.x-big.x):x+(u.x-big.x);
-	  xx=y*y;
-	  s = y + y*xx*(sn3 +xx*sn5);
-	  c = xx*(cs2 +xx*(cs4 + xx*cs6));
-	  k=u.i[LOW_HALF]<<2;
-	  sn=(m>0)?__sincostab.x[k]:-__sincostab.x[k];
-	  ssn=(m>0)?__sincostab.x[k+1]:-__sincostab.x[k+1];
-	  cs=__sincostab.x[k+2];
-	  ccs=__sincostab.x[k+3];
-	  cor=(ssn+s*ccs-sn*c)+cs*s;
-	  res=sn+cor;
-	  cor=(sn-res)+cor;
-	  retval = (res==res+1.096*cor)? res : slow1(x);
+
+	  break;
+	}
+
+    }				/*   else  if (k <  0x419921FB )    */
+
+/*---------------------105414350 <|x|< 281474976710656 --------------------*/
+  else if (k < 0x42F00000)
+    {
+      t = (x * hpinv.x + toint.x);
+      xn = t - toint.x;
+      v.x = t;
+      xn1 = (xn + 8.0e22) - 8.0e22;
+      xn2 = xn - xn1;
+      y = ((((x - xn1 * mp1.x) - xn1 * mp2.x) - xn2 * mp1.x) - xn2 * mp2.x);
+      n = v.i[LOW_HALF] & 3;
+      da = xn1 * pp3.x;
+      t = y - da;
+      da = (y - t) - da;
+      da = (da - xn2 * pp3.x) - xn * pp4.x;
+      a = t + da;
+      da = (t - a) + da;
+      eps = 1.0e-24;
+
+      switch (n)
+	{
+	case 0:
+	case 2:
+	  xx = a * a;
+	  if (n)
+	    {
+	      a = -a;
+	      da = -da;
+	    }
+	  if (xx < 0.01588)
+	    {
+	      /* Taylor series */
+	      t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx
+		    + s1.x) * a - 0.5 * da) * xx + da;
+	      res = a + t;
+	      cor = (a - res) + t;
+	      cor = (cor > 0) ? 1.02 * cor + eps : 1.02 * cor - eps;
+	      retval = (res == res + cor) ? res : bsloww (a, da, x, n);
+	      goto ret;
+	    }
+	  else
+	    {
+	      if (a > 0)
+		{
+		  m = 1;
+		  t = a;
+		  db = da;
+		}
+	      else
+		{
+		  m = 0;
+		  t = -a;
+		  db = -da;
+		}
+	      u.x = big.x + t;
+	      y = t - (u.x - big.x);
+	      xx = y * y;
+	      s = y + (db + y * xx * (sn3 + xx * sn5));
+	      c = y * db + xx * (cs2 + xx * (cs4 + xx * cs6));
+	      k = u.i[LOW_HALF] << 2;
+	      sn = __sincostab.x[k];
+	      ssn = __sincostab.x[k + 1];
+	      cs = __sincostab.x[k + 2];
+	      ccs = __sincostab.x[k + 3];
+	      cor = (ssn + s * ccs - sn * c) + cs * s;
+	      res = sn + cor;
+	      cor = (sn - res) + cor;
+	      cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
+	      retval = ((res == res + cor) ? ((m) ? res : -res)
+			: bsloww1 (a, da, x, n));
+	      goto ret;
+	    }
+	  break;
+
+	case 1:
+	case 3:
+	  if (a < 0)
+	    {
+	      a = -a;
+	      da = -da;
+	    }
+	  u.x = big.x + a;
+	  y = a - (u.x - big.x) + da;
+	  xx = y * y;
+	  k = u.i[LOW_HALF] << 2;
+	  sn = __sincostab.x[k];
+	  ssn = __sincostab.x[k + 1];
+	  cs = __sincostab.x[k + 2];
+	  ccs = __sincostab.x[k + 3];
+	  s = y + y * xx * (sn3 + xx * sn5);
+	  c = xx * (cs2 + xx * (cs4 + xx * cs6));
+	  cor = (ccs - s * ssn - cs * c) - sn * s;
+	  res = cs + cor;
+	  cor = (cs - res) + cor;
+	  cor = (cor > 0) ? 1.025 * cor + eps : 1.025 * cor - eps;
+	  retval = ((res == res + cor) ? ((n & 2) ? -res : res)
+		    : bsloww2 (a, da, x, n));
 	  goto ret;
-	}    /*   else  if (k < 0x3feb6000)    */
-
-/*----------------------- 0.855469  <|x|<2.426265  ----------------------*/
-	else if (k <  0x400368fd ) {
-
-	  y = (m>0)? hp0.x-x:hp0.x+x;
-	  if (y>=0) {
-	    u.x = big.x+y;
-	    y = (y-(u.x-big.x))+hp1.x;
-	  }
-	  else {
-	    u.x = big.x-y;
-	    y = (-hp1.x) - (y+(u.x-big.x));
-	  }
-	  xx=y*y;
-	  s = y + y*xx*(sn3 +xx*sn5);
-	  c = xx*(cs2 +xx*(cs4 + xx*cs6));
-	  k=u.i[LOW_HALF]<<2;
-	  sn=__sincostab.x[k];
-	  ssn=__sincostab.x[k+1];
-	  cs=__sincostab.x[k+2];
-	  ccs=__sincostab.x[k+3];
-	  cor=(ccs-s*ssn-cs*c)-sn*s;
-	  res=cs+cor;
-	  cor=(cs-res)+cor;
-	  retval = (res==res+1.020*cor)? ((m>0)?res:-res) : slow2(x);
+
+	  break;
+	}
+    }				/*   else  if (k <  0x42F00000 )   */
+
+/* -----------------281474976710656 <|x| <2^1024----------------------------*/
+  else if (k < 0x7ff00000)
+    {
+      n = __branred (x, &a, &da);
+      switch (n)
+	{
+	case 0:
+	  if (a * a < 0.01588)
+	    retval = bsloww (a, da, x, n);
+	  else
+	    retval = bsloww1 (a, da, x, n);
 	  goto ret;
-	} /*   else  if (k < 0x400368fd)    */
-
-/*-------------------------- 2.426265<|x|< 105414350 ----------------------*/
-	else if (k < 0x419921FB ) {
-	  t = (x*hpinv.x + toint.x);
-	  xn = t - toint.x;
-	  v.x = t;
-	  y = (x - xn*mp1.x) - xn*mp2.x;
-	  n =v.i[LOW_HALF]&3;
-	  da = xn*mp3.x;
-	  a=y-da;
-	  da = (y-a)-da;
-	  eps = ABS(x)*1.2e-30;
-
-	  switch (n) { /* quarter of unit circle */
-	  case 0:
-	  case 2:
-	    xx = a*a;
-	    if (n) {a=-a;da=-da;}
-	    if (xx < 0.01588) {
-		      /*Taylor series */
-	      t = (((((s5.x*xx + s4.x)*xx + s3.x)*xx + s2.x)*xx + s1.x)*a - 0.5*da)*xx+da;
-	      res = a+t;
-	      cor = (a-res)+t;
-	      cor = (cor>0)? 1.02*cor+eps : 1.02*cor -eps;
-	      retval = (res == res + cor)? res : sloww(a,da,x);
-	      goto ret;
-	    }
-	    else  {
-	      if (a>0)
-		{m=1;t=a;db=da;}
-	      else
-		{m=0;t=-a;db=-da;}
-	      u.x=big.x+t;
-	      y=t-(u.x-big.x);
-	      xx=y*y;
-	      s = y + (db+y*xx*(sn3 +xx*sn5));
-	      c = y*db+xx*(cs2 +xx*(cs4 + xx*cs6));
-	      k=u.i[LOW_HALF]<<2;
-	      sn=__sincostab.x[k];
-	      ssn=__sincostab.x[k+1];
-	      cs=__sincostab.x[k+2];
-	      ccs=__sincostab.x[k+3];
-	      cor=(ssn+s*ccs-sn*c)+cs*s;
-	      res=sn+cor;
-	      cor=(sn-res)+cor;
-	      cor = (cor>0)? 1.035*cor+eps : 1.035*cor-eps;
-	      retval = (res==res+cor)? ((m)?res:-res) : sloww1(a,da,x);
-	      goto ret;
-	    }
-	    break;
-
-	  case 1:
-	  case 3:
-	    if (a<0)
-	      {a=-a;da=-da;}
-	    u.x=big.x+a;
-	    y=a-(u.x-big.x)+da;
-	    xx=y*y;
-	    k=u.i[LOW_HALF]<<2;
-	    sn=__sincostab.x[k];
-	    ssn=__sincostab.x[k+1];
-	    cs=__sincostab.x[k+2];
-	    ccs=__sincostab.x[k+3];
-	    s = y + y*xx*(sn3 +xx*sn5);
-	    c = xx*(cs2 +xx*(cs4 + xx*cs6));
-	    cor=(ccs-s*ssn-cs*c)-sn*s;
-	    res=cs+cor;
-	    cor=(cs-res)+cor;
-	    cor = (cor>0)? 1.025*cor+eps : 1.025*cor-eps;
-	    retval = (res==res+cor)? ((n&2)?-res:res) : sloww2(a,da,x,n);
-	    goto ret;
-
-	    break;
-
-	  }
-
-	}    /*   else  if (k <  0x419921FB )    */
-
-/*---------------------105414350 <|x|< 281474976710656 --------------------*/
-	else if (k < 0x42F00000 ) {
-	  t = (x*hpinv.x + toint.x);
-	  xn = t - toint.x;
-	  v.x = t;
-	  xn1 = (xn+8.0e22)-8.0e22;
-	  xn2 = xn - xn1;
-	  y = ((((x - xn1*mp1.x) - xn1*mp2.x)-xn2*mp1.x)-xn2*mp2.x);
-	  n =v.i[LOW_HALF]&3;
-	  da = xn1*pp3.x;
-	  t=y-da;
-	  da = (y-t)-da;
-	  da = (da - xn2*pp3.x) -xn*pp4.x;
-	  a = t+da;
-	  da = (t-a)+da;
-	  eps = 1.0e-24;
-
-	  switch (n) {
-	  case 0:
-	  case 2:
-	    xx = a*a;
-	    if (n) {a=-a;da=-da;}
-	    if (xx < 0.01588) {
-	      /* Taylor series */
-	      t = (((((s5.x*xx + s4.x)*xx + s3.x)*xx + s2.x)*xx + s1.x)*a - 0.5*da)*xx+da;
-	      res = a+t;
-	      cor = (a-res)+t;
-	      cor = (cor>0)? 1.02*cor+eps : 1.02*cor -eps;
-	      retval = (res == res + cor)? res : bsloww(a,da,x,n);
-	      goto ret;
-	    }
-	    else  {
-	      if (a>0) {m=1;t=a;db=da;}
-	      else {m=0;t=-a;db=-da;}
-	      u.x=big.x+t;
-	      y=t-(u.x-big.x);
-	      xx=y*y;
-	      s = y + (db+y*xx*(sn3 +xx*sn5));
-	      c = y*db+xx*(cs2 +xx*(cs4 + xx*cs6));
-	      k=u.i[LOW_HALF]<<2;
-	      sn=__sincostab.x[k];
-	      ssn=__sincostab.x[k+1];
-	      cs=__sincostab.x[k+2];
-	      ccs=__sincostab.x[k+3];
-	      cor=(ssn+s*ccs-sn*c)+cs*s;
-	      res=sn+cor;
-	      cor=(sn-res)+cor;
-	      cor = (cor>0)? 1.035*cor+eps : 1.035*cor-eps;
-	      retval = (res==res+cor)? ((m)?res:-res) : bsloww1(a,da,x,n);
-	      goto ret;
-		   }
-	    break;
-
-	  case 1:
-	  case 3:
-	    if (a<0)
-	      {a=-a;da=-da;}
-	    u.x=big.x+a;
-	    y=a-(u.x-big.x)+da;
-	    xx=y*y;
-	    k=u.i[LOW_HALF]<<2;
-	    sn=__sincostab.x[k];
-	    ssn=__sincostab.x[k+1];
-	    cs=__sincostab.x[k+2];
-	    ccs=__sincostab.x[k+3];
-	    s = y + y*xx*(sn3 +xx*sn5);
-	    c = xx*(cs2 +xx*(cs4 + xx*cs6));
-	    cor=(ccs-s*ssn-cs*c)-sn*s;
-	    res=cs+cor;
-	    cor=(cs-res)+cor;
-	    cor = (cor>0)? 1.025*cor+eps : 1.025*cor-eps;
-	    retval = (res==res+cor)? ((n&2)?-res:res) : bsloww2(a,da,x,n);
-	    goto ret;
-
-	    break;
-
-	  }
-
-	}    /*   else  if (k <  0x42F00000 )   */
-
-/* -----------------281474976710656 <|x| <2^1024----------------------------*/
-	else if (k < 0x7ff00000) {
-
-	  n = __branred(x,&a,&da);
-	  switch (n) {
-	  case 0:
-	    if (a*a < 0.01588) retval = bsloww(a,da,x,n);
-	    else retval = bsloww1(a,da,x,n);
-	    goto ret;
-	    break;
-	  case 2:
-	    if (a*a < 0.01588) retval = bsloww(-a,-da,x,n);
-	    else retval = bsloww1(-a,-da,x,n);
-	    goto ret;
-	    break;
-
-	  case 1:
-	  case 3:
-	    retval = bsloww2(a,da,x,n);
-	    goto ret;
-	    break;
-	  }
-
-	}    /*   else  if (k <  0x7ff00000 )    */
+	  break;
+	case 2:
+	  if (a * a < 0.01588)
+	    retval = bsloww (-a, -da, x, n);
+	  else
+	    retval = bsloww1 (-a, -da, x, n);
+	  goto ret;
+	  break;
+
+	case 1:
+	case 3:
+	  retval = bsloww2 (a, da, x, n);
+	  goto ret;
+	  break;
+	}
+    }				/*   else  if (k <  0x7ff00000 )    */
 
 /*--------------------- |x| > 2^1024 ----------------------------------*/
-	else {
-	  if (k == 0x7ff00000 && u.i[LOW_HALF] == 0)
-	    __set_errno (EDOM);
-	  retval = x / x;
-	  goto ret;
-	}
-
- ret:
-	return retval;
+  else
+    {
+      if (k == 0x7ff00000 && u.i[LOW_HALF] == 0)
+	__set_errno (EDOM);
+      retval = x / x;
+      goto ret;
+    }
+
+ret:
+  return retval;
 }
 
 
@@ -369,11 +429,12 @@
 
 double
 SECTION
-__cos(double x)
+__cos (double x)
 {
-  double y,xx,res,t,cor,s,c,sn,ssn,cs,ccs,xn,a,da,db,eps,xn1,xn2;
-  mynumber u,v;
-  int4 k,m,n;
+  double y, xx, res, t, cor, s, c, sn, ssn, cs, ccs, xn, a, da, db, eps, xn1,
+    xn2;
+  mynumber u, v;
+  int4 k, m, n;
 
   double retval = 0;
 
@@ -381,251 +442,318 @@
 
   u.x = x;
   m = u.i[HIGH_HALF];
-  k = 0x7fffffff&m;
-
-  if (k < 0x3e400000 ) { retval = 1.0; goto ret; } /* |x|<2^-27 => cos(x)=1 */
-
-  else if (k < 0x3feb6000 ) {/* 2^-27 < |x| < 0.855469 */
-    y=ABS(x);
-    u.x = big.x+y;
-    y = y-(u.x-big.x);
-    xx=y*y;
-    s = y + y*xx*(sn3 +xx*sn5);
-    c = xx*(cs2 +xx*(cs4 + xx*cs6));
-    k=u.i[LOW_HALF]<<2;
-    sn=__sincostab.x[k];
-    ssn=__sincostab.x[k+1];
-    cs=__sincostab.x[k+2];
-    ccs=__sincostab.x[k+3];
-    cor=(ccs-s*ssn-cs*c)-sn*s;
-    res=cs+cor;
-    cor=(cs-res)+cor;
-    retval = (res==res+1.020*cor)? res : cslow2(x);
-    goto ret;
-
-}    /*   else  if (k < 0x3feb6000)    */
-
-  else if (k <  0x400368fd ) {/* 0.855469  <|x|<2.426265  */;
-    y=hp0.x-ABS(x);
-    a=y+hp1.x;
-    da=(y-a)+hp1.x;
-    xx=a*a;
-    if (xx < 0.01588) {
-      t = (((((s5.x*xx + s4.x)*xx + s3.x)*xx + s2.x)*xx + s1.x)*a - 0.5*da)*xx+da;
-      res = a+t;
-      cor = (a-res)+t;
-      cor = (cor>0)? 1.02*cor+1.0e-31 : 1.02*cor -1.0e-31;
-      retval = (res == res + cor)? res : csloww(a,da,x);
+  k = 0x7fffffff & m;
+
+  if (k < 0x3e400000)
+    {
+      retval = 1.0;
       goto ret;
-    }
-    else  {
-      if (a>0) {m=1;t=a;db=da;}
-      else {m=0;t=-a;db=-da;}
-      u.x=big.x+t;
-      y=t-(u.x-big.x);
-      xx=y*y;
-      s = y + (db+y*xx*(sn3 +xx*sn5));
-      c = y*db+xx*(cs2 +xx*(cs4 + xx*cs6));
-      k=u.i[LOW_HALF]<<2;
-      sn=__sincostab.x[k];
-      ssn=__sincostab.x[k+1];
-      cs=__sincostab.x[k+2];
-      ccs=__sincostab.x[k+3];
-      cor=(ssn+s*ccs-sn*c)+cs*s;
-      res=sn+cor;
-      cor=(sn-res)+cor;
-      cor = (cor>0)? 1.035*cor+1.0e-31 : 1.035*cor-1.0e-31;

[... 2585 lines stripped ...]
_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits