asin returns nan.0

Adrian Kubala kubalaa@bigfoot.com
Fri, 31 May 2002 15:34:05 +0200


Here's the relevant code:

areaPgram a b c = (fst b * snd c) - (snd b * fst c) + (fst a * snd b)
	- (snd a * fst b) + (snd a * fst c) - (fst a * snd c)
norm ((x1, y1), (x2, y2)) = sqrt ((x1 - x2)^2 + (y1 - y2)^2)
angle a b c = asin (areaPgram a b c / (norm (b, a) * norm (b, c)))
...
Main> angle (1,0) (0,1) (1,2)
nan.0

The problem appears to be in the "norm". Other test cases I could think
of to try worked fine... I'm mystified. How can I work around this???

-Adrian