1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

Fix fdim handling of infinities (bug 15797).

This commit is contained in:
Joseph Myers
2013-08-21 19:56:48 +00:00
parent c0c3f78afb
commit acd06bb11f
6 changed files with 51 additions and 37 deletions

View File

@ -26,16 +26,16 @@ __fdimf (float x, float y)
int clsx = fpclassify (x);
int clsy = fpclassify (y);
if (clsx == FP_NAN || clsy == FP_NAN
|| (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE))
/* Raise invalid flag. */
if (clsx == FP_NAN || clsy == FP_NAN)
/* Raise invalid flag for signaling but not quiet NaN. */
return x - y;
if (x <= y)
return 0.0f;
float r = x - y;
if (fpclassify (r) == FP_INFINITE)
if (fpclassify (r) == FP_INFINITE
&& clsx != FP_INFINITE && clsy != FP_INFINITE)
__set_errno (ERANGE);
return r;