Complex number class

Complex number class

Complex number class

  • Language: C/C++
  • Released: Jun 5, 2011
    Last Update: Jun 5, 2011

Complex numbers are of vital importance in engeneering, physics and math, also many topics on game development , require understanding of complex number field of application. The class is a single .h file The class implements templated overloaded operators, an exaple of usage is as follows:

// declaration
CComplex a(1,2),b(2,4) ,c(3,2),d(1,1),e(2,2);

//Arithmetics :

a= b+c;
a= 10.0f / b ;
a= b / 10.0f ;
b = a * 10.0f;
b+=c ;
b/= c *10.0f;
a = b * c ;
b = c/ b ;
a = b+c +d +e ;
// get real and immaginary part

float r = a.GetReal();
float i= a.GetIm();

// get real and immaginary part in trigonometric form

r= a.GetRealTrigForm();

CComplex  Coniugate ,Reciprocal;

// coniugate and reciprocals

Coniugate= a.GetConiugate();
Reciprocal = a. GetReciprocal();

// modulus and phase

float m  = b.GetModulus();
float ph = c.GetPhase();
You need to log-in or create an account
  • Create an account
  • Log-in
Please use your real name.
Activation link will be sent to this address.
Minimum 8 characters
Enter your password again

Clicking this button confirms you read and agreed to the terms of use and privacy policy.


Save your watchlist

Fill your details below to receive project updates from your watch list - including new versions, price changes and discounts.

I agree to the terms of use and privacy policy.

1 license From » $4.99 14 day money-back guarantee View Licenses
or Get a quote

for customization or integration services

Post a comment

Or enter your name and Email
No comments have been posted yet.