[all-commits] [llvm/llvm-project] ced631: [flang][runtime] Handle Fw.0 case that needs to ro...
Peter Klausler via All-commits
all-commits at lists.llvm.org
Mon Dec 11 12:11:34 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ced631e0da3443d4afe4b5c1992bc2c438caa8a8
https://github.com/llvm/llvm-project/commit/ced631e0da3443d4afe4b5c1992bc2c438caa8a8
Author: Peter Klausler <35819229+klausler at users.noreply.github.com>
Date: 2023-12-11 (Mon, 11 Dec 2023)
Changed paths:
M flang/runtime/edit-output.cpp
M flang/unittests/Runtime/NumericalFormatTest.cpp
Log Message:
-----------
[flang][runtime] Handle Fw.0 case that needs to round up to 1.0 (#74384)
A tricky case in Fw.d output editing is when the value needs to be
rounded either to a signed zero or away from zero to a power of ten
(1.0, 0.1, &c.). A bug report for LLVM on GitHub (#74274) exposed a bug
in this code in the case of Fw.0 editing where a value just over 0.5 was
rounded incorrectly to 0 rather than 1 when no fractional digits were
requested.
Rework that algorithm a little, ensuring that the initial
binary->decimal conversion produces at least one digit, and coping
correctly with the rounding of an exact 0.5 value for Fw.0 editing
(rounding it to the nearest even decimal, namely 0, following
near-universal compiler-dependent behavior in other Fortrans).
Fixes https://github.com/llvm/llvm-project/issues/74274.
More information about the All-commits
mailing list