When do you use float and when do you use double

Posted by Jakub Zaverka on Programmers See other posts from Programmers or by Jakub Zaverka
Published on 2013-02-28T10:35:51Z Indexed on 2014/08/19 22:32 UTC
Read the original article Hit count: 257

Filed under:
|

Frequently in my programming experience I need to make a decision whether I should use float or double for my real numbers. Sometimes I go for float, sometimes I go for double, but really this feels more subjective. If I would be confronted to defend my decision, I would probably not give sound reasons.

When do you use float and when do you use double? Do you always use double, only when memory constraints are present you go for float? Or you use always float unless the precision requirement requires you to use double? Are there some substantial differences regarding computational complexity of basic arithemtics between float and double? What are the pros and cons of using float or double? And have you even used long double?

© Programmers or respective owner

Related posts about c++

Related posts about c