[flang-commits] [flang] 53dca2e - [flang][runtime] Emit "0.0E+0" for (1PG0.0) editing of 0.0
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Wed Jun 29 11:42:50 PDT 2022
Author: Peter Klausler
Date: 2022-06-29T11:42:39-07:00
New Revision: 53dca2e6ec6c3bfd7d221c6486f1014bd26b60a8
URL: https://github.com/llvm/llvm-project/commit/53dca2e6ec6c3bfd7d221c6486f1014bd26b60a8
DIFF: https://github.com/llvm/llvm-project/commit/53dca2e6ec6c3bfd7d221c6486f1014bd26b60a8.diff
LOG: [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
Added:
Modified:
flang/runtime/edit-output.cpp
Removed:
################################################################################
diff --git a/flang/runtime/edit-output.cpp b/flang/runtime/edit-output.cpp
index 7dc60cbd3adbd..57641dd4da8c4 100644
--- a/flang/runtime/edit-output.cpp
+++ b/flang/runtime/edit-output.cpp
@@ -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;
More information about the flang-commits
mailing list