This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Error in fused multiply add
- From: John Pryce <j dot d dot pryce at ntlworld dot com>
- To: <libc-help at sourceware dot org>
- Cc: <j dot d dot pryce at ntlworld dot com>
- Date: Fri, 4 Jul 2008 8:05:03 +0100
- Subject: Error in fused multiply add
Can someone point me to where I should report this bug?
With GCC on my Mac, the FMA function in math.h does not behave according
to the C standard when handling infinite input, as far as I can see. For
instance the statement
printf("\n fma(PosInf,PosInf,0) = %g\n", fma(PosInf,PosInf,0)); // (*)
where PosInf holds +oo (positive infinity), produced the output
fma(BiasPosInf,BiasPosInf,0) = nan
The C standard 7.12.13 says "The fma functions [ fma(x,y,z) ] compute
(x*y)+z, rounded as one ternary operation: they compute the value (as if) to
infinite precision and round once to the result format, according to the
rounding mode characterized by the value of FLT_ROUNDS. A range error
may occur."
The statement (*) is doing (+oo * +oo) + 0 which should be +oo, not NaN,
according to my reading of the above. The new IEEE standard P754 is pretty
clear that this should be so.
Context: I want to use the C's FMA function in the corresponding function in
the Profil/BIAS Interval Arithmetic package, so correct operation in all
circumstances is crucial.
Platform:
Model Identifier: MacBookPro2,2
Processor Name: Intel Core 2 Duo
OS: Mac OS X 10.4.11 Tiger
Compiler: i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1
John Pryce
-----------------------------------------
Email sent from www.virginmedia.com/email
Virus-checked using McAfee(R) Software and scanned for spam