[poincare] Power: fix approximation

0^0 should be equal to undef
This commit is contained in:
Émilie Feral
2019-01-07 13:48:04 +01:00
committed by Léa Saviot
parent c4bd55ef08
commit 4283eb7e32

View File

@@ -100,7 +100,7 @@ bool PowerNode::isReal(Context & context) const {
template<typename T>
Complex<T> PowerNode::compute(const std::complex<T> c, const std::complex<T> d) {
std::complex<T> result;
if (c.imag() == 0.0 && d.imag() == 0.0 && (c.real() > 0.0 || std::round(d.real()) == d.real())) {
if (c.imag() == 0.0 && d.imag() == 0.0 && c.real() != 0.0 && (c.real() > 0.0 || std::round(d.real()) == d.real())) {
/* pow: (R+, R) -> R+ (2^1.3 ~ 2.46)
* pow: (R-, N) -> R+ ((-2)^3 = -8)
* In these cases we rather use std::pow(double, double) because: