Skip to content

fix: support additional scalar types in logical operations - #3711

Open
SAY-5 wants to merge 1 commit into
josdejong:developfrom
SAY-5:codex/fix-logical-scalar-types-20261005
Open

SAY-5 wants to merge 1 commit into
josdejong:developfrom
SAY-5:codex/fix-logical-scalar-types-20261005

Conversation

@SAY-5

@SAY-5 SAY-5 commented Oct 5, 2026

Copy link
Copy Markdown

Refs #3414, following the proposed split between additional type support and breaking consistency changes.

boolean(fraction(1, 3)), not(fraction(1, 3)), mixed Unit/scalar logical calls, and evaluate('and(complex(1, 1), complex(1, 1))') currently throw instead of returning their logical result.

This adds Fraction, Complex, and Unit support to boolean, exact Fraction predicates to the logical functions, and mixed Unit/scalar overloads. The expression transforms check a scalar against itself when deciding whether to short-circuit, so that check no longer introduces an unsupported Complex/boolean combination. The left expression is still evaluated once.

Tests cover both operand orders, stored Unit magnitudes, valueless Unit constructors, Fractions below floating-point range, invalid inputs, and short-circuiting. Existing BigNumber NaN and Unit/Unit promotion behavior is preserved. The bigint conversion and matrix zero/false work in #3375, and the broader inconsistencies in #3414, remain separate.

Validation on macOS with Node 26.3.0:

  • Source suite: 6,693 passing, 22 pending.
  • Generated-entry tests: 36 passing; additional isolated factory checks passed.
  • Full source/test/type lint and TypeScript compilation passed.
  • A bounded 7,296-case comparison preserved all 2,812 previously successful results and added 2,950 successful cases.

Compiled ESM/CJS, browser, and TypeScript runtime suites were not run locally.

Code, tests, and this description were developed with OpenAI Codex assistance and received independent AI review.

This branch has not been deployed

No deployments
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.

1 participant