asin returns nan.0

Sven Panne Sven.Panne@informatik.uni-muenchen.de
Fri, 31 May 2002 19:14:54 +0200


Adrian Kubala wrote:
 > [...]
 > Main> norm (b, a) * norm (b, c)
 > 2.0

Well, mathematically this is 2, but not in Real-World-Floating-Point(tm) :-).

 > Main> asin (-2 / (norm (b, a) * norm (b, c)))

Again, in theory this is well defined: asin (-1) = -pi/2, but you actually
don't pass -1, but something slightly smaller, so asin is undefined. See:

    http://docs.sun.com/htmlcoll/coll.648.2/iso-8859-1/NUMCOMPGD/ncg_goldberg.html

Also note that "normal" Hugs versions only fake Double by using Float. So Hugs'
behaviour is correct here...

Cheers,
    S.