Mail Archives: cygwin/2005/06/30/08:31:39
----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 -