Complex arithmetic misbehaves in boundary cases
Consider complex multiplication. If we have a number x+iy and multiply this number by i we get -y+ix. Let us try the same thing in Haskell with IEEE floating point: let inf = 1.0/0.0
a = 1 :+ inf
i = 0 :+ 1
in a * i This comes out as (-Infinity) :+ NaN when it should have been (-Infinity) :+ 1.0. It is not just a made up problem, see, e.g., http://www.cs.berkeley.edu/~wkahan/Curmudge.pdf
We should address this problem. I have not yet determined if testing for a real part of 0 in multiplication (and division) is sufficent, but I think it is. I will be back with more information on the fix.
-- Lennart
Trac metadata
Trac field | Value |
---|---|
Version | |
Type | Task |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | HaskellPrime |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |