Should be math.abs(x-y)/(math.abs(y) + 1e-15) < tol. You can also use ScalaTest's Tolerance:

~~~
a === b +- 1e-3
~~~