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

Home » Public Forums » archive » CHECK_MATH and exp()
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
CHECK_MATH and exp() [message #31890] Mon, 26 August 2002 16:15 Go to next message
jeyadev is currently offline  jeyadev
Messages: 78
Registered: February 1995
Member
Could someone please explain this:

WAVE> junk = check_math(1,0)
WAVE> print, junk
0
WAVE> y = exp(-9.2^2)
WAVE> print, y, check_math(1,0)
1.74307e-37 0
WAVE> y = exp(-9.3^2)
WAVE> print, y, check_math(1,0)
2.74074e-38 0
WAVE> y = exp(-9.4^2)
% Program caused arithmetic error: Floating underflow
% Program caused arithmetic error: Floating illegal operand
WAVE> print, y, check_math(1,0)
4.22418e-39 0


I first ran into the problem in a set of loops, and narrowed down
the

% Program caused arithmetic error: Floating illegal operand

error to a call to the exp() function. A little fooling around
resulted in getting to the above. It appears that when the argument
reaches -9.4^2, the underflow occurs, but I cannot understand the
"illegal operand". Also, why does CHECK_MATH() not catch the
underflow.

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
% Program caused arithmetic error: Floating underflow
% Program caused arithmetic error: Floating illegal operand
9.50000 6.38150e-40 160
% Program caused arithmetic error: Floating underflow
% Program caused arithmetic error: Floating illegal operand
9.60000 9.44966e-41 160
% Program caused arithmetic error: Floating underflow
% Program caused arithmetic error: Floating illegal operand
9.70000 1.37159e-41 160
% Program caused arithmetic error: Floating underflow
% Program caused arithmetic error: Floating illegal operand
9.80000 1.95201e-42 160
% Program caused arithmetic error: Floating underflow
% Program caused arithmetic error: Floating illegal operand
9.90000 2.71852e-43 160
% Program caused arithmetic error: Floating underflow
% Program caused arithmetic error: Floating illegal operand
10.0000 3.78351e-44 160

Again, I can see the problem for x > 9.3. But, what is the
CHECK_MATH() doing? First, it seems to say that there is an
"floating point operand error", and then it is that *plus*
and underflow. What is the "floating point operand error"
that the code 128 is indicating?


I am running PV-WAVE CL Version 6.01 (sun4 solaris sparc)
on a Sun Ultra 10 under Solaris 8.


thanks



--

Surendar Jeyadev jeyadev@wrc.xerox.bounceback.com

Remove 'bounceback' for email address
Re: CHECK_MATH and exp() [message #31926 is a reply to message #31890] Fri, 30 August 2002 12:36 Go to previous message
jeyadev is currently offline  jeyadev
Messages: 78
Registered: February 1995
Member
In article <3D6CDC8E.DB526253@saicmodis.com>,
James Kuyper <kuyper@saicmodis.com> wrote:

Thanks for your reply ......

> 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.

The begining of the differences .....!

> 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

And I get

WAVE> y = exp(-9.4^2) & print,check_math(-1)
% Program caused arithmetic error: Floating underflow
% Program caused arithmetic error: Floating illegal operand
160

>> I am running PV-WAVE CL Version 6.01 (sun4 solaris sparc)
>> on a Sun Ultra 10 under Solaris 8.

Obviously, it is something to do with ....

> I am running idl 5.4 on an SGI machine running IRIX,

.... PV-Wave. Not sure if it is to do with the Sun version,
though.

thanks, anyway,


--

Surendar Jeyadev jeyadev@wrc.xerox.bounceback.com

Remove 'bounceback' for email address
Re: CHECK_MATH and exp() [message #31965 is a reply to message #31890] Wed, 28 August 2002 07:22 Go to previous message
James Kuyper is currently offline  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,
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: overlay a 3D polygon on a 2D grayscale image?
Next Topic: Re: SVDFIT Problems

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

Current Time: Fri Oct 10 03:40:08 PDT 2025

Total time taken to generate the page: 0.40338 seconds