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

GHC ghc-devs at haskell.org
Tue Apr 29 06:02:59 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):

 Replying to [comment:16 Scott Turner]:
 > > We can also add special case for raising to 1 to increase accuracy
 > > But I'm not so sure.
 > Special cases are not just messy code; they produce messy values. I've
 seen an explanation from a numerical analyst that they need a function
 that's mathematically monotonic, such as log, to be numerically monotonic
 when computed. It's hard to guarantee smooth computational behavior if
 special cases are thrown in, in order to gain perfect accuracy.
 >
 > In my opinion it would be better to leave
 > {{{
 > x ** y         =  exp (log x * y)
 > }}}
 > in effect, except when x is 0 or infinite.
 Ok. But why we don't want to handle infinity in other functions, such as
 sqrt, exp, (/) or (*)? Why is (!**) so special?

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


More information about the ghc-tickets mailing list