Go to repository

Function toBeCloseTo

Answer if the actual value is close to the expected value, by at least the number of digits given.

`toBeCloseTo(4.0005, 4.0009, 3)` returns `true`, as there are 3
digits that are equal between actual and expected.
If no amount of digits is given, 5 is taken by default.

Parameters

  • actual: number
  • expected: number
  • numDigits: number

Returns boolean