commit_hash
stringlengths
40
40
author
stringlengths
1
57
date
timestamp[s]date
2010-07-26 04:45:09
2026-04-14 18:21:10
message
stringlengths
8
1.39M
diff
stringlengths
68
51.2k
files_changed
int64
1
136
insertions
int64
0
2.35k
deletions
int64
0
1.9k
3333b88a376bc2f20f76f6fdf5c019174ffb5d5d
Andrew Kubera
2025-08-15T09:33:32
Remove unnecessary use of Option::is_some_and
diff --git a/build.rs b/build.rs index ccb1e18..5e5dc13 100644 --- a/build.rs +++ b/build.rs @@ -13,8 +13,6 @@ const SERDE_MAX_SCALE: &str = "150000"; fn main() { let ac = autocfg::new(); - ac.emit_rustc_version(1, 70); - // abs_diff ac.emit_rustc_version(1, 60); diff --git a/src/impl_ops.rs b/sr...
2
2
21
95a0d0f6779c54ba582353277bd1a4951a0918e2
Andrew Kubera
2025-07-17T02:10:03
Move exp2 to bigdecimal::arithmetic
diff --git a/src/arithmetic/inverse.rs b/src/arithmetic/inverse.rs index 398463e..5984bf7 100644 --- a/src/arithmetic/inverse.rs +++ b/src/arithmetic/inverse.rs @@ -1,6 +1,7 @@ //! inverse implementation use crate::*; +use super::exp2; /// Implementation of inverse: (1/n) pub(crate) fn impl_inverse_uint_scale(n...
3
19
11
29fdda2bd55771eac7522ee03f81645b9b50ac9c
Andrew Kubera
2025-08-11T10:00:59
Fix docstring of RoundingMode
diff --git a/src/rounding.rs b/src/rounding.rs index 6e408a2..c6dbb55 100644 --- a/src/rounding.rs +++ b/src/rounding.rs @@ -10,7 +10,9 @@ include!(concat!(env!("OUT_DIR"), "/default_rounding_mode.rs")); /// Determines how to calculate the last digit of the number /// -/// Default rounding mode is HalfUp +/// Defau...
1
3
1
06148a9daf0319eef374460f47ada97759c8a6eb
Andrew Kubera
2025-08-13T10:46:29
Remove unnecessary 'use Sign::*'
diff --git a/src/lib.rs b/src/lib.rs index 0c54187..fc9ddd8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1371,19 +1371,15 @@ impl BigDecimalRef<'_> { /// Take square root of absolute-value of the number pub fn sqrt_abs_with_context(&self, ctx: &Context) -> BigDecimal { - use Sign::*; - let (...
1
1
5
e4c4900aefbbb93fe024e26c568490c2223af15a
Andrew Kubera
2025-08-13T10:36:54
Implement optimized BigDecimalRef::is_one() method
diff --git a/src/lib.rs b/src/lib.rs index a3c9b65..0c54187 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -98,6 +98,7 @@ use num_integer::Integer as IntegerTrait; pub use num_traits::{FromPrimitive, Num, One, Pow, Signed, ToPrimitive, Zero}; use stdlib::f64::consts::LOG2_10; +use stdlib::f64::consts::LOG10_2; //...
2
69
1
6d5fdcd5224d00a9cd2cdae4eeee1a49200ff04e
Andrew Kubera
2025-08-12T03:51:32
Move implementation of order_of_magnitude() to BigDecimalRef
diff --git a/src/lib.rs b/src/lib.rs index bb8f641..a3c9b65 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -270,10 +270,7 @@ impl BigDecimal { /// The order of magnitude of 0 is 0. /// pub fn order_of_magnitude(&self) -> i64 { - if self.is_zero() { - return 0; - } - self.deci...
1
15
4
7dce89644f8b99c861a69fd5fa3e6edd4cd77499
Andrew Kubera
2025-08-11T16:02:11
Rename count_decimal_digits() -> decimal_digit_count() and add tests
diff --git a/src/lib.rs b/src/lib.rs index 4351fec..bb8f641 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -255,7 +255,7 @@ impl BigDecimal { /// /// Zero is considered to be one digit. /// - pub fn count_decimal_digits(&self) -> u64 { + pub fn decimal_digit_count(&self) -> u64 { if self.is_z...
2
23
3
715c6710e3e0512bb9a5a2b313f42d93907c4c6c
Andrew Kubera
2025-08-11T12:11:55
Add count_digits_uint tests
diff --git a/src/arithmetic/decimal.rs b/src/arithmetic/decimal.rs index 34cd035..6666c4e 100644 --- a/src/arithmetic/decimal.rs +++ b/src/arithmetic/decimal.rs @@ -97,6 +97,8 @@ pub(crate) fn count_digits_biguint(n: &num_bigint::BigUint) -> u64 { let mut digits = (n.bits() as f64 / super::LOG2_10) as u64; //...
2
16
0
b468032b50ec9a83697a5adee5729ff7bb117059
Andrew Kubera
2023-07-10T00:20:45
Implement digit counting functions in arithmetic::decimal
diff --git a/src/arithmetic/decimal.rs b/src/arithmetic/decimal.rs index 19bcea2..34cd035 100644 --- a/src/arithmetic/decimal.rs +++ b/src/arithmetic/decimal.rs @@ -1,6 +1,86 @@ //! Algorithms for manipulating decimal digits //! +macro_rules! count_digits { + ($n:ident : u64) => { + if $n >= 100000...
2
136
0
466b2ad4eb472b724cde84a5b5209874b9fd1cfb
Andrew Kubera
2025-08-11T10:54:22
Move count_digits_{bigint,biguint} to arithmetic/decimal.rs
diff --git a/src/arithmetic/decimal.rs b/src/arithmetic/decimal.rs new file mode 100644 index 0000000..19bcea2 --- /dev/null +++ b/src/arithmetic/decimal.rs @@ -0,0 +1,19 @@ +//! Algorithms for manipulating decimal digits +//! + +/// Return number of decimal digits in biginteger +pub(crate) fn count_digits_bigint(n: &n...
3
23
23
cf843dd2b4bf635a32603fd94fe3bbbe957b675f
Andrew Kubera
2025-08-11T10:20:07
Implement count_decimal_digits and order_of_magnitude methods Add order_of_magnitude tests
diff --git a/src/lib.rs b/src/lib.rs index 7f089e1..dadc980 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -251,6 +251,31 @@ impl BigDecimal { self.into() } + /// Count of decimal digits + /// + /// Zero is considered to be one digit. + /// + pub fn count_decimal_digits(&self) -> u64 { + ...
2
51
0
acac4a1e7dffaaaa80735ec9acd60bdb3fd84dd2
Andrew Kubera
2025-04-26T22:31:02
Simplify division property tests
diff --git a/src/lib.tests.property-tests.rs b/src/lib.tests.property-tests.rs index 4327bda..4e4b1d4 100644 --- a/src/lib.tests.property-tests.rs +++ b/src/lib.tests.property-tests.rs @@ -3,6 +3,8 @@ mod arithmetic { use super::*; + use stdlib::num::NonZeroI128; + macro_rules! impl_test { ($...
1
6
10
e9476521aa9d23ff33115bc41a7892b80db27f9d
Andrew Kubera
2025-04-01T04:26:53
Begin v0.4.9 development
diff --git a/Cargo.lock b/Cargo.lock index 48fef3b..010a4cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,7 +8,7 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bigdecimal" -version = "0.4.8" +version = "0.4.9+dev" dependencies = [ "autocfg", "libm", diff -...
2
2
2
51578e3350c75561fcc70b7823fd7a2cd00fbc99
Andrew Kubera
2025-04-01T04:08:45
Version 0.4.8
diff --git a/Cargo.lock b/Cargo.lock index 8afa676..48fef3b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,7 +8,7 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bigdecimal" -version = "0.4.8+dev" +version = "0.4.8" dependencies = [ "autocfg", "libm", diff -...
2
2
2
e9e8ee1a132927e4aacbcdbd177a735dfd4f8056
Andrew Kubera
2025-03-26T00:47:48
Add more formatting test
diff --git a/src/impl_fmt.rs b/src/impl_fmt.rs index 663e4d1..789452a 100644 --- a/src/impl_fmt.rs +++ b/src/impl_fmt.rs @@ -1177,6 +1177,7 @@ mod test { impl_case!(fmt_d1: "{:.1}" => "10.0"); impl_case!(fmt_d2: "{:.2}" => "9.99"); impl_case!(fmt_d3: "{:.3}" =...
1
22
0
8f4a9466373dd57905e495e9e50d9fc472b1cc0d
Andrew Kubera
2025-03-26T00:31:03
Replace BigDecimalRef "this" param with "sign" in format functions
diff --git a/src/impl_fmt.rs b/src/impl_fmt.rs index c2585d2..663e4d1 100644 --- a/src/impl_fmt.rs +++ b/src/impl_fmt.rs @@ -45,7 +45,7 @@ impl fmt::LowerExp for BigDecimal { impl fmt::LowerExp for BigDecimalRef<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let (abs_int, scale) = get_a...
1
9
9
951904aa09d904aec15e148aa0cdeddb9ea43607
Nicolas Boichat
2025-03-20T13:23:32
impl_fmt: Fix printing of 0 with exponent 0 (aka 0e), 0e15, 0e-15 should all be printed the same way, i.e. the scale should be mapped back to 0. Also add unit tests. Fixes #144.
diff --git a/src/impl_fmt.rs b/src/impl_fmt.rs index d55f71e..c2585d2 100644 --- a/src/impl_fmt.rs +++ b/src/impl_fmt.rs @@ -44,8 +44,8 @@ impl fmt::LowerExp for BigDecimal { impl fmt::LowerExp for BigDecimalRef<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let abs_int = self.digits....
1
70
15
e5d4a3bb56ea9851d84f9d9966377718e4fed6c9
Andrew Kubera
2024-12-08T23:51:52
Begin v0.4.8 development
diff --git a/Cargo.lock b/Cargo.lock index 6916b3d..8afa676 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,7 +8,7 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bigdecimal" -version = "0.4.7" +version = "0.4.8+dev" dependencies = [ "autocfg", "libm", diff -...
2
2
2
ec91b68cb3e744399c1a031e86bd5ac41e5739da
Andrew Kubera
2024-12-08T22:57:18
Version 0.4.7
diff --git a/Cargo.lock b/Cargo.lock index c253aa0..6916b3d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,7 +8,7 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bigdecimal" -version = "0.4.7+dev" +version = "0.4.7" dependencies = [ "autocfg", "libm", diff -...
2
2
2
477947b156bef658f5bbbb1febe76c0c12e71901
Andrew Kubera
2024-12-08T18:57:43
Fix clippy lints
diff --git a/src/arithmetic/cbrt.rs b/src/arithmetic/cbrt.rs index a75b0cf..beb6e51 100644 --- a/src/arithmetic/cbrt.rs +++ b/src/arithmetic/cbrt.rs @@ -46,11 +46,16 @@ pub(crate) fn impl_cbrt_uint_scale( let (mut new_scale, remainder) = shifted_scale.div_rem(&3); - if remainder > 0 { - new_scale += ...
13
46
38
b79739356f2cc8cc04a09745b226e13011e02223
Andrew Kubera
2024-12-06T07:32:10
Fix typo
diff --git a/src/rounding.rs b/src/rounding.rs index 172c5bc..6e408a2 100644 --- a/src/rounding.rs +++ b/src/rounding.rs @@ -296,7 +296,7 @@ pub(crate) struct InsigData { } impl InsigData { - /// Build from insig data and lazily calcuated trailing-zeros callable + /// Build from insig data and lazily calculat...
1
1
1
4e304a89f992c71da7ac44f4b338a42021c07b0a
Andrew Kubera
2024-12-08T18:33:08
Implement ToPrimitive for BigDecimalRef
diff --git a/src/impl_num.rs b/src/impl_num.rs index 73e2621..c5ca352 100644 --- a/src/impl_num.rs +++ b/src/impl_num.rs @@ -11,8 +11,10 @@ use stdlib::str::FromStr; use stdlib::string::{String, ToString}; use stdlib::convert::TryFrom; use stdlib::ops::Neg; +use stdlib::cmp::Ordering; use crate::BigDecimal; +use ...
2
67
15
7fa4d3984a8d3905bddff0c6453301baa11316eb
Andrew Kubera
2024-12-08T16:24:02
Use static byte buffer and add comments to_f64
diff --git a/src/impl_num.rs b/src/impl_num.rs index 9e06f64..73e2621 100644 --- a/src/impl_num.rs +++ b/src/impl_num.rs @@ -146,8 +146,12 @@ impl ToPrimitive for BigDecimal { // approximate number of base-10 digits let digit_count = ((int_cow.bits() + 1) as f64 * stdlib::f64::consts::LOG10_2).floor...
1
30
4
50d14b5c4d1de094e38d115a485f3d773c25e1eb
Andrew Kubera
2024-12-08T15:27:05
Fix types in no-std build
diff --git a/src/impl_num.rs b/src/impl_num.rs index 8316efb..9e06f64 100644 --- a/src/impl_num.rs +++ b/src/impl_num.rs @@ -3,6 +3,9 @@ use num_traits::{Zero, Num, Signed, FromPrimitive, ToPrimitive, AsPrimitive}; use num_bigint::{BigInt, Sign, ToBigInt}; +#[cfg(not(feature = "std"))] +use num_traits::float::Float...
1
5
2
1fca278945dedc387dd31531f346d73b0163e494
Andrew Kubera
2024-12-06T05:44:24
Add new tests for to_f64
diff --git a/src/impl_num.rs b/src/impl_num.rs index cc6b12a..8316efb 100644 --- a/src/impl_num.rs +++ b/src/impl_num.rs @@ -227,4 +227,83 @@ mod test { } } + + mod to_f64 { + use super::*; + use paste::paste; + use crate::stdlib; + + + macro_rules! impl_case { + ...
2
79
17
1c139496efec953000aacae3102eedf01c9f6879
Andrew Kubera
2024-12-06T04:22:24
Reimplement ToPrimitive::to_f64 for BigDecimal
diff --git a/src/impl_num.rs b/src/impl_num.rs index c86681c..cc6b12a 100644 --- a/src/impl_num.rs +++ b/src/impl_num.rs @@ -1,8 +1,9 @@ //! Code for num_traits -use num_traits::{Num, FromPrimitive, ToPrimitive, AsPrimitive}; +use num_traits::{Zero, Num, Signed, FromPrimitive, ToPrimitive, AsPrimitive}; use num_big...
1
41
2
8e0735fd44721522fde26700e614e95c4bccdb79
Andrew Kubera
2024-06-19T06:13:34
Add methods BigDecimal::{into,as}_bigint_and_scale
diff --git a/src/lib.rs b/src/lib.rs index 57495d7..e7cfc87 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -88,6 +88,7 @@ use self::stdlib::str::FromStr; use self::stdlib::string::{String, ToString}; use self::stdlib::fmt; use self::stdlib::Vec; +use self::stdlib::borrow::Cow; use num_bigint::{BigInt, BigUint, Parse...
1
19
0
9ed03956fc81f57c91a34e8df754960d57a25cf7
Andrew Kubera
2024-11-03T02:15:13
Add arithmetic function abs_diff
diff --git a/build.rs b/build.rs index a92fc24..ccb1e18 100644 --- a/build.rs +++ b/build.rs @@ -15,6 +15,9 @@ fn main() { let ac = autocfg::new(); ac.emit_rustc_version(1, 70); + // abs_diff + ac.emit_rustc_version(1, 60); + // slice::fill ac.emit_rustc_version(1, 50); diff --git a/src/ar...
2
16
0
eb77071fe1bf6a6e2535f80aadc3374671970ef2
Andrew Kubera
2024-11-01T23:27:23
Rewrite equality tests with macros
diff --git a/src/lib.rs b/src/lib.rs index bf82b54..57495d7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1628,37 +1628,40 @@ mod bigdecimal_tests { assert!(BigDecimal::try_from(f64::NAN).is_err()); } - #[test] - fn test_equal() { - let vals = vec![ - ("2", ".2e1"), - (...
1
32
29
00a97d680f64cd5312a4ef97219ef9ff3692131e
Andrew Kubera
2024-10-23T04:17:08
Add methods BigDecimal::{to_plain_string, write_plain_string}
diff --git a/src/impl_fmt.rs b/src/impl_fmt.rs index 2a2f898..e791b58 100644 --- a/src/impl_fmt.rs +++ b/src/impl_fmt.rs @@ -120,6 +120,39 @@ fn dynamically_format_decimal( } +pub(crate) struct FullScaleFormatter<'a>(pub BigDecimalRef<'a>); + +impl<'a> fmt::Display for FullScaleFormatter<'a> { + fn fmt(&self, f...
2
90
0
02ce2a116d98ba3012580d68239371b6fbbb7950
Andrew Kubera
2024-10-28T23:56:57
Update tests to reflect new formatting rule
diff --git a/src/impl_fmt.rs b/src/impl_fmt.rs index 1429e65..2a2f898 100644 --- a/src/impl_fmt.rs +++ b/src/impl_fmt.rs @@ -254,7 +254,6 @@ fn format_ascii_digits_with_integer_and_fraction( digit_scale -= scale_diff as u64; } Some(zeros_to_add) => { - debug_ass...
1
50
12
75ad99cf7e073c353979ff7374055ba1523e95c0
Andrew Kubera
2024-10-28T23:53:37
Disable exponential form if formatting with precision
diff --git a/src/impl_fmt.rs b/src/impl_fmt.rs index 58c7370..1429e65 100644 --- a/src/impl_fmt.rs +++ b/src/impl_fmt.rs @@ -107,8 +107,9 @@ fn dynamically_format_decimal( let trailing_zero_threshold = trailing_zero_threshold as u64; // use exponential form if decimal point is outside - // the upper and ...
1
3
2
b1d6a1dde6a1a6cc01d8c97707af6f871b874711
Andrew Kubera
2024-10-28T23:29:07
Specify edition = "2015" in Cargo.toml
diff --git a/Cargo.toml b/Cargo.toml index 8e9fa6d..047452f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,6 +15,7 @@ keywords = [ categories = [ "mathematics", "science", "no-std" ] license = "MIT/Apache-2.0" autobenches = false +edition = "2015" [lib] bench = false
1
1
0
d37b4808790533192e45c60be65e024efc175c8d
Andrew Kubera
2024-10-28T04:21:38
Begin v0.4.7 development
diff --git a/Cargo.lock b/Cargo.lock index c8aaa0b..c253aa0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,7 +8,7 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bigdecimal" -version = "0.4.6" +version = "0.4.7+dev" dependencies = [ "autocfg", "libm", diff -...
2
2
2
2f2a072445fbfe751066c722a96dd4fe4876c607
Andrew Kubera
2024-10-28T04:19:05
Version 0.4.6
diff --git a/Cargo.lock b/Cargo.lock index 3f99449..c8aaa0b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,7 +8,7 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bigdecimal" -version = "0.4.6+dev" +version = "0.4.6" dependencies = [ "autocfg", "libm", diff -...
2
2
2
e3ffe6a46356474ec1faa5ac8b7b2102136b6f34
Andrew Kubera
2024-10-28T02:46:33
Fix clippy lints
diff --git a/src/arithmetic/cbrt.rs b/src/arithmetic/cbrt.rs index 3ed58cc..a75b0cf 100644 --- a/src/arithmetic/cbrt.rs +++ b/src/arithmetic/cbrt.rs @@ -38,7 +38,7 @@ pub(crate) fn impl_cbrt_uint_scale( let required_precision = 3 * required_precision; // number of extra zeros to add to end of integer_digits...
4
5
3
ea5347251c6c04a059ad1463cf7e4c107763e7fb
Andrew Kubera
2024-10-20T05:37:36
Reimplement impl_cbrt_int_scale
diff --git a/src/arithmetic/cbrt.rs b/src/arithmetic/cbrt.rs index 45e63b0..3ed58cc 100644 --- a/src/arithmetic/cbrt.rs +++ b/src/arithmetic/cbrt.rs @@ -2,85 +2,107 @@ use crate::*; use num_bigint::BigUint; +use rounding::NonDigitRoundingData; +use stdlib::num::NonZeroU64; -/// implementation of cuberoot - alwa...
2
113
69
bcf065a6b54791b3f15a8319699752e4de6cf763
Andrew Kubera
2024-10-19T20:03:40
Add method BigDecimalRef::count_trailing_zeroes
diff --git a/src/lib.rs b/src/lib.rs index f3855fe..78cfe31 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1221,6 +1221,19 @@ impl BigDecimalRef<'_> { count_decimal_digits_uint(self.digits) } + /// Return the number of trailing zeros in the referenced integer + #[allow(dead_code)] + fn count_trai...
1
13
0
e94bdaf230889fbc974010fc99853380812e4401
Andrew Kubera
2024-10-17T01:26:27
Add struct WithScale
diff --git a/src/lib.rs b/src/lib.rs index 310d12e..f3855fe 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1310,6 +1310,53 @@ impl<'a> From<&'a BigInt> for BigDecimalRef<'a> { } } + +/// pair i64 'scale' with some other value +#[derive(Clone, Copy)] +struct WithScale<T> { + pub value: T, + pub scale: i64, +...
1
47
0
8886fc057d5d9b700121d442cd4656ddcf91c234
Andrew Kubera
2024-10-17T22:14:36
Add arithmetic function multiply_by_ten_to_the_uint
diff --git a/src/arithmetic/mod.rs b/src/arithmetic/mod.rs index c321f70..e96efb3 100644 --- a/src/arithmetic/mod.rs +++ b/src/arithmetic/mod.rs @@ -62,6 +62,18 @@ pub(crate) fn ten_to_the_uint(pow: u64) -> BigUint { } } +pub(crate) fn multiply_by_ten_to_the_uint<T, P>(n: &mut T, pow: P) + where T: MulAssign...
1
12
0
3c58a3e850d5121405f919f1f71556fb5dfbe567
Andrew Kubera
2024-10-27T23:36:47
Fix compatibility with Rust 1.43
diff --git a/build.rs b/build.rs index 414eba9..a92fc24 100644 --- a/build.rs +++ b/build.rs @@ -15,6 +15,9 @@ fn main() { let ac = autocfg::new(); ac.emit_rustc_version(1, 70); + // slice::fill + ac.emit_rustc_version(1, 50); + // Option::zip ac.emit_rustc_version(1, 46); diff --git a/src...
2
16
1
8e6a9091efc094c73e8d80ba6638bc3ac49b49ae
Andrew Kubera
2024-10-27T21:38:09
Replace usage of apply_rounding_to_ascii_digits with round_ascii_digits
diff --git a/src/impl_fmt.rs b/src/impl_fmt.rs index 5da7ccc..35ff216 100644 --- a/src/impl_fmt.rs +++ b/src/impl_fmt.rs @@ -431,22 +431,16 @@ fn format_exponential_bigendian_ascii_digits( if let Some(prec) = f.precision() { // 'prec' is number of digits after the decimal point let total_prec = p...
1
8
77
65f139aa9f86eca7c37e77fe40b408d1b041d2dd
Andrew Kubera
2024-10-27T21:18:42
Rename precision to target_scale in format_full_scale
diff --git a/src/impl_fmt.rs b/src/impl_fmt.rs index 8943bd9..5da7ccc 100644 --- a/src/impl_fmt.rs +++ b/src/impl_fmt.rs @@ -140,15 +140,19 @@ fn format_full_scale( zero_right_pad_integer_ascii_digits(&mut digits, &mut exp, f.precision()); } else { let scale = this.scale as u64; - // no-pr...
1
8
4
4ac7de5ea3c337e925a2295644b968cd5f6c72e7
Andrew Kubera
2024-10-27T20:03:25
Reimplement zero_right_pad_integer_ascii_digits using NonZeroUsize
diff --git a/src/impl_fmt.rs b/src/impl_fmt.rs index 2e4a0aa..8943bd9 100644 --- a/src/impl_fmt.rs +++ b/src/impl_fmt.rs @@ -171,34 +171,51 @@ fn format_full_scale( fn zero_right_pad_integer_ascii_digits( digits: &mut Vec<u8>, exp: &mut i128, - precision: Option<usize>, + // number of zeros after the d...
1
34
17
1c662f9caf86e5cee24ce51f43414cb9b45a2b99
Andrew Kubera
2024-10-27T06:14:17
Replace shift_or_trim_fractional_digits with format_ascii_digits_no_integer
diff --git a/src/impl_fmt.rs b/src/impl_fmt.rs index 5b0870b..2e4a0aa 100644 --- a/src/impl_fmt.rs +++ b/src/impl_fmt.rs @@ -148,7 +148,7 @@ fn format_full_scale( format_ascii_digits_with_integer_and_fraction(&mut digits, scale, prec, rounder); } else { // format only fractional digit...
1
81
41
188dd0efdf956c953015dbaa0a0395c64d3341c9
Andrew Kubera
2024-10-27T06:14:17
Replace trim_ascii_digits with format_ascii_digits_with_integer_and_fraction
diff --git a/src/impl_fmt.rs b/src/impl_fmt.rs index 522690b..5b0870b 100644 --- a/src/impl_fmt.rs +++ b/src/impl_fmt.rs @@ -145,7 +145,7 @@ fn format_full_scale( if scale < digits.len() as u64 { // format both integer and fractional digits (always 'trim' to precision) - trim_ascii_di...
1
49
23
4374fd17154343395ff8ba281f6d0eb21204607a
Andrew Kubera
2024-10-27T06:14:17
Add impl_fmt function round_ascii_digits
diff --git a/src/impl_fmt.rs b/src/impl_fmt.rs index 080fed5..522690b 100644 --- a/src/impl_fmt.rs +++ b/src/impl_fmt.rs @@ -4,6 +4,7 @@ use crate::*; use rounding::{NonDigitRoundingData, InsigData}; use stdlib::fmt::Write; +use stdlib::num::NonZeroUsize; // const EXPONENTIAL_FORMAT_LEADING_ZERO_THRESHOLD: usiz...
1
72
0
4e5717d2029a80a814ca82e420f7439187a7bb6c
Andrew Kubera
2024-10-27T16:09:46
Change behavior of 'exp' variable in format_full_scale
diff --git a/src/impl_fmt.rs b/src/impl_fmt.rs index a7e8ea7..080fed5 100644 --- a/src/impl_fmt.rs +++ b/src/impl_fmt.rs @@ -126,7 +126,7 @@ fn format_full_scale( use stdlib::cmp::Ordering::*; let mut digits = abs_int.into_bytes(); - let mut exp = (this.scale as i128).neg(); + let mut exp = 0; le...
1
3
4
bbebcd507d39ab95c22e21378f05d7cdef898910
Andrew Kubera
2024-10-26T17:06:32
Use NonDigitRoundingData & InsigData in impl_fmt
diff --git a/src/context.rs b/src/context.rs index 2b0e58d..388d742 100644 --- a/src/context.rs +++ b/src/context.rs @@ -95,6 +95,7 @@ impl Context { } /// Round digits x and y with the rounding mode + #[allow(dead_code)] pub(crate) fn round_pair(&self, sign: Sign, x: u8, y: u8, trailing_zeros: bool...
2
20
13
e4d462981f0bac129c8f1ab8b1828a3262c005eb
Andrew Kubera
2024-10-27T22:59:10
Add tests dec_d9999
diff --git a/src/impl_fmt.rs b/src/impl_fmt.rs index 058f442..3275184 100644 --- a/src/impl_fmt.rs +++ b/src/impl_fmt.rs @@ -721,6 +721,32 @@ mod test { impl_case!(fmt_p05d1: "{:+05.7}" => "+123456.0000000"); } + mod dec_d099995 { + use super::*; + + fn test_input()...
1
79
1
145efc519994ca46530c3d9c8bfa970618462deb
Andrew Kubera
2024-10-26T15:43:07
Impl Default for RoundingMode
diff --git a/src/context.rs b/src/context.rs index c3226e2..2b0e58d 100644 --- a/src/context.rs +++ b/src/context.rs @@ -9,8 +9,6 @@ use arithmetic::store_carry; // const DEFAULT_PRECISION: u64 = ${RUST_BIGDECIMAL_DEFAULT_PRECISION} or 100; include!(concat!(env!("OUT_DIR"), "/default_precision.rs")); -// const DEFA...
2
18
3
74d7e1bdcce8d42d4baf4c2caa785c17fd805e5c
Andrew Kubera
2024-10-19T18:23:29
Add rounding methods to Context and BigDecimalRef
diff --git a/src/context.rs b/src/context.rs index 39ca6d1..c3226e2 100644 --- a/src/context.rs +++ b/src/context.rs @@ -85,6 +85,17 @@ impl Context { self.rounding } + /// Round decimal to precision in this context, using rounding-mode + pub fn round_decimal(&self, n: BigDecimal) -> BigDecimal { ...
2
63
0
9570915b528dd53a6f5ff6235994473ecc2705db
Andrew Kubera
2024-10-20T05:47:00
Add round_* methods to InsigData
diff --git a/src/arithmetic/mod.rs b/src/arithmetic/mod.rs index 73fcfc3..c321f70 100644 --- a/src/arithmetic/mod.rs +++ b/src/arithmetic/mod.rs @@ -162,7 +162,6 @@ pub(crate) fn store_carry(n: u8, carry: &mut u8) -> u8 { /// /// If carry overflows, it is NOT pushed into the destination vector. /// -#[allow(dead_cod...
2
31
2
161634ba1929a7718ac80ee44f7320458c0a7984
Andrew Kubera
2024-10-25T23:34:37
Add arithmetic function extend_adding_carry
diff --git a/src/arithmetic/mod.rs b/src/arithmetic/mod.rs index 0e3e6de..73fcfc3 100644 --- a/src/arithmetic/mod.rs +++ b/src/arithmetic/mod.rs @@ -156,3 +156,27 @@ pub(crate) fn store_carry(n: u8, carry: &mut u8) -> u8 { n - 10 } } + + +/// Extend destination vector with values in D, adding carry while...
1
24
0
fc6f99dbe669deb9f3b72127e6ff9355aaaf9b7d
Andrew Kubera
2024-10-19T20:09:36
Add NonDigitRoundingData to InsigData
diff --git a/src/rounding.rs b/src/rounding.rs index 28a6caf..ec43b57 100644 --- a/src/rounding.rs +++ b/src/rounding.rs @@ -273,6 +273,9 @@ pub(crate) struct InsigData { /// This is only useful if relevant for the rounding mode, it /// may be 'wrong' in these cases. pub trailing_zeros: bool, + + /// ...
1
13
7
94e55752e0863f293954281e33085cd09432b25c
Andrew Kubera
2024-10-13T17:07:39
Add method InsigData::from_digit_and_lazy_trailing_zeros
diff --git a/src/rounding.rs b/src/rounding.rs index fed29e2..28a6caf 100644 --- a/src/rounding.rs +++ b/src/rounding.rs @@ -276,6 +276,18 @@ pub(crate) struct InsigData { } impl InsigData { + /// Build from insig data and lazily calcuated trailing-zeros callable + pub fn from_digit_and_lazy_trailing_zeros( +...
1
12
0
1cd14c72e459dbc868514d8d637f05b890467380
Andrew Kubera
2024-10-27T23:02:58
Add unexpected_cfgs to lints.rust in Cargo.toml
diff --git a/Cargo.toml b/Cargo.toml index 7cf1911..1fcb60d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,3 +53,6 @@ std = ["num-bigint/std", "num-integer/std", "num-traits/std"] # BENCH: [[bench]] # BENCH: name = "arithmetic" # BENCH: harness = false + +[lints.rust] +unexpected_cfgs = { level = "allow", check-cfg...
1
3
0
db9abc58a0e1772280f96e48525997a1e9066063
Andrew Kubera
2024-10-25T23:13:21
Add method BigDecimal::from_bigint
diff --git a/src/lib.rs b/src/lib.rs index 166879d..abcdecd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -219,8 +219,16 @@ fn exp2(x: f64) -> f64 { impl BigDecimal { /// Creates and initializes a `BigDecimal`. /// + /// The more explicit method `from_bigint` should be preferred, as new + /// may change ...
1
10
1
56cf0abc6972f88720cc63b6d8df163a48d2fe30
Andrew Kubera
2024-10-18T04:22:46
Add method BigDecimal::from_biguint
diff --git a/src/lib.rs b/src/lib.rs index 9798277..166879d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -227,6 +227,11 @@ impl BigDecimal { } } + /// Construct positive BigDecimal from BigUint and a scale + pub fn from_biguint(digits: BigUint, scale: i64) -> BigDecimal { + BigDecimal::new(B...
1
32
0
e30e9d54572d5877e2426f9fcbec95ee3147d8ec
Andrew Kubera
2024-10-02T22:30:30
Rewrite multiplication tests with macros
diff --git a/src/impl_ops_mul.rs b/src/impl_ops_mul.rs index 181ce9d..a1cbc43 100644 --- a/src/impl_ops_mul.rs +++ b/src/impl_ops_mul.rs @@ -213,72 +213,70 @@ impl MulAssign<BigInt> for BigDecimal { #[cfg(test)] #[allow(non_snake_case)] mod bigdecimal_tests { - use crate::{stdlib, BigDecimal, ToString, FromStr, T...
1
60
62
9f86db4f5562178c12c5896a62327159bb9ff181
Andrew Kubera
2024-10-19T19:00:36
Update BigDecimal::round tests and doc
diff --git a/src/lib.rs b/src/lib.rs index 1a5f201..9798277 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -773,7 +773,13 @@ impl BigDecimal { result.take_with_sign(self.sign()) } - /// Return number rounded to round_digits precision after the decimal point + /// Return given number rounded to 'round...
1
12
1
9d7622b4fc158ef3439d1cbfe75c3e5d1d6dd415
Danilo Pedraza
2024-10-19T18:45:35
replace `round` implementation with call to `with_scale_round`
diff --git a/src/lib.rs b/src/lib.rs index 108d5e1..1a5f201 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -775,94 +775,7 @@ impl BigDecimal { /// Return number rounded to round_digits precision after the decimal point pub fn round(&self, round_digits: i64) -> BigDecimal { - // we have fewer digits than...
1
1
88
e558021784220dc5a47b91a09e4a4a229722d254
Andrew Kubera
2024-10-19T17:33:03
Fix logic in RoundingMode::needs_trailing_zeros
diff --git a/src/rounding.rs b/src/rounding.rs index f81b943..fed29e2 100644 --- a/src/rounding.rs +++ b/src/rounding.rs @@ -215,8 +215,12 @@ impl RoundingMode { fn needs_trailing_zeros(&self, insig_digit: u8) -> bool { use RoundingMode::*; - insig_digit == 0 - || (insig_digit == 5 && matc...
1
6
2
cc0f857c4ea4f233e0e2b0f941f78d4322180b76
Andrew Kubera
2024-10-02T21:48:19
Rewrite cbrt tests using macros
diff --git a/src/arithmetic/cbrt.rs b/src/arithmetic/cbrt.rs index 8887fb9..45e63b0 100644 --- a/src/arithmetic/cbrt.rs +++ b/src/arithmetic/cbrt.rs @@ -89,46 +89,46 @@ mod test { use super::*; use stdlib::num::NonZeroU64; - #[test] - fn test_cbrt() { - let vals = vec![ - ("0.00", "0...
1
35
35
0a5037e25bc960c2f1aaa57c034d1276d30e270c
Andrew Kubera
2024-10-19T17:18:12
Fix clippy lints
diff --git a/src/arithmetic/addition.rs b/src/arithmetic/addition.rs index 67b7d5d..bf7136b 100644 --- a/src/arithmetic/addition.rs +++ b/src/arithmetic/addition.rs @@ -116,8 +116,8 @@ pub(crate) fn addassign_bigdecimal_ref<'a, T: Into<BigDecimalRef<'a>>>( } /// Add BigDecimal references which have the same scale (...
2
5
5
0a4a5562e8123c85365268344e060acaf267d941
Andrew Kubera
2024-10-18T04:34:39
Add modified sqrt methods
diff --git a/src/lib.rs b/src/lib.rs index 6a07b5c..b219110 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1315,6 +1315,26 @@ impl BigDecimalRef<'_> { } } + /// Take square root of absolute-value of the number + pub fn sqrt_abs_with_context(&self, ctx: &Context) -> BigDecimal { + use Sign::*;...
1
20
0
119ec23e6ef67c21de15a7b10e6aaeb34245edb0
Andrew Kubera
2024-10-19T15:35:26
Increase number of trailing-zero digit checks in sqrt_impl
diff --git a/src/arithmetic/sqrt.rs b/src/arithmetic/sqrt.rs index 52cad80..d0c0ff8 100644 --- a/src/arithmetic/sqrt.rs +++ b/src/arithmetic/sqrt.rs @@ -6,18 +6,19 @@ use crate::*; pub(crate) fn impl_sqrt(n: &BigUint, scale: i64, ctx: &Context) -> BigDecimal { // Calculate the number of digits and the difference ...
1
6
3
2bb77d581dc5fbda8b7faf67d7ef866664ca9ec3
Andrew Kubera
2024-10-19T16:53:17
Remove unused function sqrt::impl_division
diff --git a/src/arithmetic/sqrt.rs b/src/arithmetic/sqrt.rs index 1127609..52cad80 100644 --- a/src/arithmetic/sqrt.rs +++ b/src/arithmetic/sqrt.rs @@ -2,79 +2,6 @@ use crate::*; -fn impl_division(mut num: BigUint, den: &BigUint, mut scale: i64, max_precision: u64) -> BigDecimal { - use Sign::Plus; - - // q...
1
0
73
8ba1b9877cef21d54df64eb8890d96a7e8899939
Andrew Kubera
2024-10-06T17:09:57
Rewrite sqrt tests using macros
diff --git a/src/arithmetic/sqrt.rs b/src/arithmetic/sqrt.rs index 7a916d9..1127609 100644 --- a/src/arithmetic/sqrt.rs +++ b/src/arithmetic/sqrt.rs @@ -104,60 +104,81 @@ pub(crate) fn impl_sqrt(n: &BigUint, scale: i64, ctx: &Context) -> BigDecimal { mod test { use super::*; - #[test] - fn test_sqrt() { -...
1
72
83
fcdf76b34ee0ad52f9f7a853b8d30553a9a95f5e
Joris Guex
2024-08-04T11:33:30
Add test_sqrt_rounding()
diff --git a/src/arithmetic/sqrt.rs b/src/arithmetic/sqrt.rs index c67843c..7a916d9 100644 --- a/src/arithmetic/sqrt.rs +++ b/src/arithmetic/sqrt.rs @@ -158,6 +158,38 @@ mod test { } } + #[test] + fn test_sqrt_rounding() { + let vals = vec![ + // sqrt(1.21) = 1.1, [Ceiling, Up] s...
1
32
0
ed6cfc3c6046c71cce15fb23281dfebdd1c2771b
Joris Guex
2024-07-31T11:55:44
Reimplement impl_sqrt for performance
diff --git a/src/arithmetic/sqrt.rs b/src/arithmetic/sqrt.rs index 6b3f1d2..c67843c 100644 --- a/src/arithmetic/sqrt.rs +++ b/src/arithmetic/sqrt.rs @@ -2,7 +2,6 @@ use crate::*; - fn impl_division(mut num: BigUint, den: &BigUint, mut scale: i64, max_precision: u64) -> BigDecimal { use Sign::Plus; @@ -78,6...
2
26
72
8d38646bfacdf1480cfce86bb8fe569fb19547f4
Joris Guex
2024-07-31T11:49:27
Make sqrt benchmark use different precision values
diff --git a/benches/arithmetic.rs b/benches/arithmetic.rs index 04ff995..8f7af2e 100644 --- a/benches/arithmetic.rs +++ b/benches/arithmetic.rs @@ -331,14 +331,17 @@ pub fn criterion_benchmark(c: &mut Criterion) { }, criterion::BatchSize::SmallInput)); - c.bench_function( - "sqrt"...
1
13
10
eb23c1ceebc230256d4a15fef659d46b2b2b2837
Andrew Kubera
2024-07-18T06:30:09
Remove scale_diff parameter from add_unaligned_bigdecimal_ref_ref
diff --git a/src/arithmetic/addition.rs b/src/arithmetic/addition.rs index 5a53254..67b7d5d 100644 --- a/src/arithmetic/addition.rs +++ b/src/arithmetic/addition.rs @@ -69,10 +69,10 @@ where add_aligned_bigdecimal_ref_ref(lhs, rhs) } Greater => { - add_unaligned_bigdecimal_ref_...
1
7
5
5426f821cd310d40846718b416e6e3b4ba36b7e0
Andrew Kubera
2024-04-06T03:34:47
Reimplement add_bigdecimal_refs with to_owned_with_scale
diff --git a/src/arithmetic/addition.rs b/src/arithmetic/addition.rs index eb91afa..5a53254 100644 --- a/src/arithmetic/addition.rs +++ b/src/arithmetic/addition.rs @@ -56,18 +56,12 @@ where let lhs = lhs.into(); let rhs = rhs.into(); if rhs.is_zero() { - if lhs.scale < rhs.scale { - le...
1
4
10
e2dc222eeca8d5431a2394dead8150cf9f088603
Andrew Kubera
2024-04-04T03:29:05
Optimize BigDecimalRef::to_owned_with_scale for small scales
diff --git a/src/lib.rs b/src/lib.rs index b8a42ef..be1cb39 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1248,10 +1248,22 @@ impl BigDecimalRef<'_> { pub fn to_owned_with_scale(&self, scale: i64) -> BigDecimal { use stdlib::cmp::Ordering::*; - let digits = match scale.cmp(&self.scale) { - ...
1
16
4
6bdde969ca59e5b440499800f893981dfc489e62
Andrew Kubera
2024-03-25T01:56:19
Reimplement add_bigdecimal_refs with Context
diff --git a/src/arithmetic/addition.rs b/src/arithmetic/addition.rs index a70beea..eb91afa 100644 --- a/src/arithmetic/addition.rs +++ b/src/arithmetic/addition.rs @@ -45,23 +45,41 @@ fn add_aligned_bigdecimals( pub(crate) fn add_bigdecimal_refs<'a, 'b, Lhs, Rhs>( lhs: Lhs, rhs: Rhs, + ctx: Option<&Conte...
3
70
7
9d05e4255ab3cb83c128727d571b824703a0cf61
Andrew Kubera
2024-07-17T23:55:49
Create arithmetic/addition.tests.rs
diff --git a/src/arithmetic/addition.rs b/src/arithmetic/addition.rs index 374d794..a70beea 100644 --- a/src/arithmetic/addition.rs +++ b/src/arithmetic/addition.rs @@ -102,3 +102,11 @@ pub(crate) fn addassign_bigdecimal_ref<'a, T: Into<BigDecimalRef<'a>>>( } } } + + +#[cfg(test)] +mod test { + use su...
2
42
0
1f574c91067fe3d2b9e704bf09da5292df2ae440
Andrew Kubera
2024-04-04T03:25:01
Use extend_scale_to in add_bigdecimals
diff --git a/src/arithmetic/addition.rs b/src/arithmetic/addition.rs index 11f04b9..374d794 100644 --- a/src/arithmetic/addition.rs +++ b/src/arithmetic/addition.rs @@ -9,18 +9,12 @@ pub(crate) fn add_bigdecimals( mut b: BigDecimal, ) -> BigDecimal { if b.is_zero() { - if a.scale < b.scale { - ...
1
2
8
f6dbe33dcd7f690bda16570ca3a45b2836ac7f23
Andrew Kubera
2024-04-04T03:24:35
Add method BigDecimal::extend_scale_to
diff --git a/src/lib.rs b/src/lib.rs index e2a3568..b8a42ef 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -428,6 +428,13 @@ impl BigDecimal { } } + /// set scale only if new_scale is greater than current + pub(crate) fn extend_scale_to(&mut self, new_scale: i64) { + if new_scale > self.scale ...
1
7
0
0484449a339239ac09f8a054a15b12b0f9f36a1c
Andrew Kubera
2024-06-21T03:32:08
Add and use RoundingMode::round_pair_with_carry
diff --git a/src/context.rs b/src/context.rs index 02a1ee1..39ca6d1 100644 --- a/src/context.rs +++ b/src/context.rs @@ -100,8 +100,7 @@ impl Context { trailing_zeros: bool, carry: &mut u8, ) -> u8 { - let r = self.round_pair(sign, x, y, trailing_zeros); - store_carry(r, carry) + ...
2
14
10
844702f29e4450de249f1213728625e83728a3f4
Andrew Kubera
2024-03-24T17:41:22
Add struct rounding::NonDigitRoundingData
diff --git a/src/rounding.rs b/src/rounding.rs index 3ea14e6..12d00e0 100644 --- a/src/rounding.rs +++ b/src/rounding.rs @@ -4,6 +4,7 @@ use crate::*; use crate::arithmetic::{add_carry, store_carry}; use stdlib; + /// Determines how to calculate the last digit of the number /// /// Default rounding mode is HalfU...
1
33
0
35d1526955c5716a4f44f66fd2ba27f91242d7fe
Andrew Kubera
2024-04-14T19:42:06
Add struct rounding::InsigData
diff --git a/src/rounding.rs b/src/rounding.rs index ef51476..3ea14e6 100644 --- a/src/rounding.rs +++ b/src/rounding.rs @@ -1,6 +1,7 @@ //! Rounding structures and subroutines -use crate::Sign; +use crate::*; +use crate::arithmetic::{add_carry, store_carry}; use stdlib; /// Determines how to calculate the last ...
1
104
1
c0ae547e0d2dae6cdfcb7ea063ee9d2d3f78ec53
Andrew Kubera
2024-03-24T17:47:17
Add method RoundingMode::needs_trailing_zeros
diff --git a/src/rounding.rs b/src/rounding.rs index 0a39655..ef51476 100644 --- a/src/rounding.rs +++ b/src/rounding.rs @@ -195,6 +195,15 @@ impl RoundingMode { // shift rounded value back to position full * splitter } + + /// Hint used to skip calculating trailing_zeros if they don't matter ...
1
9
0
07810767fa7d06109610f6cb224788e6f58506a8
Andrew Kubera
2024-02-10T21:44:56
Add slice to stdlib
diff --git a/src/with_std.rs b/src/with_std.rs index ace3082..0d0ef58 100644 --- a/src/with_std.rs +++ b/src/with_std.rs @@ -13,6 +13,7 @@ mod stdlib { num, ops, iter, + slice, str, string, i8, diff --git a/src/without_std.rs b/src/without_std.rs index deac48...
2
2
0
adbccdef675da822e6b8f08cedd4c4fb1971f0ac
Andrew Kubera
2024-06-21T01:50:21
Use store_carry in Context::round_pair_with_carry
diff --git a/src/context.rs b/src/context.rs index 32beda9..02a1ee1 100644 --- a/src/context.rs +++ b/src/context.rs @@ -4,6 +4,8 @@ use crate::*; use stdlib::num::NonZeroU64; +use arithmetic::store_carry; + // const DEFAULT_PRECISION: u64 = ${RUST_BIGDECIMAL_DEFAULT_PRECISION} or 100; include!(concat!(env!("OU...
1
11
7
43fa8e8434401f8e19762311999d9d577ef60841
Andrew Kubera
2024-03-24T21:09:03
Add functions arithmetic::{add_carry, store_carry}
diff --git a/src/arithmetic/mod.rs b/src/arithmetic/mod.rs index c6df8fc..0e3e6de 100644 --- a/src/arithmetic/mod.rs +++ b/src/arithmetic/mod.rs @@ -123,3 +123,36 @@ pub(crate) fn diff_usize(a: usize, b: usize) -> (Ordering, usize) { Equal => (Equal, 0), } } + + +/// Add carry to given number, returning ...
1
33
0
6d328a3fc4e50615915d6cb6a0e5c7829c4674d1
Andrew Kubera
2024-06-17T07:51:47
(clippy) Remove unnecessary &
diff --git a/src/arithmetic/sqrt.rs b/src/arithmetic/sqrt.rs index d2a56df..6b3f1d2 100644 --- a/src/arithmetic/sqrt.rs +++ b/src/arithmetic/sqrt.rs @@ -105,7 +105,7 @@ pub(crate) fn impl_sqrt(n: &BigUint, scale: i64, ctx: &Context) -> BigDecimal { // division needs to be precise to (at least) one extra digit ...
1
1
1
dcf95c2f7ed2ee1fdf30910639d50717fa170c44
Andrew Kubera
2024-06-17T07:46:16
Begin 0.4.6 development
diff --git a/Cargo.lock b/Cargo.lock index 9245ced..3f99449 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,7 +8,7 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bigdecimal" -version = "0.4.5" +version = "0.4.6+dev" dependencies = [ "autocfg", "libm", diff -...
2
2
2
682343b7c54fa17bc5fff5a30ec95f810f83f1bf
Andrew Kubera
2024-06-17T07:26:22
Version 0.4.5
diff --git a/Cargo.lock b/Cargo.lock index 4b47646..9245ced 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,7 +8,7 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bigdecimal" -version = "0.4.5+dev" +version = "0.4.5" dependencies = [ "autocfg", "libm", diff -...
2
2
2
dc70ccaf2c088e39e45319acb9bb21fb6d03a101
Andrew Kubera
2024-06-17T06:55:49
Replace more references of usize with u64 for 32-bit arch
diff --git a/src/impl_fmt.rs b/src/impl_fmt.rs index 9d4c4d6..058f442 100644 --- a/src/impl_fmt.rs +++ b/src/impl_fmt.rs @@ -134,11 +134,11 @@ fn format_full_scale( // formatting an integer value (add trailing zeros to the right) zero_right_pad_integer_ascii_digits(&mut digits, &mut exp, f.precision()...
1
26
14
a64bdbf4131c96b3bcb26d0fa24c5acd151f5515
Andrew Kubera
2024-06-17T06:48:32
Fix digit counting for 32-bit arch in impl_fmt
diff --git a/src/impl_fmt.rs b/src/impl_fmt.rs index 27e6488..9d4c4d6 100644 --- a/src/impl_fmt.rs +++ b/src/impl_fmt.rs @@ -87,20 +87,23 @@ fn dynamically_format_decimal( // number of zeros between most significant digit and decimal point let leading_zero_count = this.scale - ...
1
6
3
570ed33c31c2b7e32f5ad46f733953e882f70f70
Andrew Kubera
2024-06-17T06:08:18
Standardize capitalization
diff --git a/src/impl_fmt.rs b/src/impl_fmt.rs index 2e2ce0d..27e6488 100644 --- a/src/impl_fmt.rs +++ b/src/impl_fmt.rs @@ -151,7 +151,7 @@ fn format_full_scale( // add exp part to buffer (if not zero) if exp != 0 { - write!(buf, "E{:+}", exp)?; + write!(buf, "e{:+}", exp)?; } // ...
1
4
4
bee64e846ac3f9a70b09d9e8972214e4ded58804
Andrew Kubera
2024-06-17T06:04:37
Remove invalid unwrap
diff --git a/src/impl_fmt.rs b/src/impl_fmt.rs index 380aa10..2e2ce0d 100644 --- a/src/impl_fmt.rs +++ b/src/impl_fmt.rs @@ -169,7 +169,10 @@ fn zero_right_pad_integer_ascii_digits( ) { debug_assert!(*exp >= 0); - let trailing_zero_count = exp.to_usize().unwrap(); + let trailing_zero_count = match exp.to_...
1
4
1
7fbff809a39753bbd6fa0390dd33d30751f9ae70
Andrew Kubera
2024-06-17T05:14:56
Remove version restrictions of num-crate dependencies
diff --git a/Cargo.toml b/Cargo.toml index 86ab82c..d8eded5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,9 +21,9 @@ bench = false [dependencies] libm = "0.2.6" -num-bigint = { version = ">=0.3.0,<0.4.5", default-features = false } -num-integer = { version = "^0.1", default-features = false } -num-traits = { vers...
1
3
3
8a328805e334c4aa43cbbb99f5fbe6e75e96bfe4
Andrew Kubera
2024-06-17T04:56:14
Add Cargo.lock
diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..4b47646 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,157 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lan...
1
157
0
bf3fe0597a26fe19b9d41ce7ae96446f6f07ac26
Andrew Kubera
2024-06-15T16:05:40
Add test for comparision of decimals with large mangitude scales
diff --git a/src/impl_cmp.rs b/src/impl_cmp.rs index 69be708..058a369 100644 --- a/src/impl_cmp.rs +++ b/src/impl_cmp.rs @@ -378,6 +378,20 @@ mod test { impl_test!(case_1116xx459_759xx717e2: "1116386634271380982470843247639640260491505327092723527088459" < "75952262576965174613861725918993975189390245329124350...
1
14
0
99b89516c766328780399f5180098c7f070e1cad
Andrew Kubera
2024-06-15T13:29:02
Begin v0.4.5 development
diff --git a/Cargo.toml b/Cargo.toml index ad1ee1f..86ab82c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bigdecimal" -version = "0.4.4" +version = "0.4.5+dev" authors = ["Andrew Kubera"] description = "Arbitrary precision decimal numbers" documentation = "https://docs.rs/bigdecimal"
1
1
1
86cecb4e0f8d1c0e94cafd8650928ec63f834942
Andrew Kubera
2024-06-15T13:00:18
Version 0.4.4
diff --git a/Cargo.toml b/Cargo.toml index 1a9e125..ad1ee1f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bigdecimal" -version = "0.4.4+dev" +version = "0.4.4" authors = ["Andrew Kubera"] description = "Arbitrary precision decimal numbers" documentation = "https://docs.rs/bigdecimal"
1
1
1
2633ef3d529c1fd2b46c41a16224d39828ff686a
Andrew Kubera
2024-06-13T04:25:42
Further restrict versions of num-* dependencies
diff --git a/Cargo.toml b/Cargo.toml index 9d98248..1a9e125 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,9 +21,9 @@ bench = false [dependencies] libm = "0.2.6" -num-bigint = { version = "<0.4.5", default-features = false } -num-integer = { version = "0.1", default-features = false } -num-traits = { version = "<0...
1
3
3
5c8be4221beaf60bf0221570815a2ba25be3934b
Andrew Kubera
2024-06-12T05:22:51
Add missing conditional
diff --git a/src/impl_serde.rs b/src/impl_serde.rs index 1b25fd5..d299a5f 100644 --- a/src/impl_serde.rs +++ b/src/impl_serde.rs @@ -5,6 +5,7 @@ use crate::*; use serde_crate::{self as serde, de, ser, Serialize, Deserialize}; // const SERDE_SCALE_LIMIT: usize = = ${RUST_BIGDECIMAL_SERDE_SCALE_LIMIT} or 150_000; +#...
1
1
0