[Haskell-cafe] Data.Complex.magnitude slow?
Don Stewart
dons at galois.com
Fri Jul 18 14:03:37 EDT 2008
sk:
> On 18.07.2008, at 19:47, Don Stewart wrote:
> >sk:
> >>On 17.07.2008, at 21:46, Lennart Augustsson wrote:
> >>>If scaleFloat and exponent are implemented with bit twiddling
> >>>they can
> >>>be quite fast.
> >>
> >>is there a way in ghc to 'cast' between float/int32 and double/int64
> >>(without going through memory)?
> >
> >Yeah,
> >
> > "fromIntegral/Int->Float" fromIntegral = int2Float
> > "truncate/Float->Int" truncate = float2Int
> >
> >
> > "truncate/Double->Int" truncate = double2Int
> >
> >with appropriate no-op fromIntegrals for the 32 and 64 variants.
>
> i actually meant something like *(uint32_t*)fptr, but thanks anyway ;)
ah well, these should compile into as-close-to-noops as possible.
More information about the Haskell-Cafe
mailing list