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

Idiom #79 Convert integer to floating point number

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

$y = (float)$x;
float y = (float)x;
float y = x;
import std.conv : to;
int x;
float y = to!float(x);
// or
float y = cast(float) x;
double y = x.toDouble();
y = x / 1
y := float64(x)
y = fromInteger x :: Double
float y = x;
y = x + .0
var
  y: single;
begin
  y := x;
end;
my $y = $x;
y = float(x)
y = x.to_f
let y = x as f32;

Do you know the best way to do this in your language ?
New implementation...