Not lazy/smart enough

Hans Aberg haberg@matematik.su.se
Fri, 2 Nov 2001 17:01:48 +0100


At 12:56 +0100 2001/11/02, Lennart Augustsson wrote:
>You can't catch exceptions locally in any suggested extension of Haskell,
>so this is impossible.

So this might be something for the Haskell development gurus to fix then.

I think that the idea with the exceptions is the right way to go: If one
cannot do it in Haskell directly, one might try an exception monad, or
merely simulate it, by letting the design of the interface be influenced by
it.

>I think it's much cleaner to keep Infinity and NaN, and then raise an
>exception if these value should ever occur where you cannot handle them.
>IEEE754 propagates the special values in a nice way so it work pretty well.
>
>That said, don't think Haskell's Float&Double are ideal for serious numerical
>work; you might need finer control of things like rounding modes etc.

I spoke about a floating number type, not any specific like Float or
Double. -- In fact, I have followed the GNU GMP for some time, and it would
be good to have something like that a part of Hugs. (And GMP is such that
it can be implemented generically, without relying on assembler code.) One
then already has moved away from any IEEE ideas.

As for rounding modes, it seems better to add sufficiently high precision
in the computations (as far as a numerical user interface goes). (But I am
not a numerical expert, so I do not know what rounding modes are used for.)

One should not confuse rounding modes with floating -> integer conversions,
though, with is something different. (A rounding is a function floating ->
floating.)

Also for multiprecision number types, there appears to be two types: one
floating number type which approximates relative errors (like in
logarithmic differentials dlog f := df/f), and a fixed number type which
approximates absolute errors (like in the usual differentials df).

  Hans Aberg