mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 18:23:49 +00:00
e702534763
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 |
||
---|---|---|
.. | ||
dec2flt | ||
flt2dec | ||
bignum.rs | ||
const_from.rs | ||
i8.rs | ||
i16.rs | ||
i32.rs | ||
i64.rs | ||
i128.rs | ||
ieee754.rs | ||
int_log.rs | ||
int_macros.rs | ||
mod.rs | ||
nan.rs | ||
ops.rs | ||
u8.rs | ||
u16.rs | ||
u32.rs | ||
u64.rs | ||
u128.rs | ||
uint_macros.rs | ||
wrapping.rs |