• This function calculates the gap between two numbers, a and b, based on the given direction dir and tolerance tol.

    Parameters

    • a: string | number

      The first number for the calculation.

    • b: string | number

      The second number for the calculation.

    • dir: string

      The direction of the calculation. If "max", the values of a and b are switched.

    • tol: Values = Values.TOLERANCE_LEVEL

      The tolerance level to check if a and b are approximately equal.

    Returns number

    • Returns the gap between a and b. If a and b are approximately equal (within tol), it returns 0. If the minimum absolute value of a and b is less than tol, or if either a or b is Infinity, or if a and b have different signs, or if either a or b is NaN, it returns Infinity. Otherwise, it returns the relative difference between a and b divided by the minimum absolute value of a and b, rounded to 7 decimal places. If the result is -0, it converts it to 0.

Generated using TypeDoc