Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • C

Idiom #79 Convert integer to floating point number

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

float y = (float)x;

The (float) isn't really necessary, unless x is a double type. The compiler will cast x automatically.
Y : constant Float := Float (X);

New implementation...