mirror of
https://github.com/PaddiM8/kalker.git
synced 2024-11-08 00:44:40 +01:00
Trimming trailing zeroes for numbers < 0.
This commit is contained in:
parent
2944f2b9d0
commit
77751750b7
@ -16,7 +16,11 @@ pub fn eval(parser: &mut parser::Context, input: &str) {
|
||||
|
||||
let num = if exp <= 0 {
|
||||
// 0 < x < 1
|
||||
format!("0.{}{}", "0".repeat(exp.abs() as usize), digits)
|
||||
format!(
|
||||
"0.{}{}",
|
||||
"0".repeat(exp.abs() as usize),
|
||||
digits.trim_end_matches('0')
|
||||
)
|
||||
} else if use_sci_notation || result.fract() != 0 {
|
||||
// Insert the comma if there are supposed to be decimals.
|
||||
let mut chars: Vec<char> = digits
|
||||
|
Loading…
Reference in New Issue
Block a user