Thanks Ken. That is a good point.
Whilst we continue to work on a fix, a temporary work-around is to mask all underflows for Win32.
When underflows are masked, an exception is not raised when an underflow occurs. The current issue arises when the system does not recover after an underflow exception is triggered. Hence the work-around.
There are two ways to mask underflows:
- CALL MASK_UNDERFLOWS@() before doing any fp arithmetic.
- Set the environment variable:
SET SALFENVAR=mask_underflow
The round-off error for an underflow will change. For example, the following code gives 1.741119E-39 rather than zero. This value is below the threshold for 32 bit real numbers.
program test
real*4 a, b, d
real*8 c
call MASK_UNDERFLOWS@()
a = 2.89e-3
b = 8.30544
c = 95.0428
d = a * b**5.5 * exp(-c)
write(*,*) d
end program test