Function xxcalc::polynomial_calculator::functions::log [] [src]

pub fn log(args: Vec<Polynomial>) -> Result<PolynomialEvaluationError>

Computes a logarithm of arbitrary base (requires two constant arguments).

First arguments is a value to have a logarithm computed on, where a second argument is a base of the logarithm.

Examples

assert_eq!(PolynomialCalculator.process("log(100, 10)"), Ok(Polynomial::constant(2.0)));
assert_eq!(PolynomialCalculator.process("log(256, 2)"), Ok(Polynomial::constant(8.0)));Run

Errors

It will return a wrapped PolynomialError::NonConstantError when any of the arguments is not a constant polynomial (a polynomial of degree zero).