]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix i386/x86_64 logl (sNaN) (bug 20227).
authorJoseph Myers <joseph@codesourcery.com>
Wed, 8 Jun 2016 22:24:06 +0000 (22:24 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 8 Jun 2016 22:24:06 +0000 (22:24 +0000)
The i386/x86_64 versions of logl return sNaN for sNaN input.  This
patch fixes them to add a NaN input to itself so that qNaN is returned
in this case.

Tested for x86_64 and x86 (including a build for i586 to cover the
non-i686 logl version).

[BZ #20227]
* sysdeps/i386/fpu/e_logl.S (__ieee754_logl): Add NaN input to
itself.
* sysdeps/i386/i686/fpu/e_logl.S (__ieee754_logl): Likewise.
* sysdeps/x86_64/fpu/e_logl.S (__ieee754_logl): Likewise.
* math/libm-test.inc (log_test_data): Add sNaN tests.

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

index 0d140aab661292dfd7935b727916c1285cc2e203..82c698d918e2cb387a3f37268aab47d642284d4d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2016-06-08  Joseph Myers  <joseph@codesourcery.com>
 
+       [BZ #20227]
+       * sysdeps/i386/fpu/e_logl.S (__ieee754_logl): Add NaN input to
+       itself.
+       * sysdeps/i386/i686/fpu/e_logl.S (__ieee754_logl): Likewise.
+       * sysdeps/x86_64/fpu/e_logl.S (__ieee754_logl): Likewise.
+       * math/libm-test.inc (log_test_data): Add sNaN tests.
+
        [BZ #20226]
        * sysdeps/i386/fpu/e_expl.S (IEEE754_EXPL): Add NaN argument to
        itself.
index 35a256c485bd2434b54bc3eb3b1c2db5f2ea0d04..c16009b9ae090b6a6184a17e116e100c72a1acde 100644 (file)
@@ -8998,6 +8998,8 @@ static const struct test_f_f_data log_test_data[] =
     TEST_f_f (log, plus_infty, plus_infty, ERRNO_UNCHANGED),
     TEST_f_f (log, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_f (log, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_f_f (log, snan_value, qnan_value, INVALID_EXCEPTION),
+    TEST_f_f (log, -snan_value, qnan_value, INVALID_EXCEPTION),
 
     AUTO_TESTS_f_f (log),
   };
index 7a6d370e8fc89dbe195c7da41673bf08d6349f4e..53127d704e7a22f5b9dcc11577a8be996534e22e 100644 (file)
@@ -67,6 +67,7 @@ ENTRY(__ieee754_logl)
 3:     jp      4b              // in case x is +-Inf
        fstp    %st(1)
        fstp    %st(1)
+       fadd    %st(0)
        ret
 END (__ieee754_logl)
 
index e9ecbcd472e1d467cdab8a50df0d6737b5609256..7e3bc8d8175cc9bf02dab0bb35e5f7fe7eeb3089 100644 (file)
@@ -64,6 +64,7 @@ ENTRY(__ieee754_logl)
        ret
 
 3:     fstp    %st(1)
+       fadd    %st(0)
        ret
 END (__ieee754_logl)
 
index dbe6fd59dc7ec046e426e1f1f34b986e81553dc9..0d3576f48bafda8a2580b3e02669e36330b1b9e9 100644 (file)
@@ -66,6 +66,7 @@ ENTRY(__ieee754_logl)
        jnz     4b              // in case x is +-Inf
        fstp    %st(1)
        fstp    %st(1)
+       fadd    %st(0)
        ret
 END (__ieee754_logl)