Files
clang-p2996/flang/runtime/edit-output.cpp
Peter Klausler ced631e0da [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.
2023-12-11 12:11:20 -08:00

33 KiB