I've done the work by hand several times using 25 and I get 5 for an answer but when I run the code it stops after the (second?) loop(by hand its Math.abs(13.5 - 1.9), returning 1.9). Am I missing something or did I screw up altogether? Thanks for your time.
static double abs (double b){ if (b < 0){ } return (b*-1); } static double sqRoot(double n){ if (n<0)return -1; double l = 1.0; double r = n / l; while(Math.abs(l - r) > (0.1)){ l = (l + r) / 2.0; r = n / l; } return r; }