Trimming zeroes at the start of scientific notation, and scientific notation exponent value fix

This commit is contained in:
PaddiM8 2020-12-13 02:25:33 +01:00
parent 9212581ebd
commit 98014166a9
4 changed files with 7 additions and 6 deletions

4
Cargo.lock generated
View File

@ -153,7 +153,7 @@ dependencies = [
[[package]]
name = "kalk"
version = "1.2.3"
version = "1.2.4"
dependencies = [
"lazy_static",
"regex",
@ -163,7 +163,7 @@ dependencies = [
[[package]]
name = "kalk_cli"
version = "0.3.5"
version = "0.3.6"
dependencies = [
"ansi_term",
"kalk",

View File

@ -1,6 +1,6 @@
[package]
name = "kalk"
version = "1.2.3"
version = "1.2.4"
authors = ["PaddiM8"]
edition = "2018"
readme = "README.md"

View File

@ -25,7 +25,7 @@ impl ScientificNotation {
digits_and_mul.insert(1usize, '.');
}
format!("{}{}10^{}", sign, digits_and_mul, self.exponent.to_string())
format!("{}{}10^{}", sign, digits_and_mul, self.exponent - 1)
}
}
@ -74,6 +74,7 @@ impl KalkNum {
ScientificNotation {
negative: neg,
digits: digits
.trim_start_matches('0')
.trim_end_matches('0')
.trim_end_matches('.')
.to_string(),

View File

@ -1,6 +1,6 @@
[package]
name = "kalk_cli"
version = "0.3.5"
version = "0.3.6"
authors = ["PaddiM8"]
edition = "2018"
readme = "../README.md"
@ -16,7 +16,7 @@ path = "src/main.rs"
name = "kalk"
[dependencies]
kalk = { path = "../kalk", version = "^1.2.3" }
kalk = { path = "../kalk", version = "^1.2.4" }
rustyline = "7.0.0"
ansi_term = "0.12"
regex = "1"