Mark, I just ran this, (mac 10.4.11, rev 3.0) and see no problems, even up to 1000 iterations - could it be some platform-related thing?

Best,

Mark

ps. the 1000th iteration was
434665576869374275069961555511137369890149306067531359404218934455749241 032917045565907240316294571302242425620098031386057959852750558837247446 45670017852944230821885448147900618234216285807506383791353495552
On 17 Sep 2008, at 18:53, Mark Wieder wrote:

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

_______________________________________________
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

Reply via email to