RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
VarCmplx.VarComplexCreate Function

Returns a custom Variant that represents a complex number.

Pascal
function VarComplexCreate: Variant; overload;
function VarComplexCreate(const AReal: Double): Variant; overload;
function VarComplexCreate(const AReal: Double; const AImaginary: Double): Variant; overload;
function VarComplexCreate(const AText: string): Variant; overload;
C++
Variant VarComplexCreate();
Variant VarComplexCreate(const Double AReal);
Variant VarComplexCreate(const Double AReal, const Double AImaginary);
Variant VarComplexCreate(const AnsiString AText);

Call VarComplexCreate to create a Variant whose value is a complex number. 

AReal is the real part of the complex number. 

AImaginary is the imaginary part of the complex number. 

Using the first three versions of the constructor, omitting AReal or AImaginary results in a real or imaginary part of 0. 

Using the last syntax, AText is parsed using the ComplexNumberSymbol and ComplexNumberSymbolBeforeImaginary global variables and, if the string represents a complex value, that becomes the value of the new Variant. If the string can't be parsed into a complex number, VarComplexCreate raises an EConvertError exception. 

Complex Variants are custom Variants that represent complex numbers. The Variant type supports direct manipulation using the addition, subtraction, multiplication, division (but not integer division), and negation operators. They have 5 published properties: Real, Imaginary, Radius, Theta, and FixedTheta. They can be cast to and from integer types, floating point types, string types, TDateTime values, and boolean values. In addition, the VarCmplx unit implements a number of global functions for operating on complex Variants

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!