[llvm] [APFloat]extract `fltSemantics::isRepresentableBy` to header (PR #122636)
Congcong Cai via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 12 15:43:00 PST 2025
================
@@ -281,6 +281,11 @@ struct APFloatBase {
/// anything real.
static const fltSemantics &Bogus() LLVM_READNONE;
+ // Returns true if any number described by this semantics can be precisely
+ // represented by the specified semantics. Does not take into account
+ // the value of fltNonfiniteBehavior.
+ static bool isRepresentableBy(const fltSemantics &A, const fltSemantics &B);
----------------
HerrCai0907 wrote:
For the usecase of this functions. I want to warn for implicit loss of accuracy when floating point conversation happened in compiler frontend type systems.
It needs API to detect floating point type compatibility.
https://github.com/llvm/llvm-project/pull/122636
More information about the llvm-commits
mailing list