Date: Thu, 4 Mar 2010 14:39:17 -0500 From: David Schultz <das@FreeBSD.ORG> To: "Eugene M. Zheganin" <eugene@zhegan.in> Cc: freebsd-standards@FreeBSD.ORG Subject: Re: amd64/144448: sin() broken in libm on amd64 Message-ID: <20100304193917.GA80043@zim.MIT.EDU> In-Reply-To: <201003040700.o2470DY1075444@freefall.freebsd.org> References: <201003040700.o2470DY1075444@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100304193917.GA80043>