Skip to content

Commit

Permalink
Fix output of matrix or vector with complex form other than rectangul…
Browse files Browse the repository at this point in the history
…ar (issue #576)
  • Loading branch information
hanna-kn committed Sep 16, 2023
1 parent 3df7aed commit a651bc1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions libqalculate/MathStructure-eval.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1645,15 +1645,15 @@ bool MathStructure::complexToExponentialForm(const EvaluationOptions &eo) {
return true;
} else if(representsReal(true)) {
return false;
} else {
} else if(!isVector()) {
MathStructure marg(CALCULATOR->getFunctionById(FUNCTION_ID_ARG), this, NULL);
marg *= nr_one_i;
CALCULATOR->beginTemporaryStopMessages();
EvaluationOptions eo2 = eo;
eo2.complex_number_form = COMPLEX_NUMBER_FORM_RECTANGULAR;
eo2.parse_options.angle_unit = ANGLE_UNIT_RADIANS;
marg.eval(eo2);
if(!marg.isFunction() || marg.function()->id() != FUNCTION_ID_ARG) {
if((!marg.isFunction() || marg.function()->id() != FUNCTION_ID_ARG) && marg.representsScalar()) {
CALCULATOR->endTemporaryStopMessages(true);
MathStructure mabs(CALCULATOR->getFunctionById(FUNCTION_ID_ABS), this, NULL);
set(CALCULATOR->getVariableById(VARIABLE_ID_E), true);
Expand Down Expand Up @@ -1726,13 +1726,13 @@ bool MathStructure::complexToPolarForm(const EvaluationOptions &eo) {
return true;
} else if(representsReal(true)) {
return false;
} else {
} else if(!isVector()) {
MathStructure marg(CALCULATOR->getFunctionById(FUNCTION_ID_ARG), this, NULL);
CALCULATOR->beginTemporaryStopMessages();
EvaluationOptions eo2 = eo;
eo2.complex_number_form = COMPLEX_NUMBER_FORM_RECTANGULAR;
marg.eval(eo2);
if(!marg.isFunction() || marg.function()->id() != FUNCTION_ID_ARG) {
if((!marg.isFunction() || marg.function()->id() != FUNCTION_ID_ARG) && marg.representsScalar()) {
CALCULATOR->endTemporaryStopMessages(true);
MathStructure mabs(CALCULATOR->getFunctionById(FUNCTION_ID_ABS), this, NULL);
mabs.eval(eo2);
Expand Down Expand Up @@ -1803,13 +1803,13 @@ bool MathStructure::complexToCisForm(const EvaluationOptions &eo) {
return true;
} else if(representsReal(true)) {
return false;
} else {
} else if(!isVector()) {
MathStructure marg(CALCULATOR->getFunctionById(FUNCTION_ID_ARG), this, NULL);
CALCULATOR->beginTemporaryStopMessages();
EvaluationOptions eo2 = eo;
eo2.complex_number_form = COMPLEX_NUMBER_FORM_RECTANGULAR;
marg.eval(eo2);
if(!marg.isFunction() || marg.function()->id() != FUNCTION_ID_ARG) {
if((!marg.isFunction() || marg.function()->id() != FUNCTION_ID_ARG) && marg.representsScalar()) {
CALCULATOR->endTemporaryStopMessages(true);
MathStructure mabs(CALCULATOR->getFunctionById(FUNCTION_ID_ABS), this, NULL);
mabs.eval(eo2);
Expand Down

0 comments on commit a651bc1

Please sign in to comment.