diff --git a/complex.hh b/complex.hh index ae090cc..16470e0 100644 --- a/complex.hh +++ b/complex.hh @@ -102,15 +102,15 @@ static constexpr Complex operator / (Complex a, Complex b) } template -static constexpr Complex exp(Complex a) +static constexpr T norm(Complex a) { - return Complex(exp(a.real()) * cos(a.imag()), exp(a.real()) * sin(a.imag())); + return a.real() * a.real() + a.imag() * a.imag(); } template static constexpr T abs(Complex a) { - return hypot(a.real(), a.imag()); + return sqrt(norm(a)); } template @@ -119,10 +119,4 @@ static constexpr T arg(Complex a) return atan2(a.imag(), a.real()); } -template -static constexpr T norm(Complex a) -{ - return a.real() * a.real() + a.imag() * a.imag(); -} - #endif