Stop a run on a FLOAT that is not finite, so proofs about FLOAT hold
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
This commit is contained in:
1 parent
8f403226fb
commit
08c74c16d2
6 files changed
+56
-7
No files matched your search
@@ -0,0 +1,10 @@
|
||||
// The prover treats a FLOAT as a number: Y == Y, and X < X + 1.0 or not.
|
||||
// Infinity and NaN are not numbers in that sense. A run that let 1.0E308 *
|
||||
// 10.0 become infinity, and X - X become NaN, broke both claims while the
|
||||
// checker proved them. Such a run now stops at the overflow instead.
|
||||
// RUN-STOPS: overflow@7
|
||||
DECLARE X, Y : FLOAT
|
||||
X <- 1.0E308 * 10.0
|
||||
Y <- X - X
|
||||
ASSERT Y == Y
|
||||
OUTPUT Y
|
||||
Reference in new issue
Block a user