Signature (Visual Basic / VBA)
Public Function Approx( _
ByVal vX As Variant _
, ByVal vY As Variant _
, Optional ByVal vEpsilon As Double = 0.00000000000001 _
) As Variant
Code Examples
Approx(34.6, 34.59999999) = False
Approx(34.6, 34.599999999999) = True
Approx("SA", "sa") = False
Approx("SA", "SA") = True
If Y == 0: Abs(X) < Epsilon
If Y <> 0: Abs(Y - X) / Y) < Epsilon
Parameters
| Parameter | Description |
|---|---|
| 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. |
| vEpsilon | Defines the range of "approximate" values as defined below. vEpsilon defaults to 1E-14 (10 ^ -14) if it is missing. |
Notes & Version History
| 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. |
| 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. |