From: Peter Klausler Date: Mon, 27 Jun 2022 21:22:31 +0000 (-0700) Subject: [flang][runtime] Emit "0.0E+0" for (1PG0.0) editing of 0.0 X-Git-Tag: upstream/15.0.7~3131 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=53dca2e6ec6c3bfd7d221c6486f1014bd26b60a8;p=platform%2Fupstream%2Fllvm.git [flang][runtime] Emit "0.0E+0" for (1PG0.0) editing of 0.0 When a scale factor is in effect, respect it for G0.0 output editing. Differential Revision: https://reviews.llvm.org/D128761 --- diff --git a/flang/runtime/edit-output.cpp b/flang/runtime/edit-output.cpp index 7dc60cb..57641dd 100644 --- a/flang/runtime/edit-output.cpp +++ b/flang/runtime/edit-output.cpp @@ -261,9 +261,10 @@ bool RealOutputEditing::EditEorDOutput(const DataEdit &edit) { 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 RealOutputEditing::EditEorDOutput(const DataEdit &edit) { } 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;