From 5f85d32f65280442a35edb30ff48f8312ba0036f Mon Sep 17 00:00:00 2001 From: Kasper Date: Mon, 12 Oct 2020 20:45:48 +0200 Subject: [PATCH] v1.0.2 --- CHANGELOG.md | 4 ++++ Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 8 ++++---- src/units.rs | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 155cf4f..a66ec8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.2 - 2020 Oct 12 +- Fix parsing of unit `Quarter` (#1) +- Use division instead of multiplication when dividing numbers of the same unit `Quarter` (#1) + ## 1.0.1 - 2020 Aug 20 - Fixed the library not working - Added documentation comments diff --git a/Cargo.lock b/Cargo.lock index 53f2076..b19aabb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,7 +12,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cpc" -version = "1.0.1" +version = "1.0.2" dependencies = [ "decimal 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/Cargo.toml b/Cargo.toml index 1e0392f..4dfec46 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cpc" -version = "1.0.1" +version = "1.0.2" description = "evaluates math expressions, with support for units and conversion between units" authors = ["Kasper Henningsen"] edition = "2018" diff --git a/README.md b/README.md index 9c1367e..bab7b7f 100644 --- a/README.md +++ b/README.md @@ -200,9 +200,9 @@ The compiled binaries will now be available inside `target//release/`. T 1. Update `CHANGELOG.md` 2. Bump the version number in `Cargo.toml` and run `cargo check` 3. Run `cargo test` -3. Cross-compile cpc by following [the steps above](#cross-compiling) -4. Commit and tag in format `v1.0.0` -5. Publish on crates.io: +4. Cross-compile cpc by following [the steps above](#cross-compiling) +5. Commit and tag in format `v0.0.0` +6. Publish on crates.io: 1. Login by running `cargo login` and following the instructions 2. Test publish to ensure there are no issues ``` @@ -212,6 +212,6 @@ The compiled binaries will now be available inside `target//release/`. T ``` cargo publish ``` -6. Publish on GitHub +7. Publish on GitHub 1. Zip the binaries and rename them like `cpc-v1.0.0-darwin-x64` 2. Create GitHub release with release notes and attach the zipped binaries diff --git a/src/units.rs b/src/units.rs index 2a5f718..fec6bf0 100644 --- a/src/units.rs +++ b/src/units.rs @@ -420,7 +420,7 @@ pub fn divide(left: Number, right: Number) -> Result { // 1 km / 2 Ok(Number::new(left.value / right.value, right.unit)) } else if lcat == rcat { - // 1 km / 1 km + // 4 km / 2 km let (left, right) = convert_to_lowest(left, right)?; Ok(Number::new(left.value / right.value, NoUnit)) } else if (lcat == Area && rcat == Length) || (lcat == Volume && rcat == Area) {