Fixed missing sign print

pull/2/head
Mark 2023-04-01 16:43:26 -07:00
parent 5792bbcea9
commit 047c900193
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
1 changed files with 3 additions and 3 deletions

View File

@ -61,18 +61,18 @@ impl ToString for Quantity{
} else { } else {
if exp <= 0 { // Decimal, needs `0.` and leading zeros if exp <= 0 { // Decimal, needs `0.` and leading zeros
format!( format!(
"0.{}{string}", "{sign}0.{}{string}",
"0".repeat(exp_u) "0".repeat(exp_u)
) )
} else if exp_u < string.len() { // Decimal, needs only `.` } else if exp_u < string.len() { // Decimal, needs only `.`
format!( format!(
"{}.{}", "{sign}{}.{}",
&string[0..exp_u], &string[0..exp_u],
&string[exp_u..] &string[exp_u..]
) )
} else { // Integer, needs trailing zeros } else { // Integer, needs trailing zeros
format!( format!(
"{string}{}", "{sign}{string}{}",
"0".repeat(exp_u - string.len()) "0".repeat(exp_u - string.len())
) )
} }