[libc-commits] [libc] [libc][math][c++23] Add expbf16 math function (PR #161919)

Krishna Pandey via libc-commits libc-commits at lists.llvm.org
Thu Jun 25 01:38:42 PDT 2026


================
@@ -0,0 +1,194 @@
+//===-- Implementation header for expbf16 -----------------------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_EXPBF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_EXPBF16_H
+
+#include "hdr/errno_macros.h"
+#include "hdr/fenv_macros.h"
+#include "src/__support/FPUtil/FEnvImpl.h"
+#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/FPUtil/PolyEval.h"
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/__support/FPUtil/cast.h"
+#include "src/__support/FPUtil/except_value_utils.h"
+#include "src/__support/FPUtil/multiply_add.h"
+#include "src/__support/FPUtil/nearest_integer.h"
+#include "src/__support/FPUtil/rounding_mode.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/optimization.h"
+#include "src/__support/macros/properties/types.h"
+
+// bfloat16 expbf16(bfloat16 x);
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+// Generated by Sollya with the following commands:
+//   > display = hexadecimal;
+//   > for i from -96 to 88 by 8 do print(i, round(exp(i), SG, RN) @ "f,");
+LIBC_INLINE_VAR constexpr float EXP_HI[24] = {
----------------
krishna2803 wrote:

done in https://github.com/llvm/llvm-project/pull/161919/commits/62170843ae8e1423b09e635a5ebb7f41f57c384d

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


More information about the libc-commits mailing list