Skip to content

[repo-assist] feat: add IsPositive, IsNegative, and IsZero predicates#193

Merged
NichUK merged 2 commits into
developfrom
repo-assist/improve-predicates-ispositive-2026-06-18-d6fd13c462a786db
Jun 18, 2026
Merged

[repo-assist] feat: add IsPositive, IsNegative, and IsZero predicates#193
NichUK merged 2 commits into
developfrom
repo-assist/improve-predicates-ispositive-2026-06-18-d6fd13c462a786db

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This is an automated PR from Repo Assist.

What

Adds three focused static predicate methods to FixedPointNano:

  • IsPositive(FixedPointNano value)true when RawValue > 0
  • IsNegative(FixedPointNano value)true when RawValue < 0
  • IsZero(FixedPointNano value)true when RawValue == 0

All three are marked [MethodImpl(MethodImplOptions.AggressiveInlining)] since they are trivial one-line comparisons against RawValue.

Why

These predicates are commonly expected on numeric types and complement the existing IsInteger, Sign, and Abs API. They are also prerequisites for implementing INumber<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 new public static bool methods with XML doc comments, placed immediately after the existing IsInteger method
  • tests/FixedPointNano.Tests/FixedPointNanoTests.cs: three new tests — IsPositiveShouldReturnTrueOnlyForPositiveValues, IsNegativeShouldReturnTrueOnlyForNegativeValues, IsZeroShouldReturnTrueOnlyForZero

Test Status

✅ Build succeeded (dotnet build -c Release, 0 warnings, 0 errors).
✅ 1440 tests pass (was 1437; +3 new tests for the new methods).

Generated by 🌈 Repo Assist, see workflow run. Learn more.

Add this agentic workflows to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@e15e57b40918dbca11b350c55d02ab61934afa75

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>
@NichUK NichUK marked this pull request as ready for review June 18, 2026 16:53
Copilot AI review requested due to automatic review settings June 18, 2026 16:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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), and IsZero(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.

Comment thread tests/FixedPointNano.Tests/FixedPointNanoTests.cs Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@NichUK NichUK merged commit 37f40b1 into develop Jun 18, 2026
1 of 2 checks passed
@NichUK NichUK deleted the repo-assist/improve-predicates-ispositive-2026-06-18-d6fd13c462a786db branch June 18, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants