Skip to content

Commit

Permalink
Update Number.cs
Browse files Browse the repository at this point in the history
More precise reference for sqrt.
  • Loading branch information
Arithmomaniac authored Mar 11, 2024
1 parent 645a34d commit 737acae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/DotNext/Numerics/Number.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public static bool IsPrime<T>(T value)

return value == two;

// https://math.stackexchange.com/questions/2469446/what-is-a-fast-algorithm-for-finding-the-integer-square-root
// https://math.stackexchange.com/questions/2469446/what-is-a-fast-algorithm-for-finding-the-integer-square-root/4674078#4674078
static T Sqrt(T value)
{
var log2x = T.Log2(value) - T.One;
Expand Down Expand Up @@ -221,4 +221,4 @@ static bool TryGetFromTable(ReadOnlySpan<T> cachedPrimes, T value, out T result)
return success;
}
}
}
}

0 comments on commit 737acae

Please sign in to comment.