[libc-commits] [libc] [libc][math][c++23] Add {nearbyint, rint, lrint, llrint, lround, llround}bf16 math functions (PR #153882)

via libc-commits libc-commits at lists.llvm.org
Fri Aug 15 14:28:50 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp,h -- libc/src/math/generic/llrintbf16.cpp libc/src/math/generic/llroundbf16.cpp libc/src/math/generic/lrintbf16.cpp libc/src/math/generic/lroundbf16.cpp libc/src/math/generic/nearbyintbf16.cpp libc/src/math/generic/rintbf16.cpp libc/src/math/llrintbf16.h libc/src/math/llroundbf16.h libc/src/math/lrintbf16.h libc/src/math/lroundbf16.h libc/src/math/nearbyintbf16.h libc/src/math/rintbf16.h libc/test/src/math/llrintbf16_test.cpp libc/test/src/math/llroundbf16_test.cpp libc/test/src/math/lrintbf16_test.cpp libc/test/src/math/lroundbf16_test.cpp libc/test/src/math/nearbyintbf16_test.cpp libc/test/src/math/rintbf16_test.cpp libc/test/src/math/smoke/llrintbf16_test.cpp libc/test/src/math/smoke/llroundbf16_test.cpp libc/test/src/math/smoke/lrintbf16_test.cpp libc/test/src/math/smoke/lroundbf16_test.cpp libc/test/src/math/smoke/nearbyintbf16_test.cpp libc/test/src/math/smoke/rintbf16_test.cpp libc/src/__support/FPUtil/bfloat16.h libc/test/src/math/RoundToIntegerTest.h libc/test/src/math/smoke/RoundToIntegerTest.h libc/utils/MPFRWrapper/MPFRUtils.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libc/src/math/generic/llrintbf16.cpp b/libc/src/math/generic/llrintbf16.cpp
index acf4f8574..ec85454d7 100644
--- a/libc/src/math/generic/llrintbf16.cpp
+++ b/libc/src/math/generic/llrintbf16.cpp
@@ -7,8 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/llrintbf16.h"
-#include "src/__support/FPUtil/bfloat16.h"
 #include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "src/__support/FPUtil/bfloat16.h"
 #include "src/__support/common.h"
 #include "src/__support/macros/config.h"
 
diff --git a/libc/src/math/generic/llroundbf16.cpp b/libc/src/math/generic/llroundbf16.cpp
index ffbf34721..2497b6b4a 100644
--- a/libc/src/math/generic/llroundbf16.cpp
+++ b/libc/src/math/generic/llroundbf16.cpp
@@ -7,8 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/llroundbf16.h"
-#include "src/__support/FPUtil/bfloat16.h"
 #include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "src/__support/FPUtil/bfloat16.h"
 #include "src/__support/common.h"
 #include "src/__support/macros/config.h"
 
diff --git a/libc/src/math/generic/lrintbf16.cpp b/libc/src/math/generic/lrintbf16.cpp
index 97e106c2b..4b3789094 100644
--- a/libc/src/math/generic/lrintbf16.cpp
+++ b/libc/src/math/generic/lrintbf16.cpp
@@ -7,8 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/lrintbf16.h"
-#include "src/__support/FPUtil/bfloat16.h"
 #include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "src/__support/FPUtil/bfloat16.h"
 #include "src/__support/common.h"
 #include "src/__support/macros/config.h"
 
diff --git a/libc/src/math/generic/lroundbf16.cpp b/libc/src/math/generic/lroundbf16.cpp
index 227b07973..89095d178 100644
--- a/libc/src/math/generic/lroundbf16.cpp
+++ b/libc/src/math/generic/lroundbf16.cpp
@@ -7,8 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/lroundbf16.h"
-#include "src/__support/FPUtil/bfloat16.h"
 #include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "src/__support/FPUtil/bfloat16.h"
 #include "src/__support/common.h"
 #include "src/__support/macros/config.h"
 
diff --git a/libc/src/math/generic/nearbyintbf16.cpp b/libc/src/math/generic/nearbyintbf16.cpp
index e9ca8a4e0..a63919959 100644
--- a/libc/src/math/generic/nearbyintbf16.cpp
+++ b/libc/src/math/generic/nearbyintbf16.cpp
@@ -7,8 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/nearbyintbf16.h"
-#include "src/__support/FPUtil/bfloat16.h"
 #include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "src/__support/FPUtil/bfloat16.h"
 #include "src/__support/common.h"
 #include "src/__support/macros/config.h"
 
diff --git a/libc/src/math/generic/rintbf16.cpp b/libc/src/math/generic/rintbf16.cpp
index 43b920883..2ffe16a71 100644
--- a/libc/src/math/generic/rintbf16.cpp
+++ b/libc/src/math/generic/rintbf16.cpp
@@ -7,8 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/rintbf16.h"
-#include "src/__support/FPUtil/bfloat16.h"
 #include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "src/__support/FPUtil/bfloat16.h"
 #include "src/__support/common.h"
 #include "src/__support/macros/config.h"
 
diff --git a/libc/test/src/math/lrintbf16_test.cpp b/libc/test/src/math/lrintbf16_test.cpp
index 6b6bb1ae4..65a5633b8 100644
--- a/libc/test/src/math/lrintbf16_test.cpp
+++ b/libc/test/src/math/lrintbf16_test.cpp
@@ -11,4 +11,5 @@
 #include "src/__support/FPUtil/bfloat16.h"
 #include "src/math/lrintbf16.h"
 
-LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(bfloat16, long, LIBC_NAMESPACE::lrintbf16)
+LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(bfloat16, long,
+                                       LIBC_NAMESPACE::lrintbf16)
diff --git a/libc/test/src/math/nearbyintbf16_test.cpp b/libc/test/src/math/nearbyintbf16_test.cpp
index 921191fba..2d64fc5a1 100644
--- a/libc/test/src/math/nearbyintbf16_test.cpp
+++ b/libc/test/src/math/nearbyintbf16_test.cpp
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-
 #include "NearbyIntTest.h"
 
 #include "src/__support/FPUtil/bfloat16.h"
diff --git a/libc/test/src/math/smoke/lrintbf16_test.cpp b/libc/test/src/math/smoke/lrintbf16_test.cpp
index 6b6bb1ae4..65a5633b8 100644
--- a/libc/test/src/math/smoke/lrintbf16_test.cpp
+++ b/libc/test/src/math/smoke/lrintbf16_test.cpp
@@ -11,4 +11,5 @@
 #include "src/__support/FPUtil/bfloat16.h"
 #include "src/math/lrintbf16.h"
 
-LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(bfloat16, long, LIBC_NAMESPACE::lrintbf16)
+LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(bfloat16, long,
+                                       LIBC_NAMESPACE::lrintbf16)

``````````

</details>


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


More information about the libc-commits mailing list