Logo

Programming-Idioms

  • Go
  • Perl

Idiom #79 Convert integer to floating point number

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

my $y = $x;

in perl they are just scalars, there is no distinction between an int and a float
y := float64(x)

The cast must be explicit.
Y : constant Float := Float (X);

New implementation...