Logo

Programming-Idioms

History of Idiom 79 > diff from v10 to v11

Edit summary for version 11 by :

Version 10

2015-09-17, 05:58:43

Version 11

2015-10-18, 13:16:49

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
double y = x.toDouble();
Comments bubble
There is no implicit conversion so you have to use toDouble explicitly, or maybe better: type y as num which is the superclass of double and int.