Calculating Fibonacci Number accurately in C++?

后端 未结 3 1362
甜味超标
甜味超标 2021-01-03 06:09

I am really confused. I am trying to calculate Fibonacci numbers, but as they get larger and large the numbers start to become wrong. and I do not know why.

How do y

3条回答
  •  感情败类
    2021-01-03 06:56

    In general, floats and doubles are not designed to represent numbers accurately. Their purpose is to represent real numbers in a wide range. If you do want infinite precision, you could try looking into http://gmplib.org/

提交回复
热议问题