Underflow

Peter Bateman shediac92@hotmail.com
Tue, 20 May 2003 15:47:14 -0300


Mikael:

Chris made some excellents points on the order of operation. On the MPE/iX 
box Cognos could have
set the result to zero instead of giving the 'Floating point Underfow' 
error.
But is this right?

   a^-b*a^b = 1

   but if a^-b underflowed and Cognos had set the result to 0 then

   a^-b*a^b = 0 a sightly different result.

  You may say it errorred out and didn't give the 1 so what is the 
difference? With the error you know
  you have a problem. With the 0 to don't know that you have a problem.

  I guess the answer is we have to do the math.

  a^-b*a^b = a^(-b+b) = a^0=1



>From: Chris Sharman <chris.sharman@ccagroup.co.uk>
>To: Mikael A Olesen <mao@krifapost.dk>,   PowerH List    
><powerh-l@lists.swau.edu>
>Subject: Re: Underflow
>Date: 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.
>= = = = = = = = = = = = = = = = = = = = = = = = = = = =
>Mailing list: powerh-l@lists.swau.edu
>Subscribe: "subscribe" in message body to powerh-l-request@lists.swau.edu
>Unsubscribe: "unsubscribe <password>" in message body to 
>powerh-l-request@lists.swau.edu
>http://lists.swau.edu/mailman/listinfo/powerh-l
>This list is closed, thus to post to the list you must be a subscriber.

_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*   
http://join.msn.com/?page=features/junkmail