comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Math Question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Math Question [message #51109 is a reply to message #51108] Mon, 30 October 2006 07:29 Go to previous messageGo to previous message
Foldy Lajos is currently offline  Foldy Lajos
Messages: 268
Registered: October 2001
Senior Member
On Mon, 30 Oct 2006, edward.s.meinel@aero.org wrote:

>
> Rob wrote:
>> In general, powers of negative numbers are complex so you should start
>> with that assumption in the expression:
>>
>> IDL> print,(dcomplex(-1.0,0.0))^2.01
>> ( 0.99950656, 0.031410729)
>> IDL> print,(dcomplex(-1.0,0.0))^2.0
>> ( 1.0000000, -2.4492127e-016)
>>
>> It would be nice if IDL told you this rather than throwing a NaN at
>> you.
>
> Actually, to be consistent, IDL should just return a complex number.
> One of the reasons that I've been using IDL is that it automatically
> changes the variable TYPE when necessary so that I don't have to keep
> track of whether I'm operating on a BYTE, LONG, DOUBLE, whatever... Now
> I find out that it's "mostly" true (but who can refuse a nice mutton
> sandwich?).
>
> I would consider this a bug.
>
> Ed "to blave" Meinel
>

I think complex results should be returned only if complex input was
given, like in the example above. Otherwise, all your data would easily
become complex. Think of sqrt(-1.0), log(-1.0), asin(-2.0), etc.

regards,
lajos
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Determining a safe variable name from a string
Next Topic: overlaying arrow plots

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 14:42:04 PDT 2025

Total time taken to generate the page: 1.12140 seconds