Logo

Programming-Idioms

History of Idiom 79 > diff from v24 to v25

Edit summary for version 25 by Dodopod:
New C implementation by user [Dodopod]

Version 24

2016-11-30, 22:40:12

Version 25

2017-05-27, 19:54:22

Idiom #79 Convert integer to floating point number

Declare floating point number y and initialize it with the value of integer x .

Idiom #79 Convert integer to floating point number

Declare floating point number y and initialize it with the value of integer x .

Code
float y = (float)x;
Comments bubble
The _(float) isn't really necessary. The compiler will cast x automatically.