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


 
Module Checkit {
      Def exp(x)= 2.71828182845905^x
      Print Ln(exp(1))==1
      Print Log(10^5)==5
      Print Sgn(-5)=-1
      Print Abs(-2.10#)=2.1#
      Def exptype$(x)=type$(x)
      Print exptype$(Abs(-2.1#))="Currency"
      Print exptype$(Abs(-2.1~))="Single"
      Print exptype$(Abs(-2.1@))="Decimal"
      Print exptype$(Abs(-2&))="Long"
      Print exptype$(Abs(-2%))="Integer"
      Print exptype$(Abs(-2.212e34))="Double"
 
      Print exptype$(Sgn(-2.1#))="Integer"
      \\ Sgn return integer type
      Print exptype$(Sgn(-2.212e34))="Integer"
      \\ Log, Len return double
      Print exptype$(Log(1000))="Double"
      Print exptype$(exp(1%))="Double"
      Print exptype$(Ln(1212%))="Double"
      \\ power return type Double
      Print exptype$(2&^2&)="Double"
      Print exptype$(2&**2&)="Double"
      Print exptype$(2&*2&)="Long"
      Print 2**2=4, 2^2=4, 2^2^2=16, 2**2**2=16
      \\ floor() and Int() is the same
      Print Int(-2.7)=-3, Int(2.7)=2
      Print Floor(-2.7)=-3, Floor(2.7)=2
      Print Ceil(-2.7)=-2, Ceil(2.7)=3
 
      Print round(-2.7, 0)=-3, round(2.7, 0)=3
      Print round(-2.2, 0)=-2, round(2.2, 0)=2
 
 
      Print Sqrt(4)=2
}
Checkit
 