use Math::Round; print nearest(0.01, 1.256); __DATA__ 1.26