From: Joel VanderWerf Date: 2007-09-04T04:00:32+09:00 Subject: Re: 0.06 == 0.06 returns false in Ruby? M. Edward (Ed) Borasky wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Stefan Rusterholz wrote: > >> Marshal.dump on the other hand is serializing, of course you don't want >> your floats truncated just because you're serializing. > Excuse me -- does Marshal.dump serialize floats in text or in binary? > I'd hope it was binary. A *YAML* serializer would have to do it in text, > although they could obviously encode binary in base 64 or hex. The number itself is in acsii: irb(main):006:0> x = 1.234e120 => 1.234e+120 irb(main):007:0> Marshal.dump(x) => "\004\bf\0371.2340000000000001e+120\000@`" Maybe this is for compatibility, in case ruby is running on some oddball system without the standard float formats? -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407