TheAlgorithms/Java

[FEATURE REQUEST] <Added calculation of arithmetic square roots using Newtonian iteration>

yuluo-yx opened this issue · 1 comments

What would you like to Propose?

I looked at the relevant code in the math library and didn't find a way to calculate the square root, so I wanted to add this method. If I missed it, please point it out.

Propose:
Given a non-negative integer x, the arithmetic square root of x is calculated and returned.
Since the return type is an integer, only the integer part is preserved and the fractional part is rounded out.

Issue details

input:x = 4
output:2

input:x = 8
output:2
interpretation:The arithmetic square root of 8 is 2.82842..., and since the return type is an integer, the fractional part is discarded.

Additional Information

No response

Sorry, I found this method already exists and will close it now.