Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace DoubleUtil.IsNaN with double.IsNaN #4339

Merged
merged 1 commit into from
Nov 23, 2021

Conversation

omariom
Copy link
Contributor

@omariom omariom commented Mar 28, 2021

Fixes Issue #4338

Description

Replaces DoubleUtil.IsNaN with double.IsNaN which is times faster.

Customer Impact

Regression

Testing

I haven't managed to build the project.

Risk

@omariom omariom requested a review from a team as a code owner March 28, 2021 15:38
@ghost ghost added the PR metadata: Label to tag PRs, to facilitate with triage label Mar 28, 2021
@ghost ghost requested review from fabiant3, ryalanms and SamBent March 28, 2021 15:38
@@ -1403,8 +1403,8 @@ private static void RenderTransform_Changed(DependencyObject d, DependencyProper
private static bool IsRenderTransformOriginValid(object value)
{
Point v = (Point)value;
return ( (!DoubleUtil.IsNaN(v.X) && !Double.IsPositiveInfinity(v.X) && !Double.IsNegativeInfinity(v.X))
&& (!DoubleUtil.IsNaN(v.Y) && !Double.IsPositiveInfinity(v.Y) && !Double.IsNegativeInfinity(v.Y)));
return ( (!double.IsNaN(v.X) && !Double.IsPositiveInfinity(v.X) && !Double.IsNegativeInfinity(v.X))
Copy link
Member

Choose a reason for hiding this comment

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

These checks could use double.IsNormal instead of IsNan, IsPositiveInfinity, and IsNegativeInfinity.
Same on other places.

But this API isn't available on .NET Full, only starting at .NET Core 2.1 and .NET Standard 2.1.

Instead of IsPositiveInfinity and IsNegativeInfinity use just double.IsInfinity.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would implement it in a separate PR.
This one just mechanically replaces one call with another.

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense.

@singhashish-wpf singhashish-wpf merged commit b63c69e into dotnet:main Nov 23, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Apr 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
PR metadata: Label to tag PRs, to facilitate with triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants