From: Jens Vollinga Date: Mon, 27 Aug 2007 16:49:08 +0000 (+0000) Subject: input_parser accepts also pow() [A.Sheplyakov] X-Git-Tag: release_1-4-0~6 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=b9bb1375207fef63d28d48420db42bd0461e73b3 input_parser accepts also pow() [A.Sheplyakov] --- diff --git a/ginac/input_parser.yy b/ginac/input_parser.yy index 8601524c..74beb4c5 100644 --- a/ginac/input_parser.yy +++ b/ginac/input_parser.yy @@ -105,6 +105,10 @@ exp : T_NUMBER {$$ = $1;} if ($3.nops() != 1) throw (std::runtime_error("too many arguments to sqrt()")); $$ = sqrt($3.op(0)); + } else if (n == "pow" || n == "power") { + if ($3.nops() != 2) + throw std::invalid_argument("wrong number of arguments to pow()"); + $$ = power($3.op(0), $3.op(0)); } else { unsigned i = function::find_function(n, $3.nops()); $$ = function(i, ex_to($3)).eval(1);