Bug 14797

Summary: fma use of a * b + c on overflow incorrect in directed rounding modes
Product: glibc Reporter: Joseph Myers <jsm28>
Component: mathAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal Flags: fweimer: security-
Priority: P2    
Version: 2.16   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description Joseph Myers 2012-11-01 23:47:23 UTC
Various fma implementations fall back to a * b + c when a * b is known to overflow so much that the final result would still overflow, whatever the value of c.  But this is incorrect in directed rounding modes where a * b may not be an infinity.  Example using dbl-64/s_fma.c: fma (DBL_MAX, DBL_MAX, -DBL_MIN) should return DBL_MAX in FE_DOWNWARD mode but returns the next smaller floating-point number instead.
Comment 1 Joseph Myers 2012-11-04 19:27:07 UTC
Fixed for 2.17 by:

commit a0c2940d67e59b2f19515e2ac7280a7be9629ffa
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Sun Nov 4 19:26:02 2012 +0000

    Fix fma overflow results outside round-to-nearest mode (bug 14797).