Skip to content

feat(math): add dimension-aware sign function - #906

Open
efegokdemir wants to merge 2 commits into
sharkdp:mainfrom
efegokdemir:feat-144-sign-function
Open

efegokdemir wants to merge 2 commits into
sharkdp:mainfrom
efegokdemir:feat-144-sign-function

Conversation

@efegokdemir

Copy link
Copy Markdown

Implements the sgn item in #144.

Summary

  • Add sgn to core::numbers.
  • Return -1, 0 or 1 for negative, zero and positive quantities.
  • Accept dimensioned quantities and return a dimensionless Scalar.
  • Preserve NaN and handle positive and negative infinity.
  • Add regression tests for scalars, physical units and special values.

Validation

  • Numbat mathematical function tests.
  • Full numbat package test suite.
  • Formatting and diff checks.
  • Clippy with only the existing upstream map_or_identity warning excluded.

This PR implements only the sign-function item. Issue #144 should remain open for its other tasks.

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