From owner-freebsd-standards@FreeBSD.ORG Thu Mar 4 19:39:20 2010 Return-Path: Delivered-To: freebsd-standards@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37C6A106564A for ; Thu, 4 Mar 2010 19:39:20 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id EFC488FC0A for ; Thu, 4 Mar 2010 19:39:19 +0000 (UTC) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.3/8.14.2) with ESMTP id o24JdIII080099; Thu, 4 Mar 2010 14:39:18 -0500 (EST) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.3/8.14.2/Submit) id o24JdHf3080098; Thu, 4 Mar 2010 14:39:17 -0500 (EST) (envelope-from das@FreeBSD.ORG) Date: Thu, 4 Mar 2010 14:39:17 -0500 From: David Schultz To: "Eugene M. Zheganin" Message-ID: <20100304193917.GA80043@zim.MIT.EDU> Mail-Followup-To: "Eugene M. Zheganin" , freebsd-standards@freebsd.org References: <201003040700.o2470DY1075444@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201003040700.o2470DY1075444@freefall.freebsd.org> Cc: freebsd-standards@FreeBSD.ORG Subject: Re: amd64/144448: sin() broken in libm on amd64 X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Mar 2010 19:39:20 -0000 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.