0
How to prevent integer overflows in my fibonacci program
when i try to generate 100 terms of the fibonacci sequence it breaks down and gives me negative numbers indicating an overflow. using long int and long long int is of no use. can someone help me fix it> https://code.sololearn.com/c2wJt45BgkYe/?ref=app
6 Answers
0
Create a class that stimulates big numbers.
0
I'm still a beginner i dunno what classes are.
0
don't worry i fixed it by changing the long int to unsigned long long int
0
Try using long double.
0
thanks but i fixed it.
0
Use __uint128_t
It can store integers btw 0 and 2^128-1