On Sunday, 15 May 2016 at 21:06:22 UTC, Ola Fosheim Grøstad wrote:
std::cout << (f==1.30) << std::endl; // false std::cout << (c==1.30) << std::endl; // false std::cout << (i==1.30) << std::endl; // false std::cout << (1.30==(float)1.30) << std::endl; // false
If we want equality then we should compare to the representation for a 32 bit float:
std::cout << (f == 1.2999999523162841796875) << std::endl; // true