This commit is contained in:
Kasper 2020-10-12 20:45:48 +02:00
parent bb4bdb72f1
commit 5f85d32f65
5 changed files with 11 additions and 7 deletions

View File

@ -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

2
Cargo.lock generated
View File

@ -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)",
]

View File

@ -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"

View File

@ -200,9 +200,9 @@ The compiled binaries will now be available inside `target/<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/<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

View File

@ -420,7 +420,7 @@ pub fn divide(left: Number, right: Number) -> Result<Number, String> {
// 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) {