I think comparing the difference to the value (a relative error check) might be better. See `comp` or `test_numerically` in randtest, perhaps.