<-- Previous || Up || Next -->

Approx Function
Math Reals Class

Public Function Approx( _
      ByVal vX As Variant _
    , ByVal vY As Variant _
    , Optional ByVal vEpsilon As Double = 0.00000000000001 _
    ) As Variant

"Approximate"
Return True if two expressions are approximately equal.

Examples:
    Approx(34.6, 34.59999999) = False
    Approx(34.6, 34.599999999999) = True
    Approx("SA", "sa") = False
    Approx("SA", "SA") = True
See also:
    ApproxVerify Subroutine
    ApproxComplex Function
    Debug.Assert (Visual Basic)
vX: First of two numbers that are compared to see if they are approximately equal. Function returns Null if vX is Null or cannot be fixed up to a Double precision floating point number. (as defined by the ComplexStringToReals function).

vY: Second of two numbers that are compared to see if they are approximately equal. Function returns Null if vY is Null or cannot be fixed up to a Double precision floating point number.
Note: If either of the arguments are not numbers, this function compares the values using the EqualLikeDataType function; it passes the arguments to that function and returns its result. In this case, it uses EqualLikeDataType with the Compare Mode of vbBinaryCompare.

vEpsilon: Defines the range of "approximate" values as defined below. vEpsilon defaults to 1E-14 (10 ^ -14) if it is missing.

Definition:

    If Y == 0: Abs(X) < Epsilon
    If Y <> 0: Abs(Y - X) / Y) < Epsilon
v1.5 Addition: This function is new to this version of Entisoft Tools. It is a version of the ApproxComplex function which supports only real numbers.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.