[flang-commits] [PATCH] D129672: [flang][runtime] Refine list-directed REAL(2) output

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Jul 13 16:11:02 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGfaffcc3a46cb: [flang][runtime] Refine list-directed REAL(2) output (authored by klausler).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129672/new/

https://reviews.llvm.org/D129672

Files:
  flang/runtime/edit-output.cpp


Index: flang/runtime/edit-output.cpp
===================================================================
--- flang/runtime/edit-output.cpp
+++ flang/runtime/edit-output.cpp
@@ -531,7 +531,12 @@
     return EditEorDOutput(edit);
   }
   int expo{converted.decimalExponent};
-  if (expo < 0 || expo > BinaryFloatingPoint::decimalPrecision) {
+  // The decimal precision of 16-bit floating-point types is very low,
+  // so use a reasonable cap of 6 to allow more values to be emitted
+  // with Fw.d editing.
+  static constexpr int maxExpo{
+      std::max(6, BinaryFloatingPoint::decimalPrecision)};
+  if (expo < 0 || expo > maxExpo) {
     DataEdit copy{edit};
     copy.modes.scale = 1; // 1P
     return EditEorDOutput(copy);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129672.444443.patch
Type: text/x-patch
Size: 730 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220713/6d21aad7/attachment.bin>


More information about the flang-commits mailing list