diff --git a/src/DynareBison.yy b/src/DynareBison.yy index 36df7ca23af70d14c396f5c79932ce14ab68e487..5734fa13a8f90bb9207c6640ed732aa946e1a62f 100644 --- a/src/DynareBison.yy +++ b/src/DynareBison.yy @@ -1014,6 +1014,8 @@ hand_side : '(' hand_side ')' { $$ = driver.add_atan($3); } | SQRT '(' hand_side ')' { $$ = driver.add_sqrt($3); } + | CBRT '(' hand_side ')' + { $$ = driver.add_cbrt($3); } | ABS '(' hand_side ')' { $$ = driver.add_abs($3); } | SIGN '(' hand_side ')' diff --git a/src/ExprNode.cc b/src/ExprNode.cc index 9d116abd6976b44ac455e78a99ba5f370acba21b..0d473828a0164411bb8c3aab9989fe76749ee081 100644 --- a/src/ExprNode.cc +++ b/src/ExprNode.cc @@ -2777,7 +2777,22 @@ UnaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type, output << "sqrt"; break; case UnaryOpcode::cbrt: - output << "cbrt"; + if (isMatlabOutput(output_type)) + { + output << "nthroot("; + arg->writeOutput(output, output_type, temporary_terms, temporary_terms_idxs, tef_terms); + output << ", 3)"; + return; + } + else if (isLatexOutput(output_type)) + { + output << R"(\sqrt[3]{)"; + arg->writeOutput(output, output_type, temporary_terms, temporary_terms_idxs, tef_terms); + output << "}"; + return; + } + else + output << "cbrt"; break; case UnaryOpcode::abs: output << "abs";