diff --git a/ChangeLog b/ChangeLog index 495f088196..abd8fcbba4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2016-06-14 Joseph Myers + + * math/s_fdim.c (__fdim): Use islessequal and isinf instead of + fpclassify. + * math/s_fdimf.c (__fdimf): Likewise. + * math/s_fdiml.c (__fdiml): Likewise. + 2016-06-14 Rajalakshmi Srinivasaraghavan * sysdeps/powerpc/powerpc64/multiarch/Makefile: diff --git a/math/s_fdim.c b/math/s_fdim.c index b02ed27233..8789ca4c38 100644 --- a/math/s_fdim.c +++ b/math/s_fdim.c @@ -23,19 +23,11 @@ double __fdim (double x, double y) { - int clsx = fpclassify (x); - int clsy = fpclassify (y); - - if (clsx == FP_NAN || clsy == FP_NAN) - /* Raise invalid flag for signaling but not quiet NaN. */ - return x - y; - - if (x <= y) + if (islessequal (x, y)) return 0.0; double r = x - y; - if (fpclassify (r) == FP_INFINITE - && clsx != FP_INFINITE && clsy != FP_INFINITE) + if (isinf (r) && !isinf (x) && !isinf (y)) __set_errno (ERANGE); return r; diff --git a/math/s_fdimf.c b/math/s_fdimf.c index b905380478..2e8eccfc4f 100644 --- a/math/s_fdimf.c +++ b/math/s_fdimf.c @@ -23,19 +23,11 @@ float __fdimf (float x, float y) { - int clsx = fpclassify (x); - int clsy = fpclassify (y); - - if (clsx == FP_NAN || clsy == FP_NAN) - /* Raise invalid flag for signaling but not quiet NaN. */ - return x - y; - - if (x <= y) + if (islessequal (x, y)) return 0.0f; float r = x - y; - if (fpclassify (r) == FP_INFINITE - && clsx != FP_INFINITE && clsy != FP_INFINITE) + if (isinf (r) && !isinf (x) && !isinf (y)) __set_errno (ERANGE); return r; diff --git a/math/s_fdiml.c b/math/s_fdiml.c index df3f1e5ba4..4a1f6722c6 100644 --- a/math/s_fdiml.c +++ b/math/s_fdiml.c @@ -23,19 +23,11 @@ long double __fdiml (long double x, long double y) { - int clsx = fpclassify (x); - int clsy = fpclassify (y); - - if (clsx == FP_NAN || clsy == FP_NAN) - /* Raise invalid flag for signaling but not quiet NaN. */ - return x - y; - - if (x <= y) + if (islessequal (x, y)) return 0.0f; long double r = x - y; - if (fpclassify (r) == FP_INFINITE - && clsx != FP_INFINITE && clsy != FP_INFINITE) + if (isinf (r) && !isinf (x) && !isinf (y)) __set_errno (ERANGE); return r;