1 % From Haskell report PreludeComlex.hs
3 instance (RealFloat a) => Num (Complex a) where
4 (x:+y) + (x':+y') = (x+x') :+ (y+y')
5 (x:+y) - (x':+y') = (x-x') :+ (y-y')
6 (x:+y) * (x':+y') = (x*x'-y*y') :+ (x*y'+y*x')
7 negate (x:+y) = negate x :+ negate y
8 abs z = magnitude z :+ 0
10 signum z@(x:+y) = x/r :+ y/r where r = magnitude z
11 fromInteger n = fromInteger n :+ 0