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

Fractional To Real Function
Fix Ups Class

Public Function FractionalToReal( _
      ByRef rReal As Variant _
    , Optional ByVal vSupportStringDates As Variant _
    ) As Boolean

Convert either fractional or a real number into a real number.

Example:
    Assuming
       Dim varNum As Variant
       varNum = "3/4"
    for example
       FractionalToReal(varNum) = True
    leaves
       varNum = .75
Example:
    Assuming
       Dim varNum As Variant
       varNum = 34.5
    for example
       FractionalToReal(varNum) = True
    leaves
       varNum = 34.5
See also:
    FractionalToRealSample Subroutine
    ComplexStringToReals Function
Note: This function is substantially similar to the ComplexStringToReals function except that ComplexStringToReals works on complex numbers instead of fractions.
Summary: If Value is a fractional number of the form "A/B" then rReal = A / B If Value is a numeric value then rReal remains unchanged. If Value is "A/0" or non-numeric function returns false.
rReal: Argument which, if it represents a fraction with a string of the form "A/B", will be replaced by its numeric approximation.
Function returns True if rReal could be interpreted as a number or as a string representing a fractional number. Function returns False otherwise.
vSupportStringDates: Determines whether the function should consider date strings to represent numbers. Set to True if the function should consider date strings like "4/5/96" to be numbers, or set to False to save time if the function should not have to deal with date strings.
This function can also be used to determine if its argument CAN BE converted into a number, as in the following examples.
    FractionalToReal("4/5") = True
    FractionalToReal((varNum)) = True ' #2
since Visual Basic cannot modify ByRef (By Reference) arguments that are really passed ByVal (By Value). In example #2, varNum will not be replaced with its numeric equivalent (.8) because by putting the variable in parentheses will force VB to pass it by value.

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