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


FUNCTION floor(x)
    IF x > 0 THEN
       LET floor = INT(x)
    ELSE
       IF x <> INT(x) THEN LET floor = INT(x) - 1 ELSE LET floor = INT(x)
    END IF
END FUNCTION
 
PRINT "e     = "; EXP(1)          ! e  NOT available
PRINT "PI    = "; PI
 
LET x = 12.345
LET y = 1.23
 
PRINT "sqrt  = "; SQR(x), x^0.5   ! square root- NB the unusual NAME
PRINT "ln    = "; LOG(x)          ! natural logarithm BASE e
PRINT "log2  = "; LOG2(x)         ! BASE 2 logarithm
PRINT "log10 = "; LOG10(x)        ! BASE 10 logarithm
PRINT "log   = "; LOG(x)/LOG(y)   ! arbitrary BASE logarithm
PRINT "exp   = "; EXP(x)          ! exponential
PRINT "abs   = "; ABS(-1)         ! ABSOLUTE value
PRINT "floor = "; floor(x)        ! floor easily implemented AS functions
PRINT "ceil  = "; CEIL(x)         ! ceiling
PRINT "power = "; x ^ y           ! power
END