Function Math Reals Class

Max2Real

" Maximum Of Two Real Number" Return the maximum of two numeric arguments. Returns argument on left (vX) if arguments are equal.

Signature (Visual Basic / VBA)

Public Function Max2Real( _
      ByVal vX As Variant _
    , ByVal vY As Variant _
    ) As Variant

Code Example

    Max2Real(23, 45) = 45
    Max2Real(-12, 4) = 4
    Max2Real(2%, 2#) = 2%
    Max2Real(2#, 2%) = 2#
    Max2Real("SA", "RO") = "SA"

Parameters

Parameter Description
vX First of two numeric arguments, the maximum of which will be returned.
vY Second of two numeric arguments, the maximum of which will be returned.

Notes & Version History

Note If both arguments happen to be strings, they will be compared using Binary comparisons.
Note This function will generate an error if the arguments are not compatible, such as if one is a string and the other is numeric; see also the Max2Variant function.
Note This function does not support three-valued logic. The behavior of this function is undefined if either argument is Null.