CHECK_MATH and exp() [message #31890] |
Mon, 26 August 2002 16:15  |
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
|
|
|