[llvm] [APFloat] Add `APFloat::getConstant` for C++20 <numbers> constants (PR #227916)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 01:53:10 PDT 2026
================
@@ -6061,6 +6061,53 @@ APFloat APFloat::getAllOnesValue(const fltSemantics &Semantics) {
return APFloat(Semantics, APInt::getAllOnes(Semantics.sizeInBits));
}
+// The same literals as <numbers>, which are of sufficient precision for f128
+// and ppcf128. These literals will need to be updated if we add support for
+// f256 in the future.
+static constexpr StringLiteral MathConstantStrings[] = {
+ "-2.718281828459045235360287471352662498", // e
----------------
arsenm wrote:
I would hope to store these as some constant the APFloat can directly initialize to without parsing
https://github.com/llvm/llvm-project/pull/227916
More information about the llvm-commits
mailing list