Mercurial > hg > CbC > CbC_gcc
diff libquadmath/math/fdimq.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 561a7518be6b |
children |
line wrap: on
line diff
--- a/libquadmath/math/fdimq.c Thu Oct 25 07:37:49 2018 +0900 +++ b/libquadmath/math/fdimq.c Thu Feb 13 11:34:05 2020 +0900 @@ -1,5 +1,5 @@ /* Return positive difference between arguments. - Copyright (C) 1997, 2004, 2009 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -14,29 +14,19 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ -#include <errno.h> #include "quadmath-imp.h" __float128 fdimq (__float128 x, __float128 y) { - int clsx = fpclassifyq (x); - int clsy = fpclassifyq (y); + if (__builtin_islessequal (x, y)) + return 0; - if (clsx == QUADFP_NAN || clsy == QUADFP_NAN - || (y < 0 && clsx == QUADFP_INFINITE && clsy == QUADFP_INFINITE)) - /* Raise invalid flag. */ - return x - y; - - if (x <= y) - return 0.0Q; - - __float128 r = x - y; - if (isinfq (r)) + __float128 r = math_narrow_eval (x - y); + if (isinfq (r) && !isinfq (x) && !isinfq (y)) errno = ERANGE; return r;