FAILURE MAP
← Case archive

FA-90235 / Bytecode virtual machines / Member archive

Numeric for loop: float limits truncated toward zero · case 05

for i = -5, -2.5 runs to -2, one iteration past the limit.

Member previewVariant 5 · 3 implementations · 10 checks per implementation

Case contract

Numeric for-loop preparation (Lua-style FORPREP/FORLOOP). A zero step is an error. With integer init and step, a float limit is floored for positive steps and ceiled for negative ones; the loop is skipped when init is already past the limit in the step direction; otherwise the iteration count (limit - init) // step is precomputed (for negative steps (init - limit) // -step) and the loop runs count + 1 times. Otherwise the loop uses floats and re-tests v <= limit (v >= limit for negative steps). Return at most the first 20 control values.

Why this case matters

Loop-preparation opcodes must precompute counts exactly to avoid off-by-one and overflow bugs.

One recorded failure

Sample boundary fixture

This sample comes from the broken implementation of a controlled reproducer.

Boundary fixtureActualExpectedOutcome
float limit ceils for descending loops[10, 9, 8, 7, 6, 5, 4, 3, 2][10, 9, 8, 7, 6, 5, 4, 3]Failed

MEMBER ARCHIVE

The complete case is available to members.

This record includes three runnable implementations, regression fixtures, execution results, and source hashes.

Member access is invitation-based. Sign in with your invited account to inspect the sources.

Sign in to the archive ↗