Skip to content

Add UnitMath.Clamp(value, min, max)#1157

Merged
angularsen merged 4 commits into
angularsen:masterfrom
Muximize:clamp
Dec 5, 2022
Merged

Add UnitMath.Clamp(value, min, max)#1157
angularsen merged 4 commits into
angularsen:masterfrom
Muximize:clamp

Conversation

@Muximize
Copy link
Copy Markdown
Contributor

This adds UnitMath.Clamp similar to Math.Clamp.

Comment thread UnitsNet.Tests/UnitMathTests.cs Outdated
@angularsen angularsen merged commit 9b7ef8d into angularsen:master Dec 5, 2022
@angularsen
Copy link
Copy Markdown
Owner

Thanks! Nuget should be out shortly.

Release UnitsNet/5.0.0-rc004 · angularsen/UnitsNet

@Muximize
Copy link
Copy Markdown
Contributor Author

@angularsen What's your opinion on backporting this to v4?

angularsen added a commit that referenced this pull request Feb 23, 2023
* Add UnitMath.Clamp(value, min, max)

* Change Clamp to convert min/max to the unit of value, following the principle of least surprise.

* Update UnitMath.cs

Co-authored-by: Marnix <marnix@iwell.nl>
Co-authored-by: Andreas Gullberg Larsen <andreas.larsen84@gmail.com>
angularsen added a commit that referenced this pull request Feb 23, 2023
Backported from #1157 to v4.

This adds `UnitMath.Clamp` similar to `Math.Clamp`.

Co-authored-by: Muximize <Muximize@users.noreply.github.com>
Co-authored-by: Marnix <marnix@iwell.nl>
@angularsen
Copy link
Copy Markdown
Owner

@Muximize Sure, seems straight forward.
Merged: #1213

@angularsen
Copy link
Copy Markdown
Owner

@Muximize
Copy link
Copy Markdown
Contributor Author

Thanks! ❤️ Can you do a Nuget release?

@angularsen
Copy link
Copy Markdown
Owner

I tried, but the CI build failed on net5.0 no longer being included out of the box.
Attempted a fix now, we'll see 🤞

https://dev.azure.com/unitsnet/Units.NET/_build/results?buildId=356

@Muximize
Copy link
Copy Markdown
Contributor Author

Your fix worked! 🚀

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.

3 participants