Fix ambiguity warning.
Move x,y vars init closer to usage.
Changed float to double.