diff --git a/flang/runtime/edit-output.cpp b/flang/runtime/edit-output.cpp --- a/flang/runtime/edit-output.cpp +++ b/flang/runtime/edit-output.cpp @@ -277,8 +277,8 @@ return EmitPrefix(edit, converted.length, editWidth) && io_.Emit(converted.str, converted.length) && EmitSuffix(edit); } - int scale{IsZero() ? -1 : edit.modes.scale}; - int expo{converted.decimalExponent - scale}; + int scale{IsZero() ? 1 : edit.modes.scale}; // kP + int expo{converted.decimalExponent + scale}; if (expo > extraDigits && extraDigits >= 0) { extraDigits = expo; if (!edit.digits.has_value()) { // F0 diff --git a/flang/unittests/Runtime/hello.cpp b/flang/unittests/Runtime/hello.cpp --- a/flang/unittests/Runtime/hello.cpp +++ b/flang/unittests/Runtime/hello.cpp @@ -232,7 +232,7 @@ {"(G32.17E4,';')", " 1.0000000000000000 ;"}, {"(1P,E32.17,';')", " 1.00000000000000000E+00;"}, {"(1PE32.17,';')", " 1.00000000000000000E+00;"}, // no comma - {"(1P,F32.17,';')", " 0.10000000000000000;"}, + {"(1P,F32.17,';')", " 10.00000000000000000;"}, {"(1P,G32.17,';')", " 1.0000000000000000 ;"}, {"(ES32.17,';')", " 1.00000000000000000E+00;"}, {"(2P,E32.17,';')", " 10.0000000000000000E-01;"},