Fix floating-point display.
This commit is contained in:
parent
04c31fe1ff
commit
5685ca8411
@ -4,6 +4,11 @@ Rhai Release Notes
|
||||
Version 1.1.3
|
||||
=============
|
||||
|
||||
Bug fixes
|
||||
---------
|
||||
|
||||
* Printing of integral floating-point numbers is fixed (used to only prints `0.0`).
|
||||
|
||||
|
||||
Version 1.1.2
|
||||
=============
|
||||
|
@ -1825,7 +1825,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()
|
||||
|
Loading…
Reference in New Issue
Block a user