Skip to content

Fix signed zero in integer boundary inference - #622

Merged
ctate merged 1 commit into
mainfrom
ctate/fix-signed-zero-a53b72
Oct 3, 2026
Merged

ctate merged 1 commit into
mainfrom
ctate/fix-signed-zero-a53b72

Conversation

@ctate

@ctate ctate commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

Fixes #619.

An equality guard such as z === 0 accepts both zero signs, but integer-boundary inference could prove Math.trunc(Math.min(1 / z, 1)) safe even though -0 produces -Infinity. Negative odd powers had the same problem.

Account for both zero signs when dividing by the zero interval and when folding powers of zero. Preserve the NaN result of 0 / 0, acceptance of direct zero crossings, and proofs for safely clamped results. The existing interval domain combines both zero signs, so some safe one-sided clamps may now be conservatively refused even when the source only produces positive zero.

Add analyzer regressions, source-level rejection checks for i64/u64 returns, and native differential cases for safe clamps evaluated with both +0 and -0.

Validation: workspace build; all 164 library unit and integer-boundary integration tests in both plain and sanitized modes; complete plain and sanitized suite coverage in partitions. Initial package-permission, debugger-attachment, and sanitizer-configuration failures passed isolated rechecks. Sanitized Effect fixtures use the CI setting ASAN_OPTIONS=detect_leaks=0.

@vercel

vercel Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
scriptc Ready Ready Preview, v0 Oct 2, 2026 11:29pm UTC

@ctate
ctate merged commit b4454e4 into main Oct 3, 2026
77 checks passed

This branch was successfully deployed

1 active deployment
Preview — bfb1f014 Deployed Oct 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integer-boundary analyzer loses signed zero and falsely proves division/power results

1 participant