diff --git a/flang/runtime/edit-output.cpp b/flang/runtime/edit-output.cpp index 31ba9f152d74f..76f24cb07437e 100644 --- a/flang/runtime/edit-output.cpp +++ b/flang/runtime/edit-output.cpp @@ -116,7 +116,7 @@ const char *RealOutputEditingBase::FormatExponent( } } *--exponent = expo < 0 ? '-' : '+'; - if (edit.expoDigits || exponent + 3 == eEnd) { + if (edit.expoDigits || edit.IsListDirected() || exponent + 3 == eEnd) { *--exponent = edit.descriptor == 'D' ? 'D' : 'E'; // not 'G' } length = eEnd - exponent;