aboutsummaryrefslogtreecommitdiff
path: root/libgm2/libm2pim/wrapc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libgm2/libm2pim/wrapc.cc')
-rw-r--r--libgm2/libm2pim/wrapc.cc39
1 files changed, 39 insertions, 0 deletions
diff --git a/libgm2/libm2pim/wrapc.cc b/libgm2/libm2pim/wrapc.cc
index c24d214649e..4d930509037 100644
--- a/libgm2/libm2pim/wrapc.cc
+++ b/libgm2/libm2pim/wrapc.cc
@@ -277,6 +277,45 @@ EXPORT(isfinitef) (float x)
#endif
}
+/* isnan - provide non builtin alternative to the gcc builtin isnan.
+ Returns 1 if x is a NaN otherwise return 0. */
+
+extern "C" int
+EXPORT(isnan) (double x)
+{
+#if defined(FP_NAN)
+ return fpclassify (x) == FP_NAN;
+#else
+ return x != x;
+#endif
+}
+
+/* isnanf - provide non builtin alternative to the gcc builtin isnanf.
+ Returns 1 if x is a NaN otherwise return 0. */
+
+extern "C" int
+EXPORT(isnanf) (float x)
+{
+#if defined(FP_NAN)
+ return fpclassify (x) == FP_NAN;
+#else
+ return x != x;
+#endif
+}
+
+/* isnanl - provide non builtin alternative to the gcc builtin isnanl.
+ Returns 1 if x is a NaN otherwise return 0. */
+
+extern "C" int
+EXPORT(isnanl) (long double x)
+{
+#if defined(FP_NAN)
+ return fpclassify (x) == FP_NAN;
+#else
+ return x != x;
+#endif
+}
+
/* GNU Modula-2 linking hooks. */
extern "C" void