summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorMițca Dumitru <dumitru0mitca@gmail.com>2021-03-07 23:21:39 +0200
committerAndreas Kling <kling@serenityos.org>2021-03-09 07:28:06 +0100
commit88d342d007579c219fc1ac6748057316f4e93163 (patch)
treebbca7ea08dede5b2b7edbfa25b7d3cd69a9b3da6 /Userland
parentb274120b3c6c827cf58e8f9315b1b2f43dd70c60 (diff)
downloadserenity-88d342d007579c219fc1ac6748057316f4e93163.zip
LibM: Implement the frexp family
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibM/math.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/Userland/Libraries/LibM/math.cpp b/Userland/Libraries/LibM/math.cpp
index da0e6d3c11..e0cd0a8a1a 100644
--- a/Userland/Libraries/LibM/math.cpp
+++ b/Userland/Libraries/LibM/math.cpp
@@ -663,22 +663,22 @@ long double log2l(long double x) NOEXCEPT
return log2(x);
}
-double frexp(double, int*) NOEXCEPT
+double frexp(double x, int* exp) NOEXCEPT
{
- VERIFY_NOT_REACHED();
- return 0;
+ *exp = (x == 0) ? 0 : (1 + ilogb(x));
+ return scalbn(x, -(*exp));
}
-float frexpf(float, int*) NOEXCEPT
+float frexpf(float x, int* exp) NOEXCEPT
{
- VERIFY_NOT_REACHED();
- return 0;
+ *exp = (x == 0) ? 0 : (1 + ilogbf(x));
+ return scalbnf(x, -(*exp));
}
-long double frexpl(long double, int*) NOEXCEPT
+long double frexpl(long double x, int* exp) NOEXCEPT
{
- VERIFY_NOT_REACHED();
- return 0;
+ *exp = (x == 0) ? 0 : (1 + ilogbl(x));
+ return scalbnl(x, -(*exp));
}
double round(double value) NOEXCEPT