[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commits] r22927 - in /fsf/trunk/libc: ./ benchtests/ math/ sysdeps/i386/fpu/ sysdeps/x86_64/fpu/
- To: commits@xxxxxxxxxx
- Subject: [Commits] r22927 - in /fsf/trunk/libc: ./ benchtests/ math/ sysdeps/i386/fpu/ sysdeps/x86_64/fpu/
- From: eglibc@xxxxxxxxxx
- Date: Thu, 25 Apr 2013 00:01:46 -0000
Author: eglibc
Date: Thu Apr 25 00:01:45 2013
New Revision: 22927
Log:
Import glibc-mainline for 2013-04-25
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/NEWS
fsf/trunk/libc/benchtests/Makefile
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/sysdeps/i386/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 Thu Apr 25 00:01:45 2013
@@ -1,3 +1,38 @@
+2013-04-24 Carlos O'Donell <carlos@xxxxxxxxxx>
+
+ * math/libm-test.inc (cos_test): Use accurate hex constants.
+ (sincost_test): Likewise.
+
+2013-04-24 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ * math/libm-test.inc (catan_test): Add more tests.
+ (catanh_test): Likewise.
+
+ * math/s_catanf.c (__catanf): Use suffixed floating-point
+ constants.
+ * math/s_catanhf.c (__catanhf): Likewise.
+ * math/s_catanhl.c (__catanhl): Likewise.
+ * math/s_catanl.c (__catanl): Likewise.
+
+ [BZ #15394]
+ * math/s_catan.c (__catan): Calculate imaginary part of result
+ with log1p not log unless computing log of number close to 0.
+ * math/s_catanf.c (__catanf): Likewise.
+ * math/s_catanl.c (__catanl): Likewise.
+ * math/s_catanh.c (__catanh): Calculate real part of result with
+ log1p not log unless computing log of number close to 0.
+ * math/s_catanhf.c (__catanhf): Likewise.
+ * math/s_catanhl.c (__catanhl): 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-24 Siddhesh Poyarekar <siddhesh@xxxxxxxxxx>
+
+ * benchtests/Makefile: Mention files in which fast and slow
+ paths of math functions are implemented.
+
2013-04-23 Roland McGrath <roland@xxxxxxxxxxxxx>
* sysdeps/posix/timespec_get.c: New file.
Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Thu Apr 25 00:01:45 2013
@@ -14,7 +14,7 @@
14888, 14920, 14964, 14981, 14982, 14985, 14994, 14996, 15003, 15006,
15020, 15023, 15036, 15054, 15055, 15062, 15078, 15160, 15214, 15232,
15234, 15283, 15285, 15287, 15304, 15305, 15307, 15309, 15327, 15330,
- 15335, 15336, 15337, 15342, 15346, 15361.
+ 15335, 15336, 15337, 15342, 15346, 15361, 15394.
* 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 Thu Apr 25 00:01:45 2013
@@ -48,13 +48,13 @@
bench := exp pow rint sin cos tan atan modf \
slowexp slowpow slowsin slowcos slowtan slowatan
-# exp function fast path
+# 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
+# pow function fast path: sysdeps/ieee754/dbl-64/e_pow.c
pow-ITER = 2e8
pow-ARGLIST = double:double
pow-RET = double
@@ -65,66 +65,66 @@
rint-RET = double
LDFLAGS-bench-rint = -lm
-# exp function slowest path
+# 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
+# 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
+# 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
+# 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
+# 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
+# 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
+# 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
+# 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
+# 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
+# atan function slowest path: sysdeps/ieee754/dbl-64/mpatan.c
slowatan-ITER = 3e8
slowatan-ARGLIST = double
slowatan-RET = double
Modified: fsf/trunk/libc/math/libm-test.inc
==============================================================================
--- fsf/trunk/libc/math/libm-test.inc (original)
+++ fsf/trunk/libc/math/libm-test.inc Thu Apr 25 00:01:45 2013
@@ -4254,6 +4254,15 @@
TEST_c_c (catan, 0, minus_zero, 0, minus_zero);
TEST_c_c (catan, minus_zero, minus_zero, minus_zero, minus_zero);
+ TEST_c_c (catan, 1.0L, plus_zero, M_PI_4l, plus_zero);
+ TEST_c_c (catan, 1.0L, minus_zero, M_PI_4l, minus_zero);
+ TEST_c_c (catan, -1.0L, plus_zero, -M_PI_4l, plus_zero);
+ TEST_c_c (catan, -1.0L, minus_zero, -M_PI_4l, minus_zero);
+ TEST_c_c (catan, plus_zero, 1.0L, plus_zero, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+ TEST_c_c (catan, minus_zero, 1.0L, minus_zero, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+ TEST_c_c (catan, plus_zero, -1.0L, plus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+ TEST_c_c (catan, minus_zero, -1.0L, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+
TEST_c_c (catan, plus_infty, plus_infty, M_PI_2l, 0);
TEST_c_c (catan, plus_infty, minus_infty, M_PI_2l, minus_zero);
TEST_c_c (catan, minus_infty, plus_infty, -M_PI_2l, 0);
@@ -4299,6 +4308,35 @@
TEST_c_c (catan, qnan_value, qnan_value, qnan_value, qnan_value);
+ TEST_c_c (catan, 0x1p50L, 0.0L, 1.570796326794895731052901991514519103193L, 0.0L);
+ TEST_c_c (catan, 0x1p50L, -0.0L, 1.570796326794895731052901991514519103193L, -0.0L);
+ TEST_c_c (catan, -0x1p50L, 0.0L, -1.570796326794895731052901991514519103193L, 0.0L);
+ TEST_c_c (catan, -0x1p50L, -0.0L, -1.570796326794895731052901991514519103193L, -0.0L);
+ TEST_c_c (catan, 0.0L, 0x1p50L, 1.570796326794896619231321691639751442099L, 8.881784197001252323389053344728897997441e-16L);
+ TEST_c_c (catan, -0.0L, 0x1p50L, -1.570796326794896619231321691639751442099L, 8.881784197001252323389053344728897997441e-16L);
+ TEST_c_c (catan, 0.0L, -0x1p50L, 1.570796326794896619231321691639751442099L, -8.881784197001252323389053344728897997441e-16L);
+ TEST_c_c (catan, -0.0L, -0x1p50L, -1.570796326794896619231321691639751442099L, -8.881784197001252323389053344728897997441e-16L);
+#ifndef TEST_FLOAT
+ TEST_c_c (catan, 0x1p500L, 0.0L, 1.570796326794896619231321691639751442099L, 0.0L);
+ TEST_c_c (catan, 0x1p500L, -0.0L, 1.570796326794896619231321691639751442099L, -0.0L);
+ TEST_c_c (catan, -0x1p500L, 0.0L, -1.570796326794896619231321691639751442099L, 0.0L);
+ TEST_c_c (catan, -0x1p500L, -0.0L, -1.570796326794896619231321691639751442099L, -0.0L);
+ TEST_c_c (catan, 0.0L, 0x1p500L, 1.570796326794896619231321691639751442099L, 3.054936363499604682051979393213617699789e-151L);
+ TEST_c_c (catan, -0.0L, 0x1p500L, -1.570796326794896619231321691639751442099L, 3.054936363499604682051979393213617699789e-151L);
+ TEST_c_c (catan, 0.0L, -0x1p500L, 1.570796326794896619231321691639751442099L, -3.054936363499604682051979393213617699789e-151L);
+ TEST_c_c (catan, -0.0L, -0x1p500L, -1.570796326794896619231321691639751442099L, -3.054936363499604682051979393213617699789e-151L);
+#endif
+#if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
+ TEST_c_c (catan, 0x1p5000L, 0.0L, 1.570796326794896619231321691639751442099L, 0.0L);
+ TEST_c_c (catan, 0x1p5000L, -0.0L, 1.570796326794896619231321691639751442099L, -0.0L);
+ TEST_c_c (catan, -0x1p5000L, 0.0L, -1.570796326794896619231321691639751442099L, 0.0L);
+ TEST_c_c (catan, -0x1p5000L, -0.0L, -1.570796326794896619231321691639751442099L, -0.0L);
+ TEST_c_c (catan, 0.0L, 0x1p5000L, 1.570796326794896619231321691639751442099L, 7.079811261048172892385615158694057552948e-1506L);
+ TEST_c_c (catan, -0.0L, 0x1p5000L, -1.570796326794896619231321691639751442099L, 7.079811261048172892385615158694057552948e-1506L);
+ TEST_c_c (catan, 0.0L, -0x1p5000L, 1.570796326794896619231321691639751442099L, -7.079811261048172892385615158694057552948e-1506L);
+ TEST_c_c (catan, -0.0L, -0x1p5000L, -1.570796326794896619231321691639751442099L, -7.079811261048172892385615158694057552948e-1506L);
+#endif
+
TEST_c_c (catan, 0.75L, 1.25L, 1.10714871779409050301706546017853704L, 0.549306144334054845697622618461262852L);
TEST_c_c (catan, -2, -3, -1.4099210495965755225306193844604208L, -0.22907268296853876629588180294200276L);
@@ -4320,6 +4358,15 @@
TEST_c_c (catanh, minus_zero, 0, minus_zero, 0.0);
TEST_c_c (catanh, 0, minus_zero, 0.0, minus_zero);
TEST_c_c (catanh, minus_zero, minus_zero, minus_zero, minus_zero);
+
+ TEST_c_c (catanh, 1.0L, plus_zero, plus_infty, plus_zero, DIVIDE_BY_ZERO_EXCEPTION);
+ TEST_c_c (catanh, 1.0L, minus_zero, plus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
+ TEST_c_c (catanh, -1.0L, plus_zero, minus_infty, plus_zero, DIVIDE_BY_ZERO_EXCEPTION);
+ TEST_c_c (catanh, -1.0L, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
+ TEST_c_c (catanh, plus_zero, 1.0L, plus_zero, M_PI_4l);
+ TEST_c_c (catanh, minus_zero, 1.0L, minus_zero, M_PI_4l);
+ TEST_c_c (catanh, plus_zero, -1.0L, plus_zero, -M_PI_4l);
+ TEST_c_c (catanh, minus_zero, -1.0L, minus_zero, -M_PI_4l);
TEST_c_c (catanh, plus_infty, plus_infty, 0.0, M_PI_2l);
TEST_c_c (catanh, plus_infty, minus_infty, 0.0, -M_PI_2l);
@@ -4364,6 +4411,35 @@
TEST_c_c (catanh, qnan_value, -0.75, qnan_value, qnan_value, INVALID_EXCEPTION_OK);
TEST_c_c (catanh, qnan_value, qnan_value, qnan_value, qnan_value);
+
+ TEST_c_c (catanh, 0x1p50L, 0.0L, 8.881784197001252323389053344728897997441e-16L, 1.570796326794896619231321691639751442099L);
+ TEST_c_c (catanh, 0x1p50L, -0.0L, 8.881784197001252323389053344728897997441e-16L, -1.570796326794896619231321691639751442099L);
+ TEST_c_c (catanh, -0x1p50L, 0.0L, -8.881784197001252323389053344728897997441e-16L, 1.570796326794896619231321691639751442099L);
+ TEST_c_c (catanh, -0x1p50L, -0.0L, -8.881784197001252323389053344728897997441e-16L, -1.570796326794896619231321691639751442099L);
+ TEST_c_c (catanh, 0.0L, 0x1p50L, 0.0L, 1.570796326794895731052901991514519103193L);
+ TEST_c_c (catanh, -0.0L, 0x1p50L, -0.0L, 1.570796326794895731052901991514519103193L);
+ TEST_c_c (catanh, 0.0L, -0x1p50L, 0.0L, -1.570796326794895731052901991514519103193L);
+ TEST_c_c (catanh, -0.0L, -0x1p50L, -0.0L, -1.570796326794895731052901991514519103193L);
+#ifndef TEST_FLOAT
+ TEST_c_c (catanh, 0x1p500L, 0.0L, 3.054936363499604682051979393213617699789e-151L, 1.570796326794896619231321691639751442099L);
+ TEST_c_c (catanh, 0x1p500L, -0.0L, 3.054936363499604682051979393213617699789e-151L, -1.570796326794896619231321691639751442099L);
+ TEST_c_c (catanh, -0x1p500L, 0.0L, -3.054936363499604682051979393213617699789e-151L, 1.570796326794896619231321691639751442099L);
+ TEST_c_c (catanh, -0x1p500L, -0.0L, -3.054936363499604682051979393213617699789e-151L, -1.570796326794896619231321691639751442099L);
+ TEST_c_c (catanh, 0.0L, 0x1p500L, 0.0L, 1.570796326794896619231321691639751442099L);
+ TEST_c_c (catanh, -0.0L, 0x1p500L, -0.0L, 1.570796326794896619231321691639751442099L);
+ TEST_c_c (catanh, 0.0L, -0x1p500L, 0.0L, -1.570796326794896619231321691639751442099L);
+ TEST_c_c (catanh, -0.0L, -0x1p500L, -0.0L, -1.570796326794896619231321691639751442099L);
+#endif
+#if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
+ TEST_c_c (catanh, 0x1p5000L, 0.0L, 7.079811261048172892385615158694057552948e-1506L, 1.570796326794896619231321691639751442099L);
+ TEST_c_c (catanh, 0x1p5000L, -0.0L, 7.079811261048172892385615158694057552948e-1506L, -1.570796326794896619231321691639751442099L);
+ TEST_c_c (catanh, -0x1p5000L, 0.0L, -7.079811261048172892385615158694057552948e-1506L, 1.570796326794896619231321691639751442099L);
+ TEST_c_c (catanh, -0x1p5000L, -0.0L, -7.079811261048172892385615158694057552948e-1506L, -1.570796326794896619231321691639751442099L);
+ TEST_c_c (catanh, 0.0L, 0x1p5000L, 0.0L, 1.570796326794896619231321691639751442099L);
+ TEST_c_c (catanh, -0.0L, 0x1p5000L, -0.0L, 1.570796326794896619231321691639751442099L);
+ TEST_c_c (catanh, 0.0L, -0x1p5000L, 0.0L, -1.570796326794896619231321691639751442099L);
+ TEST_c_c (catanh, -0.0L, -0x1p5000L, -0.0L, -1.570796326794896619231321691639751442099L);
+#endif
TEST_c_c (catanh, 0.75L, 1.25L, 0.261492138795671927078652057366532140L, 0.996825126463918666098902241310446708L);
TEST_c_c (catanh, -2, -3, -0.14694666622552975204743278515471595L, -1.3389725222944935611241935759091443L);
@@ -5337,23 +5413,23 @@
to each type. */
#ifdef TEST_FLOAT
/* 32-bit float. */
- TEST_f_f (cos, M_PI_2l, -4.371139000186241438857289400265215e-8L);
+ TEST_f_f (cos, M_PI_2l, -0x1.777a5cp-25L);
#endif
#if defined TEST_DOUBLE || (defined TEST_LDOUBLE && LDBL_MANT_DIG == 53)
/* 64-bit double or 64-bit long double. */
- TEST_f_f (cos, M_PI_2l, 6.123233995736765886130329661375001e-17L);
+ TEST_f_f (cos, M_PI_2l, 0x1.1a62633145c07p-54L);
#endif
#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 64
/* 96-bit long double. */
- TEST_f_f (cos, M_PI_2l, -2.50827880633416601177866354016537e-20L);
+ TEST_f_f (cos, M_PI_2l, -0xe.ce675d1fc8f8cbbp-69L);
#endif
#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 106
/* 128-bit IBM long double. */
- TEST_f_f (cos, M_PI_2l, 1.082856673921913968223746169860580e-32L);
+ TEST_f_f (cos, M_PI_2l, 0x1.c1cd129024e088a67cc74020bcp-107L);
#endif
#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 113
/* 128-bit long double. */
- TEST_f_f (cos, M_PI_2l, 4.335905065061890512398522013021675e-35L);
+ TEST_f_f (cos, M_PI_2l, 0x1.cd129024e088a67cc74020bbea64p-115L);
#endif
TEST_f_f (cos, 0.75L, 0.731688868873820886311838753000084544L);
@@ -12164,23 +12240,23 @@
to each type. */
#ifdef TEST_FLOAT
/* 32-bit float. */
- TEST_extra (sincos, M_PI_2l, 1, -4.371139000186241438857289400265215e-8L);
+ TEST_extra (sincos, M_PI_2l, 1, -0x1.777a5cp-25L);
#endif
#if defined TEST_DOUBLE || (defined TEST_LDOUBLE && LDBL_MANT_DIG == 53)
/* 64-bit double or 64-bit long double. */
- TEST_extra (sincos, M_PI_2l, 1, 6.123233995736765886130329661375001e-17L);
+ TEST_extra (sincos, M_PI_2l, 1, 0x1.1a62633145c07p-54L);
#endif
#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 64
/* 96-bit long double. */
- TEST_extra (sincos, M_PI_2l, 1, -2.50827880633416601177866354016537e-20L);
+ TEST_extra (sincos, M_PI_2l, 1, -0xe.ce675d1fc8f8cbbp-69L);
#endif
#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 106
/* 128-bit IBM long double. */
- TEST_extra (sincos, M_PI_2l, 1, 1.082856673921913968223746169860580e-32L);
+ TEST_extra (sincos, M_PI_2l, 1, 0x1.c1cd129024e088a67cc74020bcp-107L);
#endif
#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 113
/* 128-bit long double. */
- TEST_extra (sincos, M_PI_2l, 1, 4.335905065061890512398522013021675e-35L);
+ TEST_extra (sincos, M_PI_2l, 1, 0x1.cd129024e088a67cc74020bbea64p-115L);
#endif
TEST_extra (sincos, M_PI_6l, 0.5, 0.86602540378443864676372317075293616L);
Modified: fsf/trunk/libc/math/s_catan.c
==============================================================================
--- fsf/trunk/libc/math/s_catan.c (original)
+++ fsf/trunk/libc/math/s_catan.c Thu Apr 25 00:01:45 2013
@@ -61,7 +61,7 @@
}
else
{
- double r2, num, den;
+ double r2, num, den, f;
r2 = __real__ x * __real__ x;
@@ -75,7 +75,14 @@
den = __imag__ x - 1.0;
den = r2 + den * den;
- __imag__ res = 0.25 * __ieee754_log (num / den);
+ f = num / den;
+ if (f < 0.5)
+ __imag__ res = 0.25 * __ieee754_log (f);
+ else
+ {
+ num = 4.0 * __imag__ x;
+ __imag__ res = 0.25 * __log1p (num / den);
+ }
}
return res;
Modified: fsf/trunk/libc/math/s_catanf.c
==============================================================================
--- fsf/trunk/libc/math/s_catanf.c (original)
+++ fsf/trunk/libc/math/s_catanf.c Thu Apr 25 00:01:45 2013
@@ -61,21 +61,28 @@
}
else
{
- float r2, num, den;
+ float r2, num, den, f;
r2 = __real__ x * __real__ x;
den = 1 - r2 - __imag__ x * __imag__ x;
- __real__ res = 0.5 * __ieee754_atan2f (2.0 * __real__ x, den);
+ __real__ res = 0.5f * __ieee754_atan2f (2.0f * __real__ x, den);
- num = __imag__ x + 1.0;
+ num = __imag__ x + 1.0f;
num = r2 + num * num;
- den = __imag__ x - 1.0;
+ den = __imag__ x - 1.0f;
den = r2 + den * den;
- __imag__ res = 0.25 * __ieee754_logf (num / den);
+ f = num / den;
+ if (f < 0.5f)
+ __imag__ res = 0.25f * __ieee754_logf (f);
+ else
+ {
+ num = 4.0f * __imag__ x;
+ __imag__ res = 0.25f * __log1pf (num / den);
+ }
}
return res;
Modified: fsf/trunk/libc/math/s_catanh.c
==============================================================================
--- fsf/trunk/libc/math/s_catanh.c (original)
+++ fsf/trunk/libc/math/s_catanh.c Thu Apr 25 00:01:45 2013
@@ -64,7 +64,14 @@
double den = 1.0 - __real__ x;
den = i2 + den * den;
- __real__ res = 0.25 * (__ieee754_log (num) - __ieee754_log (den));
+ double f = num / den;
+ if (f < 0.5)
+ __real__ res = 0.25 * __ieee754_log (f);
+ else
+ {
+ num = 4.0 * __real__ x;
+ __real__ res = 0.25 * __log1p (num / den);
+ }
den = 1 - __real__ x * __real__ x - i2;
Modified: fsf/trunk/libc/math/s_catanhf.c
==============================================================================
--- fsf/trunk/libc/math/s_catanhf.c (original)
+++ fsf/trunk/libc/math/s_catanhf.c Thu Apr 25 00:01:45 2013
@@ -58,17 +58,24 @@
{
float i2 = __imag__ x * __imag__ x;
- float num = 1.0 + __real__ x;
+ float num = 1.0f + __real__ x;
num = i2 + num * num;
- float den = 1.0 - __real__ x;
+ float den = 1.0f - __real__ x;
den = i2 + den * den;
- __real__ res = 0.25 * (__ieee754_logf (num) - __ieee754_logf (den));
+ float f = num / den;
+ if (f < 0.5f)
+ __real__ res = 0.25f * __ieee754_logf (f);
+ else
+ {
+ num = 4.0f * __real__ x;
+ __real__ res = 0.25f * __log1pf (num / den);
+ }
den = 1 - __real__ x * __real__ x - i2;
- __imag__ res = 0.5 * __ieee754_atan2f (2.0 * __imag__ x, den);
+ __imag__ res = 0.5f * __ieee754_atan2f (2.0f * __imag__ x, den);
}
return res;
Modified: fsf/trunk/libc/math/s_catanhl.c
==============================================================================
--- fsf/trunk/libc/math/s_catanhl.c (original)
+++ fsf/trunk/libc/math/s_catanhl.c Thu Apr 25 00:01:45 2013
@@ -58,17 +58,24 @@
{
long double i2 = __imag__ x * __imag__ x;
- long double num = 1.0 + __real__ x;
+ long double num = 1.0L + __real__ x;
num = i2 + num * num;
- long double den = 1.0 - __real__ x;
+ long double den = 1.0L - __real__ x;
den = i2 + den * den;
- __real__ res = 0.25 * (__ieee754_logl (num) - __ieee754_logl (den));
+ long double f = num / den;
+ if (f < 0.5L)
+ __real__ res = 0.25L * __ieee754_logl (f);
+ else
+ {
+ num = 4.0L * __real__ x;
+ __real__ res = 0.25L * __log1pl (num / den);
+ }
den = 1 - __real__ x * __real__ x - i2;
- __imag__ res = 0.5 * __ieee754_atan2l (2.0 * __imag__ x, den);
+ __imag__ res = 0.5L * __ieee754_atan2l (2.0L * __imag__ x, den);
}
return res;
Modified: fsf/trunk/libc/math/s_catanl.c
==============================================================================
--- fsf/trunk/libc/math/s_catanl.c (original)
+++ fsf/trunk/libc/math/s_catanl.c Thu Apr 25 00:01:45 2013
@@ -61,21 +61,28 @@
}
else
{
- long double r2, num, den;
+ long double r2, num, den, f;
r2 = __real__ x * __real__ x;
den = 1 - r2 - __imag__ x * __imag__ x;
- __real__ res = 0.5 * __ieee754_atan2l (2.0 * __real__ x, den);
+ __real__ res = 0.5L * __ieee754_atan2l (2.0L * __real__ x, den);
- num = __imag__ x + 1.0;
+ num = __imag__ x + 1.0L;
num = r2 + num * num;
- den = __imag__ x - 1.0;
+ den = __imag__ x - 1.0L;
den = r2 + den * den;
- __imag__ res = 0.25 * __ieee754_logl (num / den);
+ f = num / den;
+ if (f < 0.5L)
+ __imag__ res = 0.25L * __ieee754_logl (f);
+ else
+ {
+ num = 4.0L * __imag__ x;
+ __imag__ res = 0.25L * __log1pl (num / den);
+ }
}
return res;
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 Thu Apr 25 00:01:45 2013
@@ -3417,6 +3417,8 @@
Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
double: 1
idouble: 1
+ildouble: 1
+ldouble: 1
# cbrt
Test "cbrt (-27.0) == -3.0":
Modified: fsf/trunk/libc/sysdeps/x86_64/fpu/libm-test-ulps
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/fpu/libm-test-ulps (original)
+++ fsf/trunk/libc/sysdeps/x86_64/fpu/libm-test-ulps Thu Apr 25 00:01:45 2013
@@ -3985,6 +3985,8 @@
Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
double: 1
idouble: 1
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
float: 6
ifloat: 6
_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits