I see there is a way in ScalaCheck to test for almost equal relative to an absolute epsilon, however, what would be perhaps more useful would be an epsilon which is interpreted as a fraction of the value being checked.

This was briefly discussed here but I’m not sure if it was implemented.

I can implement this myself, but I’m not sure what the most general form should be.

```
def almostEqual(tolerance:Double)(x:Double, y:Double):Boolean = {
( x == y) || abs(x - y ) < tolerance * max(abs(x),abs(y))
}
```

The semantics is that `almostEqual(0.3)(x,y)`

is that the distance from `x`

to `y`

is within 30% of the maximum (in absolute value) of `x`

and `y`

.