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
This commit is contained in:
parent
e5937885de
commit
0234394621
3 changed files with 13 additions and 3 deletions
|
|
@ -1 +1 @@
|
||||||
# see floor.s
|
# see floorl.s
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,18 @@ expm1l:
|
||||||
fldt 8(%rsp)
|
fldt 8(%rsp)
|
||||||
fldl2e
|
fldl2e
|
||||||
fmulp
|
fmulp
|
||||||
|
movl $0xc2820000,-4(%rsp)
|
||||||
|
flds -4(%rsp)
|
||||||
|
fucomp %st(1)
|
||||||
|
fnstsw %ax
|
||||||
|
sahf
|
||||||
fld1
|
fld1
|
||||||
fld %st(1)
|
jb 1f
|
||||||
|
# x*log2e <= -65, return -1 without underflow
|
||||||
|
fstp %st(1)
|
||||||
|
fchs
|
||||||
|
ret
|
||||||
|
1: fld %st(1)
|
||||||
fabs
|
fabs
|
||||||
fucom %st(1)
|
fucom %st(1)
|
||||||
fnstsw %ax
|
fnstsw %ax
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
# see floor.s
|
# see floorl.s
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue