Skip to content

Add magnitude bars to the math expression parser - #4565

Merged
Keavon merged 1 commit into
masterfrom
math-parser-magnitude-bars
Sep 21, 2026
Merged

Keavon merged 1 commit into
masterfrom
math-parser-magnitude-bars

Conversation

@Keavon

@Keavon Keavon commented Sep 21, 2026

Copy link
Copy Markdown
Member

|x| is the magnitude (Euclidean norm), abs(x) is now the component-wise absolute value:

  • |-3 -4i| is 5
  • abs(-3 - 4i) is 3 + 4i.

This also removes real(), imag(), and arg() since the spec describes upcoming replacements for those.

Partly closes #2026

…n each part

Magnitude bars `|x|` give the magnitude on every rung, with `|`
opening where an operand is expected and closing where an operator is,
and `||` reading as Or unless two magnitudes are open, while `abs()`
stays the absolute value of each part. The `real()`, `imag()`, and
`arg()` functions are removed in favor of the matrix literals and
`angle()` the specification defines for those readings.

@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 6 files

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

Re-trigger cubic

Comment thread libraries/math-parser/src/constants.rs
Comment thread libraries/math-parser/src/lexer.rs
@Keavon
Keavon merged commit d0fb9a1 into master Sep 21, 2026
10 checks passed
@Keavon
Keavon deleted the math-parser-magnitude-bars branch September 21, 2026 19:46

This branch was successfully deployed

1 active deployment
graphite-dev (Preview) dace6b3f 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