[llvm] [APFloat] Add APFloat::format (PR #99088)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 00:28:54 PDT 2024


================
@@ -1381,6 +1394,20 @@ class APFloat : public APFloatBase {
         toString(Str, FormatPrecision, FormatMaxPadding, TruncateZero));
   }
 
+  /// Decomposes the value to an integer and an exponent such that
+  /// value = I * 2^exp
+  /// returns true on success, false otherwise (e.g., NaN, Infinity)
+  /// similar to the standard modf, but exponent does not
+  /// have to have the same sign as the value.
+  bool decomposeToIntegerAndPowerOf2(APInt &I, int &exp) const {
+    APFLOAT_DISPATCH_ON_SEMANTICS(decomposeToIntegerAndPowerOf2(I, exp));
+  }
+
+  SmallVectorImpl<char> &
+  format(SmallVectorImpl<char> &strout,
----------------
arsenm wrote:

why isn't this on raw_ostream, and using a raw small string? 

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


More information about the llvm-commits mailing list