[Mono-dev] Double multiplication
Aras Pranckevicius
aras at unity3d.com
Thu Nov 29 08:19:51 EST 2007
> 127.2 * 100 = 12720
> 128.2 * 100 = 12819
> Am I the only one that thinks this is wrong?
What is so wrong about it? 128.2 does not have an exact representation
in floating point (just like 0.1 - results in infinite periodic
series). By teh way, floor(128.2 * 100) is 12819 in a C program as
well.
Here's a neat little page that shows IEEE-754 representations of
arbitrary numbers: http://babbage.cs.qc.edu/IEEE-754/Decimal.html
--
Aras Pranckevicius
work: http://unity3d.com
home: http://aras-p.info
More information about the Mono-devel-list
mailing list