js-on-sx: js-div coerces divisor to inexact
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 55s

(js-div 1 0) with rational integer literals throws "rational: division
by zero" instead of producing Infinity. Wrapped the divisor in
(exact->inexact ...) so integer-by-zero now returns inf/-inf/nan
matching JS semantics. Hit by the harness's _isSameValue +0/-0 check
which calls (js-div 1 a) on JS literal arguments.
built-ins/Number: 37/50 → 41/50. built-ins/String: 77/99.
conformance.sh: 148/148.
This commit is contained in:
2026-05-07 18:35:29 +00:00
parent f4b0ebf353
commit 5f97e78d5f
4 changed files with 11 additions and 17 deletions

View File

@@ -1436,7 +1436,9 @@
(define js-mul (fn (a b) (* (js-to-number a) (js-to-number b))))
(define js-div (fn (a b) (/ (js-to-number a) (js-to-number b))))
(define
js-div
(fn (a b) (/ (js-to-number a) (exact->inexact (js-to-number b)))))
(define js-mod (fn (a b) (mod (js-to-number a) (js-to-number b))))