diff options
author | Tyler Murphy <=> | 2023-07-16 02:54:32 -0400 |
---|---|---|
committer | Tyler Murphy <=> | 2023-07-16 02:54:32 -0400 |
commit | fbf131b5c043b27e0b1543374bb144e3e426f723 (patch) | |
tree | 07f0ab2fc107b36621d5ae95480e6a91e332548b /libk/src/math/frexp.c | |
download | finix-fbf131b5c043b27e0b1543374bb144e3e426f723.tar.gz finix-fbf131b5c043b27e0b1543374bb144e3e426f723.tar.bz2 finix-fbf131b5c043b27e0b1543374bb144e3e426f723.zip |
initial
Diffstat (limited to 'libk/src/math/frexp.c')
-rw-r--r-- | libk/src/math/frexp.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libk/src/math/frexp.c b/libk/src/math/frexp.c new file mode 100644 index 0000000..16b8dd3 --- /dev/null +++ b/libk/src/math/frexp.c @@ -0,0 +1,19 @@ +#include <math.h> + +double frexp(double arg, int* exp) { + *exp = 0; + while (arg > 1) { + arg /= 2;; + (*exp)++; + } + return arg; +} + +float frexpf(float arg, int* exp) { + *exp = 0; + while (arg > 1) { + arg /= 2; + (*exp)++; + } + return arg; +} |