X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fisfinite.c;h=310ac2c67797dcf14b7a4626ffb8f24ac20fd243;hb=b344de996cd51f8a2f2558a3172016b64d99c622;hp=32647fcae7496098456af13f4f67dcad938833a4;hpb=3030c5b5e0a5199e16b05927da72c43c42f211c3;p=gnulib.git diff --git a/lib/isfinite.c b/lib/isfinite.c index 32647fcae..310ac2c67 100644 --- a/lib/isfinite.c +++ b/lib/isfinite.c @@ -1,5 +1,5 @@ /* Test for finite value (zero, subnormal, or normal, and not infinite or NaN). - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,17 +23,30 @@ #include "isnand-nolibm.h" #include "isnanl-nolibm.h" +/* The "cc" compiler on HP-UX 11.11, when optimizing, simplifies the test + x - y == 0.0 to x == y, a simplification which is invalid when x and y + are Infinity. Disable this optimization. */ +#if defined __hpux && !defined __GNUC__ +static float zerof; +static double zerod; +static long double zerol; +#else +# define zerof 0.f +# define zerod 0. +# define zerol 0.L +#endif + int gl_isfinitef (float x) { - return !isnanf (x) && x - x == 0.f; + return !isnanf (x) && x - x == zerof; } int gl_isfinited (double x) { - return !isnand (x) && x - x == 0.; + return !isnand (x) && x - x == zerod; } int gl_isfinitel (long double x) { - return !isnanl (x) && x - x == 0.L; + return !isnanl (x) && x - x == zerol; }