Skip to content

Add Wrap extension for double and float#69

Merged
Tyrrrz merged 8 commits intoprimefrom
copilot/add-numeric-types-extension
Apr 19, 2026
Merged

Add Wrap extension for double and float#69
Tyrrrz merged 8 commits intoprimefrom
copilot/add-numeric-types-extension

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 19, 2026

Ports the Wrap numeric extension from LightBulb into PowerKit, making it available as a general-purpose utility.

Changes

  • DoubleExtensions.cs / SingleExtensions.cs — adds extension(double value) / extension(float value) instance blocks with a Wrap(min, max) method that cyclically wraps a value within the given range
  • DoubleExtensionsTests.cs / SingleExtensionsTests.cs — adds Wrap_Test covering in-range, above-max, below-min, boundary, and multi-cycle cases

Usage

13.0.Wrap(0.0, 10.0)  // → 3.0
(-3.0).Wrap(0.0, 10.0) // → 7.0
10.0.Wrap(0.0, 10.0)  // → 0.0 (max wraps to min)

Copilot AI and others added 2 commits April 19, 2026 09:17
@Tyrrrz Tyrrrz added the enhancement New feature or request label Apr 19, 2026
@Tyrrrz Tyrrrz marked this pull request as ready for review April 19, 2026 09:23
Copilot AI review requested due to automatic review settings April 19, 2026 09:23
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 19, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.85%. Comparing base (20415da) to head (cd49aaf).
⚠️ Report is 1 commits behind head on prime.

Files with missing lines Patch % Lines
PowerKit/Extensions/DoubleExtensions.cs 28.57% 4 Missing and 1 partial ⚠️
PowerKit/Extensions/SingleExtensions.cs 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            prime      #69      +/-   ##
==========================================
- Coverage   94.07%   93.85%   -0.22%     
==========================================
  Files         128      128              
  Lines        2496     2524      +28     
  Branches      198      200       +2     
==========================================
+ Hits         2348     2369      +21     
- Misses        107      112       +5     
- Partials       41       43       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a Wrap(min, max) numeric extension for float and double, ported from LightBulb, to cyclically wrap values into a specified range.

Changes:

  • Added Wrap(min, max) instance extensions for float and double.
  • Added unit tests covering common in-range/out-of-range wrapping scenarios for both types.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
PowerKit/Extensions/SingleExtensions.cs Adds float.Wrap(min, max) implementation.
PowerKit/Extensions/DoubleExtensions.cs Adds double.Wrap(min, max) implementation.
PowerKit.Tests/Extensions/SingleExtensionsTests.cs Adds Wrap_Test for float.
PowerKit.Tests/Extensions/DoubleExtensionsTests.cs Adds Wrap_Test for double.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread PowerKit/Extensions/SingleExtensions.cs Outdated
Comment thread PowerKit/Extensions/SingleExtensions.cs Outdated
Comment thread PowerKit/Extensions/DoubleExtensions.cs Outdated
Comment thread PowerKit/Extensions/DoubleExtensions.cs Outdated
Comment thread PowerKit.Tests/Extensions/SingleExtensionsTests.cs
Comment thread PowerKit.Tests/Extensions/DoubleExtensionsTests.cs
Tyrrrz and others added 6 commits April 19, 2026 12:27
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants