replace (1/2) with 0.5 because 1/2 will be computed using integer arithmetic and gives a result of 0