Merge branch 'v1.1-fixes'

This commit is contained in:
Stephen Chung
2021-11-09 08:48:16 +08:00
2 changed files with 10 additions and 1 deletions

View File

@@ -1832,7 +1832,7 @@ impl<F: Float + fmt::Debug> fmt::Debug for FloatWrapper<F> {
impl<F: Float + fmt::Display + fmt::LowerExp + From<f32>> fmt::Display for FloatWrapper<F> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let abs = self.0.abs();
if abs.fract().is_zero() {
if abs.is_zero() {
f.write_str("0.0")
} else if abs > Self::MAX_NATURAL_FLOAT_FOR_DISPLAY.into()
|| abs < Self::MIN_NATURAL_FLOAT_FOR_DISPLAY.into()