(&self, f: &mut Formatter<'_>)
| 392 | |
| 393 | #[cfg(feature = "egg")] |
| 394 | fn fmt_expanded_number(&self, f: &mut Formatter<'_>) -> Result { |
| 395 | let value = self.token().value(); |
| 396 | let is_negative = value < 0.0; |
| 397 | let abs_value = value.abs(); |
| 398 | if is_negative { |
| 399 | f.write_str("-")?; |
| 400 | } else { |
| 401 | f.write_str("+")?; |
| 402 | } |
| 403 | |
| 404 | if self.token().is_int() { |
| 405 | return write!(f, "{:010.0}", abs_value); |
| 406 | } |
| 407 | if value == 0.0 { |
| 408 | return f.write_str("0.00000000000000e+0000000000"); |
| 409 | } |
| 410 | let exp = abs_value.log10().floor() as i32; |
| 411 | let mantissa = abs_value / 10_f32.powi(exp); |
| 412 | write!(f, "{:.14}e{:+011}", mantissa, exp) |
| 413 | } |
| 414 | |
| 415 | #[cfg(feature = "egg")] |
| 416 | fn fmt_expanded_ident(&self, f: &mut Formatter<'_>) -> Result { |
no test coverage detected