Files
pplus-library/mojo/probes/float-contract-runtime-off.mojo
alexm 568474d52f
Test (in pplus-core) / in-core (push) Failing after 28m44s
Initial commit
2026-11-12 22:23:48 -05:00

15 lines
673 B
Mojo

# probe: with contraction off (--fp-mode contract=off, as the pin builds), is x * x - x rounded twice, as IEEE arithmetic one operation at a time, both when x arrives at run time and when it is a literal? (float-contract-runtime is the same program with contraction on, where the run-time line comes out -0.22222222222222224)
# args: --fp-mode contract=off
# stdin: 2 3\n
# expect-stdout: -0.2222222222222222
# expect-stdout: -0.2222222222222222
def square_less(x: Float64) -> Float64:
return x * x - x
def main() raises:
var w = input().split(" ")
var x = Float64(atol(w[0])) / Float64(atol(w[1]))
print(square_less(x))
print(square_less(2.0 / 3.0))