[llvm] [APFloat]extract `fltSemantics::isRepresentableBy` to header (PR #122636)

Matthias Springer via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 12 11:24:50 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);
----------------
matthias-springer wrote:

What's your use case for this function? Given that this function does not take into account `fltNonfiniteBehavior`, `hasZero`, `hasSignedRepr`, I'm wondering how useful it is in practice. (I'm also wondering, why it does not take into account `fltNonfiniteBehavior`.)

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


More information about the llvm-commits mailing list