Function Math Complex Class

RealPart

"Real Part" Return the real part of a complex (or real) number. Function returns vX unchanged if vX is already a real number.

Signature (Visual Basic / VBA)

Public Function RealPart( _
    ByVal vX As Variant _
    ) As Variant

Code Example

    RealPart(45) = 45
    RealPart("23|45") = 23
    RealPart("-34.5|12") = -34.5
    IsNull(RealPart(Null)) = True

Parameters

Parameter Description
vX The number whose real part is to be returned. Function returns Null if vX is Null or cannot be fixed up to a real or complex number (as defined by the ComplexStringToReals function). Complex numbers are represented within strings as "R|I" where R is the real part and I is the imaginary part.