The highest number that double
can represent is extremely high, I thought.
Though following code throws an exception. It's actually my full code.
public class Summe {
public static void main(String[] args) {
System.out.println(summe(20000));
}
public static double summe(double s) {
return s == 0 ? s : s + summe(s-1);
}
}
Thanks for the answers so far. My question is: How can I make my code work?