Re: what is Floating illegal operand question? [message #43691 is a reply to message #43690] |
Mon, 18 April 2005 14:02   |
Haje Korth
Messages: 651 Registered: May 1997
|
Senior Member |
|
|
Well, if I understand this right, 0/0 is defined and the result is 0, so
that the division by zero message is only informational. On the other hand
0./0. is not defined for floating point numbers and results in an error (see
http://mathworld.wolfram.com/DivisionbyZero.html). Correct me if I am wrong.
Haje
"Michael Wallace" <mwallace.no.spam@no.spam.swri.edu.invalid> wrote in
message news:11687a01efaaa29@corp.supernews.com...
> lixiaoyao wrote:
>> when I run this code in idl,it generated the following wrong
>> information,what is
>> wrong there?
>> % Compiled module: $MAIN$.
>> % Program caused arithmetic error: Floating illegal operand
>> window,xs=640,ys=480
>> x=10*!pi*findgen(1001)/1000
>> sn=sin(x)/x
>> plot,x,sn
>> end
>> thanks
>>
>
> You're getting it from a floating point divide by zero. When using
> integers, IDL actually tells you that you tried to divide by zero. For
> some reason, they have a different message for floating point.
>
> IDL> x = 0 / 0
> % Program caused arithmetic error: Integer divide by 0
> IDL> x = 0.0 / 0.0
> % Program caused arithmetic error: Floating illegal operand
>
> -Mike
|
|
|