Added ** exponentiation

pull/2/head
Mark 2023-03-27 21:25:16 -07:00
parent e5b7aa2d1a
commit 56521cbbcd
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
3 changed files with 14 additions and 15 deletions

View File

@ -19,7 +19,6 @@ This is nowhere near complete. Stay tuned.
- Arrows to move cursor
- Documentation
- Branding
- ** as exponentiation
- Improve tests

View File

@ -309,13 +309,13 @@ mod tests {
good_expr(64f64, "4^3");
good_expr(64f64, "4 ^ 3");
//good_expr(64f64, "4**3");
//good_expr(64f64, "4 ** 3");
good_expr(64f64, "4**3");
good_expr(64f64, "4 ** 3");
good_expr(-81f64, "-3^4");
good_expr(-81f64, "-3 ^ 4");
//good_expr(-81f64, "-3**4");
//good_expr(-81f64, "-3 ** 4");
good_expr(-81f64, "-3**4");
good_expr(-81f64, "-3 ** 4");
good_expr(-81f64, "-(3^4)");
//good_expr(f64, "3 ^ (-1.4)");

View File

@ -242,7 +242,7 @@ impl Operator {
"i*" => {Some( Operator::ImplicitMultiply )},
"%" => {Some( Operator::Modulo )},
"mod" => {Some( Operator::ModuloLong )},
"^" => {Some( Operator::Power )},
"^"|"**" => {Some( Operator::Power )},
"!" => {Some( Operator::Factorial )},
_ => None
}