1#ifndef SCIFIR_UNITS_MECA_NUMBER_COMPLEX_NUMBER_HPP_INCLUDED
2#define SCIFIR_UNITS_MECA_NUMBER_COMPLEX_NUMBER_HPP_INCLUDED
5#include "../util/is_number.hpp"
6#include "../units/scalar_unit.hpp"
7#include "../util/types.hpp"
9#include "boost/algorithm/string.hpp"
79 real = std::move(x.real);
142 return angle(180.0f);
183 bool is_complex(
const string& init_complex_number);
199 else if (x.imaginary < 0)
219template<
typename T,
typename U>
222 if (x.real == y.real and x.imaginary == y.imaginary)
232template<
typename T,
typename U>
247 return !(x == init_complex_number);
259 return !(init_complex_number == x);
271 return x + to_string(y);
277 return to_string(x) + y;
283 return os << to_string(x);
Class that allows to work with angles. Each angle sizes 4 bytes. Initialization string example: "20°"...
complex_number(const scalar_unit &x, const scalar_unit &y)
complex_number< scalar_unit > operator/(const complex_number< U > &x) const
complex_number(const string &init_complex_number)
complex_number< scalar_unit > get_reciprocal() const
complex_number(const string &x, const string &y)
string display(int number_of_decimals=2) const
void operator-=(const complex_number< U > &x)
complex_number< T > & operator=(const complex_number< T > &x)
void operator+=(const complex_number< U > &x)
complex_number< T > operator+(const complex_number< U > &x) const
complex_number(const complex_number< T > &x)
angle get_argument() const
complex_number< T > get_conjugate() const
complex_number(complex_number< T > &&x)
complex_number< T > operator-(const complex_number< U > &x) const
complex_number< scalar_unit > operator*(const complex_number< U > &x) const
Class that allows to create scalar units, which are composed of a value (as a float) and dimensions....
bool operator!=(const scifir::complex_number< T > &x, const scifir::complex_number< U > &y)
istream & operator>>(istream &is, scifir::complex_number< T > &x)
ostream & operator<<(ostream &os, const scifir::complex_number< T > &x)
bool operator==(const scifir::complex_number< T > &x, const scifir::complex_number< U > &y)
void operator+=(string &x, const scifir::complex_number< T > &y)
string operator+(const string &x, const scifir::complex_number< T > &y)
The namespace scifir contains all scifir-units, excepting the string literals, which are outside.
T abs(const complex_number< T > &x)
scalar_unit pow(const scalar_unit &x, int exponent)
Exponentiates a scalar_unit to some numeric type, the dimensions are also exponentiated.
string to_string(const aid &x)
Creates a string representation of aid, it's for aid equivalent to the display() function of aid.
angle atan(float x)
Calculates the atan of some value x and returns the result as angle in degrees.
string display_float(const float &value, int number_of_decimals)
bool is_complex(const string &init_complex_number)
angle sqrt(const angle &x)
Calculates the square root of the angle x and returns that new angle.