From: Rich Felker Date: Mon, 13 Aug 2012 18:51:43 +0000 (-0400) Subject: add significand[fl] math functions X-Git-Tag: v0.9.4~15 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=2242bf616b893e85886ed0a2348b96bf1cf7623e;p=oweals%2Fmusl.git add significand[fl] math functions --- diff --git a/include/math.h b/include/math.h index 583dc3da..656f7868 100644 --- a/include/math.h +++ b/include/math.h @@ -400,6 +400,10 @@ long double exp10l(long double); double pow10(double); float pow10f(float); long double pow10l(long double); + +double significand(double); +float significandf(float); +long double significandl(long double); #endif #ifdef __cplusplus 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 + +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 + +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 + +long double significandl(long double x) +{ + return scalbnl(x, -ilogbl(x)); +}