* This file must be processed with yacc/bison. */
/*
- * GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2002 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "input_lexer.h"
#include "ex.h"
#include "relational.h"
+#include "operators.h"
#include "symbol.h"
#include "lst.h"
#include "power.h"
| T_LITERAL {$$ = $1;}
| T_DIGITS {$$ = $1;}
| T_SYMBOL '(' exprseq ')' {
- unsigned i = function::find_function(ex_to<symbol>($1).get_name(), $3.nops());
- $$ = function(i, ex_to<exprseq>($3)).eval(1);
+ std::string n = ex_to<symbol>($1).get_name();
+ if (n == "sqrt") {
+ if ($3.nops() != 1)
+ throw (std::runtime_error("too many arguments to sqrt()"));
+ $$ = sqrt($3.op(0));
+ } else {
+ unsigned i = function::find_function(n, $3.nops());
+ $$ = function(i, ex_to<exprseq>($3)).eval(1);
+ }
}
| exp T_EQUAL exp {$$ = $1 == $3;}
| exp T_NOTEQ exp {$$ = $1 != $3;}