var a = 100000000000000.01 var b = 100000000000000.011 # Rounding at 2 and 3 decimal places, respectively say (round(a, -2) == round(b, -2)) # true say (round(a, -3) == round(b, -3)) # false