std-method
Floating-point logarithms and exponentials
Translate growth factors to logarithmic scales and back. Positive finite inputs are needed for ordinary real logarithms; results may have platform-dependent precision. Expected stdout (not executed): true true Common mistake: A logarithm of zero is negative infinity, not a usable finite reading.
Formal Syntax & Structure
rust syntaxrust
x.ln(); x.log2(); x.log10(); x.exp()Working Example
Example Snippetrust
fn main() { println!("{}", (8.0_f64.log2() - 3.0).abs() < 1e-10); println!("{}", (1.0_f64.exp().ln() - 1.0).abs() < 1e-10);}