Running this code:
n = 4 * 1000 * 1000
fn = (((1 + Math.sqrt(5)) ** n) - ((1 - Math.sqrt(5)) ** n)) / ((2 ** n) * Math.sqrt(5))
puts fn - 1
I get the warning
Bignum out of Float range
How can I fixed my code to solve this error?
Since ruby is dynamically typed, I don't know how. Thanks a lot.