summaryrefslogtreecommitdiff
path: root/libgcompat
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2018-01-14 21:41:21 -0600
committerSamuel Holland <samuel@sholland.org>2018-01-14 21:45:16 -0600
commitea0bbb48b37dc43c3a1cec4e87ed7049e13b4ff9 (patch)
tree1bfdd433ff04bef0724ecb6f3d2fdb4c9266c345 /libgcompat
parent9549bf6ab9feddec4959de21d3e1a1f59adb15a5 (diff)
downloadgcompat-ea0bbb48b37dc43c3a1cec4e87ed7049e13b4ff9.tar.gz
gcompat-ea0bbb48b37dc43c3a1cec4e87ed7049e13b4ff9.tar.bz2
gcompat-ea0bbb48b37dc43c3a1cec4e87ed7049e13b4ff9.tar.xz
gcompat-ea0bbb48b37dc43c3a1cec4e87ed7049e13b4ff9.zip
math: Clean up, add additional functions
* Add finite() variants, needed by some applications. * Add remaining long double variants of existing functions. * Sort and document existing functions, including where referenced in the LSB standard. Signed-off-by: Samuel Holland <samuel@sholland.org>
Diffstat (limited to 'libgcompat')
-rw-r--r--libgcompat/math.c91
1 files changed, 80 insertions, 11 deletions
diff --git a/libgcompat/math.c b/libgcompat/math.c
index 2982116..db123f8 100644
--- a/libgcompat/math.c
+++ b/libgcompat/math.c
@@ -1,27 +1,96 @@
-#include <math.h> /* isinf, isnan */
+#include <math.h> /* isfinite, isinf, isnan */
#include "alias.h" /* weak_alias */
-int __isinff(float number)
+/**
+ * Test for finite value.
+ */
+int __finite(double arg)
{
- return isinf(number);
+ return isfinite(arg);
}
-weak_alias(__isinff, isinff);
+weak_alias(__finite, finite);
+
+/**
+ * Test for finite value.
+ */
+int __finitef(float arg)
+{
+ return isfinite(arg);
+}
+weak_alias(__finitef, finitef);
+
+/**
+ * Test for finite value.
+ */
+int __finitel(long double arg)
+{
+ return isfinite(arg);
+}
+weak_alias(__finitel, finitel);
-int __isinf(double number)
+/**
+ * Test for infinity.
+ *
+ * LSB 5.0: LSB-Core-generic/baselib---isinf.html
+ */
+int __isinf(double arg)
{
- return isinf(number);
+ return isinf(arg);
}
weak_alias(__isinf, isinf);
-int __isnanf(float number)
+/**
+ * Test for infinity.
+ *
+ * LSB 5.0: LSB-Core-generic/baselib---isinff.html
+ */
+int __isinff(float arg)
{
- return isnan(number);
+ return isinf(arg);
}
-weak_alias(__isnanf, isnanf);
+weak_alias(__isinff, isinff);
-int __isnan(double number)
+/**
+ * Test for infinity.
+ *
+ * LSB 5.0: LSB-Core-generic/baselib---isinfl.html
+ */
+int __isinfl(long double arg)
{
- return isnan(number);
+ return isinf(arg);
+}
+weak_alias(__isinfl, isinfl);
+
+/**
+ * Test for a NaN.
+ *
+ * LSB 5.0: LSB-Core-generic/baselib---isnan.html
+ */
+int __isnan(double arg)
+{
+ return isnan(arg);
}
weak_alias(__isnan, isnan);
+
+/**
+ * Test for a NaN.
+ *
+ * LSB 5.0: LSB-Core-generic/baselib---isnanf.html
+ */
+int __isnanf(float arg)
+{
+ return isnan(arg);
+}
+weak_alias(__isnanf, isnanf);
+
+/**
+ * Test for a NaN.
+ *
+ * LSB 5.0: LSB-Core-generic/baselib---isnanl.html
+ */
+int __isnanl(long double arg)
+{
+ return isnan(arg);
+}
+weak_alias(__isnanl, isnanl);