summaryrefslogtreecommitdiff
path: root/Libraries/LibM
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-06-04 14:38:44 +0100
committerAndreas Kling <kling@serenityos.org>2020-06-04 15:45:11 +0200
commitc883bab62abf73973946dfa6503c56adfc7c12e2 (patch)
treed357d85c279c5900ec6d2e8e325d7f826c9cb51a /Libraries/LibM
parentead76377b025eb69b9918f6b71c1539c3e233f40 (diff)
downloadserenity-c883bab62abf73973946dfa6503c56adfc7c12e2.zip
LibM: Add exp2() and exp2f()
Diffstat (limited to 'Libraries/LibM')
-rw-r--r--Libraries/LibM/math.cpp10
-rw-r--r--Libraries/LibM/math.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/Libraries/LibM/math.cpp b/Libraries/LibM/math.cpp
index 33e05047fe..f1de325ebd 100644
--- a/Libraries/LibM/math.cpp
+++ b/Libraries/LibM/math.cpp
@@ -279,6 +279,16 @@ float expf(float exponent)
return (float)exp(exponent);
}
+double exp2(double exponent)
+{
+ return pow(2.0, exponent);
+}
+
+float exp2f(float exponent)
+{
+ return pow(2.0f, exponent);
+}
+
double cosh(double x)
{
double exponentiated = exp(-x);
diff --git a/Libraries/LibM/math.h b/Libraries/LibM/math.h
index ed738b356b..c8177fded8 100644
--- a/Libraries/LibM/math.h
+++ b/Libraries/LibM/math.h
@@ -74,6 +74,8 @@ double fmod(double, double);
float fmodf(float, float);
double exp(double);
float expf(float);
+double exp2(double);
+float exp2f(float);
double frexp(double, int* exp);
float frexpf(float, int* exp);
double log(double);