[llvm] [MathExtras] Fix typos in hex fp constant values. NFC. (PR #123047)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 04:09:16 PST 2025


https://github.com/jayfoad updated https://github.com/llvm/llvm-project/pull/123047

>From 05574e806e9e465a226735e723e9430d35bd5780 Mon Sep 17 00:00:00 2001
From: Jay Foad <jay.foad at amd.com>
Date: Wed, 15 Jan 2025 12:01:49 +0000
Subject: [PATCH 1/2] [MathExtras] Fix typos in hex fp constant values. NFC.

---
 llvm/include/llvm/Support/MathExtras.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h
index a52a9f07bacd4b..fb7b096eb10737 100644
--- a/llvm/include/llvm/Support/MathExtras.h
+++ b/llvm/include/llvm/Support/MathExtras.h
@@ -44,14 +44,14 @@ using common_sint =
 namespace numbers {
 // TODO: Track C++20 std::numbers.
 // TODO: Favor using the hexadecimal FP constants (requires C++17).
-constexpr double e          = 2.7182818284590452354, // (0x1.5bf0a8b145749P+1) https://oeis.org/A001113
+constexpr double e          = 2.7182818284590452354, // (0x1.5bf0a8b145769P+1) https://oeis.org/A001113
                  egamma     = .57721566490153286061, // (0x1.2788cfc6fb619P-1) https://oeis.org/A001620
                  ln2        = .69314718055994530942, // (0x1.62e42fefa39efP-1) https://oeis.org/A002162
-                 ln10       = 2.3025850929940456840, // (0x1.24bb1bbb55516P+1) https://oeis.org/A002392
+                 ln10       = 2.3025850929940456840, // (0x1.26bb1bbb55516P+1) https://oeis.org/A002392
                  log2e      = 1.4426950408889634074, // (0x1.71547652b82feP+0)
                  log10e     = .43429448190325182765, // (0x1.bcb7b1526e50eP-2)
                  pi         = 3.1415926535897932385, // (0x1.921fb54442d18P+1) https://oeis.org/A000796
-                 inv_pi     = .31830988618379067154, // (0x1.45f306bc9c883P-2) https://oeis.org/A049541
+                 inv_pi     = .31830988618379067154, // (0x1.45f306dc9c883P-2) https://oeis.org/A049541
                  sqrtpi     = 1.7724538509055160273, // (0x1.c5bf891b4ef6bP+0) https://oeis.org/A002161
                  inv_sqrtpi = .56418958354775628695, // (0x1.20dd750429b6dP-1) https://oeis.org/A087197
                  sqrt2      = 1.4142135623730950488, // (0x1.6a09e667f3bcdP+0) https://oeis.org/A00219

>From 757caf5b9c77333b354974e380f3947007751513 Mon Sep 17 00:00:00 2001
From: Jay Foad <jay.foad at amd.com>
Date: Wed, 15 Jan 2025 12:08:34 +0000
Subject: [PATCH 2/2] Disable clang-format

---
 llvm/include/llvm/Support/MathExtras.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h
index fb7b096eb10737..574e9a61166037 100644
--- a/llvm/include/llvm/Support/MathExtras.h
+++ b/llvm/include/llvm/Support/MathExtras.h
@@ -44,6 +44,7 @@ using common_sint =
 namespace numbers {
 // TODO: Track C++20 std::numbers.
 // TODO: Favor using the hexadecimal FP constants (requires C++17).
+// clang-format off
 constexpr double e          = 2.7182818284590452354, // (0x1.5bf0a8b145769P+1) https://oeis.org/A001113
                  egamma     = .57721566490153286061, // (0x1.2788cfc6fb619P-1) https://oeis.org/A001620
                  ln2        = .69314718055994530942, // (0x1.62e42fefa39efP-1) https://oeis.org/A002162
@@ -74,6 +75,7 @@ constexpr float ef          = 2.71828183F, // (0x1.5bf0a8P+1) https://oeis.org/A
                 sqrt3f      = 1.73205081F, // (0x1.bb67aeP+0) https://oeis.org/A002194
                 inv_sqrt3f  = .577350269F, // (0x1.279a74P-1)
                 phif        = 1.61803399F; // (0x1.9e377aP+0) https://oeis.org/A001622
+// clang-format on
 } // namespace numbers
 
 /// Create a bitmask with the N right-most bits set to 1, and all other



More information about the llvm-commits mailing list