summaryrefslogtreecommitdiff
path: root/src/math
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-03-03 21:22:28 -0500
committerJakob Kaivo <jkk@ung.org>2019-03-03 21:22:28 -0500
commitf654b033b8b2982968e174e19be19a5ac461c107 (patch)
tree7c0ee958aac6fe9eb9e45d0c55c98c59344dafd0 /src/math
parente35f7dfb24a5b26679d34698f6f3c8c0207289fe (diff)
implement in terms of fpclassify()
Diffstat (limited to 'src/math')
-rw-r--r--src/math/isfinite.c6
-rw-r--r--src/math/isinf.c6
-rw-r--r--src/math/isnan.c7
-rw-r--r--src/math/isnormal.c6
4 files changed, 4 insertions, 21 deletions
diff --git a/src/math/isfinite.c b/src/math/isfinite.c
index dab650c0..04978b68 100644
--- a/src/math/isfinite.c
+++ b/src/math/isfinite.c
@@ -1,10 +1,6 @@
#include <math.h>
- int __isfinitef(float x);
- int __isfinited(double x);
- int __isfinitel(long double x);
-#define isfinite(x) ((sizeof (x) == sizeof (float)) ? __isfinitef(x) : \
- (sizeof (x) == sizeof (double)) ? __isfinited(x) : __isfinitel(x))
+#define isfinite(x) (fp_classify(x) != FP_INFINITE)
/*
STDC(199901)
diff --git a/src/math/isinf.c b/src/math/isinf.c
index 9139197f..1a6b00ff 100644
--- a/src/math/isinf.c
+++ b/src/math/isinf.c
@@ -1,10 +1,6 @@
#include <math.h>
- int __isinff(float x);
- int __isinfd(double x);
- int __isinfl(long double x);
-#define isinf(x) ((sizeof (x) == sizeof (float)) ? __isinff(x) : \
- (sizeof (x) == sizeof (double)) ? __isinfd(x) : __isinfl(x))
+#define isinf(x) (fpclassify(x) == FP_INFINITE)
/*
STDC(199901)
diff --git a/src/math/isnan.c b/src/math/isnan.c
index 963b7021..e3e0160a 100644
--- a/src/math/isnan.c
+++ b/src/math/isnan.c
@@ -1,10 +1,5 @@
#include <math.h>
- int __isnanf(float x);
- int __isnand(double x);
- int __isnanl(long double x);
-
-#define isnan(x) ((sizeof (x) == sizeof (float)) ? __isnanf(x) : \
- (sizeof (x) == sizeof (double)) ? __isnand(x) : __isnanl(x))
+#define isnan(x) (fpclassify(x) == FP_NAN)
/*
STDC(199901)
diff --git a/src/math/isnormal.c b/src/math/isnormal.c
index 5702fc94..868c7ea2 100644
--- a/src/math/isnormal.c
+++ b/src/math/isnormal.c
@@ -1,10 +1,6 @@
#include <math.h>
- int __isnormalf(float x);
- int __isnormald(double x);
- int __isnormall(long double x);
-#define isnormal(x) ((sizeof (x) == sizeof (float)) ? __isnormalf(x) : \
- (sizeof (x) == sizeof (double)) ? __isnormald(x) : __isnormall(x))
+#define isnormal(x) (fpclassify(x) == FP_NORMAL)
/*
STDC(199901)