package com.mercurylake.test.stack;
public class Sqrt {
static double sqrt_(double x)
{
double g=x;
while(Math.abs(g*g-x)>0.000001)
{
g=(g+x/g)/2;
}
return g;
}
public static void main(String[] args) {
double x=sqrt_(4);
System.out.println((int)x);
}
}
public class Sqrt {
static double sqrt_(double x)
{
double g=x;
while(Math.abs(g*g-x)>0.000001)
{
g=(g+x/g)/2;
}
return g;
}
public static void main(String[] args) {
double x=sqrt_(4);
System.out.println((int)x);
}
}