[all-commits] [llvm/llvm-project] 487652: [flang] runtime: For Fw.d formatting, don't oscill...

Peter Klausler via All-commits all-commits at lists.llvm.org
Wed Aug 4 12:24:10 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4876520eef34f517075fed9007dc8b3162d67d1a
      https://github.com/llvm/llvm-project/commit/4876520eef34f517075fed9007dc8b3162d67d1a
  Author: peter klausler <pklausler at nvidia.com>
  Date:   2021-08-04 (Wed, 04 Aug 2021)

  Changed paths:
    M flang/lib/Decimal/binary-to-decimal.cpp
    M flang/runtime/edit-output.cpp
    M flang/unittests/Runtime/NumericalFormatTest.cpp

  Log Message:
  -----------
  [flang] runtime: For Fw.d formatting, don't oscillate forever

The algorithm for Fw.d output will drive binary to decimal conversion for
an initial fixed number of digits, then adjust that number based on the
result's exposent.  For value close to a power of ten, this adjustment
process wouldn't terminate; e.g., formatting 9.999 as F10.2 would start
with 1e2, boost the digits to 2, get 9.99e1, decrease the digits, and loop.
Solve by refusing to boost the digits a second time.

Differential Revision: https://reviews.llvm.org/D107490




More information about the All-commits mailing list