Re: Divide By Zero error [message #27955 is a reply to message #27906] |
Mon, 12 November 2001 15:03  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
Stein Vidar Hagfors Haugan <shaugan@esa.nascom.nasa.gov> writes:
> Nigel Wade <nmw@ion.le.ac.uk> writes:
>
>> Paul Manusiu wrote:
>>
>>> What is the log of zero ??
>>>
>>> Logan Lindquist wrote:
>>>
>>> What is this NaN
>>>> business and why am I getting Infinity?
>>
>> Also, what is the log of a negative number?
>>
>> --
>> -----------------------------------------------------------
>> Nigel Wade, System Administrator, Space Plasma Physics Group
>
> Hey, someone else in the Space Plasma Physics dept might tell you
> that alog(-1) should return complex(0,+/-!PI) !
>
> e^(-i pi) + 1 = 0
Which agrees with the result of IDL, allowing for round-off errors:
IDL> print, exp(-dcomplex(0,!dpi)) + 1d
( 0.0000000, -1.2246064e-16)
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|