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

Promote To Most Capable Data Type Function
Convert Values Class

Public Function PromoteToMostCapableDataType( _
      ByRef rOne As Variant _
    , ByRef rTwo As Variant _
    ) As Boolean

Possibly promotes one of two arguments to the more CAPABLE data type.
The most capable data type is the one which has the widest range of values and is capable of representing both arguments.

Example:
    Assuming
       Dim varOne As Variant
       Dim varTwo As Variant
       varOne = 1%
       varTwo = 3#
    for example
       PromoteToMostCapableDataType(varOne, varTwo) = True
    leaves
       VarType(varOne) = vbDouble
See also:
    MostCapableDataType Function
    FixUpToType Function
The data type of one or both arguments will be changed so that they are capable of storing the same type of values. Function returns True upon success, but may generate an error if passed arguments such as object pointers.
rOne: First of the two values which may be promoted to a more capable data type. Note: This argument is pass-by-reference and it may be modified.
rTwo: Second of the two values which may be promoted to a more capable data type. Note: This argument is pass-by-reference and it may be modified.

This function uses the MostCapableDataType function to determine the data type to which arguments will be promoted.

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