From acd06bb11f6d6436e15d0c7608fc7ea6008c224f Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 21 Aug 2013 19:56:48 +0000 Subject: Fix fdim handling of infinities (bug 15797). --- math/s_fdiml.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'math/s_fdiml.c') diff --git a/math/s_fdiml.c b/math/s_fdiml.c index 5604532..030fcc2 100644 --- a/math/s_fdiml.c +++ b/math/s_fdiml.c @@ -26,16 +26,16 @@ __fdiml (long double x, long double 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; long double r = x - y; - if (fpclassify (r) == FP_INFINITE) + if (fpclassify (r) == FP_INFINITE + && clsx != FP_INFINITE && clsy != FP_INFINITE) __set_errno (ERANGE); return r; -- cgit v1.1