Do-s and Don't-s for floating point arithmetic?

后端 未结 7 1917
臣服心动
臣服心动 2021-02-13 16:32

What are some good do-s and don\'t-s for floating point arithmetic (IEEE754 in case there\'s confusion) to ensure good numerical stability and high accuracy in your results?

7条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-13 16:48

    The #1 "don't" rule with floating-point numbers is:

    Don't use floating-point numbers where integers will suffice.

提交回复
热议问题