I am aware that suffixing a floating point number with f lets the compiler know that it is a float rather than a double. Which is important to prevent unnecessary casting when operating on floats rather than doubles. However in some code I have been provided by an external company I have seen the following for example:
double i = 1.4f;
Now what I’m wondering is what happens in this case? Will the compiler silently ignore the ‘f’ and it is just something that has no bearing on anything and I can safely ignore?
I then wondered that if numbers are assigned to doubles with an f suffix elsewhere, not just on initialisation would that be a different case that acts differently?
Relevant quotes from the C standard:
§6.4.4.2 paragraph 4
paragraph 5
paragraph 7
Assuming IEEE-754 numerics
1.4fproduces the value:whereas
1.4has the value: