{ "|", Or, 2, 1, -2}
};
-#define NB_FUNCTIONS 31
+#define NB_FUNCTIONS 32
keyword_t functions[NB_FUNCTIONS] = {
{ "sqrt", Sqr, 1, 4, 5},
{ "pow", Pow, 2, 3, 5},
{ "acos", Acos, 1, 4, 5},
{ "asin", Asin, 1, 4, 5},
{ "atan", Atan, 1, 4, 5},
+ { "ln", Ln, 1, 2, 5},
{ "log", Log, 1, 3, 5},
{ "exp", Exp, 1, 3, 5},
{ "abs", Abs, 1, 3, 5},
case Acos: func = "Arc Cosine"; break;
case Asin: func = "Arc Sine"; break;
case Atan: func = "Arc Tangent"; break;
- case Log: func = "Logarithm"; break;
+ case Ln: func = "Logarithm (e base)"; break;
+ case Log: func = "Logarithm (10 base)"; break;
case Exp: func = "Exponantial"; break;
case Abs: func = "Absolute value"; break;
case Ceil: func = "Ceil value"; break;
double *tmp = (double *) callocordie (nbops, sizeof (double));
memcpy (tmp, storage, storage_size * sizeof (double));
free (storage);
- storage = tmp;
- storage_size = nbops;
+ (programs + n)->storage = storage = tmp;
+ (programs + n)->storage_size = storage_size = nbops;
}
for (i = 0; i < nbops; i++) {
double val = evaluate_element (ops[i], 0);
fprintf (stdout, "logical operators:");
fprintf (stdout, " & | !\n");
fprintf (stdout, "mathematic functions:");
- fprintf (stdout, " pow sqrt log exp\n");
+ fprintf (stdout, " exp ln log pow sqrt\n");
fprintf (stdout, "trig. func.:");
- fprintf (stdout, " cos sin tan acos asin atan\n");
+ fprintf (stdout, " acos asin atan cos sin tan\n");
fprintf (stdout, "supported functions:");
fprintf (stdout, " abs ceil floor\n");
- fprintf (stdout, "storage functions:");
- fprintf (stdout, " mem sto rcl inc dec disp\n");
+ fprintf (stdout, "stor. functions:");
+ fprintf (stdout, " clear dec disp inc mem rcl sto\n");
+ fprintf (stdout, "cond. functions:");
+ fprintf (stdout, " cond print while {} ;\n");
fprintf (stdout, "prog. functions:");
- fprintf (stdout, " cond while print {} ;\n");
+ fprintf (stdout, " call del edit ls prog\n");
fprintf (stdout, "misc. functions:");
- fprintf (stdout, " quit help\n");
+ fprintf (stdout, " help quit\n");
fprintf (stdout, "supported constants:");
- fprintf (stdout, " e pi\n");
+ fprintf (stdout, " ans e pi\n");
}
/* evaluate element tree */
case Acos:
case Asin:
case Atan:
+ case Ln:
case Log:
case Exp:
case Abs:
case Acos: return acos (op0);
case Asin: return asin (op0);
case Atan: return atan (op0);
- case Log: return log (op0);
+ case Ln: return log (op0);
+ case Log: return log10 (op0);
case Exp: return exp (op0);
case Abs: return fabs (op0);
case Ceil: return ceil (op0);