mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[poincare] Log + negative argument gives unreal if complexFormat=real
This commit is contained in:
@@ -1,19 +1,18 @@
|
||||
#include <poincare/logarithm.h>
|
||||
|
||||
#include <poincare/addition.h>
|
||||
#include <poincare/approximation_helper.h>
|
||||
#include <poincare/arithmetic.h>
|
||||
#include <poincare/constant.h>
|
||||
#include <poincare/division.h>
|
||||
#include <poincare/infinity.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/multiplication.h>
|
||||
#include <poincare/naperian_logarithm.h>
|
||||
#include <poincare/power.h>
|
||||
#include <poincare/rational.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
#include <poincare/constant.h>
|
||||
#include <poincare/undefined.h>
|
||||
#include <poincare/unreal.h>
|
||||
#include <cmath>
|
||||
#include <ion.h>
|
||||
#include <assert.h>
|
||||
@@ -118,6 +117,11 @@ Expression Logarithm::shallowReduce(ExpressionNode::ReductionContext reductionCo
|
||||
if (c.sign(reductionContext.context()) == ExpressionNode::Sign::Negative
|
||||
|| childAtIndex(1).sign(reductionContext.context()) == ExpressionNode::Sign::Negative)
|
||||
{
|
||||
if (reductionContext.complexFormat() == Preferences::ComplexFormat::Real) {
|
||||
Expression result = Unreal::Builder();
|
||||
replaceWithInPlace(result);
|
||||
return result;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
Expression f = simpleShallowReduce(reductionContext.context(), reductionContext.complexFormat(), reductionContext.angleUnit());
|
||||
|
||||
@@ -40,7 +40,7 @@ QUIZ_CASE(poincare_complex_simplify) {
|
||||
assert_parsed_expression_simplify_to("𝐢", "unreal", User, Radian, Real);
|
||||
assert_parsed_expression_simplify_to("√(-1)", "unreal", User, Radian, Real);
|
||||
assert_parsed_expression_simplify_to("√(-1)×√(-1)", "unreal", User, Radian, Real);
|
||||
assert_parsed_expression_simplify_to("ln(-2)", "ln(-2)", User, Radian, Real);
|
||||
assert_parsed_expression_simplify_to("ln(-2)", "unreal", User, Radian, Real);
|
||||
assert_parsed_expression_simplify_to("(-8)^(2/3)", "4", User, Radian, Real);
|
||||
assert_parsed_expression_simplify_to("(-8)^(2/5)", "2×root(2,5)", User, Radian, Real);
|
||||
assert_parsed_expression_simplify_to("(-8)^(1/5)", "-root(8,5)", User, Radian, Real);
|
||||
|
||||
Reference in New Issue
Block a user