The prover reasons about a FLOAT as a number: Y == Y holds, and X < Z or X >= Z. The interpreter let 1.0E308 * 10.0 become infinity and X - X become NaN and carried on, so a run broke claims the prover had proved (tests/prover/float-overflow.pseudo proved ASSERT Y == Y with Y NaN). The notation already stops on a FLOAT division by zero and on a whole number past 2^53 - 1. It now also stops, with an 'overflow' error, when an arithmetic result, a built-in's result or a literal is not a finite number (finiteCheck in interp.js). Every run then stays inside what a proof covers. Regression programs whose fix was to the language rather than to a rule now say where the run must stop, with a RUN-STOPS header the soundness test checks. A unit that does FLOAT arithmetic now carries a 'float-model' note: FLOAT is treated as a finite number, rounding is opaque, and the lab stops past about 1.8e308, while the generated Mojo goes on with inf or nan (stated for a division by zero, the case probes/float-special has verified). New probe mojo/probes/float-overflow.mojo asks the compiler what a Float64 product past the largest double gives; it is unverified and needs pixi run mojo-verify-item 'probes/float-overflow' (network). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FgvbRdoEheAHqsRmr2WuKZ
6 lines
174 B
Mojo
6 lines
174 B
Mojo
# probe: does a Float64 product past the largest double give inf at run time, and inf - inf nan?
|
|
def main():
|
|
var big = 1.0e308
|
|
var x = big * 10.0
|
|
print(x, x - x)
|