| Re: CHECK_MATH and exp() [message #31965 is a reply to message #31890] |
Wed, 28 August 2002 07:22  |
James Kuyper
Messages: 425 Registered: March 2000
|
Senior Member |
|
|
Surendar Jeyadev wrote:
>
> Could someone please explain this:
...
> WAVE> y = exp(-9.4^2)
> % Program caused arithmetic error: Floating underflow
> % Program caused arithmetic error: Floating illegal operand
I only get the first message, not the second.
> ... Also, why does CHECK_MATH() not catch the
> underflow.
Because, as the documentation says:
"No errors detected since the last interactive prompt or call to
CHECK_MATH".
Since the exp() call occurred before the last interactive prompt, it
doesn't count. Instead, try the following:
IDL> y = exp(-9.4^2) & print,check_math(-1)
% Program caused arithmetic error: Floating underflow
32
check_math() wasn't really intended for use at the command line; you get
immediate notification of errors when working interactively, so it isn't
needed.
> And, now for more:
>
> WAVE> .run
> - for i=90,100 do begin
> - x = i/10.0
> - y = exp(-x^2)
> - print, x, y, check_math(1,0)
> - endfor
> - end
> % Compiled module: $MAIN$.
> 9.00000 6.63968e-36 128
> 9.10000 1.08661e-36 128
> 9.20000 1.74307e-37 128
> 9.30000 2.74074e-38 128
> % Program caused arithmetic error: Floating underflow
> % Program caused arithmetic error: Floating illegal operand
> 9.40000 4.22418e-39 160
...
I get:
% Compiled module: $MAIN$.
9.00000 6.63968e-36 0
9.10000 1.08661e-36 0
9.20000 1.74307e-37 0
9.30000 2.74074e-38 0
% Program caused arithmetic error: Floating underflow
9.40000 0.00000 32
> I am running PV-WAVE CL Version 6.01 (sun4 solaris sparc)
> on a Sun Ultra 10 under Solaris 8.
I am running idl 5.4 on an SGI machine running IRIX,
|
|
|
|