about summary refs log tree commit diff
path: root/compiler/rustc_driver/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-11-16 07:20:30 +0000
committerbors <bors@rust-lang.org>2022-11-16 07:20:30 +0000
commite702534763599db252f2ca308739ec340d0933de (patch)
tree041b34bdae1354bcfd29757625e44035866d0255 /compiler/rustc_driver/src
parent3b91b1a37bbb607348b8713d2e8f1051bf414048 (diff)
parentaa9837ba29d88d0748e2599e46403f333a629836 (diff)
downloadrust-e702534763599db252f2ca308739ec340d0933de.tar.gz
rust-e702534763599db252f2ca308739ec340d0933de.zip
Auto merge of #102935 - ajtribick:display-float-0.5-fixed-0, r=scottmcm
Fix inconsistent rounding of 0.5 when formatted to 0 decimal places

As described in #70336, when displaying values to zero decimal places the value of 0.5 is rounded to 1, which is inconsistent with the display of other half-integer values which round to even.

From testing the flt2dec implementation, it looks like this comes down to the condition in the fixed-width Dragon implementation where an empty buffer is treated as a case to apply rounding up. I believe the change below fixes it and updates only the relevant tests.

Nevertheless I am aware this is very much a core piece of functionality, so please take a very careful look to make sure I haven't missed anything. I hope this change does not break anything in the wider ecosystem as having a consistent rounding behaviour in floating point formatting is in my opinion a useful feature to have.

Resolves #70336
Diffstat (limited to 'compiler/rustc_driver/src')
0 files changed, 0 insertions, 0 deletions