BigIntegerFib lol

This commit is contained in:
2025-10-19 21:31:18 -05:00
parent 3de5f89ff5
commit 0096f393ef
33 changed files with 3607 additions and 135 deletions

View File

@@ -0,0 +1,35 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package bigintegerfibonacci;
/**
*
* @author caleb
*/
public class StackSize {
public static void main(String[] args) {
try {
//System.out.println(fact(1 << 15));
System.out.println(infinateRecursion(0));
}
catch (StackOverflowError e) {
System.err.println("true recursion level was " + level);
System.err.println("reported recursion level was " +
e.getStackTrace().length);
}
}
private static int level = 0;
public static long fact(int n) {
level++;
return n < 2 ? n : n * fact(n - 1);
}
public static long infinateRecursion(long n) {
level++;
return infinateRecursion(n++);
}
}