[repo-assist] feat: add IsPositive, IsNegative, and IsZero predicates#193
Merged
NichUK merged 2 commits intoJun 18, 2026
Conversation
Add three AggressiveInlining static predicates that complement the existing IsInteger helper and complete the sign/zero API: - IsPositive(value): true when RawValue > 0 - IsNegative(value): true when RawValue < 0 - IsZero(value): true when RawValue == 0 These are commonly expected on numeric types and lay the groundwork for implementing INumber<T>/ISignedNumber<T> in a future PR. 3 new tests; total 1440, all passing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds three small, focused predicate helpers to the FixedPointNano numeric type (IsPositive, IsNegative, IsZero) to complement the existing API and align with future generic-math expectations.
Changes:
- Added
FixedPointNano.IsPositive(FixedPointNano),IsNegative(FixedPointNano), andIsZero(FixedPointNano)with aggressive inlining and XML doc summaries. - Added unit tests covering positive/negative/zero behavior across representative values (including min/max).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/FixedPointNano/FixedPointNano.cs | Adds three new static predicate methods based on RawValue comparisons. |
| tests/FixedPointNano.Tests/FixedPointNanoTests.cs | Adds three tests validating the new predicate methods’ expected truth tables. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This is an automated PR from Repo Assist.
What
Adds three focused static predicate methods to
FixedPointNano:IsPositive(FixedPointNano value)—truewhenRawValue > 0IsNegative(FixedPointNano value)—truewhenRawValue < 0IsZero(FixedPointNano value)—truewhenRawValue == 0All three are marked
[MethodImpl(MethodImplOptions.AggressiveInlining)]since they are trivial one-line comparisons againstRawValue.Why
These predicates are commonly expected on numeric types and complement the existing
IsInteger,Sign, andAbsAPI. They are also prerequisites for implementingINumber<T>/ISignedNumber<T>in a future step — adding them now keeps that path open without committing to the full interface surface yet.Changes
src/FixedPointNano/FixedPointNano.cs: three newpublic static boolmethods with XML doc comments, placed immediately after the existingIsIntegermethodtests/FixedPointNano.Tests/FixedPointNanoTests.cs: three new tests —IsPositiveShouldReturnTrueOnlyForPositiveValues,IsNegativeShouldReturnTrueOnlyForNegativeValues,IsZeroShouldReturnTrueOnlyForZeroTest Status
✅ Build succeeded (
dotnet build -c Release, 0 warnings, 0 errors).✅ 1440 tests pass (was 1437; +3 new tests for the new methods).
Add this agentic workflows to your repo
To install this agentic workflow, run