#2271: floor, ceiling, round :: Double -> Int are awesomely slow
------------------------------------------+---------------------------------
    Reporter:  dons                       |        Owner:  daniel.is.fischer
        Type:  bug                        |       Status:  patch            
    Priority:  low                        |    Milestone:  7.0.1            
   Component:  libraries/base             |      Version:  7.1              
    Keywords:  performance, math, double  |     Testcase:                   
   Blockedby:                             |   Difficulty:  Unknown          
          Os:  Unknown/Multiple           |     Blocking:                   
Architecture:  Unknown/Multiple           |      Failure:  None/Unknown     
------------------------------------------+---------------------------------

Comment(by daniel.is.fischer):

 Ah, no. The `-0.0` doesn't come from the rounding, it's because of
 {{{
     case float2Int# x of
       n -> (I# n, F# (x `minusFloat#` int2Float# n))
 }}}
 (analogous for Double) and (-0.0) - 0.0 gives (-0.0). The extra check for
 zero will cost a bit of performance :(

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2271#comment:29>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to