From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 11 17:40:46 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 11AC716A4CE for ; Sun, 11 Jul 2004 17:40:46 +0000 (GMT) Received: from tensor.xs4all.nl (tensor.xs4all.nl [194.109.160.97]) by mx1.FreeBSD.org (Postfix) with ESMTP id A353A43D1F for ; Sun, 11 Jul 2004 17:40:43 +0000 (GMT) (envelope-from dimitry@andric.com) Received: from kilgore.dim (kilgore.dim [192.168.0.3]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.xs4all.nl (Postfix) with ESMTP id 5CA7C22850; Sun, 11 Jul 2004 19:40:41 +0200 (CEST) Date: Sun, 11 Jul 2004 19:40:31 +0200 From: Dimitry Andric X-Mailer: The Bat! (v2.12 RC/3) Business X-Priority: 3 (Normal) Message-ID: <115911306.20040711194031@andric.com> To: Dmitry Morozovsky In-Reply-To: <20040711210219.J84500@woozle.rinet.ru> References: <20040711210219.J84500@woozle.rinet.ru> MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="----------D81AD301C85E2F5" cc: freebsd-hackers@freebsd.org Subject: Re: gcc strangeness X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2004 17:40:46 -0000 ------------D81AD301C85E2F5 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit On 2004-07-11 at 19:06:32 Dmitry Morozovsky wrote: > 1.000000 1.000 0 > 2.000000 2.000 1 > 3.000000 3.000 2 > 4.000000 4.000 3 > 5.000000 5.000 5 > 6.000000 6.000 6 > 7.000000 7.000 7 > 8.000000 8.000 7 > 9.000000 9.000 8 > 9.999999 10.000 9 Yes, this is completely normal if you use IEEE floating point, due to decimal <-> binary conversion and other accumulating rounding errors. In other words, floating point calculations will almost never be exact... This is not a gcc problem. In fact, I can even reproduce your output under Windows using a Microsoft C compiler! :) ------------D81AD301C85E2F5 Content-Type: application/pgp-signature -----BEGIN PGP MESSAGE----- Version: GnuPG v1.2.4 (MingW32) iD8DBQFA8XuOsF6jCi4glqMRAuh3AKCX9aqzKBh5i9Nj5SQsMOjDuRLcBgCfWyFl 28onGDE/9u8YlOHXbYqMjH0= =NJ5n -----END PGP MESSAGE----- ------------D81AD301C85E2F5--