Skip to content

Allow the math parser's expression results to become complex instead of NaN - #4564

Merged
Keavon merged 1 commit into
masterfrom
math-parser-complex-climbing
Sep 21, 2026
Merged

Keavon merged 1 commit into
masterfrom
math-parser-complex-climbing

Conversation

@Keavon

@Keavon Keavon commented Sep 21, 2026

Copy link
Copy Markdown
Member

Partly closes #2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 4 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread libraries/math-parser/src/executer.rs
Comment thread libraries/math-parser/src/value.rs
…ever producing NaN

Every value is a quaternion in principle, so narrower storage is never
observable: a result whose imaginary part is zero is the real number,
`-0` is `0`, and a real input whose answer leaves the real line climbs
into the complex plane (`sqrt(-4)` is `2i`, `ln(-1)` is `iπ`, `asin(2)`
its complex value) instead of producing NaN. No operation returns NaN
at all: an indeterminate form like `0/0` or `∞ - ∞` is an evaluation
error, as is a NaN arriving through a host binding at its point of use.
@Keavon
Keavon force-pushed the math-parser-complex-climbing branch from 5e0036e to 10b9996 Compare September 21, 2026 18:45
@Keavon
Keavon merged commit f0622d6 into master Sep 21, 2026
10 checks passed
@Keavon
Keavon deleted the math-parser-complex-climbing branch September 21, 2026 18:58

This branch was successfully deployed

1 active deployment
graphite-dev (Preview) 10b9996a Deployed Sep 21, 2026 by github-actions[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.

Tracking Issue: Math expression parser/calculator

1 participant