How to actually avoid floating point errors when you need to use float?

前端 未结 4 947
攒了一身酷
攒了一身酷 2021-01-13 18:11

I am trying to affect the translation of a 3D model using some UI buttons to shift the position by 0.1 or -0.1.

My model position is a three dimensional float so sim

4条回答
  •  南方客
    南方客 (楼主)
    2021-01-13 18:48

    The Kahan summation and pairwise summation algorithms help to reduce floating point errors. Here's some Java code for the Kahan algorithm.

提交回复
热议问题