Red Hat Bugzilla – Bug 59826
library functions give floating point exceptions
Last modified: 2007-04-18 12:40:24 EDT
Description of Problem:
The default math libraries give floating point exceptions
when doing fairly ordinary things, such as exp(-709.0) and
then using the result.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. In a C program, do exp(-709.0) and then use the result.
(Sample source code as an attachment.)
The result should be a usable FP number somewhere near
or equal to zero.
It appears the exp() function is returning a denormalized
number, and later use of this number causes an exception.
I had seen this issue and worked around it by using -mieee
in the Rainbow information retrieval package, either the
Festival speech synthesis package or the Phoenix speech
recognition package, and xlock (-mode invert). However,
on advice from experts on the axp-list mailing list, I now
consider it a library bug.
Created attachment 45563 [details]
C program source
Created attachment 45565 [details]
compilation script that shows the problem
Created attachment 45566 [details]
compilation script that shows a workaround
There is just one libm and is not multilibbed, so you really cannot have both
precise results for -mieee and flushing to zero for non-mieee at the same time.
I'd suggest using -mieee always (e.g. the whole RHL alpha distribution is
compiled that way), or before using return values from libm functions wrapping
them in some function which flushes them to zero.