3 ms·
See edit below. C99 allows greater precision than required by the type! Hmm, you're right. I think something similar bit me long ago and left me under impress
by vardump 9y ago
See edit below. C99 allows greater precision than required by the type!
Hmm, you're right.
I think something similar bit me long ago and left me under impression f-suffix for a float is not portable.
Perhaps it's time to read the standard through once again...
Then again, explicit casts generate code that works on all compilers, standards compliant or not.
Edit: C99, 6.3.1.8.2: "The values of floating operands and of the results of floating expressions may be represented in greater precision and range than that required by the type; the types are not changed thereby."
So I guess explicit floating point casts are needed when explicit operations are wanted!
- enqk 9y agoYou might have encountered in the past is C/C++ silently promoting your floats to double. An example, `printf("%f", float_value)` will actually promote float_value to a double. Or calling a function from `math.h` with a float constant