mirror of https://github.com/rm-dr/daisy
Added ** exponentiation
parent
e5b7aa2d1a
commit
56521cbbcd
|
@ -19,7 +19,6 @@ This is nowhere near complete. Stay tuned.
|
|||
- Arrows to move cursor
|
||||
- Documentation
|
||||
- Branding
|
||||
- ** as exponentiation
|
||||
- Improve tests
|
||||
|
||||
|
||||
|
|
|
@ -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)");
|
||||
|
|
|
@ -234,16 +234,16 @@ impl Operator {
|
|||
#[inline(always)]
|
||||
pub fn from_string(s: &str) -> Option<Operator> {
|
||||
match s {
|
||||
"+" => {Some( Operator::Add )},
|
||||
"-" => {Some( Operator::Subtract )},
|
||||
"neg" => {Some( Operator::Negative )},
|
||||
"*"|"×" => {Some( Operator::Multiply )},
|
||||
"/"|"÷" => {Some( Operator::Divide )},
|
||||
"i*" => {Some( Operator::ImplicitMultiply )},
|
||||
"%" => {Some( Operator::Modulo )},
|
||||
"mod" => {Some( Operator::ModuloLong )},
|
||||
"^" => {Some( Operator::Power )},
|
||||
"!" => {Some( Operator::Factorial )},
|
||||
"+" => {Some( Operator::Add )},
|
||||
"-" => {Some( Operator::Subtract )},
|
||||
"neg" => {Some( Operator::Negative )},
|
||||
"*"|"×" => {Some( Operator::Multiply )},
|
||||
"/"|"÷" => {Some( Operator::Divide )},
|
||||
"i*" => {Some( Operator::ImplicitMultiply )},
|
||||
"%" => {Some( Operator::Modulo )},
|
||||
"mod" => {Some( Operator::ModuloLong )},
|
||||
"^"|"**" => {Some( Operator::Power )},
|
||||
"!" => {Some( Operator::Factorial )},
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue