Proposal: Faster toRational and fromRational
daniel.is.fischer at web.de
Fri Oct 22 07:25:32 EDT 2010
On Friday 22 October 2010 02:50:41, Isaac Dupree wrote:
> On 10/21/10 15:35, Daniel Fischer wrote:
> > 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.
> I generally approve! If the libraries list has any non-trivial doubts
> then it might be best not to squeeze it into 7.0. But if not, then
> Do we, the Libraries list, need to approve adding ( integerLog2# ::
> Integer -> Int# ) to the integer-* packages? I had the notion those are
> relatively private packages that GHC developers have purview over.
Well, I don't know. I'm not quite clear on which libraries concern
libraries@ and which not, so I rather ask too often than too rarely (and
then get told "No, can't do that").
> (Then we could think separately from this proposal about adding a
> user-friendly integerLog2 to somewhere nice; and then I'd wish for a
> log2 for types like Int as well; maybe it would make sense for
> Data.Bits; questions like that. I would be supportive but I don't think
> we have to do this before we optimize Rational.)
I have also wordLog2# :: Word# -> Int#, that would cover also Int arguments
(and WordN, IntN for N <= WORD_SIZE_IN_BITS, but the smaller types would
profit from special implementations as the high bits are checked first;
those would be easy to add).
More information about the Libraries