]> sourceware.org Git - glibc.git/commitdiff
Fix i386/x86_64 log2l (sNaN) (bug 20235).
authorJoseph Myers <joseph@codesourcery.com>
Thu, 9 Jun 2016 18:04:30 +0000 (18:04 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Thu, 9 Jun 2016 18:04:30 +0000 (18:04 +0000)
The i386/x86_64 versions of log2l return sNaN for sNaN input.  This
patch fixes them to add NaN inputs to themselves so that qNaN is
returned in this case.

Tested for x86_64 and x86.

[BZ #20235]
* sysdeps/i386/fpu/e_log2l.S (__ieee754_log2l): Add NaN input to
itself.
* sysdeps/x86_64/fpu/e_log2l.S (__ieee754_log2l): Likewise.
* math/libm-test.inc (log2_test_data): Add sNaN tests.

ChangeLog
math/libm-test.inc
sysdeps/i386/fpu/e_log2l.S
sysdeps/x86_64/fpu/e_log2l.S

index 81192ce5b847ebef6b5dfcf77039dbf5ee98e4fe..c0a32785e799ee44a650f624a058b848a621510b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2016-06-09  Joseph Myers  <joseph@codesourcery.com>
 
+       [BZ #20235]
+       * sysdeps/i386/fpu/e_log2l.S (__ieee754_log2l): Add NaN input to
+       itself.
+       * sysdeps/x86_64/fpu/e_log2l.S (__ieee754_log2l): Likewise.
+       * math/libm-test.inc (log2_test_data): Add sNaN tests.
+
        [BZ #20234]
        * sysdeps/ieee754/ldbl-128ibm/s_log1pl.c (__log1pl): Add positive
        infinity or NaN input to itself.
index 4371c4ca7b36fbc605b4a43dc9ba7671c7dba4e5..2df6f29a346ed5bcaae42e0b40c1ae82d25d9954 100644 (file)
@@ -9076,6 +9076,8 @@ static const struct test_f_f_data log2_test_data[] =
     TEST_f_f (log2, plus_infty, plus_infty, ERRNO_UNCHANGED),
     TEST_f_f (log2, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_f (log2, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_f_f (log2, snan_value, qnan_value, INVALID_EXCEPTION),
+    TEST_f_f (log2, -snan_value, qnan_value, INVALID_EXCEPTION),
 
     AUTO_TESTS_f_f (log2),
   };
index 0f5f7e5789ada54a31d83bb34c1faa540722f998..73e62ea908e316aa279531faf632ca8f62543a5a 100644 (file)
@@ -64,6 +64,7 @@ ENTRY(__ieee754_log2l)
 3:     jp      4b              // in case x is ±Inf
        fstp    %st(1)
        fstp    %st(1)
+       fadd    %st(0)
        ret
 END (__ieee754_log2l)
 strong_alias (__ieee754_log2l, __log2l_finite)
index a063255dddfceb0c58e2dc1238a0d5a2025e7abb..023ec29164cddda9f61d61a6ace6802d4665fb09 100644 (file)
@@ -63,6 +63,7 @@ ENTRY(__ieee754_log2l)
        jnz     4b              // in case x is ±Inf
        fstp    %st(1)
        fstp    %st(1)
+       fadd    %st(0)
        ret
 END (__ieee754_log2l)
 
This page took 0.237279 seconds and 5 git commands to generate.