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


include c:\cxpl\codes;                          \intrinsic 'code' declarations
 
func real Power(X, Y);  \X raised to the Y power
real X, Y;
return Exp(Y*Ln(X));
 
real E, Pi;
[Format(4, 16);                                 \places shown before and after .
E:= Exp(1.0);
RlOut(0, E);  CrLf(0);
RlOut(0, Ln(E));  CrLf(0);
CrLf(0);
Pi:= ATan2(0.0, -1.0);                          \Pi is also a defined constant
RlOut(0, Pi);  CrLf(0);
RlOut(0, Cos(Pi));  CrLf(0);
CrLf(0);
RlOut(0, Sqrt(2.0));  CrLf(0);                  \Sqrt is a call to an intrinsic
RlOut(0, Log(100.0));  CrLf(0);
RlOut(0, Ln(Exp(123.456789)));  CrLf(0);
CrLf(0);
RlOut(0, abs(-1234.5));  CrLf(0);               \abs works for both reals & ints
CrLf(0);
RlOut(0, float(fix(1.999-0.5)));  CrLf(0);      \floor   rounds toward -infinity
RlOut(0, float(fix(1.001+0.5)));  CrLf(0);      \ceiling rounds toward +infinity
RlOut(0, Power(sqrt(2.0), 4.0));  CrLf(0);      \sqrt is an inline function and
]                                               \ can be used for both reals & ints