summaryrefslogtreecommitdiff
path: root/math/s_fdim.c
diff options
context:
space:
mode:
Diffstat (limited to 'math/s_fdim.c')
-rw-r--r--math/s_fdim.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/math/s_fdim.c b/math/s_fdim.c
index 2f97948b2e..f8fd80490d 100644
--- a/math/s_fdim.c
+++ b/math/s_fdim.c
@@ -26,16 +26,16 @@ __fdim (double x, 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.0;
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;