]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: ilogbl: Make sure to return FP_ILGB0 on zero input
authorCorinna Vinschen <corinna@vinschen.de>
Mon, 16 Dec 2019 09:50:17 +0000 (10:50 +0100)
committerCorinna Vinschen <corinna@vinschen.de>
Mon, 16 Dec 2019 09:50:17 +0000 (10:50 +0100)
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
winsup/cygwin/math/ilogbl.S
winsup/cygwin/release/3.1.0

index f68082ce63bf75a5a7d1d97e8e040112a150d948..a4fe503adcaf3f213e4bf406f6b9acca32d5d772 100644 (file)
@@ -23,6 +23,8 @@ __MINGW_USYMBOL(ilogbl):
        andb    %ah, %dh
        cmpb    $0x05, %dh
        je      1f              /* Is +-Inf, jump.  */
+       cmpb    $0x40, %dh
+       je      2f              /* Is +-Inf, jump.  */
 
        fxtract
        pushq   %rax
@@ -37,6 +39,9 @@ __MINGW_USYMBOL(ilogbl):
 1:     fstp    %st
        movl    $0x7fffffff, %eax
        ret
+2:     fstp    %st
+       movl    $0x80000001, %eax       /* FP_ILOGB0  */
+       ret
 #else
        fldt    4(%esp)
 /* I added the following ugly construct because ilogb(+-Inf) is
@@ -48,6 +53,8 @@ __MINGW_USYMBOL(ilogbl):
        andb    %ah, %dh
        cmpb    $0x05, %dh
        je      1f              /* Is +-Inf, jump.  */
+       cmpb    $0x40, %dh
+       je      2f              /* Is +-Inf, jump.  */
 
        fxtract
        pushl   %eax
@@ -62,4 +69,7 @@ __MINGW_USYMBOL(ilogbl):
 1:     fstp    %st
        movl    $0x7fffffff, %eax
        ret
+2:     fstp    %st
+       movl    $0x80000001, %eax       /* FP_ILOGB0  */
+       ret
 #endif
index b0e845657ef1a793834e3ddb739b03ecbea1e1d6..681ea5db9f00c706f34d12a696d095c958674e26 100644 (file)
@@ -108,3 +108,6 @@ Bug Fixes
 - Fix an assertion failure when /cygdrive contains an offline network
   drive.
   Addresses: https://cygwin.com/ml/cygwin/2019-12/msg00016.html
+
+- Fix return value of ilogbl for 0 input.
+  Addresses: https://cygwin.com/ml/cygwin/2019-12/msg00074.html
This page took 0.033871 seconds and 5 git commands to generate.