Differences in rounded result when calling pow()

后端 未结 4 1760
无人及你
无人及你 2020-12-07 04:28

OK, I know that there was many question about pow function and casting it\'s result to int, but I couldn\'t find answer to this a bit specific question.

OK, this is

4条回答
  •  一生所求
    2020-12-07 04:46

    To add to the other answers here: just generally be very careful when working with floating point values.

    I highly recommend reading this paper (even though it is a long read): http://hal.archives-ouvertes.fr/docs/00/28/14/29/PDF/floating-point-article.pdf

    Skip to section 3 for practical examples, but don't neglect the previous chapters!

提交回复
热议问题