Floating point representations seem to do integer arithmetic correctly - why?

前端 未结 8 1286
死守一世寂寞
死守一世寂寞 2021-01-06 10:41

I\'ve been playing around with floating point numbers a little bit, and based on what I\'ve learned about them in the past, the fact that 0.1 + 0.2 ends up bein

8条回答
  •  感情败类
    2021-01-06 10:55

    Integers withing the representable range are exactly representable by the machine, floats are not (well, most of them).

    If by "basic integer math" you understand "feature", then yes, you can assume correctly implementing arithmetic is a feature.

提交回复
热议问题