[GHC] #2271: floor, ceiling, round :: Double -> Int are awesomely slow

GHC cvs-ghc at haskell.org
Mon Oct 18 12:32:32 EDT 2010


#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):

 Either
 {{{
 "truncate/Float->Int8"
     forall x. truncate x = (fromIntegral :: Int -> Int8) (truncateFloatInt
 x)
 }}}
 or
 {{{
 "truncate/Float->Int8"
     forall x. truncate x = (fromIntegral :: Int -> Int8) ((truncate ::
 Float -> Int) x)
 }}}
 Well, I guess we could leave the type signature off truncate in the latter
 and rely on type inference.

 The import cycle is not created by the rules per se, but to define the
 rules, we need the involved types and functions in scope. IntN and WordN
 aren't in scope in GHC.Float, bringing them into scope there creates the
 import cycle. So the other obvious solution is to bring Double, Float and
 the functions into scope in GHC.Int and GHC.Word.

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


More information about the Glasgow-haskell-bugs mailing list