Function Math Complex Class

RealToComplex

"Real Numbers To Complex Number" Construct a complex number string from two real numbers.

Signature (Visual Basic / VBA)

Public Function RealToComplex( _
      ByVal vReal As Variant _
    , ByVal vImag As Variant _
    ) As Variant

Code Example

    RealToComplex(2, -3) = "2|-3"
    RealToComplex(6, 0) = 6
    RealToComplex(4, Null) = 4
    IsNull(RealToComplex(Null, 5)) = True

Parameters

Parameter Description
vReal The real part of the complex number that will be returned. Function returns Null if vReal is Null or cannot be fixed up to a number.
vImag The imaginary part of the complex number being constructed. vImag defaults to 0 (zero) if it is Null or cannot be fixed up to a number.

Notes & Version History

Summary If vReal and vImag are numeric and/or date values, then a complex number of the form "R|I" is returned. If vReal is numeric/date and vImag is not, vReal is returned as a numeric type. If vReal is non-numeric, then Null is returned.