Logo

Programming-Idioms

History of Idiom 79 > diff from v25 to v26

Edit summary for version 26 by Dodopod:
[C] "_(float)" doesn't emphasize "(float)"

Version 25

2017-05-27, 19:54:22

Version 26

2017-05-27, 19:58:31

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;
Code
float y = (float)x;
Comments bubble
The _(float) isn't really necessary. The compiler will cast x automatically.
Comments bubble
The (float) isn't really necessary. The compiler will cast x automatically.