[llvm-branch-commits] [libc] [libc][math][c++23] Add scalb{, l}nbf16 math functions (PR #155569)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Aug 27 10:11:18 PDT 2025


================
@@ -0,0 +1,21 @@
+//===-- Implementation of scalblnbf16 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/scalblnbf16.h"
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(bfloat16, scalblnbf16, (bfloat16 x, long n)) {
----------------
overmighty wrote:

Missing this check that existing `scalbln` function implementations have:

```cpp
#if FLT_RADIX != 2
#error "FLT_RADIX != 2 is not supported."
#endif
```

https://github.com/llvm/llvm-project/pull/155569


More information about the llvm-branch-commits mailing list