From: "M. Edward (Ed) Borasky" Date: 2007-09-01T00:24:39+09:00 Subject: Re: 0.06 == 0.06 returns false in Ruby? -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Kyle Schmitt wrote: > On 8/30/07, doug meyer wrote: >> There is also a class called BigDecimal (or something like that) if >> you want to have really accurate numbers and no floating-point errors. > > A warning on things like BigDecimal. > Unless I'm mistaken it's still stored in twos compliment, which means > you'll still end up with the same sort of floating point problems > (albeit further down), and the same numbers that you can't express > exactly with a normal float, can't be expressed exactly with a > BigDecimal. > > You'd think some fixed point math libraries would help, but be > careful, because many of those _also_ store in twos compliment. > > --Kyle > > IIRC BigDecimal is in fact stored in (pregnant pause) Binary Coded Decimal. But I should check that. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG2DKp8fKMegVjSM8RAsTQAKCNicl4roW3uh7LWLERNMxbtL0dnQCdHTAY /Y2wWjyVegtTECn6Ur32v30= =hAqx -----END PGP SIGNATURE-----