rust/library/core/tests/num
bors e702534763 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
2022-11-16 07:20:30 +00:00
..
dec2flt
flt2dec Fix inconsistent rounding of 0.5 when formatted to 0 decimal places 2022-10-11 23:09:23 +02:00
bignum.rs
const_from.rs
i8.rs Update int_roundings methods from feedback 2022-05-04 23:20:29 -04:00
i16.rs Update int_roundings methods from feedback 2022-05-04 23:20:29 -04:00
i32.rs Update int_roundings methods from feedback 2022-05-04 23:20:29 -04:00
i64.rs Update int_roundings methods from feedback 2022-05-04 23:20:29 -04:00
i128.rs Update int_roundings methods from feedback 2022-05-04 23:20:29 -04:00
ieee754.rs
int_log.rs add tests for panicking integer logarithms 2022-10-02 14:25:36 +02:00
int_macros.rs Implement carrying_add and borrowing_sub on signed numbers 2022-05-30 18:32:27 -04:00
mod.rs more dupe word typos 2022-10-14 12:57:56 +08:00
nan.rs
ops.rs Remove unused macro rules 2022-04-18 23:28:06 +02:00
u8.rs Update int_roundings methods from feedback 2022-05-04 23:20:29 -04:00
u16.rs Update int_roundings methods from feedback 2022-05-04 23:20:29 -04:00
u32.rs Update int_roundings methods from feedback 2022-05-04 23:20:29 -04:00
u64.rs Update int_roundings methods from feedback 2022-05-04 23:20:29 -04:00
u128.rs Update int_roundings methods from feedback 2022-05-04 23:20:29 -04:00
uint_macros.rs Implement carrying_add and borrowing_sub on signed numbers 2022-05-30 18:32:27 -04:00
wrapping.rs make const_err a hard error 2022-10-07 18:08:49 +02:00