Proposal: Faster toRational and fromRational
lennart at augustsson.net
Fri Oct 22 04:04:47 EDT 2010
Yes, a big thanks to Daniel. The code used at the moment was meant as
a reference implementation and needs a lot of improvement.
On Fri, Oct 22, 2010 at 8:31 AM, Simon Peyton-Jones
<simonpj at microsoft.com> wrote:
> 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
> | 7.0).
> | At
> | http://hackage.haskell.org/trac/ghc/attachment/ticket/4344/FloatingRationalConversion
> | s.tar.gz
> | there's a bundle containing the proposed new implementations, QuickCheck
> | tests and benchmarks.
> | I get a pretty impressive speedup.
> | Cheers,
> | Daniel
> | _______________________________________________
> | Libraries mailing list
> | Libraries at haskell.org
> | http://www.haskell.org/mailman/listinfo/libraries
> Libraries mailing list
> Libraries at haskell.org
More information about the Libraries