diff options
author | mbkma <[email protected]> | 2019-04-13 16:40:01 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-04-15 10:45:19 +0200 |
commit | d6fb7b35b8fdf499f8d2c693e446bf502068b344 (patch) | |
tree | 431d275bb5924090bbb8aafee98299eab119bd7f | |
parent | 4a6090abc47a96a032ff107aef5db897800bd92e (diff) | |
download | mate-calc-d6fb7b35b8fdf499f8d2c693e446bf502068b344.tar.bz2 mate-calc-d6fb7b35b8fdf499f8d2c693e446bf502068b344.tar.xz |
Add support for "pi" in addition to "π"
-rw-r--r-- | src/mp-equation.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mp-equation.c b/src/mp-equation.c index 9b6a195..b80408e 100644 --- a/src/mp-equation.c +++ b/src/mp-equation.c @@ -18,7 +18,7 @@ static int variable_is_defined(ParserState *state, const char *name) { /* FIXME: Make more generic */ - if (strcmp(name, "e") == 0 || strcmp(name, "i") == 0 || strcmp(name, "π") == 0) + if (strcmp(name, "e") == 0 || strcmp(name, "i") == 0 || strcmp(name, "π") == 0 || strcmp(name, "pi") == 0) return 1; if (state->options->variable_is_defined) return state->options->variable_is_defined(name, state->options->callback_data); @@ -35,7 +35,7 @@ get_variable(ParserState *state, const char *name, MPNumber *z) mp_get_eulers(z); else if (strcmp(name, "i") == 0) mp_get_i(z); - else if (strcmp(name, "π") == 0) + else if (strcmp(name, "π") == 0 || strcmp(name, "pi") == 0) mp_get_pi(z); else if (state->options->get_variable) result = state->options->get_variable(name, z, state->options->callback_data); @@ -49,7 +49,7 @@ static void set_variable(ParserState *state, const char *name, const MPNumber *x) { // Reserved words, e, π, mod, and, or, xor, not, abs, log, ln, sqrt, int, frac, sin, cos, ... - if (strcmp(name, "e") == 0 || strcmp(name, "i") == 0 || strcmp(name, "π") == 0) + if (strcmp(name, "e") == 0 || strcmp(name, "i") == 0 || strcmp(name, "π") == 0 || strcmp(name, "pi") == 0) return; // FALSE if (state->options->set_variable) |