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
11
12
13
14
15
# PMAT-1011 (sweep #7): bool↔float comparison — the "separate rarer follow-up"
# deferred by PMAT-617. Python's bool is an int subtype, so `True == 1.0` /
# `True < 1.5` / `0.5 < True` are valid; xpile emitted a bare `bool OP f64`
# (rustc E0308). The bool side coerces to i64 and routes through the exact
# MixedIntFloatCmp template (same as int↔float, PMAT-745).
def eq_one(b: bool) -> bool:
    return b == 1.0


def lt_threshold(b: bool, t: float) -> bool:
    return b < t


def rev_cmp(x: float, b: bool) -> bool:
    return x < b