about summary refs log tree commit diff
path: root/sysdeps/i386/fpu/s_tanf.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/i386/fpu/s_tanf.S')
-rw-r--r--sysdeps/i386/fpu/s_tanf.S15
1 files changed, 14 insertions, 1 deletions
diff --git a/sysdeps/i386/fpu/s_tanf.S b/sysdeps/i386/fpu/s_tanf.S
index 7a7509119b..355dff9c8d 100644
--- a/sysdeps/i386/fpu/s_tanf.S
+++ b/sysdeps/i386/fpu/s_tanf.S
@@ -7,10 +7,23 @@
 
 RCSID("$NetBSD: s_tanf.S,v 1.3 1995/05/09 00:31:09 jtc Exp $")
 
-/* A float's domain isn't large enough to require argument reduction. */
 ENTRY(__tanf)
 	flds	4(%esp)
 	fptan
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	1f
+	fstp	%st(0)
+	ret
+1:	fldpi
+	fadd	%st(0)
+	fxch	%st(1)
+2:	fprem1
+	fstsw	%ax
+	testl	$0x400,%eax
+	jnz	2b
+	fstp	%st(1)
+	fptan
 	fstp	%st(0)
 	ret
 END (__tanf)