Proposal: Better power for Rational

Henning Thielemann schlepptop at henning-thielemann.de
Tue Sep 28 14:23:01 EDT 2010


Simon Peyton-Jones schrieb:
> |  >  #4101: constant folding for (**)
> |  >  #3676: realToFrac conversions
> |  >  #3744: comparisons against minBound and maxBound are not optimised away
> |  >  #3065: quot is sub-optimal
> |  >  #2269: Word type to Double or Float conversions
> |  >  #2271: floor, ceiling, round :: Double -> Int are awesomely slow
> |  >  #1434: slow conversion Double to Int
> |  
> |  For the rounding issue I have already written some code for numeric-prelude:
> |    http://code.haskell.org/numeric-prelude/src/Algebra/RealRing.hs
> 
> Great. I'm not sure which ticket you are referring to, but if you could propose a patch, by email to the libraries list, that would be great

I'm referring to tickets #2271 and #1434.
I implemented round, truncate, floor, ceiling with Int result in terms
of double2Int and friends and added RULES for decomposing, e.g.
  round :: Double -> Int16
 into
  (fromIntegral :: Int -> Int16) . (round :: Double -> Int)
 However my code is adapted to NumericPrelude's type classes and must be
adapted to those of Haskell98's Prelude. This should not be too hard.
I'll try to create a patch, however I may need some assistance compiling
base libraries.


Henning


More information about the Libraries mailing list