All-
I just ran into an integer overflow problem and I'm wondering if there
is a preferred way of dealing with this. I get the right number of
digits, but after iteration 79 the last digits are all zero. Is there
a way of dealing with large numbers? Here's a simple handler that
gives wrong answers:
--------------------------------------------------
-- Find the Nth Fibonacci number
-- Usage: Fibonacci(100)
-- note: this overflows at around iteration 79
--------------------------------------------------
on Fibonacci pIteration
local tFibNum
local tPrevious
local tTemp
-- prime the pump
put 1 into tPrevious -- Fibonacci number 1
put 1 into tFibNum -- Fibonacci number 2
repeat with x=3 to pIteration
put tFibNum into tTemp
add tPrevious to tFibNum
put tTemp into tPrevious
-- show your work
put "Iteration" && x & "=" && tFibNum & cr after field 1
end repeat
end Fibonacci
--
-Mark Wieder
[EMAIL PROTECTED]
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution