Calc: remove default epsilon in + allow for scientific notation

This commit is contained in:
Robin Jadoul 2017-01-30 13:39:49 +01:00
parent 85566d511c
commit 33f8c30bfc
2 changed files with 2 additions and 2 deletions

View File

@ -23,7 +23,7 @@ namespace {
if (args.size() != 3)
return 0;
double test = args[0]->eval(vars, funs);
if (std::fabs(test) < 1e-8)
if (test == 0)
return args[2]->eval(vars, funs);
else
return args[1]->eval(vars, funs);

View File

@ -11,6 +11,6 @@ DIVIDE = /
EXPONENT = ^
LT = <
ASSIGN = =
NUM = (0|[1-9][0-9]*)(\.[0-9]+)?
NUM = (0|[1-9][0-9]*)(\.[0-9]+)?([eE]-?[0-9]+)?
IDENT = [a-zA-Z_][a-zA-Z0-9_]*
ignore = \n|\r| |\t