[llvm] [libc] [libc][math] Implement nexttoward functions (PR #72763)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 21 02:12:13 PST 2023


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 7fd021a0929094bc4b6407896b735b7d360df36c 0ada816ebdb7d8d2b3f0384046d83f73b12e028b -- libc/src/math/generic/nexttoward.cpp libc/src/math/generic/nexttowardf.cpp libc/src/math/generic/nexttowardl.cpp libc/src/math/nexttoward.h libc/src/math/nexttowardf.h libc/src/math/nexttowardl.h libc/test/src/math/smoke/NextTowardTest.h libc/test/src/math/smoke/nexttoward_test.cpp libc/test/src/math/smoke/nexttowardf_test.cpp libc/test/src/math/smoke/nexttowardl_test.cpp libc/src/__support/FPUtil/ManipulationFunctions.h libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h
``````````

</details>

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

``````````diff
diff --git a/libc/src/__support/FPUtil/ManipulationFunctions.h b/libc/src/__support/FPUtil/ManipulationFunctions.h
index 4693c2699a..aa6d3220d6 100644
--- a/libc/src/__support/FPUtil/ManipulationFunctions.h
+++ b/libc/src/__support/FPUtil/ManipulationFunctions.h
@@ -17,9 +17,9 @@
 
 #include "src/__support/CPP/bit.h"
 #include "src/__support/CPP/type_traits.h"
+#include "src/__support/FPUtil/FEnvImpl.h"
 #include "src/__support/macros/attributes.h"
 #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
-#include "src/__support/FPUtil/FEnvImpl.h"
 
 #include <limits.h>
 #include <math.h>
@@ -181,7 +181,8 @@ LIBC_INLINE T nextafter(T from, T to) {
 }
 
 template <typename T>
-LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<T>, T> nexttoward(T from, long double to) {
+LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<T>, T>
+nexttoward(T from, long double to) {
   FPBits<T> from_bits(from);
   if (from_bits.is_nan())
     return from;
diff --git a/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h b/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h
index ab19d623bf..4508671b47 100644
--- a/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h
+++ b/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h
@@ -16,8 +16,8 @@
 #endif
 
 #include "src/__support/CPP/bit.h"
-#include "src/__support/FPUtil/FPBits.h"
 #include "src/__support/FPUtil/FEnvImpl.h"
+#include "src/__support/FPUtil/FPBits.h"
 
 #include <stdint.h>
 

``````````

</details>


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


More information about the llvm-commits mailing list