{ "|", Or, 2, 1, -2}
};
-#define NB_FUNCTIONS 17
+#define NB_FUNCTIONS 23
keyword_t functions[NB_FUNCTIONS] = {
{ "sqrt", Sqr, 1, 4, 5},
{ "pow", Pow, 2, 3, 5},
{ "cos", Cos, 1, 3, 5},
{ "sin", Sin, 1, 3, 5},
+ { "tan", Tan, 1, 3, 5},
+ { "acos", Acos, 1, 4, 5},
+ { "asin", Asin, 1, 4, 5},
{ "atan", Atan, 1, 4, 5},
- { "exp", Exp, 1, 3, 5},
{ "log", Log, 1, 3, 5},
+ { "exp", Exp, 1, 3, 5},
+ { "abs", Abs, 1, 3, 5},
+ { "floor", Floor, 1, 5, 5},
+ { "ceil", Ceil, 1, 4, 5},
{ "sto", Store, 2, 3, 5},
{ "rcl", Recall, 1, 3, 5},
{ "inc", Inc, 1, 3, 5},
{ "help", Help, 0, 4, 9},
{ "!", Not, 1, 1, 6},
{ "cond", Cond, 3, 4, 5},
- { "whl", While, 2, 3, 5}
+ { "while", While, 2, 5, 5}
};
#define NB_CONSTANTS 3
case Sqr: func = "Square Root"; break;
case Cos: func = "Cosine"; break;
case Sin: func = "Sine"; break;
+ case Tan: func = "Tangent"; break;
+ case Acos: func = "Arc Cosine"; break;
+ case Asin: func = "Arc Sine"; break;
case Atan: func = "Arc Tangent"; break;
case Log: func = "Logarithm"; break;
case Exp: func = "Exponantial"; break;
+ case Abs: func = "Absolute value"; break;
+ case Ceil: func = "Ceil value"; break;
+ case Floor: func = "Floor value"; break;
case Store: func = "Store"; break;
case Recall: func = "Recall"; break;
case Inc: func = "Increase"; break;
fprintf (stdout, " == != >= <= > <\n");
fprintf (stdout, "logical operators:");
fprintf (stdout, " & | !\n");
+ fprintf (stdout, "mathematic functions:");
+ fprintf (stdout, " pow sqrt cos sin tan acos asin atan log exp\n");
fprintf (stdout, "supported functions:");
- fprintf (stdout, " pow sqrt cos sin atan log exp\n");
+ fprintf (stdout, " abs ceil floor\n");
fprintf (stdout, "storage functions:");
fprintf (stdout, " sto rcl inc dec\n");
fprintf (stdout, "conditional functions:");
- fprintf (stdout, " cond\n");
+ fprintf (stdout, " cond while\n");
fprintf (stdout, "miscellaneous functions:");
fprintf (stdout, " quit help\n");
fprintf (stdout, "supported constants:");
case Sqr:
case Cos:
case Sin:
+ case Tan:
+ case Acos:
+ case Asin:
case Atan:
case Log:
case Exp:
+ case Abs:
+ case Ceil:
+ case Floor:
case Recall:
case Inc:
case Dec:
case Sqr: return sqrt (op0);
case Cos: return cos (op0);
case Sin: return sin (op0);
+ case Tan: return tan (op0);
+ case Acos: return acos (op0);
+ case Asin: return asin (op0);
case Atan: return atan (op0);
case Log: return log (op0);
case Exp: return exp (op0);
+ case Abs: return fabs (op0);
+ case Ceil: return ceil (op0);
+ case Floor: return floor (op0);
case Store: return store ((int)op0, (op1) ? op1 : answer);
case Recall: return recall ((int)op0);
case Inc: return increase ((int)op0);