"Dougal Stanton" <[EMAIL PROTECTED]> writes: > On 31 May 2007 21:52:33 +0100, > Jon Fairbairn <[EMAIL PROTECTED]> wrote: > > Yes, but you didn't say that it's not only silly but > > demonstrates the opposite of expressiveness as it's all > > about breaking an abstraction and must be non-portable > > code (because it's definition is that it won't give the > > same results on different hardware), so such code should > > be *hard* to write in a good language. > > Well, I would suggest that maybe *good* is not completely > congruent with *expressive* (at least for this case). If I > want to write a program to learn how IEEE floats are > constructed, by destructing them, then I *should* be able > to.
You can. Getting a notion of how they are constructed (independent of the precise hardware) is easy, (just try foo x = floatToDigits (floatRadix x) x foo (1/0) together with looking at floatDigits etc), getting the precise machine representation is harder (but possible). But then, if you want to do that, why shouldn't you use some assembler? It would be even more instructive, after all. > I have no solutions of my own though :-( I wait in eager > expectation.... Isn't the combination of the functions mentioned earlier in the thread enough for you to do it? (even disregarding unsafeCoerce). -- Jón Fairbairn [EMAIL PROTECTED] _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe