[flang-commits] [PATCH] D88688: [flang] Make binary->decimal conversion buffer sizes accurate

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Mon Oct 5 13:12:31 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG07cb4c013c43: [flang] Make binary->decimal conversion buffer sizes accurate (authored by klausler).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88688

Files:
  flang/include/flang/Common/real.h


Index: flang/include/flang/Common/real.h
===================================================================
--- flang/include/flang/Common/real.h
+++ flang/include/flang/Common/real.h
@@ -39,26 +39,25 @@
   }
 }
 
-// Number of significant decimal digits in the fraction of the
-// exact conversion of the least nonzero (subnormal) value
-// in each type; i.e., a 128-bit quad value can be formatted
-// exactly with FORMAT(E0.22981).
+// Maximum number of significant decimal digits in the fraction of an
+// exact conversion in each type; computed by converting the value
+// with the minimum exponent (biased to 1) and all fractional bits set.
 static constexpr int MaxDecimalConversionDigits(int binaryPrecision) {
   switch (binaryPrecision) {
   case 8:
-    return 93;
+    return 96;
   case 11:
-    return 17;
+    return 21;
   case 24:
-    return 105;
+    return 112;
   case 53:
-    return 751;
+    return 767;
   case 64:
-    return 11495;
+    return 11514;
   case 106:
-    return 2 * 751;
+    return 2 * 767;
   case 113:
-    return 11530;
+    return 11563;
   default:
     return -1;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88688.296279.patch
Type: text/x-patch
Size: 1118 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20201005/f639f96f/attachment.bin>


More information about the flang-commits mailing list