Why does GDB evaluate floating-point arithmetic differently from C++?

后端 未结 3 560
情深已故
情深已故 2021-02-13 01:46

I\'ve encountered something a little confusing while trying to deal with a floating-point arithmetic problem.

First, the code. I\'ve distilled the essence of my problem

3条回答
  •  耶瑟儿~
    2021-02-13 02:08

    Could be because the x86 FPU works in registers to 80 bits accuracy, but rounds to 64 bits when the value is stored to memory. GDB will be storing to memory on every step of the (interpreted) computation.

提交回复
热议问题