Hey Leute, muss eine Methode schreiben, die den Logarithmus per Intervallschachtellung und ohne Rekursion berechnet, allerdings kommt im Java-Compiler immer die Meldung "missing return statement". Könnt ihr mir sagen, was ich ändern muss?
public static double logarithmus (int x, int b){
double min = 0.0;
double max = 3.0;
boolean suchen = true;
while (suchen){
double test = (min+max)/2;
double c = Math.pow(b,test);
if(c>x){
test=min;
}
else if(c<x){
test=max;
}
else if(c==x){
suchen=false;
return test;
}
}
}
public static double logarithmus (int x, int b){
double min = 0.0;
double max = 3.0;
boolean suchen = true;
while (suchen){
double test = (min+max)/2;
double c = Math.pow(b,test);
if(c>x){
test=min;
}
else if(c<x){
test=max;
}
else if(c==x){
suchen=false;
return test;
}
}
}