Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
From: "Dave Korn" <dave.korn@artimi.com>
To: <cygwin@cygwin.com>
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: <SERRANOn60TMZQu5Snz000002d4@SERRANO.CAM.ARTIMI.COM>

----Original Message----
>From: Peter Mueller
>Sent: 30 June 2005 13:18

> Hi!
> 
> 
> Peter J. Acklam wrote:
> 
>> haro@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@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@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/

