That is because your telling maya you use integers for the division. Substituting just one fo theese values as a explicit float fixes this.
float $x = 1/2.0;
Very normal programming practice, in languages with dynamic type conversion. FOr exmaple same applies to python as well.
reason for this is that yes the 1 is floating point but at the tinme of evalueation of.
1/2 which happens before maya only sees integers, and theres perfectly valid reasons for having separate integer mathematics for computation purposes. (floats are quite inaccurate, because even something quite precice as 0.13 is quite unrecice and needs to be rounded to 0.13 for your viewing pleasure, why well because computers use base of 2 not base of 10 so some of our rational numbers are quite irrational for the computer)