1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-09 23:45:42 +00:00

perf: remove redundant 0 check in Sqrt

This check was a defensive manoeuvrer in the event that the input is 0, but this condition has already been verified to be false with the switch guard clause.

This changes bumps coverage to 100% for Sqrt.
This commit is contained in:
Oliver Booth 2023-03-31 20:40:06 +01:00
parent 3d2baf595b
commit c8ccb1deb8
No known key found for this signature in database
GPG Key ID: 20BEB9DC87961025
3 changed files with 0 additions and 15 deletions

View File

@ -198,11 +198,6 @@ public static class DecimalExtensions
do
{
previous = current;
if (previous == 0.0m)
{
return 0;
}
current = (previous + value / previous) / 2;
} while (System.Math.Abs(previous - current) > 0.0m);

View File

@ -460,11 +460,6 @@ public static class DoubleExtensions
do
{
previous = current;
if (previous == 0.0)
{
return 0;
}
current = (previous + value / previous) / 2;
} while (System.Math.Abs(previous - current) > double.Epsilon);

View File

@ -419,11 +419,6 @@ public static class SingleExtensions
do
{
previous = current;
if (previous == 0.0f)
{
return 0;
}
current = (previous + value / previous) / 2;
} while (MathF.Abs(previous - current) > float.Epsilon);