Standard Prelude - Floating Class

Lennart Augustsson [email protected]
Tue, 16 Oct 2001 17:08:58 +0200

Jerzy Karczmarczuk wrote:

> Did Joe Fasel include this consciously? If yes,
> my respect - already almost infinite, is even bigger now).

I'm pretty sure he did, but he can speak for himself.  I know he
discussed these things with his numerical collegues when designing
the prelude.
Look at this definition (from Complex, by Joe) for instance

instance  (RealFloat a) => Fractional (Complex a)  where
    (x:+y) / (x':+y') =  (x*x''+y*y'') / d :+ (y*x''-x*y'') / d
        x'' = scaleFloat k x'
        y'' = scaleFloat k y'
        k   = - max (exponent x') (exponent y')
        d   = x'*x'' + y'*y''

The scaleFloat calls are there for numeric reasons.

    -- Lennart