#4344: Better toRational for Float and Double
----------------------------------------+-----------------------------------
Reporter: daniel.is.fischer | Owner: daniel.is.fischer
Type: proposal | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.12.3
Keywords: toRational, performance | Testcase:
Blockedby: | Difficulty:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: Runtime performance bug
----------------------------------------+-----------------------------------
Changes (by daniel.is.fischer):
* type: bug => proposal
Comment:
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 29^th^ October 2010 (I'd like to see it
in 7.0).
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4344#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs