Proposal: Faster toRational and fromRational
simonpj at microsoft.com
Fri Oct 22 03:31:54 EDT 2010
Thank you for doing this stuff on improving Haskell numerics. My impression is that good numerics requires both expertise (to get the details right) and sweat (to get the details right), and you seem willing to bring both to the table. Thank you.
| -----Original Message-----
| From: libraries-bounces at haskell.org [mailto:libraries-bounces at haskell.org] On Behalf
| Of Daniel Fischer
| Sent: 21 October 2010 20:36
| To: libraries at haskell.org
| Subject: Proposal: Faster toRational and fromRational
| trac: http://hackage.haskell.org/trac/ghc/ticket/4344#comment:10
| Proposal: include faster implementations for
| 1. toRational :: Float -> Rational
| 2. toRational :: Double -> Rational
| 3. fromRational :: Rational -> Float
| 4. fromRational :: Rational -> Double
| The semantics of these functions shall remain the same as it is now, only
| their speed will be affected.
| For fromRational, a fast integer logarithm is essential. Without access to
| the internal representation of Integer, it would be significantly slower,
| so this proposal includes the addition of modules defining the needed
| integer logarithm functions to the packages integer-gmp and integer-simple.
| Since Int is not available in the integer-* packages, those functions would
| return Int# values. I suggest adding wrappers integerLog2 :: Integer -> Int
| and integerLogBase :: Integer -> Integer -> Int to some module in base
| because those functions are far more generally useful. Currently
| integerLogBase is available from GHC.Float, so we might stick them there,
| although it's not very intuitive. Suggestions welcome.
| Discussion period: one week, until 29th October 2010 (I'd like to see it in
| there's a bundle containing the proposed new implementations, QuickCheck
| tests and benchmarks.
| I get a pretty impressive speedup.
| Libraries mailing list
| Libraries at haskell.org
More information about the Libraries