I am wondering what the difference is between these two variables in C:
float price = 3.00;
and
float price = 3.00f;
Adding few more combination of comparisons between float and double data types.
int main()
{
// Double type constant(3.14) converts to Float type by
// truncating it's bits representation
float a = 3.14;
// Problem: float type 'a' promotes to double type and the value
// of 'a' depends on how many bits added to represent it.
if(a == 3.14)
std::cout<<"a: Equal"<
Output:
a: Not Equal
b: Not Equal
c: Equal
d: Equal