Bug 14797 - fma use of a * b + c on overflow incorrect in directed rounding modes
Summary: fma use of a * b + c on overflow incorrect in directed rounding modes
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: math (show other bugs)
Version: 2.16
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-01 23:47 UTC by Joseph Myers
Modified: 2014-06-14 11:16 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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).