From f4e4fcb0dc145e3e4f852bb5bdc74c951e7c9a07 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 13 Feb 2000 19:38:55 +0000 Subject: [PATCH] Domain of opcode is not large enough so test for overflow and handle it. --- sysdeps/libm-i387/s_cosf.S | 15 ++++++++++++++- sysdeps/libm-i387/s_sinf.S | 15 ++++++++++++++- sysdeps/libm-i387/s_tanf.S | 15 ++++++++++++++- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/sysdeps/libm-i387/s_cosf.S b/sysdeps/libm-i387/s_cosf.S index d8e80906393..21f87aa8746 100644 --- a/sysdeps/libm-i387/s_cosf.S +++ b/sysdeps/libm-i387/s_cosf.S @@ -7,10 +7,23 @@ RCSID("$NetBSD: s_cosf.S,v 1.3 1995/05/08 23:55:16 jtc Exp $") -/* A float's domain isn't large enough to require argument reduction. */ ENTRY(__cosf) flds 4(%esp) fcos + fnstsw %ax + testl $0x400,%eax + jnz 1f + ret + .align ALIGNARG(4) +1: fldpi + fadd %st(0) + fxch %st(1) +2: fprem1 + fnstsw %ax + testl $0x400,%eax + jnz 2b + fstp %st(1) + fcos ret END (__cosf) weak_alias (__cosf, cosf) diff --git a/sysdeps/libm-i387/s_sinf.S b/sysdeps/libm-i387/s_sinf.S index a010d60f5ef..5ca45f52e2c 100644 --- a/sysdeps/libm-i387/s_sinf.S +++ b/sysdeps/libm-i387/s_sinf.S @@ -7,10 +7,23 @@ RCSID("$NetBSD: s_sinf.S,v 1.3 1995/05/09 00:27:53 jtc Exp $") -/* A float's domain isn't large enough to require argument reduction. */ ENTRY(__sinf) flds 4(%esp) fsin + fnstsw %ax + testl $0x400,%eax + jnz 1f + ret + .align ALIGNARG(4) +1: fldpi + fadd %st(0) + fxch %st(1) +2: fprem1 + fnstsw %ax + testl $0x400,%eax + jnz 2b + fstp %st(1) + fsin ret END (__sinf) weak_alias (__sinf, sinf) diff --git a/sysdeps/libm-i387/s_tanf.S b/sysdeps/libm-i387/s_tanf.S index 7a7509119b9..355dff9c8da 100644 --- a/sysdeps/libm-i387/s_tanf.S +++ b/sysdeps/libm-i387/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) -- 2.47.2