almost-equal.js 327 B

12345678910111213
  1. const almostEqual = require('almost-equal');
  2. function tapAlmostEqual(t, a, b, { atol=1e-8, rtol=1e-5 } = {}) {
  3. var result = almostEqual(a, b, atol, rtol);
  4. if (result) {
  5. t.ok(true, `${a} is almost equal to ${b}`);
  6. } else {
  7. t.ok(false, `${a} is not almost equal to ${b}`);
  8. }
  9. }
  10. module.exports = tapAlmostEqual;