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.

Recommended Answers

All 2 Replies

Member Avatar for iamthwee

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

So there is a float number problem.

What do you mean by this.??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.