There is one bug. If you divide swap 1/2 to 1.0/2.0 otherwise 1/2=0