Skip to content

Commit

Permalink
specify ln to log() for natural log evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
falconindy committed May 4, 2010
1 parent 147ae19 commit e8f7057
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion posty.c
Expand Up @@ -189,6 +189,8 @@ int parse_mfunc(char *mfunc) {
res = atan(op1);
else if (strcmp(mfunc, "sqrt") == 0)
res = sqrt(op1);
else if (strcmp(mfunc, "ln") == 0)
res = log(op1);

if (verbose == 1)
printf("%s(%.*f) = %.*f\n", mfunc, precision, op1, precision, res);
Expand All @@ -204,7 +206,7 @@ int parse_expression(char *expr) {

char *token;
static const char *operators = "+/*-%^";
static const char *mfuncs = "|sqrt|sin|cos|tan|asin|acos|atan|";
static const char *mfuncs = "|ln|sqrt|sin|cos|tan|asin|acos|atan|";
static const char *constants = "|e|pi|";
double operand;
char *ptr;
Expand Down

0 comments on commit e8f7057

Please sign in to comment.