diff options
author | Hendiadyoin1 <leon2002.la@gmail.com> | 2021-05-11 18:36:59 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-02 19:50:43 +0200 |
commit | c74d7adac6be66130bc116097bd5a121dac89f5f (patch) | |
tree | ec0c5a3d5393a02a24e02a127646c5fa96674040 /Userland/Libraries/LibM | |
parent | 71fc7ac7ac28156edc7609b8c4bb39198e27202d (diff) | |
download | serenity-c74d7adac6be66130bc116097bd5a121dac89f5f.zip |
LibM: Implement path for negative powers
Diffstat (limited to 'Userland/Libraries/LibM')
-rw-r--r-- | Userland/Libraries/LibM/math.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Userland/Libraries/LibM/math.cpp b/Userland/Libraries/LibM/math.cpp index 1a0cb99369..653adb6177 100644 --- a/Userland/Libraries/LibM/math.cpp +++ b/Userland/Libraries/LibM/math.cpp @@ -426,6 +426,10 @@ long double powl(long double x, long double y) NOEXCEPT result = 1.0l / result; return result; } + if (x < 0) { + return 1.l / exp2l(y * log2l(-x)); + } + return exp2l(y * log2l(x)); } |