This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix cbrtl for ldbl-96


	[BZ #15749]
	* sysdeps/ieee754/ldbl-96/s_cbrtl.c (__cbrtl): Use fabsl instead
	of fabs.
	* math/libm-test.inc (cbrt_test_data) [TEST_LDOUBLE &&
	LDBL_MAX_EXP >= 16384]: Add tests for it.
---
 math/libm-test.inc                | 5 +++++
 sysdeps/ieee754/ldbl-96/s_cbrtl.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/math/libm-test.inc b/math/libm-test.inc
index 2324d4f..851f1be 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -5845,6 +5845,11 @@ static const struct test_f_f_data cbrt_test_data[] =
     TEST_f_f (cbrt, -27.0, -3.0),
     TEST_f_f (cbrt, 0.9921875L, 0.997389022060725270579075195353955217L),
     TEST_f_f (cbrt, 0.75L, 0.908560296416069829445605878163630251L),
+
+#if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
+    TEST_f_f (cbrt, 0x1p16383L, 0x1p5461L),
+    TEST_f_f (cbrt, 0x1p-16383L, 0x1p-5461L),
+#endif
   };
 
 static void
diff --git a/sysdeps/ieee754/ldbl-96/s_cbrtl.c b/sysdeps/ieee754/ldbl-96/s_cbrtl.c
index b481c84..e6b2f25 100644
--- a/sysdeps/ieee754/ldbl-96/s_cbrtl.c
+++ b/sysdeps/ieee754/ldbl-96/s_cbrtl.c
@@ -45,7 +45,7 @@ __cbrtl (long double x)
   int xe;
 
   /* Reduce X.  XM now is an range 1.0 to 0.5.  */
-  xm = __frexpl (fabs (x), &xe);
+  xm = __frexpl (fabsl (x), &xe);
 
   /* If X is not finite or is null return it (with raising exceptions
      if necessary.
-- 
1.8.3.4

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]