Underflow
Chris Sharman
chris.sharman@ccagroup.co.uk
Mon, 19 May 2003 10:10:11 +0100
Mikael A Olesen wrote:
> Hello
>
> I have a qtp program that sometimes crash with the following error:
>
> *E* Floating point underflow occurred (number too small).
> *Fatal Error* *1370* Notify Cognos Customer Support
>
> The program runs on just about the same amount of data every time and most
> times it goes okay.
This is an arithmetic issue.
You don't mention your platform, so I'll give a VMS example. The same
arguments apply to all platforms though.
F float (float*4) supports around 7 digits precision, in the range
10^-38 to 10^38.
D float (alternate float*8) supports 16 digits precision, same range
(10^-38 to 10^38).
G float (float*8) supports 15 digits precision, range 10^-308 to 10^308.
When the exponent goes beyond the upper bound (ie number too large to
represent) that's a floating point overflow.
When it goes beyond the lower bound, that's either a floating point
underflow, or rounded to zero, depending on achitecture and
configuration. (If you're just subtotalling numbers, rounding to zero is
probably the desired behaviour - if you're multiplying, dividing, or
doing anything more complex, you probably want an error.
Look out for calculations that can have very small intermediate results,
and use wider-ranging floats or rearrange your calculations (with
parentheses) to ensure that intermediate results are OK.
Eg.
def a float*4 = 10^-20
def b float*4 = a*a*10^10 ; this will underflow (or round) on the a*a
def b float*4 = a*(a*10^10) ; this will be ok
Also be aware that defines are evaluated before selects, so calculations
may be carried out on garbage, causing arithmetic errors, before record
complexes are rejected.
The example is for VMS, but the same argument applies to all
architectures - it's just the names, sizes, precisions, and ranges of
the floating point formats that may change - consult your manuals.
Chris
-----------------------------------------------------------------------
Any views expressed in this message are those of the sender and not
necessarily those of CCA Group. The unauthorized use, disclosure,
copying or alteration of this message is forbidden. The contents of
this message may be confidential and/or privileged, copyright CCA Group
and are intended solely for the use of the individual or entity to whom
they are addressed. Whilst this message has been scanned, CCA Group
cannot guarantee that it is virus free or compatible with your systems
and accepts no responsibility for any loss or damage arising from its
use. The recipient is advised to run their own anti-virus software. If
you receive this message in error please contact
postmaster@ccagroup.co.uk immediately, destroy any copies and delete it
from your computer systems.