X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fisfinite.c;h=f3ce5c67df1fb9731cc4290db9d32583ef16124d;hb=43593319b31e6b0175b8eec4433bac744959822d;hp=84dcd175aa47c950c18c4c88480d95e6df2bec5f;hpb=e74e1f1540f02fc57e442a6281c62f9594af15e5;p=gnulib.git
diff --git a/lib/isfinite.c b/lib/isfinite.c
index 84dcd175a..f3ce5c67d 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 Free Software Foundation, Inc.
+ Copyright (C) 2007-2013 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
@@ -12,28 +12,40 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see . */
/* Written by Ben Pfaff , 2007. */
#include
-#include "isnan.h"
-#include "isnanf.h"
+#include "isnanf-nolibm.h"
+#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 !isnan (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;
}