diff options
| author | aaryanshukla <53713108+aaryanshukla@users.noreply.github.com> | 2024-08-08 14:33:50 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-08 14:33:50 -0700 |
| commit | d0fe470fd2b32de96762465fac130c13e9a1f782 (patch) | |
| tree | b2b00118383c2e85e15e9af31653e6f45099a75e /libc/src/math/generic/scalbln.cpp | |
| parent | 2b592b16c17e5c4fc135534d80d7c61a986a292c (diff) | |
[libc][math] Add scalbln{,f,l,f128} math functions (#102219)
Co-authored-by: OverMighty <its.overmighty@gmail.com>
Diffstat (limited to 'libc/src/math/generic/scalbln.cpp')
| -rw-r--r-- | libc/src/math/generic/scalbln.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libc/src/math/generic/scalbln.cpp b/libc/src/math/generic/scalbln.cpp new file mode 100644 index 000000000000..f97619954237 --- /dev/null +++ b/libc/src/math/generic/scalbln.cpp @@ -0,0 +1,25 @@ +//===-- Implementation of scalbln function --------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/math/scalbln.h" +#include "hdr/float_macros.h" +#include "src/__support/FPUtil/ManipulationFunctions.h" +#include "src/__support/common.h" +#include "src/__support/macros/config.h" + +#if FLT_RADIX != 2 +#error "FLT_RADIX != 2 is not supported." +#endif + +namespace LIBC_NAMESPACE_DECL { + +LLVM_LIBC_FUNCTION(double, scalbln, (double x, long n)) { + return fputil::ldexp(x, n); +} + +} // namespace LIBC_NAMESPACE_DECL |
