fix: account for negative sign
This commit is contained in:
parent
667f2e8eeb
commit
4a8a08f66a
1 changed files with 4 additions and 1 deletions
|
|
@ -65,7 +65,10 @@ pub fn pretty_eval(input: &str, max_digits: usize) -> Result<String, Error> {
|
||||||
if let Some(dot_pos) = changing_string.find('.') {
|
if let Some(dot_pos) = changing_string.find('.') {
|
||||||
changing_string.remove(dot_pos);
|
changing_string.remove(dot_pos);
|
||||||
}
|
}
|
||||||
changing_string.insert_str(0, &format!("0.{}", "0".repeat(uexp - 1)));
|
changing_string.insert_str(
|
||||||
|
if changing_string.contains('-') { 1 } else { 0 },
|
||||||
|
&("0.".to_owned() + &"0".repeat(uexp - 1)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue