[flang-commits] [PATCH] D128761: [flang][runtime] Emit "0.0E+0" for (1PG0.0) editing of 0.0

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Jun 28 14:31:05 PDT 2022


klausler created this revision.
klausler added a reviewer: vdonaldson.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
klausler requested review of this revision.

When a scale factor is in effect, respect it for G0.0 output editing.


https://reviews.llvm.org/D128761

Files:
  flang/runtime/edit-output.cpp


Index: flang/runtime/edit-output.cpp
===================================================================
--- flang/runtime/edit-output.cpp
+++ flang/runtime/edit-output.cpp
@@ -261,9 +261,10 @@
     flags |= decimal::AlwaysSign;
   }
   bool noLeadingSpaces{editWidth == 0};
+  int scale{edit.modes.scale}; // 'kP' value
   if (editWidth == 0) { // "the processor selects the field width"
     if (edit.digits.has_value()) { // E0.d
-      if (editDigits == 0) { // E0.0
+      if (editDigits == 0 && scale <= 0) { // E0.0
         significantDigits = 1;
       }
     } else { // E0
@@ -274,7 +275,6 @@
   }
   bool isEN{edit.variation == 'N'};
   bool isES{edit.variation == 'S'};
-  int scale{edit.modes.scale}; // 'kP' value
   int zeroesAfterPoint{0};
   if (isEN) {
     scale = IsZero() ? 1 : 3;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128761.440773.patch
Type: text/x-patch
Size: 803 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220628/9fe57d82/attachment-0001.bin>


More information about the flang-commits mailing list