Skip to content

Commit

Permalink
Version 1.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
paupino committed May 23, 2021
1 parent 864c8af commit 93bed3c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "MIT"
name = "rust_decimal"
readme = "./README.md"
repository = "https://github.com/paupino/rust-decimal"
version = "1.13.0"
version = "1.14.0"
exclude = [ "tests/generated/*" ]

[package.metadata.docs.rs]
Expand Down
9 changes: 9 additions & 0 deletions VERSION.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Version History

## 1.14.0

* Added `checked_exp` and `checked_norm_pdf` functions [#375](https://github.com/paupino/rust-decimal/pull/375).
* Fixes bug in division under certain circumstances whereby overflow would occur during rounding. [#377](https://github.com/paupino/rust-decimal/pull/377)
* Documentation improvements

Thank you to [@falsetru](https://github.com/falsetru), [@schungx](https://github.com/schungx) and [@blasrodri](https://github.com/blasrodri) for your
help with this release!

## 1.13.0

This is a minor update to the library providing a few new features and one breaking change (I'm not using semver properly here
Expand Down
4 changes: 2 additions & 2 deletions macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rust_decimal_macros"
version = "1.13.0"
version = "1.14.0"
authors = ["Paul Mason <paul@form1.co.nz>"]
edition = "2018"
description = "Shorthand macros to assist creating Decimal types."
Expand All @@ -12,7 +12,7 @@ categories = ["science","data-structures"]
license = "MIT"

[dependencies]
rust_decimal = { path = "..", version = "1.13.0" }
rust_decimal = { path = "..", version = "1.14.0" }
quote = "1.0"

[features]
Expand Down
7 changes: 2 additions & 5 deletions src/decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ impl Decimal {
flags: flags & SCALE_MASK,
}
} else {
Decimal { lo, mid, hi, flags }
Decimal { flags, hi, lo, mid }
}
}

Expand Down Expand Up @@ -1735,10 +1735,7 @@ impl ToPrimitive for Decimal {
fn to_f64(&self) -> Option<f64> {
if self.scale() == 0 {
let integer = self.to_i64();
match integer {
Some(i) => Some(i as f64),
None => None,
}
integer.map(|i| i as f64)
} else {
let sign: f64 = if self.is_sign_negative() { -1.0 } else { 1.0 };
let mut mantissa: u128 = self.lo.into();
Expand Down
7 changes: 7 additions & 0 deletions tests/decimal_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3431,6 +3431,13 @@ mod maths {
}
}

#[test]
#[should_panic(expected = "Exp overflowed")]
fn test_exp_expected_panic() {
let d = Decimal::from_str("-1024").unwrap();
let _ = d.exp();
}

#[test]
fn test_norm_cdf() {
let test_cases = &[
Expand Down

0 comments on commit 93bed3c

Please sign in to comment.