[Haskell-cafe] Just for a laugh...
Donald Bruce Stewart
dons at cse.unsw.edu.au
Fri Jun 1 07:09:25 EDT 2007
> Donald Bruce Stewart wrote:
> > > let s = encode (1.1 :: Float)
> > > :t s
> > s :: Data.ByteString.Lazy.ByteString
> > > s
> > LPS ["\NUL\NUL\140\204\205\255\255\255\255\255\255\255\233"]
> > > decode s :: Float
> > 1.1
> But doesn't Data.Binary serialise to a guaranteed representation, i.e.
> machine-independent? Whereas this (stupid) question explicitly asked for
> *your particular hardware's* floating point rep.
Ah right. Missed that. There was a long thread on the libraries@ mailing
list on doing this (David Roundy suggested it, initially, iirc) a couple
of months ago. Might be useful to read.
More information about the Haskell-Cafe