You have been given an algorithm. What steps have you taken to code it in Java?
Show us your work; tell us where you are stuck; then we can give you a hand.
double sqrt(double x) {
if (x <= 0)
throw new IllegalArgumentException("x not positive");
double ne = x/2 ;
double pe = x ;
while ( Math.abs(ne-pe) > 0.0001) {
pe = ne ;
ne = (pe + x / pe) / 2;
}
return ne ;
}
Title | # Comments | Views | Activity |
---|---|---|---|
My project did see openJDK that I installed. What could be the problem | 7 | 94 | |
basic hardware to learn oop advanced design patterns | 3 | 74 | |
array6 challenfge | 6 | 63 | |
groovy example issue | 10 | 67 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
20 Experts available now in Live!