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


the floatPrecision = 8
 
-- e (base of the natural logarithm)
put exp(1)
-- 2.71828183
 
-- pi
put PI
-- 3.14159265
 
-- square root
put sqrt(2.0)
-- 1.41421356
 
-- logarithm (any base allowed)
x = 100
 
put log(x) -- calculate log for base e
-- 4.60517019
 
put log(x)/log(10) -- calculate log for base 10
-- 2.00000000
 
-- exponential (ex)
put exp(3)
-- 20.08553692
 
-- absolute value (a.k.a. "magnitude")
put abs(-1)
-- 1
 
-- floor (largest integer less than or equal to this number--not the same as truncate or int)
n = 23.536
put bitOr(n, 0) -- calculates floor
-- 23
 
-- ceiling (smallest integer not less than this number--not the same as round up)
n = 23.536
-- calculates ceil
floor = bitOr(n, 0)
if (floor >= n) then put floor
else put floor+1
-- 24
 
-- power
put power(2, 8)
-- 256.00000000