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 |
|---|---|---|---|---|---|---|---|
4aaba34afa1eddf4a6c92d8d0ec6b45fc5588d26 | Andrew Kubera | 2025-10-09T01:56:05 | Allow breaking some more formatting rules | diff --git a/src/arithmetic/multiplication.rs b/src/arithmetic/multiplication.rs
index 408f516..1afe841 100644
--- a/src/arithmetic/multiplication.rs
+++ b/src/arithmetic/multiplication.rs
@@ -1,6 +1,7 @@
//! Routines for multiplying numbers
//!
#![allow(dead_code)]
+#![allow(clippy::identity_op)]
use stdlib::num... | 3 | 4 | 0 |
89fa650d4bf6dbc1bb6f85b5c91de797fe92fa3e | Andrew Kubera | 2025-10-09T01:41:19 | Refactor is_one_quickcheck into signed and unsigned parts | diff --git a/src/lib.rs b/src/lib.rs
index 82dddd5..45fa51d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1413,14 +1413,30 @@ impl<'a> BigDecimalRef<'a> {
/// A check if this decimal is equal to one for purposes of optimization
/// Returns None if the computation would be expensive
pub fn is_one_quickchec... | 2 | 22 | 5 |
730acb9755d75093e39ae4e593ff3c1885f05b69 | Andrew Kubera | 2025-10-09T01:06:32 | Fix setting decimal scale and sign when multiplying | diff --git a/src/arithmetic/multiplication.rs b/src/arithmetic/multiplication.rs
index fdf87c1..408f516 100644
--- a/src/arithmetic/multiplication.rs
+++ b/src/arithmetic/multiplication.rs
@@ -62,6 +62,7 @@ pub(crate) fn multiply_decimals_with_context<'a, A, B>(
ctx.precision(),
rounding_data,... | 1 | 6 | 3 |
8f7dc2958f52c7fe31ffe833aa987b16cae8506e | Andrew Kubera | 2025-10-08T01:38:50 | Minor formatting fixes | diff --git a/src/arithmetic/decimal.rs b/src/arithmetic/decimal.rs
index becfad9..b97df35 100644
--- a/src/arithmetic/decimal.rs
+++ b/src/arithmetic/decimal.rs
@@ -200,7 +200,7 @@ pub(crate) fn count_digits_biguint(n: &num_bigint::BigUint) -> u64 {
let mut digits = (n.bits() as f64 / super::LOG2_10) as u64;
... | 14 | 48 | 64 |
40b0e30f36447e127d925c62739cc61bbcc05a17 | Andrew Kubera | 2025-10-08T01:26:45 | Add and use function multiply_scaled_u64_into_decimal | diff --git a/src/arithmetic/multiplication.rs b/src/arithmetic/multiplication.rs
index 69347d6..c4a50af 100644
--- a/src/arithmetic/multiplication.rs
+++ b/src/arithmetic/multiplication.rs
@@ -33,8 +33,7 @@ pub(crate) fn multiply_decimals_with_context<'a, A, B>(
a: A,
b: B,
ctx: &Context,
-)
-where
+) wh... | 1 | 62 | 3 |
f3519dc10c33267c89409ae4f5091dbf960759f2 | Andrew Kubera | 2025-10-07T06:22:13 | Add count_digits_u128 | diff --git a/src/arithmetic/decimal.rs b/src/arithmetic/decimal.rs
index 6831c00..becfad9 100644
--- a/src/arithmetic/decimal.rs
+++ b/src/arithmetic/decimal.rs
@@ -53,6 +53,49 @@ pub fn dec_shift_right_u64(x: u64, n: usize) -> u64 {
macro_rules! count_digits {
+ ($n:ident : u128) => {
+ if $n >= ... | 1 | 52 | 0 |
7a10538e61a4154ea9c79ef604fc0c0e54be427f | Andrew Kubera | 2025-10-06T23:14:52 | Add methods for multiplying BigDecimals using context | diff --git a/src/context.rs b/src/context.rs
index 2a1575c..cf1581d 100644
--- a/src/context.rs
+++ b/src/context.rs
@@ -130,6 +130,32 @@ impl Context {
) -> u8 {
self.rounding.round_pair_with_carry(sign, (x, y), trailing_zeros, carry)
}
+
+ /// Multiply two decimals, returning product rounded to ... | 2 | 39 | 1 |
e77b277cafec5ea795c43ac5f6880ed91bb84d22 | Andrew Kubera | 2025-10-06T02:46:40 | Add function multiplication::mul_scaled_slices_truncating_into | diff --git a/src/arithmetic/multiplication.rs b/src/arithmetic/multiplication.rs
index 57e62c5..69347d6 100644
--- a/src/arithmetic/multiplication.rs
+++ b/src/arithmetic/multiplication.rs
@@ -526,6 +526,67 @@ fn calculate_partial_product_trailing_zeros(
return false;
}
+/// Calculate dest = a * b to at most 'p... | 2 | 62 | 1 |
ea78bbcbb3944470d2eb1676d49b9a088aea45c2 | Andrew Kubera | 2025-10-05T18:45:00 | Allow ignoring trailing-zero calculation in multiply_slices_with_prec_into_p19_z and update doc-comments | diff --git a/src/arithmetic/multiplication.rs b/src/arithmetic/multiplication.rs
index 9c93715..57e62c5 100644
--- a/src/arithmetic/multiplication.rs
+++ b/src/arithmetic/multiplication.rs
@@ -177,14 +177,38 @@ pub(crate) fn multiply_big_int_with_ctx(a: &BigInt, b: &BigInt, ctx: Context) ->
}
}
-
-#[allow(unrea... | 1 | 46 | 5 |
b18ee20aaf53b230c5b53415667f06317ea80396 | Andrew Kubera | 2025-10-05T18:20:44 | Rewrite multiply_at_product_index to be generic in Radix and Endianness | diff --git a/src/arithmetic/multiplication.rs b/src/arithmetic/multiplication.rs
index 852a371..9c93715 100644
--- a/src/arithmetic/multiplication.rs
+++ b/src/arithmetic/multiplication.rs
@@ -88,35 +88,39 @@ where
/// Carrying from lower digits is not calculated, so care must be given
/// to ensure data enough digit... | 1 | 17 | 13 |
755a73f65fee656c31ea99f806da8bc9482bfbfa | Andrew Kubera | 2025-10-05T00:39:06 | Add method DigitVec::remove_insignificant_digits | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index d660173..ef68de2 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -69,6 +69,20 @@ impl<R: RadixType, E: Endianness> DigitVec<R, E> {
self.digits.truncate(n);
}
+ /// Remove 'n' insignificant from the vector
... | 1 | 14 | 0 |
494c8676cbf8235534ac6706de05a37691da4990 | Andrew Kubera | 2025-10-05T00:30:19 | Add method Endian::remove_insignificant_digits | diff --git a/src/bigdigit/endian.rs b/src/bigdigit/endian.rs
index 5219827..6548073 100644
--- a/src/bigdigit/endian.rs
+++ b/src/bigdigit/endian.rs
@@ -86,6 +86,9 @@ pub(crate) trait Endianness: Copy + Clone + Default + fmt::Debug {
Self::iter_slice(digits).rev().position(|d| !d.is_zero()).unwrap_or(digits.le... | 1 | 22 | 0 |
6a89db6049aa6701a253b4bdd4799a046afb8cde | Andrew Kubera | 2025-10-03T02:38:56 | Add method Endianness::reorder_be_vec | diff --git a/src/bigdigit/endian.rs b/src/bigdigit/endian.rs
index 4c5fd80..5219827 100644
--- a/src/bigdigit/endian.rs
+++ b/src/bigdigit/endian.rs
@@ -91,6 +91,11 @@ pub(crate) trait Endianness: Copy + Clone + Default + fmt::Debug {
/// Reverses for BigEndian, no-op for LittleEndian
fn reorder_le_digits<D: ... | 1 | 27 | 0 |
d7a4f68a74c833fe16f30bbeff30360bc99bc78b | Andrew Kubera | 2025-10-01T04:11:47 | Strip leading zero in DigitVec conversions | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index 9c4fef7..d660173 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -518,6 +518,9 @@ impl From<DigitVec<RADIX_10p19_u64, LittleEndian>> for DigitVec<RADIX_u64, Littl
let (sum, overflow) = src.digits[0].overflowi... | 1 | 3 | 0 |
9d1878477c3bad33a21751435fbdd58595cdb97a | Andrew Kubera | 2025-10-01T04:08:49 | Use is_all_zeros in multiply_slices_with_prec_into_p19 | diff --git a/src/arithmetic/multiplication.rs b/src/arithmetic/multiplication.rs
index f076fb2..852a371 100644
--- a/src/arithmetic/multiplication.rs
+++ b/src/arithmetic/multiplication.rs
@@ -191,17 +191,9 @@ pub(crate) fn multiply_slices_with_prec_into_p19(
return multiply_slices_with_prec_into_p19(dest, b, ... | 1 | 1 | 9 |
f2b26ad0ec791efe2bbb3e9280d6f8a91f262b01 | Andrew Kubera | 2025-10-01T03:29:06 | Add is_all_zeros method to DigitVec & DigitSlice | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index 12d61d9..9c4fef7 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -107,6 +107,11 @@ impl<R: RadixType, E: Endianness> DigitVec<R, E> {
E::count_significant_zeros(self.digits.as_slice())
}
+ /// true if empty... | 1 | 10 | 0 |
2b86caae650a0f93dc7490b4460bfdfd52f0a2bb | Andrew Kubera | 2025-10-01T02:40:13 | Add tests for multiply_scaled_u64_slices_with_prec_into | diff --git a/src/arithmetic/multiplication.tests.rs b/src/arithmetic/multiplication.tests.rs
index 303b71d..c075f27 100644
--- a/src/arithmetic/multiplication.tests.rs
+++ b/src/arithmetic/multiplication.tests.rs
@@ -1,5 +1,126 @@
use paste::paste;
+mod multiply_scaled_u64_slices_with_prec_into {
+ use super::*;
... | 1 | 124 | 8 |
6dfe08091e428b709d13e3a841be5b49726d4156 | Andrew Kubera | 2025-10-01T02:44:35 | Rewrite multiply_slices_with_prec_into as multiply_scaled_u64_slices_with_prec_into | diff --git a/src/arithmetic/multiplication.rs b/src/arithmetic/multiplication.rs
index 97840b5..f076fb2 100644
--- a/src/arithmetic/multiplication.rs
+++ b/src/arithmetic/multiplication.rs
@@ -61,10 +61,10 @@ where
let digit_vec = BigDigitVec::new();
let mut digit_vec_scale = WithScale::from((digit_vec, 0));
... | 1 | 11 | 18 |
30c145fd7dd64ed5e949c18159c4605294f1986b | Andrew Kubera | 2025-09-30T06:33:58 | Add methods mulassign_u64 and mulassign_add_carry | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index 7dd2ead..12d61d9 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -192,6 +192,19 @@ impl<R: RadixType> DigitVec<R, BigEndian> {
}
}
+impl<E: Endianness> DigitVec<RADIX_u64, E> {
+ /// multiply this vector by 'n'
+ ... | 2 | 24 | 0 |
248e04eb8d5f7627f465b2fe10bf2f6480903665 | Andrew Kubera | 2025-09-28T21:52:00 | Move trailing-zero trimming into multiply_slices_with_prec_into_p19 | diff --git a/src/arithmetic/multiplication.rs b/src/arithmetic/multiplication.rs
index 83b3e88..97840b5 100644
--- a/src/arithmetic/multiplication.rs
+++ b/src/arithmetic/multiplication.rs
@@ -11,14 +11,14 @@ use crate::rounding::{NonDigitRoundingData, InsigData};
use super::log10;
use crate::bigdigit::{
- radix... | 1 | 27 | 30 |
f278f9b9c540048149fad78b3bca04c3723cb8c6 | Andrew Kubera | 2025-07-17T04:20:46 | Add test_round_biguint_inplace | diff --git a/src/rounding.tests.rs b/src/rounding.tests.rs
index f530541..fe74b92 100644
--- a/src/rounding.tests.rs
+++ b/src/rounding.tests.rs
@@ -269,3 +269,97 @@ mod test_round_u32 {
impl_test!(8 :: Down => 0);
}
}
+
+
+#[allow(non_snake_case)]
+mod test_round_biguint_inplace {
+ use super::*;
+ ... | 1 | 94 | 0 |
972f482019c237dc7b18d04a8315a64cfc26bb4d | Andrew Kubera | 2025-07-17T01:57:22 | Add and use libm::log10 | diff --git a/src/arithmetic/mod.rs b/src/arithmetic/mod.rs
index bbc8a1a..38031d9 100644
--- a/src/arithmetic/mod.rs
+++ b/src/arithmetic/mod.rs
@@ -24,6 +24,11 @@ mod funcs {
pub fn exp2(x: f64) -> f64 {
libm::exp2(x)
}
+
+ // f64::log10 is only available in std, we have to use an external crate ... | 2 | 12 | 2 |
d230b44d1e345838dbd9827c2da8a74aad723a6e | Andrew Kubera | 2025-07-16T12:16:32 | Add method RadixPowerTen::divceil_digit_count | diff --git a/src/arithmetic/multiplication.rs b/src/arithmetic/multiplication.rs
index 5807254..0c0e834 100644
--- a/src/arithmetic/multiplication.rs
+++ b/src/arithmetic/multiplication.rs
@@ -1,8 +1,6 @@
//! Routines for multiplying numbers
//!
#![allow(dead_code)]
-#![allow(unreachable_code)]
-#![allow(unused_vari... | 2 | 18 | 14 |
6c4c060d5ebd827cb1a32f2cff615f9e69129949 | Andrew Kubera | 2025-07-13T21:04:26 | Remove use of slice.fill | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index e385841..7dd2ead 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -627,10 +627,10 @@ impl DigitVec<RADIX_10_u8, LittleEndian> {
match sig_digits.iter().position(|&d| d != 9) {
Some(idx) => {
... | 1 | 14 | 2 |
6fa3c61ffdf63d0699f59845e4c73d110cc653db | Andrew Kubera | 2025-07-07T23:38:51 | Implement calculate_partial_product_trailing_zeros | diff --git a/src/arithmetic/multiplication.rs b/src/arithmetic/multiplication.rs
index 6708d36..5807254 100644
--- a/src/arithmetic/multiplication.rs
+++ b/src/arithmetic/multiplication.rs
@@ -285,7 +285,7 @@ pub(crate) fn multiply_slices_with_prec_into_p19(
// keep adding more multiplication terms if the number e... | 1 | 142 | 34 |
978887066132b1aedd2c46a316328142fc05b61f | Andrew Kubera | 2025-07-07T22:50:43 | Implement overflow handler in multiply_slices_with_prec_into_p19 | diff --git a/src/arithmetic/multiplication.rs b/src/arithmetic/multiplication.rs
index 44d7888..6708d36 100644
--- a/src/arithmetic/multiplication.rs
+++ b/src/arithmetic/multiplication.rs
@@ -310,7 +310,21 @@ pub(crate) fn multiply_slices_with_prec_into_p19(
);
if carry != 0 {
- todo!()
+ deb... | 1 | 15 | 1 |
8ada8ca19ba9b414b53fd01a64e0926584a299b3 | Andrew Kubera | 2025-07-07T23:42:19 | Update multiplication tests | diff --git a/src/arithmetic/multiplication.tests.rs b/src/arithmetic/multiplication.tests.rs
index cc37aa4..303b71d 100644
--- a/src/arithmetic/multiplication.tests.rs
+++ b/src/arithmetic/multiplication.tests.rs
@@ -153,7 +153,40 @@ mod multiply_big_int_with_ctx {
};
}
- mod mulz_stuff {
+ mod mu... | 1 | 122 | 19 |
a391aff738991a9f7dbd1082f64f920f952d8580 | Andrew Kubera | 2025-07-04T00:16:29 | Add DigitVec<RADIX_u64>::from_10p19_digits | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index 4696a86..e385841 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -197,6 +197,84 @@ impl DigitVec<RADIX_u64, LittleEndian> {
pub fn into_bigint(self, sign: Sign) -> BigInt {
BigInt::from_biguint(sign, self.into()... | 1 | 78 | 0 |
9415997c6088f9f17562953a2372f5072d7f68a9 | Andrew Kubera | 2025-07-08T00:27:31 | DigitVec::shift_n_digits_returning_high | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index fcb7b56..4696a86 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -239,6 +239,51 @@ impl DigitVec<RADIX_10p19_u64, LittleEndian> {
Self::from_2p64le_vec(tmp)
}
+ /// remove the bottom 'n' digits in the vecto... | 1 | 45 | 0 |
842f5c71965de63e378b5027f32ed1a2800dbc22 | Andrew Kubera | 2025-06-30T23:22:59 | Add test_from_biguint_using_tmp | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index 78a4761..fcb7b56 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -422,6 +422,39 @@ impl From<&num_bigint::BigUint> for DigitVec<RADIX_10_u8, LittleEndian> {
}
}
+#[cfg(test)]
+mod test_from_biguint_using_tmp {
+ us... | 1 | 33 | 0 |
10352a84507f5a0005c4ad66e0c6f259269f1c32 | Andrew Kubera | 2025-06-30T23:21:41 | Fix and update doc-comments for DigitVec BigInt | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index 54441d0..78a4761 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -229,6 +229,7 @@ impl From<&DigitVec<RADIX_u64, LittleEndian>> for num_bigint::BigUint {
}
impl DigitVec<RADIX_10p19_u64, LittleEndian> {
+ /// Convert a... | 1 | 7 | 7 |
19b5e8e0c2537dddad028c3c5240028f07a97905 | Andrew Kubera | 2025-06-29T20:38:10 | Add function multiply_slices_with_prec_into_p19 | diff --git a/src/arithmetic/multiplication.rs b/src/arithmetic/multiplication.rs
index 3e30647..44d7888 100644
--- a/src/arithmetic/multiplication.rs
+++ b/src/arithmetic/multiplication.rs
@@ -1,6 +1,8 @@
//! Routines for multiplying numbers
//!
#![allow(dead_code)]
+#![allow(unreachable_code)]
+#![allow(unused_vari... | 1 | 173 | 55 |
4369608ac012b0febc203879272d43e3d0e3543e | Andrew Kubera | 2025-07-01T21:57:41 | Implement and test multiply_at_product_index | diff --git a/src/arithmetic/multiplication.rs b/src/arithmetic/multiplication.rs
index 42e1a74..3e30647 100644
--- a/src/arithmetic/multiplication.rs
+++ b/src/arithmetic/multiplication.rs
@@ -71,6 +71,55 @@ where
dest.scale = a.scale + b.scale - digit_vec_scale.scale;
}
+
+/// Multiply digits in slices a and b... | 2 | 146 | 0 |
461fd5ac37865d4b6fa3b8c655c5c5591080fe84 | Andrew Kubera | 2025-09-24T02:43:03 | Add DigitVec::get_rounding_digits_at_prec | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index d0ea605..54441d0 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -424,6 +424,23 @@ impl From<&num_bigint::BigUint> for DigitVec<RADIX_10_u8, LittleEndian> {
/// Vector of base-10 digits
impl DigitVec<RADIX_10_u8, LittleEn... | 1 | 17 | 0 |
53e000f3bcef102f007e89d000d27f3cb3bd0e14 | Andrew Kubera | 2025-06-29T16:58:01 | Change meaning of returned scale in RoundingMode::round_bigint_to_prec | diff --git a/src/arithmetic/multiplication.tests.rs b/src/arithmetic/multiplication.tests.rs
index f3915d3..54639dd 100644
--- a/src/arithmetic/multiplication.tests.rs
+++ b/src/arithmetic/multiplication.tests.rs
@@ -49,10 +49,10 @@ mod multiply_big_int_with_ctx {
let product = multiply_big_int_with_ctx(&x... | 2 | 6 | 6 |
737f5f1d95f751fe32ba9ab8e1af7fd9b3173902 | Andrew Kubera | 2025-06-29T14:46:51 | Add and use const BASE2_BIGINT_MUL_THRESHOLD | diff --git a/src/arithmetic/multiplication.rs b/src/arithmetic/multiplication.rs
index d8b8dc7..42e1a74 100644
--- a/src/arithmetic/multiplication.rs
+++ b/src/arithmetic/multiplication.rs
@@ -23,6 +23,8 @@ type BigDigitSliceP19<'a> = DigitSlice<'a, RADIX_10p19_u64, LittleEndian>;
type SmallDigitVec = DigitVec<RADIX... | 1 | 5 | 3 |
2919ee8b73bcfa1ba3e80494c712f2c2358d0793 | Andrew Kubera | 2025-06-29T04:04:20 | Reimplement multiply_big_int_with_ctx | diff --git a/src/arithmetic/multiplication.rs b/src/arithmetic/multiplication.rs
index 7f04bf2..d8b8dc7 100644
--- a/src/arithmetic/multiplication.rs
+++ b/src/arithmetic/multiplication.rs
@@ -6,10 +6,10 @@ use stdlib::num::NonZeroU64;
use num_traits::AsPrimitive;
use crate::*;
-use crate::rounding::NonDigitRoundin... | 1 | 34 | 11 |
c0533bc51db6d436956a25e6af136a6547534cd2 | Andrew Kubera | 2025-06-29T01:48:57 | Add bigint/biguint rounding methods to Context and RoundingMode | diff --git a/src/context.rs b/src/context.rs
index 8e24509..2a1575c 100644
--- a/src/context.rs
+++ b/src/context.rs
@@ -94,6 +94,24 @@ impl Context {
d.with_precision_round(self.precision(), self.rounding_mode())
}
+ /// Round the bigint to the context's precision, returning it along with
+ /// t... | 2 | 103 | 0 |
b435a5651f98b8449bd169d5fe82587b243330d9 | Andrew Kubera | 2025-05-07T05:19:38 | Add module arithmetic::modulo | diff --git a/src/arithmetic/mod.rs b/src/arithmetic/mod.rs
index 0ef9a97..bbc8a1a 100644
--- a/src/arithmetic/mod.rs
+++ b/src/arithmetic/mod.rs
@@ -8,6 +8,7 @@ pub(crate) mod decimal;
pub(crate) mod addition;
pub(crate) mod multiplication;
+pub(crate) mod modulo;
pub(crate) mod sqrt;
pub(crate) mod cbrt;
pub(cr... | 2 | 40 | 0 |
31932b92c56d3c3d08ce6d6a35c03024a044c785 | Andrew Kubera | 2025-06-18T02:28:00 | Add method DigitVec<LittleEndian>::remove_significant_digits | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index b6fdf9b..d0ea605 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -174,6 +174,15 @@ impl<R: RadixPowerOfTen, E: Endianness> DigitVec<R, E> {
}
}
+impl<R: RadixType> DigitVec<R, LittleEndian> {
+ /// allocate with n ... | 1 | 9 | 0 |
bb52819f25414671b6b4ae02668aed9b2dcee087 | Andrew Kubera | 2025-06-15T16:41:57 | Add DigitVec::as_digit_slice_at | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index 04960d5..b6fdf9b 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -71,20 +71,17 @@ impl<R: RadixType, E: Endianness> DigitVec<R, E> {
/// Borrow inner vectory as immutable digit-slice
pub fn as_digit_slice(&self) -... | 1 | 7 | 10 |
6ce9254d7a3102b6ae6aaed3fc3ad7a13e2cbfe2 | Andrew Kubera | 2025-06-04T01:44:19 | Change multiplication test macros | diff --git a/src/arithmetic/multiplication.tests.rs b/src/arithmetic/multiplication.tests.rs
index b075256..f3915d3 100644
--- a/src/arithmetic/multiplication.tests.rs
+++ b/src/arithmetic/multiplication.tests.rs
@@ -27,7 +27,7 @@ mod multiply_big_int_with_ctx {
}
}
};
- ($... | 1 | 13 | 8 |
9d9a1d660fdbab412fd363ce7abbdf9c37905099 | Andrew Kubera | 2025-06-01T17:29:42 | Use crate::* in arithmetic::multiplication | diff --git a/src/arithmetic/multiplication.rs b/src/arithmetic/multiplication.rs
index 91d3efe..7f04bf2 100644
--- a/src/arithmetic/multiplication.rs
+++ b/src/arithmetic/multiplication.rs
@@ -2,18 +2,11 @@
//!
#![allow(dead_code)]
-use num_bigint::{Sign, BigInt, BigUint};
-use num_integer::Integer;
-use num_traits... | 1 | 3 | 12 |
89034774aac581b631b0c2babe4a6a753875f1f1 | Andrew Kubera | 2025-05-10T19:15:40 | Add method DigitVec<10u8>::round_at_prec_inplace | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index 4b3a0ab..04960d5 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -3,10 +3,13 @@
use crate::*;
use stdlib::marker::PhantomData;
+use stdlib::num::NonZeroU64;
use super::radix::*;
use super::endian::*;
+use crate::rou... | 1 | 50 | 0 |
ecd92da88f81cc88566d214bf821189fa5a4ac9a | Andrew Kubera | 2025-05-10T19:36:25 | Add methods for DigitVec <-> BigUint conversion | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index 491160f..4b3a0ab 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -184,15 +184,10 @@ impl<R: RadixType> DigitVec<R, BigEndian> {
}
impl DigitVec<RADIX_u64, LittleEndian> {
- pub fn from_biguint(n: &num_bigint::BigUint) ... | 2 | 33 | 8 |
34f3769cb079576f02d1ad0a046fac7594c49e05 | Andrew Kubera | 2025-05-10T19:04:27 | Rewrite multiplication tests with macros | diff --git a/src/arithmetic/multiplication.tests.rs b/src/arithmetic/multiplication.tests.rs
index 6759792..b075256 100644
--- a/src/arithmetic/multiplication.tests.rs
+++ b/src/arithmetic/multiplication.tests.rs
@@ -1,266 +1,194 @@
-use num_bigint::{BigUint, BigInt};
+use paste::paste;
mod multiply_big_int_with_ctx... | 1 | 146 | 218 |
b958ba9a3759e70cf66353fac9f72bb9ed57e8e8 | Andrew Kubera | 2025-05-09T04:27:58 | Simplify multiply_slices_with_prec_into | diff --git a/src/arithmetic/multiplication.rs b/src/arithmetic/multiplication.rs
index 8bb992e..91d3efe 100644
--- a/src/arithmetic/multiplication.rs
+++ b/src/arithmetic/multiplication.rs
@@ -178,11 +178,11 @@ pub(crate) fn multiply_slices_with_prec_into(
let dest_insig_count = dest.len().saturating_sub(requested... | 1 | 3 | 3 |
03fa8a2ebd60411795b941d567f53a08e4581892 | Andrew Kubera | 2025-05-09T02:33:37 | Add tests for multiply_big_int_with_ctx | diff --git a/src/arithmetic/multiplication.tests.rs b/src/arithmetic/multiplication.tests.rs
index fe3c7b3..6759792 100644
--- a/src/arithmetic/multiplication.tests.rs
+++ b/src/arithmetic/multiplication.tests.rs
@@ -1,44 +1,266 @@
-use paste::paste;
+use num_bigint::{BigUint, BigInt};
+mod multiply_big_int_with_ctx ... | 1 | 257 | 35 |
137fa2095ce0a8c36c04cd038f006edfd9f633f7 | Andrew Kubera | 2025-05-06T23:20:30 | Move arithmetic::multiplication tests to separate file | diff --git a/src/arithmetic/multiplication.rs b/src/arithmetic/multiplication.rs
index 5e79f32..8bb992e 100644
--- a/src/arithmetic/multiplication.rs
+++ b/src/arithmetic/multiplication.rs
@@ -595,45 +595,7 @@ pub(crate) fn multiply_quad_spread_into_wrapping(
}
#[cfg(test)]
-mod test_multiply_quad_spread_into {
+mo... | 2 | 46 | 40 |
8aba868382e03240929f1a9f6c083f3bf28a27d9 | Andrew Kubera | 2025-06-18T02:28:00 | Add count_decimal_digits to PowerOfTen DigitVec/DigitSlice/DigitSliceMut | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index f2a54e6..491160f 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -168,6 +168,11 @@ impl<R: RadixType, E: Endianness> DigitVec<R, E> {
}
}
+impl<R: RadixPowerOfTen, E: Endianness> DigitVec<R, E> {
+ pub fn count_dec... | 1 | 22 | 0 |
3d2c52571aa41c4d18b019845ac804fc7a3521aa | Andrew Kubera | 2025-05-06T22:53:13 | Move bigint counting functions to arithmetic::decimal | diff --git a/src/arithmetic/mod.rs b/src/arithmetic/mod.rs
index 4248d66..0ef9a97 100644
--- a/src/arithmetic/mod.rs
+++ b/src/arithmetic/mod.rs
@@ -12,6 +12,11 @@ pub(crate) mod sqrt;
pub(crate) mod cbrt;
pub(crate) mod inverse;
+pub(crate) use self::decimal::{
+ count_digits_bigint as count_decimal_digits,
+ ... | 2 | 8 | 2 |
784ec7cdd56a695fe37e07e9024087b91b769b66 | Andrew Kubera | 2025-05-09T02:33:37 | Add function multiply_decimals_with_context | diff --git a/src/arithmetic/multiplication.rs b/src/arithmetic/multiplication.rs
index aceae7a..5e79f32 100644
--- a/src/arithmetic/multiplication.rs
+++ b/src/arithmetic/multiplication.rs
@@ -2,8 +2,198 @@
//!
#![allow(dead_code)]
-use num_traits::AsPrimitive;
+use num_bigint::{Sign, BigInt, BigUint};
use num_int... | 1 | 191 | 1 |
beb1a4b9cd67fd703ba5302c1bfc0ef653a0f364 | Andrew Kubera | 2023-07-09T05:58:52 | Add module arithmetic::multiplication | diff --git a/src/arithmetic/mod.rs b/src/arithmetic/mod.rs
index b96908b..4248d66 100644
--- a/src/arithmetic/mod.rs
+++ b/src/arithmetic/mod.rs
@@ -7,6 +7,7 @@ use num_traits::AsPrimitive;
pub(crate) mod decimal;
pub(crate) mod addition;
+pub(crate) mod multiplication;
pub(crate) mod sqrt;
pub(crate) mod cbrt;
... | 2 | 450 | 0 |
2399aa60f08b07569430350771f7a2de9e03e22a | Andrew Kubera | 2025-05-04T18:01:52 | Replace decimal-shift lookup tables with hardcoded divides | diff --git a/src/arithmetic/decimal.rs b/src/arithmetic/decimal.rs
index 0fa866e..6831c00 100644
--- a/src/arithmetic/decimal.rs
+++ b/src/arithmetic/decimal.rs
@@ -5,114 +5,53 @@
//!
#![allow(dead_code)]
-/// Lookup table used to divide u32 by a power of ten, using
-/// a multiply and a shift-right
-///
-/// Presu... | 1 | 38 | 99 |
37fde8fa59de25d8cbc7387c4e2a365dc335f7fc | Andrew Kubera | 2023-07-08T18:30:12 | Add decimal shifting functions to arithmetic::decimal | diff --git a/src/arithmetic/decimal.rs b/src/arithmetic/decimal.rs
index 6666c4e..0fa866e 100644
--- a/src/arithmetic/decimal.rs
+++ b/src/arithmetic/decimal.rs
@@ -1,5 +1,117 @@
//! Algorithms for manipulating decimal digits
//!
+//! Note: Many bit-optimizations don't apply when doing decimal
+//! math, as hig... | 2 | 187 | 0 |
8a37dc2470d7f9db8de8f42c9eedb36442eafae6 | Andrew Kubera | 2025-09-22T04:36:56 | Test AddAssignAlignment | diff --git a/src/bigdigit/alignment.tests.rs b/src/bigdigit/alignment.tests.rs
index ee71333..c5ccea6 100644
--- a/src/bigdigit/alignment.tests.rs
+++ b/src/bigdigit/alignment.tests.rs
@@ -34,6 +34,58 @@ mod from_lengths_and_scales {
use super::*;
use paste::*;
+ macro_rules! impl_test {
+ (($x:li... | 1 | 55 | 3 |
f2bce9fa0b9f00c4f50cd5a667273c3536b437c8 | Andrew Kubera | 2025-09-22T04:08:28 | Add struct WithIntCount to bigdigit::alignment | diff --git a/src/bigdigit/alignment.rs b/src/bigdigit/alignment.rs
index aa737fd..ca01412 100644
--- a/src/bigdigit/alignment.rs
+++ b/src/bigdigit/alignment.rs
@@ -74,6 +74,22 @@ impl AddAssignSliceAlignment {
}
}
}
+
+ /// Determine relative alignment of digit-arrays of given length
+ ... | 1 | 29 | 0 |
ad4ff6c12e45cf120417964b635f0941bf3e47d1 | Andrew Kubera | 2025-09-21T22:08:38 | Move radix tests to separate file | diff --git a/src/bigdigit/radix.rs b/src/bigdigit/radix.rs
index e366602..5702da4 100644
--- a/src/bigdigit/radix.rs
+++ b/src/bigdigit/radix.rs
@@ -389,85 +389,5 @@ impl RadixType for RADIX_10_u8 {
mod tests {
use super::*;
- mod radix_10p19_u64 {
- use super::*;
- use super::RADIX_10p19_u64 a... | 2 | 83 | 81 |
98b7d817ec9be3d433692473b64bbbefd4e48a36 | Andrew Kubera | 2025-08-26T23:36:41 | Add methods Endian::{rotate_trailing_le_digits_at,reorder_le_digits} | diff --git a/src/bigdigit/endian.rs b/src/bigdigit/endian.rs
index d052bbf..acb6aed 100644
--- a/src/bigdigit/endian.rs
+++ b/src/bigdigit/endian.rs
@@ -85,6 +85,19 @@ pub(crate) trait Endianness: Copy + Clone + Default + fmt::Debug {
fn count_significant_zeros<D: Zero>(digits: &[D]) -> usize {
Self::iter... | 1 | 32 | 0 |
6c79090d68271fc06a4c3c653ef509b525bbb3a8 | Andrew Kubera | 2025-08-26T04:27:58 | Add enum AddAssignSliceAlignment and tests | diff --git a/src/arithmetic/mod.rs b/src/arithmetic/mod.rs
index 3690b31..b96908b 100644
--- a/src/arithmetic/mod.rs
+++ b/src/arithmetic/mod.rs
@@ -134,7 +134,6 @@ where
}
/// Return difference of two numbers, returning diff as usize
-#[allow(dead_code)]
pub(crate) fn diff_usize<T>(a: T, b: T) -> (Ordering, usize... | 3 | 174 | 38 |
d9aede1348b659a45a4009b55ae7a869bffecc8a | Andrew Kubera | 2025-09-22T04:15:17 | Reimplement diff_usize to use generic arguments | diff --git a/src/arithmetic/mod.rs b/src/arithmetic/mod.rs
index edc8aa7..3690b31 100644
--- a/src/arithmetic/mod.rs
+++ b/src/arithmetic/mod.rs
@@ -2,6 +2,7 @@
use crate::*;
use num_traits::CheckedSub;
+use num_traits::AsPrimitive;
pub(crate) mod decimal;
@@ -134,12 +135,15 @@ where
/// Return difference o... | 1 | 7 | 3 |
abc34b24afa00e60828bf33394c8b18966827204 | Andrew Kubera | 2025-09-16T00:38:27 | Add count and split methods to DigitVec and DigitSlice | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index cf982f5..f2a54e6 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -84,6 +84,29 @@ impl<R: RadixType, E: Endianness> DigitVec<R, E> {
}
}
+ /// Split slice at 'pos' least-significant digits
+ pub fn split_... | 1 | 46 | 0 |
2b4c24dacaf7eb3df49ef330295e2b6b3c030770 | Andrew Kubera | 2025-09-16T00:21:31 | Add methods to split slices to Endianness | diff --git a/src/bigdigit/endian.rs b/src/bigdigit/endian.rs
index 21817cd..d052bbf 100644
--- a/src/bigdigit/endian.rs
+++ b/src/bigdigit/endian.rs
@@ -69,6 +69,14 @@ pub(crate) trait Endianness: Copy + Clone + Default + fmt::Debug {
/// Split significant zeros from digits returning pair (digits, zeros)
fn s... | 1 | 26 | 0 |
5d25c7190308e31bcaa5c93b8f6958f7cf470b2c | Andrew Kubera | 2025-09-15T09:33:48 | Impl DoubleEndedIterator and ExactSizeIterator for LittleEndianBigDigitIter | diff --git a/src/bigdigit/endian.rs b/src/bigdigit/endian.rs
index 5d28083..21817cd 100644
--- a/src/bigdigit/endian.rs
+++ b/src/bigdigit/endian.rs
@@ -282,6 +282,21 @@ impl<D> Iterator for LittleEndianBigDigitIter<'_, D> {
}
}
+#[cfg(not(rustc_1_75))]
+impl<D> DoubleEndedIterator for LittleEndianBigDigitIter<... | 1 | 15 | 0 |
7a1ba0dd998242a31c6580d215aa36612312f5b2 | Andrew Kubera | 2025-09-15T09:33:19 | Add method Endian::count_significant_zeros | diff --git a/src/bigdigit/endian.rs b/src/bigdigit/endian.rs
index c870740..5d28083 100644
--- a/src/bigdigit/endian.rs
+++ b/src/bigdigit/endian.rs
@@ -72,6 +72,11 @@ pub(crate) trait Endianness: Copy + Clone + Default + fmt::Debug {
/// Remove any zeros at the location of highest significance, if all zeros
... | 1 | 5 | 0 |
3846444f6a652845317739008ff74ec7165c8852 | Andrew Kubera | 2025-09-14T23:45:58 | Add custom implementation of Debug for Digit{Vec,Slice,SliceMut} | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index 10c9220..cf982f5 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -13,7 +13,7 @@ use super::endian::*;
/// Value of the integer is defined by the radix and endianness
/// type parameters.
///
-#[derive(Clone, Debug, Default... | 2 | 27 | 3 |
46db4f320c2112432e9114d8547dd193208ba564 | Andrew Kubera | 2025-09-12T07:14:41 | Add RadixType::addassign_with_carry | diff --git a/src/bigdigit/radix.rs b/src/bigdigit/radix.rs
index 8452879..e366602 100644
--- a/src/bigdigit/radix.rs
+++ b/src/bigdigit/radix.rs
@@ -113,6 +113,14 @@ pub trait RadixType: Copy + Clone + Default + fmt::Debug {
*n = lo;
}
+ /// Perform n += a + carry, returning overflow in carry
+ fn... | 1 | 8 | 0 |
10760a1b238e37b6961e502c58709febcec69edb | Andrew Kubera | 2025-09-12T05:54:44 | Add methods {iter_le, iter_le_mut} to DigitVec and DigitSlices | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index 2c0234c..10c9220 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -13,7 +13,7 @@ use super::endian::*;
/// Value of the integer is defined by the radix and endianness
/// type parameters.
///
-#[derive(Debug, Default)]
+#[d... | 1 | 51 | 1 |
2551d0c5c265b3145ecc3fbc3b1442a69606912f | Andrew Kubera | 2025-08-31T16:36:02 | Add methods DigitSlice::without_leading_zeros and Endianness::split_significant_zeros | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index 5588e4a..2c0234c 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -400,6 +400,12 @@ impl<'a, R: RadixType, E: Endianness> DigitSlice<'a, R, E> {
pub fn len(&self) -> usize {
self.digits.len()
}
+
+ /// Re... | 2 | 27 | 0 |
6020fe7724be22e53a6e849ae41e7ea4b07e2932 | Andrew Kubera | 2025-06-29T06:49:56 | Add methods for Digit{Vec,Slice} conversion | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index b515f87..5588e4a 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -1,11 +1,8 @@
//! Digit vectors (and slices) of arbitrary radix and endianness
-use stdlib::{
- Vec,
- marker::PhantomData,
-};
+use crate::*;
-use n... | 1 | 214 | 6 |
996a8e7a67a39a3f6992bdb777d8672d5d5ff6db | Andrew Kubera | 2025-06-18T02:50:57 | Add method RADIX_10p19_u64::rotating_div_u64_radix | diff --git a/src/bigdigit/radix.rs b/src/bigdigit/radix.rs
index 9107fb5..8452879 100644
--- a/src/bigdigit/radix.rs
+++ b/src/bigdigit/radix.rs
@@ -262,6 +262,19 @@ impl RadixPowerOfTen for RADIX_10p4_i16 {
const DIGITS: usize = 4;
}
+impl RADIX_10p19_u64 {
+ /// Divide double-wide u64 by radix, storing the... | 1 | 13 | 0 |
6d4516b8455317c7799b34ff0909d18bf76a6fe6 | Andrew Kubera | 2025-07-07T22:48:58 | Add method RadixType::add_carry_into | diff --git a/src/bigdigit/radix.rs b/src/bigdigit/radix.rs
index c7e7f73..9107fb5 100644
--- a/src/bigdigit/radix.rs
+++ b/src/bigdigit/radix.rs
@@ -174,9 +174,18 @@ pub trait RadixType: Copy + Clone + Default + fmt::Debug {
/// Starts adding at index 0.
///
fn add_carry_into_slice(dest: &mut [Self::Base... | 1 | 10 | 1 |
c9e67e8a06ebcfe135f184e422f2be0aa352fce0 | Andrew Kubera | 2025-06-29T14:24:50 | Add method RadixType::sub_with_carry_borrow | diff --git a/src/bigdigit/radix.rs b/src/bigdigit/radix.rs
index cfa87d5..c7e7f73 100644
--- a/src/bigdigit/radix.rs
+++ b/src/bigdigit/radix.rs
@@ -26,6 +26,7 @@ pub trait RadixType: Copy + Clone + Default + fmt::Debug {
+ num_traits::WrappingSub
+ num_traits::Pow<u8, Output = Self::Base>
+ ... | 1 | 24 | 0 |
49f59e6c7a4044f73790bf5ddaa3ec731c7aa9f2 | Andrew Kubera | 2025-09-03T23:32:20 | Move alignment tests to separate file | diff --git a/src/bigdigit/alignment.tests.rs b/src/bigdigit/alignment.tests.rs
new file mode 100644
index 0000000..30dd3b6
--- /dev/null
+++ b/src/bigdigit/alignment.tests.rs
@@ -0,0 +1,43 @@
+use bigdigit::radix::RADIX_10p9_u32;
+use bigdigit::radix::RADIX_10p19_u64;
+
+
+#[test]
+fn split_987654321_low_3() {
+ let... | 1 | 43 | 0 |
765600bfec6aa22b68a4692988feb80a443c0cff | Andrew Kubera | 2025-06-29T20:36:31 | Add module bigdigit::alignment | diff --git a/src/bigdigit/alignment.rs b/src/bigdigit/alignment.rs
new file mode 100644
index 0000000..6e67427
--- /dev/null
+++ b/src/bigdigit/alignment.rs
@@ -0,0 +1,423 @@
+//! Splitting and shifting bigdigits for alignment
+//!
+
+use crate::*;
+use super::radix::RadixPowerOfTen;
+use super::endian::LittleEndian;
+... | 2 | 424 | 0 |
00312e474879ba70e824e3a7c971f66ae838d97a | Andrew Kubera | 2025-06-19T21:47:08 | Add function arithmetic::ten_to_the_the_t | diff --git a/src/arithmetic/mod.rs b/src/arithmetic/mod.rs
index bc31e55..edc8aa7 100644
--- a/src/arithmetic/mod.rs
+++ b/src/arithmetic/mod.rs
@@ -42,6 +42,15 @@ pub(crate) fn ten_to_the_u64(pow: u8) -> u64 {
10u64.pow(pow as u32)
}
+/// Return 10^{pow} as output
+pub(crate) fn ten_to_the_t<T>(pow: u8) -> T
+... | 1 | 9 | 0 |
1da05ecf4537fb5f9264749e4f7e7b9f3ffd9193 | Andrew Kubera | 2025-08-13T15:09:16 | Add method Endianness::addassign_carry_into_slice_at | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index 2487fa8..b515f87 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -113,7 +113,7 @@ impl<R: RadixType, E: Endianness> DigitVec<R, E> {
let overflow = self.as_digit_slice_mut().add_value_at(0, n);
if !overflo... | 2 | 56 | 7 |
819cb5b4d9b71379b5d10d5332d3a1d2d26a4ebe | Andrew Kubera | 2025-06-29T01:33:00 | Move strip_significiant_zeros implementation to Endianness | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index 7538b06..2487fa8 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -116,14 +116,15 @@ impl<R: RadixType, E: Endianness> DigitVec<R, E> {
E::push_significant_digit(&mut self.digits, overflow);
}
}
-}
... | 2 | 30 | 7 |
1ec7bcbb5b54dcf1cd9aeb971d615830f84f9067 | Andrew Kubera | 2025-05-10T19:11:34 | Implement Endianness::split_most_significant_digit | diff --git a/src/bigdigit/endian.rs b/src/bigdigit/endian.rs
index 434e681..6425c1b 100644
--- a/src/bigdigit/endian.rs
+++ b/src/bigdigit/endian.rs
@@ -36,6 +36,11 @@ pub(crate) trait Endianness: Copy + Clone + Default + fmt::Debug {
/// Place given digit at the most-significant end of the vecor
fn push_si... | 1 | 13 | 0 |
58fc28bd159ec95f52e89cce40e561a80867c828 | Andrew Kubera | 2025-09-05T00:26:35 | Support digit-iterators in legacy Rust versions | diff --git a/src/bigdigit/endian.rs b/src/bigdigit/endian.rs
index ee60713..434e681 100644
--- a/src/bigdigit/endian.rs
+++ b/src/bigdigit/endian.rs
@@ -1,46 +1,88 @@
//! Structs and traits for generic operations on big or little endian ints
+use crate::stdlib;
use crate::stdlib::fmt;
use crate::stdlib::Vec;
+#[... | 3 | 127 | 14 |
c0fd17d64db82560be3af56bb0cb139dfc3dfc7c | Andrew Kubera | 2025-05-03T22:26:31 | Add Default and Debug trait requirements to structs & traits | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
index f7cd7d8..7538b06 100644
--- a/src/bigdigit/digitvec.rs
+++ b/src/bigdigit/digitvec.rs
@@ -16,7 +16,7 @@ use super::endian::*;
/// Value of the integer is defined by the radix and endianness
/// type parameters.
///
-#[derive(Debug)]
+#[derive(Deb... | 4 | 13 | 13 |
b9d70041f97eb2b33025a92504d4236f38e32667 | Andrew Kubera | 2023-08-21T00:49:12 | Add module bigdigit::digitvec | diff --git a/src/bigdigit/digitvec.rs b/src/bigdigit/digitvec.rs
new file mode 100644
index 0000000..f7cd7d8
--- /dev/null
+++ b/src/bigdigit/digitvec.rs
@@ -0,0 +1,273 @@
+//! Digit vectors (and slices) of arbitrary radix and endianness
+
+use stdlib::{
+ Vec,
+ marker::PhantomData,
+};
+
+use num_traits::Zero;
... | 2 | 274 | 0 |
bd177080ae01b0069bf41ababf72a885e2e52414 | Andrew Kubera | 2025-05-03T16:10:04 | Impl RadixType for RADIX_10_u8 and add DIGITS const to RadixPowerOfTen | diff --git a/src/bigdigit/radix.rs b/src/bigdigit/radix.rs
index 747c147..4b64c85 100644
--- a/src/bigdigit/radix.rs
+++ b/src/bigdigit/radix.rs
@@ -212,10 +212,22 @@ pub struct RADIX_u32;
pub struct RADIX_u64;
-trait RadixPowerOfTen {}
+pub(crate) trait RadixPowerOfTen : RadixType {
+ const DIGITS: usize;
+}
... | 1 | 25 | 3 |
3dfdb160bd6ecb7e7eab1c6934b12cf421a5b254 | Andrew Kubera | 2025-05-03T21:01:30 | Add iteration methods to Endianness trait | diff --git a/src/bigdigit/endian.rs b/src/bigdigit/endian.rs
index 208859f..80f760d 100644
--- a/src/bigdigit/endian.rs
+++ b/src/bigdigit/endian.rs
@@ -1,9 +1,23 @@
//! Structs and traits for generic operations on big or little endian ints
+use crate::stdlib::fmt;
+use crate::stdlib::Vec;
+
/// Trait to allow ge... | 1 | 51 | 3 |
07638b52a7359190dc7b198bda7a2f2f5bf7d78e | Andrew Kubera | 2023-07-06T03:36:11 | Add module bigdigit::endian | diff --git a/src/bigdigit/endian.rs b/src/bigdigit/endian.rs
new file mode 100644
index 0000000..208859f
--- /dev/null
+++ b/src/bigdigit/endian.rs
@@ -0,0 +1,18 @@
+//! Structs and traits for generic operations on big or little endian ints
+
+
+/// Trait to allow generic parameterization of significant digit ordering
... | 2 | 19 | 0 |
225ce314b3d998e3004da397c32b864d08e9a476 | Andrew Kubera | 2022-06-26T00:23:56 | Add module bigdigit::radix | diff --git a/src/bigdigit/mod.rs b/src/bigdigit/mod.rs
index 3fa883f..ce830b5 100644
--- a/src/bigdigit/mod.rs
+++ b/src/bigdigit/mod.rs
@@ -9,4 +9,4 @@
//! NOTE: These are distinct from the BigDigits in num_bigint.
//!
-
+pub mod radix;
diff --git a/src/bigdigit/radix.rs b/src/bigdigit/radix.rs
new file mode 10064... | 2 | 398 | 1 |
60724d138e37d603a9b85306a9faef92e6988a6c | Andrew Kubera | 2022-06-26T00:23:56 | Create bigdigit module | diff --git a/src/bigdigit/mod.rs b/src/bigdigit/mod.rs
new file mode 100644
index 0000000..3fa883f
--- /dev/null
+++ b/src/bigdigit/mod.rs
@@ -0,0 +1,12 @@
+//! BigDigit types and routines
+//!
+//! Constants and structures defining the "BigDigit" components of BigDecimal.
+//!
+//! BigDigit is generic over Radix types... | 2 | 16 | 0 |
92551154bf9c7a04ff6bbc3ff657c95df55fd062 | Andrew Kubera | 2023-07-06T03:36:31 | Add marker to stdlib | diff --git a/src/with_std.rs b/src/with_std.rs
index 1d127cf..6815233 100644
--- a/src/with_std.rs
+++ b/src/with_std.rs
@@ -9,6 +9,7 @@ mod stdlib {
default,
fmt,
hash,
+ marker,
mem,
num,
ops,
diff --git a/src/without_std.rs b/src/without_std.rs
index 30605... | 2 | 2 | 0 |
ebcb5b4aa7860a5d6fc735cac7e024b33b6fd751 | Andrew Kubera | 2025-07-13T18:46:44 | Add 1.75 to build.rs | diff --git a/build.rs b/build.rs
index 5e5dc13..b021073 100644
--- a/build.rs
+++ b/build.rs
@@ -13,6 +13,9 @@ const SERDE_MAX_SCALE: &str = "150000";
fn main() {
let ac = autocfg::new();
+ // Fn() -> impl Trait
+ ac.emit_rustc_version(1, 75);
+
// abs_diff
ac.emit_rustc_version(1, 60); | 1 | 3 | 0 |
bcea44be8abbbf5e642697e70107df4e33f5be76 | Andrew Kubera | 2025-09-21T20:24:39 | Replace explicit implementations of Mul<BigDecimal> for BigInt with macros | diff --git a/src/impl_ops_mul.rs b/src/impl_ops_mul.rs
index 19695e5..89ae3e4 100644
--- a/src/impl_ops_mul.rs
+++ b/src/impl_ops_mul.rs
@@ -112,66 +112,12 @@ impl Mul<&BigInt> for &BigDecimal {
}
}
-impl Mul<BigDecimal> for BigInt {
- type Output = BigDecimal;
-
- #[inline]
- fn mul(self, mut rhs: Big... | 1 | 5 | 59 |
3892b2d6d268d3e238b709f90bb4de91a8e5640d | Andrew Kubera | 2025-09-21T20:20:45 | Implement Mul for BigDecimal and BigUint operands | diff --git a/src/impl_ops_mul.rs b/src/impl_ops_mul.rs
index 4a2c560..19695e5 100644
--- a/src/impl_ops_mul.rs
+++ b/src/impl_ops_mul.rs
@@ -173,6 +173,60 @@ impl Mul<&BigDecimal> for BigInt {
}
}
+impl Mul<BigUint> for BigDecimal {
+ type Output = BigDecimal;
+
+ #[inline]
+ fn mul(mut self, rhs: BigU... | 2 | 97 | 0 |
66e9f583244c3f32b28dc32563305ef4e1837d7c | Andrew Kubera | 2025-09-21T20:17:35 | Reimplement some Mul implementations and add tests | diff --git a/src/impl_ops_mul.rs b/src/impl_ops_mul.rs
index 86fc713..4a2c560 100644
--- a/src/impl_ops_mul.rs
+++ b/src/impl_ops_mul.rs
@@ -11,22 +11,21 @@ impl Mul<BigDecimal> for BigDecimal {
#[inline]
fn mul(mut self, rhs: BigDecimal) -> BigDecimal {
if self.is_one_quickcheck() == Some(true) {
- ... | 2 | 62 | 38 |
a8457c215854d9092497cc1722c795fd74a260b4 | Andrew Kubera | 2025-09-21T18:22:19 | Update formatting in lib.rs | diff --git a/src/lib.rs b/src/lib.rs
index 2dc3df4..652559d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -132,7 +132,7 @@ mod impl_num;
mod impl_fmt;
// Implementations for deserializations and serializations
-#[cfg(any(feature = "serde", feature="serde_json"))]
+#[cfg(any(feature = "serde", feature = "serde_json"))... | 1 | 17 | 17 |
ddfb0e7b4e1c81133469bf63effe8654d0b83547 | Andrew Kubera | 2025-09-20T22:10:11 | Remove remaining runtime datafile-reading functions from benches | diff --git a/benches/arithmetic.rs b/benches/arithmetic.rs
index 8f7af2e..93f275c 100644
--- a/benches/arithmetic.rs
+++ b/benches/arithmetic.rs
@@ -7,7 +7,6 @@ extern crate lazy_static;
use lazy_static::lazy_static;
-use std::fs::File;
use std::time::Duration;
use criterion::{black_box, criterion_group, crite... | 2 | 8 | 31 |
ac732466855fc3ae8995b7810221bc0b4cb7620d | Andrew Kubera | 2025-09-20T17:41:51 | Replace another is_one with is_one_quickcheck in impl_ops_mul | diff --git a/src/impl_ops_mul.rs b/src/impl_ops_mul.rs
index 6173f09..86fc713 100644
--- a/src/impl_ops_mul.rs
+++ b/src/impl_ops_mul.rs
@@ -34,7 +34,7 @@ impl<'a> Mul<&'a BigDecimal> for BigDecimal {
} else if rhs.is_zero() {
self.scale = 0;
self.int_val.set_zero();
- } else i... | 1 | 1 | 1 |
ca6bc8031e83525c500182c6dbd2ed546d03411b | Andrew Kubera | 2025-09-20T16:53:33 | Use is_one_quickcheck in more Decimal math operations | diff --git a/src/lib.rs b/src/lib.rs
index cd68779..2dc3df4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -710,7 +710,7 @@ impl BigDecimal {
/// assert_eq!(n.square(), "8.5351685337567832225E+169".parse().unwrap());
/// ```
pub fn square(&self) -> BigDecimal {
- if self.is_zero() || self.is_one() {
... | 1 | 5 | 5 |
71c29dcc587c308bc9261cd8af3c865545cc43f3 | Andrew Kubera | 2025-09-20T16:33:15 | Add tests for is_one_quickcheck | diff --git a/src/lib.rs b/src/lib.rs
index 4df5801..cd68779 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1518,7 +1518,7 @@ impl<T: Zero> WithScale<&T> {
#[cfg(test)]
#[allow(non_snake_case)]
mod bigdecimal_tests {
- use crate::{stdlib, BigDecimal, ToString, FromStr, TryFrom};
+ use super::*;
use num_trait... | 2 | 64 | 1 |
dff2f0b5fd6ad6b6e0ebe4dba0d6745adfae873e | Andrew Kubera | 2025-09-20T16:29:47 | Support u128 for small-size is_one_quickcheck | diff --git a/src/lib.rs b/src/lib.rs
index 1cfd2f0..4df5801 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1387,7 +1387,7 @@ impl BigDecimalRef<'_> {
/// Return if the referenced decimal is one
pub fn is_one(&self) -> bool {
if let Some(is_one) = self.is_one_quickcheck() {
- return is_one;
+ ... | 1 | 19 | 10 |
0bb2697839f3b4e5cf0dbcfee09775eceee902cf | Andrew Kubera | 2025-09-20T13:35:54 | Replace uses of is_one with is_one_quickcheck in impl_ops_mul | diff --git a/src/impl_ops_mul.rs b/src/impl_ops_mul.rs
index 3a24897..6173f09 100644
--- a/src/impl_ops_mul.rs
+++ b/src/impl_ops_mul.rs
@@ -10,9 +10,9 @@ impl Mul<BigDecimal> for BigDecimal {
#[inline]
fn mul(mut self, rhs: BigDecimal) -> BigDecimal {
- if self.is_one() {
+ if self.is_one_qui... | 1 | 11 | 11 |
355c1eff7550c2376016df1ac901554657cb8944 | Andrew Kubera | 2025-09-20T13:35:31 | Add method is_one_quickcheck to BigDecimal and BigDecimalRef | diff --git a/src/lib.rs b/src/lib.rs
index 2dcaf91..1cfd2f0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -841,6 +841,11 @@ impl BigDecimal {
}
}
+ /// Try to determine if decimal is 1.0, without allocating
+ pub fn is_one_quickcheck(&self) -> Option<bool> {
+ self.to_ref().is_one_quickcheck(... | 1 | 26 | 9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.