[ballen@uwm.edu] libc/2269: triginometric argument reduction error in libm
Andreas Jaeger
aj@suse.de
Sun May 20 08:56:00 GMT 2001
Bruce Allen <ballen@gravity.phys.uwm.edu> writes:
> On Sun, 20 May 2001, Geoff Keating wrote:
>
> > Someone needs to fix libc/sysdeps/i386/fpu/s_sin.S so that it does
> > proper range reduction, I think. It works fine on non-x86 chips.
> >
> > Intel's manual (I was looking at the 'Pentium Processor Family
> > Developer's Manual, volume 3') has some spectacularly bad advice on
> > how to do range reduction. I would suggest ignoring it.
>
> Geoff,
>
> Could you please give a URL for this manual? I'm familiar enough with the
> problems of range reduction to be interested in seeing how they got it
> wrong.
Just for reference, I'm appending the ia32 double sin implementation.
Andreas
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
#include <machine/asm.h>
RCSID("$NetBSD: s_sin.S,v 1.5 1995/05/09 00:25:54 jtc Exp $")
ENTRY(__sin)
fldl 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 (__sin)
weak_alias (__sin, sin)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj
More information about the Libc-alpha
mailing list