-
Notifications
You must be signed in to change notification settings - Fork 30
Closed
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
Line 676 in d2b35ac
let mut r = Self::raw(1); |
Line 1046 in d2b35ac
impl<M: Modulus> Product<_> for StaticModInt<M> { fn product(_) -> _ { _(Self::raw(1), Mul::mul) } } |
Line 1048 in d2b35ac
impl<I: Id > Product<_> for DynamicModInt<I> { fn product(_) -> _ { _(Self::raw(1), Mul::mul) } } |
The identity of multiplication should be Self::new(1)
(not raw
but new
), because of following (corner) cases:
use ac_library_rs::ModInt;
ModInt::set_modulus(1); // !!
let x: ModInt = std::iter::empty::<ModInt>().product();
assert_eq!(x.val(), 0);
let y = ModInt::new(123).pow(0);
assert_eq!(y.val(), 0);
Note that the original ACL allows to use modint::set_mod(1)
.
TonalidadeHidrica
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working