Skip to content

[MathExtras] Fix typos in hex fp constant values. NFC. #123047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 16, 2025

Conversation

jayfoad
Copy link
Contributor

@jayfoad jayfoad commented Jan 15, 2025

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Jan 15, 2025

@llvm/pr-subscribers-llvm-support

Author: Jay Foad (jayfoad)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/123047.diff

1 Files Affected:

  • (modified) llvm/include/llvm/Support/MathExtras.h (+3-3)
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

@jayfoad
Copy link
Contributor Author

jayfoad commented Jan 15, 2025

Tested by compiling a table of all these constants using the decimal values, and then using the hex values from the comments, and comparing.

@jayfoad
Copy link
Contributor Author

jayfoad commented Jan 15, 2025

I also double checked against the OEIS references that the decimal values were the correct ones (but only for the ones where the decimal and hex didn't agree).

Copy link

github-actions bot commented Jan 15, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@ebahapo
Copy link
Contributor

ebahapo commented Jan 15, 2025

LGTM. Thank you.

@jayfoad jayfoad merged commit 0d6b4cb into llvm:main Jan 16, 2025
8 checks passed
@jayfoad jayfoad deleted the mathextras-constants branch January 16, 2025 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants