bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

erfc() & Alphas


From: Tyson Whitehead
Subject: erfc() & Alphas
Date: Tue, 21 Aug 2001 18:39:58 -0400

I noticed that the erfc() implementation on the Alpha seems to return denormalized results (i.e. erfc(27) -> 5.237046e-319) when -mieee is not specified to GCC.  This is somewhat curious and problematic.

From what I've read from the Alpha Microprocessor Reference manual, during computations the Alpha generates an exception when one of the arguments is denormalized.  This is non-negotiable behavior.  If it is the results that is denormalized, however, then the action depends on the setting of the floating point control register (FPCR).  Either an exception can be generated, or the results can be set to zero.  This makes it possible to support denormalized calculations in the software (slow), or just ignore them all together.  GCC will generate the required software support if -mieee is specified (slow!).  If it is not, then the FPCR is set to zero denormalized numbers (fast but less accurate).

The key point here is that there is no way to avoid an exception if one of the source arguments is denormalized.  The assumption is presumably that if the FPU never generates a denormalized number (i.e. sets them all to zero), then it will never have a denormalized number as an argument.  This is all fine and dandy until erfc() is used.  It returns denormalized numbers regardless of the fact that the hardware does not generate them (must be some bit twiddling going on!).  As a result the program then generates an unavoidable (in hardware) exception if the results are used in any subsequent calculations.

Anyone have any idea of why erfc() is twiddling with the bits directly instead of using the FPU (or some other explanation for what is going on)?  Could something be done to fix this?

Thanks,
-T

PS:  I don't subscribe to this mailing list, so if you could include me in the reply, that would be great!

-- 
 Tyson Whitehead  (address@hidden -- WSC 140-)
 Computer Engineer                          Dept. of Applied Mathematics,
 Graduate Student- Applied Mathematics      University of Western Ontario,
 GnuPG Key ID# 0x8A2AB5D8                   London, Ontario, Canada
 
reply via email to

[Prev in Thread] Current Thread [Next in Thread]