xpile 0.1.616

Polyglot transpile workbench (Python/C/C++/Rust/Ruchy/Lean ↔ Rust/Ruchy/PTX/WGSL/SPIR-V) with provable contracts at every layer.
1
2
3
4
5
# PMAT-605: 3-arg pow(a, b, m) with a NEGATIVE modulus. Python's result takes
# the sign of the modulus (range (m, 0] for m < 0); the square-multiply loop
# produced the non-negative Euclidean residue, so it was re-signed.
def mp(a: int, b: int, m: int) -> int:
    return pow(a, b, m)