|Synopsis:||Floating values should not be converted to integral types except through use of standard library routines.|
Since mixed precision arithmetic involves implementation defined and undefined behaviour, it is safer to avoid implicit conversions between floating and integral types.
For ANSI-C 99 compilers this comes down to using the function "
So instead of using an implicit conversion such as
int i; float fl; i = fl; /* implicit conversion from float to int */
one should make it explicit by using the defined library function:
int i; float fl; i = f2i(fl); /* explicit conversion from float to int */