Skip to main content

ln

Function ln 

Source
pub fn ln(x: &DBig, precision: usize) -> OxiNumResult<DBig>
Expand description

Compute ln(x) (natural logarithm) with the given precision.

§Errors

Returns OxiNumError::Precision if x <= 0.

§Examples

use oxinum_float::ln;
use std::str::FromStr;
let x = dashu_float::DBig::from_str("2.718281828459045").unwrap();
let result = ln(&x, 30).unwrap();
let s = result.to_string();
assert!(s.starts_with("0.99999") || s.starts_with("1.0000"), "ln(e) = {}", s);