Why my double can contain a value below the machine epsilon?

前端 未结 3 1512
伪装坚强ぢ
伪装坚强ぢ 2021-01-14 00:40

I was solving an equation using double precision and I got -7.07649e-17 as a solution instead of 0.

I agree it\'s close enough that I can s

3条回答
  •  逝去的感伤
    2021-01-14 01:15

    You are not guaranteed that rounding will take place at any particular time. The C++ standard permits the implementation to use additional precision pretty much anywhere it wants to and many real-world implementations do exactly that.

提交回复
热议问题