delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/06/30/08:31:39

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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" <dave DOT korn AT artimi DOT com>
To: <cygwin AT cygwin DOT com>
Subject: RE: Bug in printf ?
Date: Thu, 30 Jun 2005 13:29:56 +0100
MIME-Version: 1.0
In-Reply-To: <42C3E2ED.3030305@elimpex.com>
Message-ID: <SERRANOn60TMZQu5Snz000002d4@SERRANO.CAM.ARTIMI.COM>

----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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019