0

Hi everybody. I have a problem with my program.
I want to make a program that can display the Fibonacci, but the number of term i must display is 2147483647. So there is a float number problem. How can i do it with fast speed.

3
Contributors
2
Replies
3
Views
11 Years
Discussion Span
Last Post by SpS
0

Hi everybody. I have a problem with my program.
I want to make a program that can display the Fibonacci, but the number of term i must display is 2147483647. So there is a float number problem. How can i do it with fast speed.

>number of term i must display is 2147483647

Short answer is yes you can - but you need a big number library. If this is homework, as i suspect, the object of the assinement wud probably be to use strings to get that term.

So you have to think back to basic school arithmetic and addition on paper, i.e adding it column by column and carrying the surplus to the preceeding column.

Simple as pie.


>Speed

hmm, dunno about that. I'd say the speed would be the constant since you're adding rather than multiplying. multiplying can lend itself to varying speeds - Karatsuba etc.I'd imagine addition to be constant. But I cud be wrong. I'm sure sumone will prove this to be so. :rolleyes:

[Edit] Gotta love google, it would seem an efficient method does exist, he he [/Edit]

http://www.everything2.com/index.pl?node_id=1328208

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.