Skip to content

Commit db12046

Browse files
committed
add ln to algebra system
1 parent 9bd9bd5 commit db12046

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/compile/algebra.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,12 @@ impl<'a> AlgebraEnv<'a> {
465465
self.stack.push(res);
466466
self.handled += 1;
467467
}
468+
Ln => {
469+
let a = self.pop()?;
470+
let res = a.log(E.into()).ok_or(AlgebraError::TooComplex)?;
471+
self.stack.push(res);
472+
self.handled += 1;
473+
}
468474
Sin => {
469475
let a = self.pop()?;
470476
self.stack.push(Term::Sin(a).into());
@@ -491,6 +497,12 @@ impl<'a> AlgebraEnv<'a> {
491497
self.stack.push(Term::Cos(a).into());
492498
self.handled += 1;
493499
}
500+
Exp => {
501+
let a = self.pop()?;
502+
let res = Expr::from(E).pow(a).ok_or(AlgebraError::TooComplex)?;
503+
self.stack.push(res);
504+
self.handled += 1;
505+
}
494506
_ => return Err(AlgebraError::NotSupported(prim.to_string())),
495507
},
496508
Mod(prim, args, _) => match prim {

0 commit comments

Comments
 (0)