How to cast a variable from an Int to a Float

I cant work out how to cast variables in JS.

The following doesnt work as the calculation of the height is done as an int and then gets assigned to a float (I’m guessing).

var ratio: float;
ratio=Screen.width/Screen.height


So Ive done these which seems a bit like hard work:

var ratio: float;
var w: float;
var h: float;
w=Screen.width;
h=Screen.height;
ratio=w/h;


Also is there a guide somewhere on this type of stuff?  All I can find is class references.

An old trick to convert to a float/double is to multiply by 1.0. Ex: 7*1.0 is 7.0. So:
(Screen.width*1.0)/Screen.height.

You have to watch the order: 1.0width/height works, but width/height1.0 converts after you’ve dropped fractions.

You can use parseFloat() if you want more obvious code, though multiplying by 1.0 is a little faster.