Why would you use float over double, or double over long double?

后端 未结 5 1207
我寻月下人不归
我寻月下人不归 2021-01-01 13:35

I\'m still a beginner at programming and I always have more questions than our book or internet searches can answer (unless I missed something). So I apologize in advance if

5条回答
  •  遥遥无期
    2021-01-01 14:09

    You might be interested in seeing the answer posted here Should I use double or float?

    But it boils down to memory footprint vs the amount of precision you need for a given situation. In a physics engine, you might care more about precision, so it would make more sense to use a double or long double.

    Bottom line: You should only use as much precision as you need for a given algorithm

提交回复
热议问题