diff --git a/ref_app/src/math/extended_complex/extended_complex.h b/ref_app/src/math/extended_complex/extended_complex.h index 8d8744aea..1cc71fe4c 100644 --- a/ref_app/src/math/extended_complex/extended_complex.h +++ b/ref_app/src/math/extended_complex/extended_complex.h @@ -442,8 +442,16 @@ template EXTENDED_COMPLEX_CONSTEXPR auto operator-=(const complex& my_z) -> complex& { - my_re -= static_cast(my_z.my_re); - my_im -= static_cast(my_z.my_im); + if(this == &my_z) + { + my_re = static_cast(static_cast(UINT8_C(0))); + my_im = static_cast(static_cast(UINT8_C(0))); + } + else + { + my_re -= static_cast(my_z.my_re); + my_im -= static_cast(my_z.my_im); + } return *this; } @@ -843,7 +851,7 @@ { using std::asin; - return T(asin(T(static_cast(UINT8_C(1))))) - asin(my_z); + return asin(T(static_cast(UINT8_C(1)))) - asin(my_z); } template EXTENDED_COMPLEX_CONSTEXPR auto asin(const complex& my_z) -> complex @@ -1013,11 +1021,11 @@ return exp(my_a * log(my_z)); } - template EXTENDED_COMPLEX_CONSTEXPR auto pow(const T& my_z, const complex& my_a) -> complex + template EXTENDED_COMPLEX_CONSTEXPR auto pow(const T& my_x, const complex& my_a) -> complex { using std::log; - return exp(my_a * log(my_z)); + return exp(my_a * log(my_x)); } template EXTENDED_COMPLEX_CONSTEXPR auto sin(const complex& my_z) -> complex