X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Data%2FComplex.hs;h=3b37f6c91f0b8dea033afffd3ce03c7d38e5ad3f;hb=abf088ecc34ebfd87e098194407dbacae495abe9;hp=0f8d13ba98a4e550cf55e34f67485d67d93af817;hpb=242953c875b501e3cf43c49c5b72cb21712944ae;p=ghc-base.git diff --git a/Data/Complex.hs b/Data/Complex.hs index 0f8d13b..3b37f6c 100644 --- a/Data/Complex.hs +++ b/Data/Complex.hs @@ -136,7 +136,7 @@ instance (RealFloat a) => Num (Complex a) where (x:+y) * (x':+y') = (x*x'-y*y') :+ (x*y'+y*x') negate (x:+y) = negate x :+ negate y abs z = magnitude z :+ 0 - signum 0 = 0 + signum (0:+0) = 0 signum z@(x:+y) = x/r :+ y/r where r = magnitude z fromInteger n = fromInteger n :+ 0 #ifdef __HUGS__ @@ -165,7 +165,7 @@ instance (RealFloat a) => Floating (Complex a) where where expx = exp x log z = log (magnitude z) :+ phase z - sqrt 0 = 0 + sqrt (0:+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)