about summary refs log tree commit diff
path: root/src/math/x86_64/exp2l.s
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/x86_64/exp2l.s')
-rw-r--r--src/math/x86_64/exp2l.s12
1 files changed, 11 insertions, 1 deletions
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