From 5d01ab4ac64b913c537e91f7c01d5c8e910151da Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Thu, 21 Nov 2013 01:16:49 +0000 Subject: math: add (obsolete) bsd drem and finite functions --- include/math.h | 6 ++++++ src/math/finite.c | 7 +++++++ src/math/finitef.c | 7 +++++++ src/math/remainder.c | 3 +++ src/math/remainderf.c | 3 +++ 5 files changed, 26 insertions(+) create mode 100644 src/math/finite.c create mode 100644 src/math/finitef.c diff --git a/include/math.h b/include/math.h index 3c2105ef..ec04a8a7 100644 --- a/include/math.h +++ b/include/math.h @@ -381,6 +381,12 @@ double yn(int, double); #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #define HUGE 3.40282346638528859812e+38F +double drem(double, double); +float dremf(float, float); + +int finite(double); +int finitef(float); + double scalb(double, double); float scalbf(float, float); diff --git a/src/math/finite.c b/src/math/finite.c new file mode 100644 index 00000000..25a0575f --- /dev/null +++ b/src/math/finite.c @@ -0,0 +1,7 @@ +#define _GNU_SOURCE +#include + +int finite(double x) +{ + return isfinite(x); +} diff --git a/src/math/finitef.c b/src/math/finitef.c new file mode 100644 index 00000000..2c4c7714 --- /dev/null +++ b/src/math/finitef.c @@ -0,0 +1,7 @@ +#define _GNU_SOURCE +#include + +int finitef(float x) +{ + return isfinite(x); +} diff --git a/src/math/remainder.c b/src/math/remainder.c index ed5c477e..6cd089c4 100644 --- a/src/math/remainder.c +++ b/src/math/remainder.c @@ -1,7 +1,10 @@ #include +#include "libc.h" double remainder(double x, double y) { int q; return remquo(x, y, &q); } + +weak_alias(remainder, drem); diff --git a/src/math/remainderf.c b/src/math/remainderf.c index b418bbff..420d3bfc 100644 --- a/src/math/remainderf.c +++ b/src/math/remainderf.c @@ -1,7 +1,10 @@ #include +#include "libc.h" float remainderf(float x, float y) { int q; return remquof(x, y, &q); } + +weak_alias(remainderf, dremf); -- cgit v1.2.1