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


 
print exp( 1)            ' e  not available
print 4 *atn( 1)         ' pi not available
 
x =12.345: y =1.23
 
print sqr( x), x^0.5     ' square root- NB the unusual name
print log( x)            ' natural logarithm base e
print log( x) /2.303     ' base 10 logarithm
print log( x) /log( y)   ' arbitrary base logarithm
print exp( x)            ' exponential
print abs( x)            ' absolute value
print floor( x)          ' floor
print ceiling( x)        ' ceiling
print x^y                ' power
 
end
 
function floor( x)
    if x >0 then
        floor =int( x)
    else
        if x <>int( x) then floor =int( x) -1 else floor =int( x)
    end if
end function
 
function ceiling( x)
    if x <0 then
        ceiling =int( x)
    else
        ceiling =int( x) +1
    end if
end function
 