(1) use the integer() function

(2) var <-> int is automatically converted. Forcing a cast will deliver undesired results as the fixpoint value of var won't be converted to int as you'd expect.