diff options
author | Joseph Myers <joseph@codesourcery.com> | 2013-08-21 19:56:48 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2013-08-21 19:56:48 +0000 |
commit | acd06bb11f6d6436e15d0c7608fc7ea6008c224f (patch) | |
tree | c789341c0b86f19efa34ba8dbb09bef9705c2817 /math/s_fdimf.c | |
parent | c0c3f78afb6070721848574e2e5dff5cfa20e28d (diff) | |
download | glibc-acd06bb11f6d6436e15d0c7608fc7ea6008c224f.tar.gz glibc-acd06bb11f6d6436e15d0c7608fc7ea6008c224f.tar.xz glibc-acd06bb11f6d6436e15d0c7608fc7ea6008c224f.zip |
Fix fdim handling of infinities (bug 15797).
Diffstat (limited to 'math/s_fdimf.c')
-rw-r--r-- | math/s_fdimf.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/math/s_fdimf.c b/math/s_fdimf.c index 03810b5728..86efe6ef2a 100644 --- a/math/s_fdimf.c +++ b/math/s_fdimf.c @@ -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; |