Task

Show how to use the following math constants and functions in your language   (if not available, note it):

   e   (base of the natural logarithm)
   



π


{\displaystyle \pi }


   square root
   logarithm   (any base allowed)
   exponential   (ex )
   absolute value   (a.k.a. "magnitude")
   floor   (largest integer less than or equal to this number--not the same as truncate or int)
   ceiling   (smallest integer not less than this number--not the same as round up)
   power   (xy )


Related task

   Trigonometric Functions


use std::f64::consts::*;
 
fn main() {
    // e (base of the natural logarithm)
    let mut x = E;
    // π
    x += PI;
    // square root
    x = x.sqrt();
    // logarithm (any base allowed)
    x = x.ln();
    // ceiling (smallest integer not less than this number--not the same as round up)
    x = x.ceil();
    // exponential (ex)
    x = x.exp();
    // absolute value (a.k.a. "magnitude")
    x = x.abs();
    // floor (largest integer less than or equal to this number--not the same as truncate or int)
    x = x.floor();
    // power (xy) 
    x = x.powf(x);
 
    assert_eq!(x, 4.0);
}