[Haskell-cafe] Re: Just for a laugh...

Jon Fairbairn jon.fairbairn at cl.cam.ac.uk
Fri Jun 1 05:54:28 EDT 2007

"Dougal Stanton" <ithika at gmail.com> writes:

> On 31 May 2007 21:52:33 +0100,
> Jon Fairbairn <jon.fairbairn at cl.cam.ac.uk> 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

Jón Fairbairn                                 Jon.Fairbairn at cl.cam.ac.uk

More information about the Haskell-Cafe mailing list