[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
This commit is contained in:
Peter Klausler 2022-06-27 14:22:31 -07:00
parent 5f2cf3a21f
commit 53dca2e6ec
1 changed files with 2 additions and 2 deletions

View File

@ -261,9 +261,10 @@ bool RealOutputEditing<binaryPrecision>::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<binaryPrecision>::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;