Haskell 98 Standard; library Complex

George Russell ger@tzi.de
Thu, 25 Oct 2001 12:56:16 +0200

I sent a report to SPJ on Tuesday complaining about the Haskell 98 definition of asin
on Complex.  Whatever the outcome of this report, I think the Haskell 98 definitions for 
Complex need the following documentational change.  We should document, not in Haskell code,
but in words, what each function is supposed to do, where there might be any doubt.
For example, how do you tell from the definition of sqrt in the standard which of the 
two possible square roots is being chosen:
> sqrt 0         =  0
> sqrt z@(x:+y)  =  u :+ (if y < 0 then -v else v)
>                   where (u,v) = if x < 0 then (v',u') else (u',v')
>                         v'    = abs y / (u'*2)
>                         u'    = sqrt ((magnitude z + abs x) / 2)
(I think I'll leave this as an exercise for the reader 8-)

What is needed is a statement saying that sqrt z approximates the squareroot with phase
in [0,pi) (or whatever the answer is).

The standard should also specify in words which answer to log, asinh, acosh, atanh, asin,
acos, atan, is being chosen.