Module modular

Source
Expand description

Modular arithmetic.

Modular arithmetic is performed on Reduced values attached to a ConstDivisor.

Trying to mix different ConstDivisor instances (even with the same modulus!) will cause a panic.

§Examples

use dashu_int::{fast_div::ConstDivisor, UBig};

let ring = ConstDivisor::new(UBig::from(10000u32));
let x = ring.reduce(12345);
let y = ring.reduce(55443);
assert_eq!(format!("{}", x - y), "6902 (mod 10000)");

Structs§

Reduced
Modular arithmetic.

Traits§

IntoRing
Trait for types that can be converted into an IntoRing::RingElement by a RingReducer.