npm.nicfv.com

    Function approx

    • Check if two numbers are approximately equal with a maximum abolute error.

      Parameters

      • a: number

        Any number

      • b: number

        Any number

      • epsilon: number = 1e-6

        Maximum absolute error

      Returns boolean

      True if a is approximately b

      const b1 = SMath.approx(1 / 3, 0.33, 1e-6), // false
      b2 = SMath.approx(1 / 3, 0.33, 1e-2); // true
    MMNEPVFCICPMFPCPTTAAATR