Bart van Ingen Schenau wrote:
> On Mar 26, 2:54 pm, Ioannis Vranos <(EMail Removed)>
> wrote:
>> ISO/IEC 9899:1990/1995 says (from K&R2):
>>
>> “A6.4
>>
>> When a less precise floating value is converted to an equally or more
>> precise floating type, the value is unchanged. When a more precise
>> floating value is converted to a less precise floating type, and the
>> value is within representable range, the result may be either the next
>> higher or the next lower representable value. If the result is out of
>> range, the behavior is undefined”.
>>
>> Question: Does the above mean that it is a good practice or *always*
>> needed to use the appropriate type suffixes with floating point constants?
>>
> I don't know about best practiceI don't use floating point often
> enough for that, but it certainly is not needed to always specify
> the suffixes.
>
> First of all, the majority of floating point constants are not exactly
> representable in any of the floating point types, so you get the
> conversion to the next higher or next lower representable value
> anyway.
> If float and double don't have the same range and precision, then a
> compiler must be really perverse to get different results for the
> expressions '(float)0.33439' and '0.33439F'.
>
> The only suffix with more than documentary value is L (or l), if you
> need the extra precision or range that long double might give you.
>
> Bart v Ingen Schenau
Thank you for your answer, the discussion is continued in thread:
"Corrected: Using type suffixes with floating point constants"
where I will forward your answer.
