Skip to content

Commit ddf8b94

Browse files
committed
Fix #59
1 parent ee0d3df commit ddf8b94

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/math.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub fn crt(r: &[i64], m: &[i64]) -> (i64, i64) {
3333
// Contracts: 0 <= r0 < m0
3434
let (mut r0, mut m0) = (0, 1);
3535
for (&(mut ri), &(mut mi)) in r.iter().zip(m.iter()) {
36-
assert!(1 < mi);
36+
assert!(1 <= mi);
3737
ri = internal_math::safe_mod(ri, mi);
3838
if m0 < mi {
3939
swap(&mut r0, &mut ri);
@@ -185,6 +185,9 @@ mod tests {
185185
let a = [12345, 67890, 99999];
186186
let b = [13, 444321, 95318];
187187
assert_eq!(crt(&a, &b), (103333581255, 550573258014));
188+
let a = [0, 3, 4];
189+
let b = [1, 9, 5];
190+
assert_eq!(crt(&a, &b), (39, 45));
188191
}
189192

190193
#[test]

0 commit comments

Comments
 (0)