feat: add ln function
this one is easier than log or root, because it only takes one arg
This commit is contained in:
parent
e59f928192
commit
f1c6073708
3 changed files with 6 additions and 0 deletions
|
|
@ -52,6 +52,8 @@ fn collapse_toplevel(nodes: &mut Vec<Node>, mut end: usize) -> Result<(), Error>
|
||||||
Node::Number(n) => match variant {
|
Node::Number(n) => match variant {
|
||||||
Function::Sqrt => n.sqrt_mut(),
|
Function::Sqrt => n.sqrt_mut(),
|
||||||
|
|
||||||
|
Function::Ln => n.ln_mut(),
|
||||||
|
|
||||||
Function::Sine => n.sin_mut(),
|
Function::Sine => n.sin_mut(),
|
||||||
Function::ArcSine => n.asin_mut(),
|
Function::ArcSine => n.asin_mut(),
|
||||||
Function::Cosine => n.cos_mut(),
|
Function::Cosine => n.cos_mut(),
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,8 @@ pub enum Operator {
|
||||||
pub enum Function {
|
pub enum Function {
|
||||||
Sqrt,
|
Sqrt,
|
||||||
|
|
||||||
|
Ln,
|
||||||
|
|
||||||
Sine,
|
Sine,
|
||||||
ArcSine,
|
ArcSine,
|
||||||
Cosine,
|
Cosine,
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,8 @@ impl FromStr for Function {
|
||||||
match s {
|
match s {
|
||||||
"sqrt" => Ok(Self::Sqrt),
|
"sqrt" => Ok(Self::Sqrt),
|
||||||
|
|
||||||
|
"ln" => Ok(Self::Ln),
|
||||||
|
|
||||||
"sin" => Ok(Self::Sine),
|
"sin" => Ok(Self::Sine),
|
||||||
"asin" => Ok(Self::ArcSine),
|
"asin" => Ok(Self::ArcSine),
|
||||||
"cos" => Ok(Self::Cosine),
|
"cos" => Ok(Self::Cosine),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue