]> www.ginac.de Git - ginac.git/commitdiff
input_parser accepts also pow() [A.Sheplyakov]
authorJens Vollinga <vollinga@thep.physik.uni-mainz.de>
Mon, 27 Aug 2007 16:49:08 +0000 (16:49 +0000)
committerJens Vollinga <vollinga@thep.physik.uni-mainz.de>
Mon, 27 Aug 2007 16:49:08 +0000 (16:49 +0000)
ginac/input_parser.yy

index 8601524c1dbbe5d2c31c556fc2d947cf08343e98..74beb4c54f44464ff78ccfd97f726186b384269f 100644 (file)
@@ -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<exprseq>($3)).eval(1);