[Haskell-cafe] Data.Complex.magnitude slow?
lemming at henning-thielemann.de
Thu Jul 17 11:18:01 EDT 2008
On Thu, 17 Jul 2008, stefan kersten wrote:
> i've attached an example program which seems to indicate that the magnitude
> function from Data.Complex is very slow compared to a more naive
> implementation (for Complex Float). on my machine (intel core2 duo, osx 10.4)
> the CPU time using the library function is about 6-7 times as much as when
> using the other function. any ideas what might be going on? any flaws in my
> measurement code?
Complex.magnitude must prevent overflows, that is, if you just square
1e200::Double you get an overflow, although the end result may be also
around 1e200. I guess, that to this end Complex.magnitude will separate
mantissa and exponent, but this is done via Integers, I'm afraid.
More information about the Haskell-Cafe