Skip to content

Commit

Permalink
Merge pull request #571 from ckormanyos/update_complex
Browse files Browse the repository at this point in the history
Update extendec-complex again
  • Loading branch information
ckormanyos authored Nov 20, 2024
2 parents e9e44c0 + 761a5e4 commit c5cf6c8
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions ref_app/src/math/extended_complex/extended_complex.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,16 @@
template<typename X>
EXTENDED_COMPLEX_CONSTEXPR auto operator-=(const complex<X>& my_z) -> complex&
{
my_re -= static_cast<value_type>(my_z.my_re);
my_im -= static_cast<value_type>(my_z.my_im);
if(this == &my_z)
{
my_re = static_cast<value_type>(static_cast<unsigned>(UINT8_C(0)));
my_im = static_cast<value_type>(static_cast<unsigned>(UINT8_C(0)));
}
else
{
my_re -= static_cast<value_type>(my_z.my_re);
my_im -= static_cast<value_type>(my_z.my_im);
}

return *this;
}
Expand Down Expand Up @@ -843,7 +851,7 @@
{
using std::asin;

return T(asin(T(static_cast<unsigned>(UINT8_C(1))))) - asin(my_z);
return asin(T(static_cast<unsigned>(UINT8_C(1)))) - asin(my_z);
}

template<typename T, typename EnableType> EXTENDED_COMPLEX_CONSTEXPR auto asin(const complex<T, EnableType>& my_z) -> complex<T, EnableType>
Expand Down Expand Up @@ -1013,11 +1021,11 @@
return exp(my_a * log(my_z));
}

template<typename T, typename EnableType> EXTENDED_COMPLEX_CONSTEXPR auto pow(const T& my_z, const complex<T, EnableType>& my_a) -> complex<T, EnableType>
template<typename T, typename EnableType> EXTENDED_COMPLEX_CONSTEXPR auto pow(const T& my_x, const complex<T, EnableType>& my_a) -> complex<T, EnableType>
{
using std::log;

return exp(my_a * log(my_z));
return exp(my_a * log(my_x));
}

template<typename T, typename EnableType> EXTENDED_COMPLEX_CONSTEXPR auto sin(const complex<T, EnableType>& my_z) -> complex<T, EnableType>
Expand Down

0 comments on commit c5cf6c8

Please sign in to comment.