From: Szabolcs Nagy Date: Thu, 5 Sep 2013 12:23:44 +0000 (+0000) Subject: math: fix expm1l on x86_64 (avoid underflow for large negative x) X-Git-Tag: v0.9.14~26 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=02343946215a7ae03634c6490abcc69da68df589;p=oweals%2Fmusl.git math: fix expm1l on x86_64 (avoid underflow for large negative x) copy the fix from i386: return -1 instead of exp2l(x)-1 when x <= -65 --- diff --git a/src/math/x86_64/ceill.s b/src/math/x86_64/ceill.s index bc29f15c..f5cfa3b3 100644 --- a/src/math/x86_64/ceill.s +++ b/src/math/x86_64/ceill.s @@ -1 +1 @@ -# see floor.s +# see floorl.s diff --git a/src/math/x86_64/exp2l.s b/src/math/x86_64/exp2l.s index e7145881..0d6cd563 100644 --- a/src/math/x86_64/exp2l.s +++ b/src/math/x86_64/exp2l.s @@ -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 diff --git a/src/math/x86_64/truncl.s b/src/math/x86_64/truncl.s index bc29f15c..f5cfa3b3 100644 --- a/src/math/x86_64/truncl.s +++ b/src/math/x86_64/truncl.s @@ -1 +1 @@ -# see floor.s +# see floorl.s