diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2022-04-01 20:58:27 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-04-01 21:24:45 +0100 |
commit | 086969277e74d8ba065bf8145d3aeb0dec0bfee5 (patch) | |
tree | 02b3699a66735ef806d9b46353491f18f8e4e7b4 /AK/Complex.h | |
parent | 0376c127f6e98e03607700d0b3f5154b7014b2f8 (diff) | |
download | serenity-086969277e74d8ba065bf8145d3aeb0dec0bfee5.zip |
Everywhere: Run clang-format
Diffstat (limited to 'AK/Complex.h')
-rw-r--r-- | AK/Complex.h | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/AK/Complex.h b/AK/Complex.h index 728ae33c77..365c19b3b4 100644 --- a/AK/Complex.h +++ b/AK/Complex.h @@ -61,7 +61,7 @@ public: } template<AK::Concepts::Arithmetic U> - constexpr Complex<T>& operator=(const Complex<U>& other) + constexpr Complex<T>& operator=(Complex<U> const& other) { m_real = other.real(); m_imag = other.imag(); @@ -77,7 +77,7 @@ public: } template<AK::Concepts::Arithmetic U> - constexpr Complex<T> operator+=(const Complex<U>& x) + constexpr Complex<T> operator+=(Complex<U> const& x) { m_real += x.real(); m_imag += x.imag(); @@ -92,7 +92,7 @@ public: } template<AK::Concepts::Arithmetic U> - constexpr Complex<T> operator-=(const Complex<U>& x) + constexpr Complex<T> operator-=(Complex<U> const& x) { m_real -= x.real(); m_imag -= x.imag(); @@ -107,7 +107,7 @@ public: } template<AK::Concepts::Arithmetic U> - constexpr Complex<T> operator*=(const Complex<U>& x) + constexpr Complex<T> operator*=(Complex<U> const& x) { const T real = m_real; m_real = real * x.real() - m_imag * x.imag(); @@ -124,7 +124,7 @@ public: } template<AK::Concepts::Arithmetic U> - constexpr Complex<T> operator/=(const Complex<U>& x) + constexpr Complex<T> operator/=(Complex<U> const& x) { const T real = m_real; const T divisor = x.real() * x.real() + x.imag() * x.imag(); @@ -142,7 +142,7 @@ public: } template<AK::Concepts::Arithmetic U> - constexpr Complex<T> operator+(const Complex<U>& a) + constexpr Complex<T> operator+(Complex<U> const& a) { Complex<T> x = *this; x += a; @@ -158,7 +158,7 @@ public: } template<AK::Concepts::Arithmetic U> - constexpr Complex<T> operator-(const Complex<U>& a) + constexpr Complex<T> operator-(Complex<U> const& a) { Complex<T> x = *this; x -= a; @@ -174,7 +174,7 @@ public: } template<AK::Concepts::Arithmetic U> - constexpr Complex<T> operator*(const Complex<U>& a) + constexpr Complex<T> operator*(Complex<U> const& a) { Complex<T> x = *this; x *= a; @@ -190,7 +190,7 @@ public: } template<AK::Concepts::Arithmetic U> - constexpr Complex<T> operator/(const Complex<U>& a) + constexpr Complex<T> operator/(Complex<U> const& a) { Complex<T> x = *this; x /= a; @@ -206,13 +206,13 @@ public: } template<AK::Concepts::Arithmetic U> - constexpr bool operator==(const Complex<U>& a) const + constexpr bool operator==(Complex<U> const& a) const { return (this->real() == a.real()) && (this->imag() == a.imag()); } template<AK::Concepts::Arithmetic U> - constexpr bool operator!=(const Complex<U>& a) const + constexpr bool operator!=(Complex<U> const& a) const { return !(*this == a); } @@ -234,7 +234,7 @@ private: // reverse associativity operators for scalars template<AK::Concepts::Arithmetic T, AK::Concepts::Arithmetic U> -constexpr Complex<T> operator+(const U& b, const Complex<T>& a) +constexpr Complex<T> operator+(const U& b, Complex<T> const& a) { Complex<T> x = a; x += b; @@ -242,7 +242,7 @@ constexpr Complex<T> operator+(const U& b, const Complex<T>& a) } template<AK::Concepts::Arithmetic T, AK::Concepts::Arithmetic U> -constexpr Complex<T> operator-(const U& b, const Complex<T>& a) +constexpr Complex<T> operator-(const U& b, Complex<T> const& a) { Complex<T> x = a; x -= b; @@ -250,7 +250,7 @@ constexpr Complex<T> operator-(const U& b, const Complex<T>& a) } template<AK::Concepts::Arithmetic T, AK::Concepts::Arithmetic U> -constexpr Complex<T> operator*(const U& b, const Complex<T>& a) +constexpr Complex<T> operator*(const U& b, Complex<T> const& a) { Complex<T> x = a; x *= b; @@ -258,7 +258,7 @@ constexpr Complex<T> operator*(const U& b, const Complex<T>& a) } template<AK::Concepts::Arithmetic T, AK::Concepts::Arithmetic U> -constexpr Complex<T> operator/(const U& b, const Complex<T>& a) +constexpr Complex<T> operator/(const U& b, Complex<T> const& a) { Complex<T> x = a; x /= b; @@ -272,15 +272,15 @@ template<AK::Concepts::Arithmetic T> static constinit Complex<T> complex_imag_unit = Complex<T>((T)0, (T)1); template<AK::Concepts::Arithmetic T, AK::Concepts::Arithmetic U> -static constexpr bool approx_eq(const Complex<T>& a, const Complex<U>& b, const double margin = 0.000001) +static constexpr bool approx_eq(Complex<T> const& a, Complex<U> const& b, double const margin = 0.000001) { - const auto x = const_cast<Complex<T>&>(a) - const_cast<Complex<U>&>(b); + auto const x = const_cast<Complex<T>&>(a) - const_cast<Complex<U>&>(b); return x.magnitude() <= margin; } // complex version of exp() template<AK::Concepts::Arithmetic T> -static constexpr Complex<T> cexp(const Complex<T>& a) +static constexpr Complex<T> cexp(Complex<T> const& a) { // FIXME: this can probably be faster and not use so many "expensive" trigonometric functions return exp(a.real()) * Complex<T>(cos(a.imag()), sin(a.imag())); |