Skip to content

fix(math): preserve expm1 and log1p precision#2970

Merged
proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-2946-math-precision
May 30, 2026
Merged

fix(math): preserve expm1 and log1p precision#2970
proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-2946-math-precision

Conversation

@andrewtdiz
Copy link
Copy Markdown
Contributor

Summary

  • route direct Math.expm1 / Math.log1p codegen through the existing precision-preserving runtime helpers
  • add parity coverage for tiny positive/negative values and 1e-9 sanity cases
  • keep the naive exp(x) - 1 / log(1 + x) collapse contrast in the fixture

Fixes #2946.

Baseline

Pre-fix Perry lowered direct Math.expm1 / Math.log1p to exp(x) - 1 / log(1 + x), causing all six precision checks in the new fixture to print false.

Verification

  • PATH=/home/github-runner/actions-runner/externals/node24/bin:$PATH node --experimental-strip-types test-parity/node-suite/globals/math-expm1-log1p-precision.ts
  • target/release/perry test-parity/node-suite/globals/math-expm1-log1p-precision.ts -o /tmp/perry_math_precision_2946_post && /tmp/perry_math_precision_2946_post
  • PATH=/home/github-runner/actions-runner/externals/node24/bin:$PATH RUSTC_WRAPPER= ./run_parity_tests.sh --suite node-suite --module globals --filter math-expm1-log1p-precision
    • report: test-parity/reports/parity_report_20260530_035423.json
  • RUSTC_WRAPPER= cargo check -p perry-codegen -p perry-runtime
  • RUSTC_WRAPPER= cargo build --release -p perry
  • cargo fmt --all -- --check
  • git diff --check origin/main...HEAD
  • jq empty test-parity/known_failures.json test-parity/threshold.json
  • rg -n "^(<<<<<<<|>>>>>>>)"
  • ./scripts/check_file_size.sh

@proggeramlug proggeramlug merged commit a405046 into PerryTS:main May 30, 2026
11 checks passed
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.

runtime: preserve Math.expm1 and Math.log1p precision in codegen paths

2 participants