Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
binary square root
import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { double wert=double.parseDouble(args[0]); } public static double sucheWurzel(double x) { if (x < 0) return Double.NaN; else return sucheWurzel(x,0 , x < 1 && x > 0 ? 1 : x);//, 0.000001); } public static double sucheWurzel(double x, double a, double e) {//, double eps) { System.out.println("e="+e); double m = (a + e) / 2; // Wert genau genug, Double-Wert ändert sich nicht mehr if (a == m || e == m) { return m; } // Genauigkeitstoleranz eps //if (Math.abs(m*m - x) <= eps) // return m; // Wert zu groß if (x < m*m) return sucheWurzel(x, a, m);//, eps); // Wert zu klein else return sucheWurzel(x, m, e);//, eps); } }
run
|
edit
|
history
|
help
0
4.b
Chiper
3e
Java - SimpleDateFormat(ting)
Sorting array
Sieve of Eratosthenes Revisited
has a
191fa07050
jb14 L
Fmt test