Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: amd64/144448: sin() broken in libm on amd64

1 view
Skip to first unread message

Eugene M. Zheganin

unread,
Mar 4, 2010, 2:00:13 AM3/4/10
to freebsd-...@freebsd.org
The following reply was made to PR standards/144448; it has been noted by GNATS.

From: "Eugene M. Zheganin" <eug...@zhegan.in>
To: Peter Jeremy <peter...@acm.org>
Cc: freebsd-gn...@FreeBSD.org
Subject: Re: amd64/144448: sin() broken in libm on amd64
Date: Thu, 04 Mar 2010 11:38:40 +0500

Hi.

On 04.03.2010 03:39, Peter Jeremy wrote:
> I agree they are different but why do you think the i386 result is valid?
> Between imperfect rounding of trig functions and throwing away high
> bits (when intermediate results are outside +/-pi), after iterating
> 20 times, your result is not much better than noise in either case.
>
>
Okay, after some explanations received from my colleagues I realized I
was wrong with this pr.
Sorry for your time and thank you.

Eugene.

David Schultz

unread,
Mar 4, 2010, 2:39:17 PM3/4/10
to Eugene M. Zheganin, freebsd-...@freebsd.org
Computing the sin() of very large values in floating point is
generally not a good idea because fixed-width floating point
formats can't express large input operands accurately enough to
get a useful result. For example, even with a perfect sin()
implementation, the sin of pi*10^12 and the sin of pi*10^12 + 1
will be identical in double precision because the inputs will
be rounded to the same value. You're getting different results
in bc because the inputs aren't rounded to double precision.

The amd64 implementation of sin() should produce very accurate
results subject to the limitation described above. The i386
implementation is optimized and may produce less accurate
results, particularly for inputs > 2^64 or so.

0 new messages