| Re: complex math error? [message #4275 is a reply to message #4255] |
Thu, 18 May 1995 00:00  |
thompson
Messages: 584 Registered: August 1991
|
Senior Member |
|
|
heard@drep.dnd.ca (Garry J. Heard) writes:
> Hi,
> I think we've found an erratic math error in IDL V3.6 (running on a PPC and
> an SGI results were similar). Here it is:
> print, exp( complex(0,1)*sqrt(2.)*10. )^sqrt(2.)
> Execute the above line a time or two and you'll get the wrong answer, then try
> almost any simple math operation on a complex number. i.e.,
> print, complex(0,1)^2
> Chances are you'll get a wrong answer again. Try the last operation again
> and you might then get the correct answer. It's an erratic sort of bug and
> seems to have a lot to do with complex numbers and sqrt functions. But it
> is unpredictable. The only way we have been able to induce it so far is to
> raise a complex exponential to a power involving a sqrt. I guess you should
> be wary of any complex math in IDL until RSI has had a look at it. Also, the
> bug may not exist in V4. I think that WAVE may not allow these kinds of
> operations on complex values, so in a way that will protect you from this
> bug (I might be wrong about this since I don't have a current WAVE version
> to try it on).
I can't make it fail running IDL 3.6.1c under OSF/1 v2.0 on an AXP 3000/600
workstation. I always get the result
IDL> print, exp( complex(0,1)*sqrt(2.)*10. )^sqrt(2.)
( -1.28269e-10, 1.66070e-10)
no matter how many times I try it. (I assume that's the correct value.) Also,
I always get
IDL> print, complex(0,1)^2
( -1.00000, 0.00000)
Bill Thompson
|
|
|
|