[project @ 1997-03-14 05:31:07 by sof]
[ghc-hetmet.git] / ghc / CONTRIB / pphs / docs / internalalign1.hs
1 instance  (RealFloat a) => Num (Complex a)  where
2     (x:+y) + (x':+y')   =  (x+x') :+ (y+y')
3     (x:+y) - (x':+y')   =  (x-x') :+ (y-y')
4     (x:+y) * (x':+y')   =  (x*x'-y*y') :+ (x*y'+y*x')
5     negate (x:+y)       =  negate x :+ negate y
6     abs z               =  magnitude z :+ 0
7     signum 0            =  0
8     signum z@(x:+y)     =  x/r :+ y/r  where r = magnitude z
9     fromInteger n       =  fromInteger n :+ 0