Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: "Dave Korn" To: Subject: RE: Bug in printf ? Date: Thu, 30 Jun 2005 13:29:56 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit In-Reply-To: <42C3E2ED.3030305@elimpex.com> Message-ID: ----Original Message---- >From: Peter Mueller >Sent: 30 June 2005 13:18 > Hi! > > > Peter J. Acklam wrote: > >> haro AT NOTYOUTOO! wrote: ^^^^^^^^^^^^^ Please avoid quoting peoples email addresses in your replies, it causes them to suffer more spamming. >>>>> How come "0.125" gets printed as "0.12", and not "1.3"? >>> ^^^ "0.13", off >>> cource ;-) >>> >>> >> >> Dealing with integers illustrates the matter more clearly. When >> the decimal value is exactly 0.5, then printf should round to the >> nearest *even* integer, as far as I know, so you should get >> >> > Never heard of such a rule! > As I learned it in school, 0.5 should allways be rounded to 1 . I guess they didn't teach you IEEE-754-compliant floating point maths in school. You may find it informative to google some/any/all/none of the following terms: dk AT mace /artimi/firmware> grep FE_ /usr/include/mingw/fenv.h | grep 0x0.00 #define FE_TONEAREST 0x0000 #define FE_DOWNWARD 0x0400 #define FE_UPWARD 0x0800 #define FE_TOWARDZERO 0x0c00 dk AT mace /artimi/firmware> cheers, DaveK -- Can't think of a witty .sigline today.... -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/