I have a Fibonacci recursion function:
int efib (int num) {
if (num == 0){
return 0;
}else if (num == 1){
return 1;
}else if (num == -1){
return -1;
}else if (num > 0){
return efib(num - 1) + efib (num - 2);
}else{
return efib (num + 1) + efib(num + 2);
}
}
I'm trying to find the exact element num where the int value overflows, is it possible to obtain the current recursion value to compare it to the maximum value an int data type can hold?
I know that the max value an int can hold that is included in the Fibonacci sequence is 1836311903.