Skip to main content

Module rational

Module rational 

Source
Expand description

Level 1 — ℚ. Exact rational arithmetic over the RNS substrate.

An RnsRational stores a reduced numerator and a positive denominator, each as an RnsInt. Arithmetic reconstructs to BigInt, computes exactly, and re-normalizes — so results never drift the way floating point does.

The module also exposes base awareness: which primes a fraction’s denominator contains, whether it terminates in a given base, and the minimal (“natural”) base in which it is exact.

Structs§

RnsRational
An exact rational number represented over RNS channels.