diff --git a/src/quantity/mod.rs b/src/quantity/mod.rs index c70fc59..f8c3f77 100644 --- a/src/quantity/mod.rs +++ b/src/quantity/mod.rs @@ -4,4 +4,4 @@ pub mod quantity; pub use crate::quantity::quantity::Quantity; const FLOAT_PRECISION: u32 = 2048; -const PRINT_LEN: usize = 4; // How many significant digits we will show in output \ No newline at end of file +const PRINT_LEN: usize = 5; // How many significant digits we will show in output \ No newline at end of file diff --git a/src/quantity/quantity.rs b/src/quantity/quantity.rs index 31052f3..c56be24 100644 --- a/src/quantity/quantity.rs +++ b/src/quantity/quantity.rs @@ -48,15 +48,16 @@ impl ToString for Quantity{ exp_u = exp.try_into().unwrap() } - if exp_u >= 4 { + if exp_u >= PRINT_LEN { // Exponential notation let pre = &string[0..1]; let post = &string[1..]; format!( - "{pre}{}{post}e{}{exp}", + "{pre}{}{post}e{}", if post.len() != 0 {"."} else {""}, - if exp > 0 {"+"} else {""}, + //if exp > 0 {"+"} else {""}, + exp - 1 ) } else { if exp <= 0 { // Decimal, needs `0.` and leading zeros