You're overflowing the Int
datatype, because the result of fib(93) (12,200,160,415,121,876,738
, roughly 1.22 x 10^19
) is larger than Int64.max
(9,223,372,036,854,775,807
, or roughly 9.22 x 10^18
).
On 32 bit machines, this will crash even earlier, at fib(47) (2,971,215,073
), because Int
is a 32 bit type on 32 bit machines. Int32.max
is only 2,147,483,647
.