mirror of
https://github.com/rm-dr/daisy
synced 2025-02-21 22:49:24 -08:00
Fixed missing sign print
This commit is contained in:
parent
5792bbcea9
commit
047c900193
@ -61,18 +61,18 @@ impl ToString for Quantity{
|
||||
} else {
|
||||
if exp <= 0 { // Decimal, needs `0.` and leading zeros
|
||||
format!(
|
||||
"0.{}{string}",
|
||||
"{sign}0.{}{string}",
|
||||
"0".repeat(exp_u)
|
||||
)
|
||||
} else if exp_u < string.len() { // Decimal, needs only `.`
|
||||
format!(
|
||||
"{}.{}",
|
||||
"{sign}{}.{}",
|
||||
&string[0..exp_u],
|
||||
&string[exp_u..]
|
||||
)
|
||||
} else { // Integer, needs trailing zeros
|
||||
format!(
|
||||
"{string}{}",
|
||||
"{sign}{string}{}",
|
||||
"0".repeat(exp_u - string.len())
|
||||
)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user