This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug math/15797] New: Incorrect fdim handling of infinities
- From: "jsm28 at gcc dot gnu.org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Sun, 28 Jul 2013 16:55:09 +0000
- Subject: [Bug math/15797] New: Incorrect fdim handling of infinities
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=15797
Bug ID: 15797
Summary: Incorrect fdim handling of infinities
Product: glibc
Version: 2.17
Status: NEW
Severity: normal
Priority: P2
Component: math
Assignee: unassigned at sourceware dot org
Reporter: jsm28 at gcc dot gnu.org
The generic fdim implementation does:
if (clsx == FP_NAN || clsy == FP_NAN
|| (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE))
/* Raise invalid flag. */
return x - y;
I'm not sure of the purpose of the FP_INFINITE checks here, but the only case
they help with is fdim (Inf, -Inf), avoiding an incorrect errno setting. For
fdim (-Inf, -Inf), the infinities are wrongly subtracted resulting in a NaN
return with "invalid" exception, when the correct result for equal infinite
arguments is 0 (+0, independent of rounding mode). For other cases of fdim
where an argument is an infinity and the expected result is an exact (positive)
infinity, errno will be wrongly set to ERANGE because the result is wrongly
considered to overflow.
--
You are receiving this mail because:
You are on the CC list for the bug.