[GHC] #8539: Data.Complex shouldn't use default implementation of (**)

GHC ghc-devs at haskell.org
Mon Apr 28 17:39:00 UTC 2014


#8539: Data.Complex shouldn't use default implementation of (**)
-------------------------------------+-------------------------------------
        Reporter:  jjaredsimpson     |            Owner:
            Type:  bug               |           Status:  patch
        Priority:  low               |        Milestone:
       Component:  Prelude           |          Version:  7.6.3
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  Incorrect result  |       Difficulty:  Easy (less than 1
  at runtime                         |  hour)
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+-------------------------------------

Comment (by yalas):

 Testing
 [https://ghc.haskell.org/trac/ghc/attachment/ticket/8539/complex_functions.patch
 complex_functions.patch]:
 ||= =||= Double =||= Complex Double (patched) =||= Complex Double
 (current) =||
 || 1/0 || Infinity || Infinity :+ 0.0 || Infinity ||
 || 1/0*0 || Nan || NaN :+ 0.0 || NaN :+ NaN ||
 || 1/0/0 || Infinity || Infinity :+ 0.0 || NaN :+ NaN ||
 || 1/0/2 || Infinity || Infinity :+ 0.0 || NaN :+ NaN ||
 || (1/0)*(1/0) || Infinity || Infinity :+ 0.0 || NaN :+ NaN ||
 || sqrt (1/0) || Infinity || Infinity :+ 0.0 || NaN :+ NaN ||
 || exp (1/0) || Infinity || Infinity :+ 0.0 || NaN :+ NaN ||
 || exp (-1/0) || 0.0 || 0.0 :+ 0.0 || NaN :+ NaN ||
 || log (1/0) || Infinity || Infinity :+ 0.0 || NaN :+ NaN ||
 || log (-1/0) || NaN || Infinity :+ 3.141592653589793 || NaN :+ NaN ||
 || 0!**0 || 1.0 || 1.0 :+ 0.0 || NaN :+ NaN ||
 || 0!**2 || 0.0 || 0.0 :+ 0.0 || NaN :+ NaN ||
 || 0!**(-2) || Infinity || Infinity :+ 0.0 || NaN :+ NaN ||
 || 2!**4 || 16.0 || 16.0 :+ 0.0 || 15.999999999999998 :+ 0.0 ||
 || 3!**1 || 3.0 || 3.0 :+ 0 || 3.0000000000000004 :+ 0.0 ||
 || sqrt (-4) || NaN || 0.0 :+ 2.0 || (-0.0) :+ 2.0 ||
 This even partially fixes old raise to power implementation:
 ||= =||= Double =||= Complex Double (patched) =||= Complex Double
 (current) =||
 || exp (log 0 * 2) || 0.0 || 0.0 :+ 0.0 || NaN :+ NaN ||
 || exp (log 0 * 0) || 1.0 || NaN :+ 0.0 || NaN :+ NaN ||
 || exp (log 0 * (-2)) || Infinity || Infinity :+ 0.0 || NaN :+ NaN ||
 What do you think?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8539#comment:12>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list