math: fix expm1l on x86_64 (avoid underflow for large negative x)
authorSzabolcs Nagy <nsz@port70.net>
Thu, 5 Sep 2013 12:23:44 +0000 (12:23 +0000)
committerSzabolcs Nagy <nsz@port70.net>
Thu, 5 Sep 2013 12:23:44 +0000 (12:23 +0000)
copy the fix from i386: return -1 instead of exp2l(x)-1 when x <= -65

src/math/x86_64/ceill.s
src/math/x86_64/exp2l.s
src/math/x86_64/truncl.s

index bc29f15ce79215d44fb6a5f2c03e12d25bdb81e2..f5cfa3b307b49abad69f8a619595122b5618e2d1 100644 (file)
@@ -1 +1 @@
-# see floor.s
+# see floorl.s
index e71458811385162567573b4ef015a9a37d05eae3..0d6cd563baca544f6f49401a77939965ef2cee87 100644 (file)
@@ -4,8 +4,18 @@ expm1l:
        fldt 8(%rsp)
        fldl2e
        fmulp
+       movl $0xc2820000,-4(%rsp)
+       flds -4(%rsp)
+       fucomp %st(1)
+       fnstsw %ax
+       sahf
        fld1
-       fld %st(1)
+       jb 1f
+               # x*log2e <= -65, return -1 without underflow
+       fstp %st(1)
+       fchs
+       ret
+1:     fld %st(1)
        fabs
        fucom %st(1)
        fnstsw %ax
index bc29f15ce79215d44fb6a5f2c03e12d25bdb81e2..f5cfa3b307b49abad69f8a619595122b5618e2d1 100644 (file)
@@ -1 +1 @@
-# see floor.s
+# see floorl.s