about summary refs log tree commit diff
path: root/src/math
diff options
context:
space:
mode:
Diffstat (limited to 'src/math')
-rw-r--r--src/math/i386/sqrt.s16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/math/i386/sqrt.s b/src/math/i386/sqrt.s
index c6e55303..8289d094 100644
--- a/src/math/i386/sqrt.s
+++ b/src/math/i386/sqrt.s
@@ -2,4 +2,20 @@
 .type sqrt,@function
 sqrt:	fldl 4(%esp)
 	fsqrt
+	fstsw %ax
+	sub $12,%esp
+	fld %st(0)
+	fstpt (%esp)
+	mov (%esp),%ecx
+	and $0x7ff,%ecx
+	cmp $0x400,%ecx
+	jnz 1f
+	and $0x200,%eax
+	sub $0x100,%eax
+	sub %eax,(%esp)
+	fstp %st(0)
+	fldt (%esp)
+1:	add $12,%esp
+	fstpl 4(%esp)
+	fldl 4(%esp)
 	ret