dotnet / dotNext

Next generation API for .NET
https://dotnet.github.io/dotNext/
MIT License
1.56k stars 119 forks source link

Directly reference algorithm used in int sqrt #228

Closed Arithmomaniac closed 3 months ago

Arithmomaniac commented 3 months ago

https://github.com/dotnet/dotNext/blob/b20da06268a9b51ca4a767f308ad43bcf45c6460/src/DotNext/Numerics/Number.cs#L134C9-L134C121

It appears the actual algo is this exact answer to the question? https://math.stackexchange.com/a/4674078

sakno commented 3 months ago

Rewritten using generic math, but fundamentally yes, it's the same.

Arithmomaniac commented 3 months ago

Yeah, just a nitpick to link to the solution rather than the question. (I can make the PR myself if requested.)

sakno commented 3 months ago

Yeah, link to the solution is more precise. You can submit PR.