[PATCH] D88610: [flang] Correct kP scaling on F output

Peter Klausler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 5 13:59:43 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG567462b48eba: [flang] Correct kP scaling on F output (authored by klausler).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88610/new/

https://reviews.llvm.org/D88610

Files:
  flang/runtime/edit-output.cpp
  flang/unittests/Runtime/hello.cpp


Index: flang/unittests/Runtime/hello.cpp
===================================================================
--- flang/unittests/Runtime/hello.cpp
+++ 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;"},
Index: flang/runtime/edit-output.cpp
===================================================================
--- flang/runtime/edit-output.cpp
+++ 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88610.296291.patch
Type: text/x-patch
Size: 1398 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201005/1715c945/attachment.bin>


More information about the llvm-commits mailing list