xpile 0.1.615

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
6
7
8
9
10
# PMAT-608: max()/min() over a float sequence that turns out EMPTY must raise
# ValueError (Python), not return the ±inf fold sentinel. The float reduce now
# yields Option (empty → panic, ≈ ValueError); first-arg-wins also matches
# Python on ties/NaN. Non-empty cases compute the extremum normally.
def max_pos_ratio(xs: list[int]) -> float:
    return max(x / 2 for x in xs if x > 0)


def min_pos_ratio(xs: list[int]) -> float:
    return min(x / 2 for x in xs if x > 0)