From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 11 18:07:30 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 7AFAB16A4CE for ; Sun, 11 Jul 2004 18:07:30 +0000 (GMT) Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id BC6CE43D3F for ; Sun, 11 Jul 2004 18:07:29 +0000 (GMT) (envelope-from marck@rinet.ru) Received: from localhost (localhost [127.0.0.1]) by woozle.rinet.ru (8.12.11/8.12.11) with ESMTP id i6BI7Rwu089458; Sun, 11 Jul 2004 22:07:27 +0400 (MSD) (envelope-from marck@rinet.ru) Date: Sun, 11 Jul 2004 22:07:27 +0400 (MSD) From: Dmitry Morozovsky To: Dimitry Andric In-Reply-To: <115911306.20040711194031@andric.com> Message-ID: <20040711220440.R84500@woozle.rinet.ru> References: <20040711210219.J84500@woozle.rinet.ru> <115911306.20040711194031@andric.com> X-NCC-RegID: ru.rinet MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 18:07:30 -0000 On Sun, 11 Jul 2004, Dimitry Andric wrote: DA> > 1.000000 1.000 0 DA> > 2.000000 2.000 1 DA> > 3.000000 3.000 2 DA> > 4.000000 4.000 3 DA> > 5.000000 5.000 5 DA> > 6.000000 6.000 6 DA> > 7.000000 7.000 7 DA> > 8.000000 8.000 7 DA> > 9.000000 9.000 8 DA> > 9.999999 10.000 9 DA> DA> Yes, this is completely normal if you use IEEE floating point, due to DA> decimal <-> binary conversion and other accumulating rounding errors. DA> In other words, floating point calculations will almost never be DA> exact... DA> DA> This is not a gcc problem. In fact, I can even reproduce your output DA> under Windows using a Microsoft C compiler! :) Wow, it's interesting for us to have exact step-by-step instructions for that! ;) Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------