summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-08-13 14:51:43 -0400
committerRich Felker <dalias@aerifal.cx>2012-08-13 14:51:43 -0400
commit2242bf616b893e85886ed0a2348b96bf1cf7623e (patch)
treee6e88ad8040ab298898509aabe5a77fee0808d12 /src
parent0c42beb5f90fe5583c2cae5a31c2ef68847974e3 (diff)
downloadmusl-2242bf616b893e85886ed0a2348b96bf1cf7623e.tar.gz
musl-2242bf616b893e85886ed0a2348b96bf1cf7623e.tar.bz2
musl-2242bf616b893e85886ed0a2348b96bf1cf7623e.tar.xz
musl-2242bf616b893e85886ed0a2348b96bf1cf7623e.zip
add significand[fl] math functions
Diffstat (limited to 'src')
-rw-r--r--src/math/significand.c7
-rw-r--r--src/math/significandf.c7
-rw-r--r--src/math/significandl.c7
3 files changed, 21 insertions, 0 deletions
diff --git a/src/math/significand.c b/src/math/significand.c
new file mode 100644
index 00000000..40d9aa9f
--- /dev/null
+++ b/src/math/significand.c
@@ -0,0 +1,7 @@
+#define _GNU_SOURCE
+#include <math.h>
+
+double significand(double x)
+{
+ return scalbn(x, -ilogb(x));
+}
diff --git a/src/math/significandf.c b/src/math/significandf.c
new file mode 100644
index 00000000..8a697e1a
--- /dev/null
+++ b/src/math/significandf.c
@@ -0,0 +1,7 @@
+#define _GNU_SOURCE
+#include <math.h>
+
+float significandf(float x)
+{
+ return scalbnf(x, -ilogbf(x));
+}
diff --git a/src/math/significandl.c b/src/math/significandl.c
new file mode 100644
index 00000000..c1d68cd7
--- /dev/null
+++ b/src/math/significandl.c
@@ -0,0 +1,7 @@
+#define _GNU_SOURCE
+#include <math.h>
+
+long double significandl(long double x)
+{
+ return scalbnl(x, -ilogbl(x));
+}