[Haskell-cafe] Data.Complex.magnitude slow?
Henning Thielemann
lemming at henning-thielemann.de
Fri Jul 18 07:05:51 EDT 2008
On Fri, 18 Jul 2008, stefan kersten wrote:
> 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)?
What speaks against going through memory? If you want to write a large
chunk of Doubles to disk, you may write it to a StorableVector and write
that to disk. However shipping internal bit patterns to disk may violate
portability, because on different machines there can be different floating
point formats. What other situations might be there, where you want to
cast Float to Int32 and so on?
More information about the Haskell-Cafe
mailing list