Site Menu Project Specification Implementation Recommendations Reference Needs Updating Work in Progress Wastebasket Wiki Manual |
MathDEFINITION MODULE Math; (* Mathematical constants and functions *) CONST E = 2.7182818284590452353602874713526; PI = 3.1415926535897932384626433832795; PHI = 1.6180339887498948482045868343656; PROCEDURE sgn( r : REAL ) : REAL; (* Returns the signum value of r. *) PROCEDURE floor( r : REAL ) : REAL; (* Returns the floor value of r. *) PROCEDURE ceil( r : REAL ) : REAL; (* Returns the ceiling value of r. *) PROCEDURE frac( r : REAL ) : REAL; (* Returns the fractional part of r. *) PROCEDURE trunc( r : REAL; n : CARDINAL ) : REAL; (* Returns the value of r truncated to n decimal places after the decimal point. *) PROCEDURE round( r : REAL; n : CARDINAL ) : REAL; (* Returns the value of r rounded to n decimal places after the decimal point. *) PROCEDURE power( base, exponent : REAL ) : REAL; (* Returns the value of base raised to the power of exponent. *) PROCEDURE sqrt( r : REAL ) : REAL; (* Returns the square root of r. *) PROCEDURE ln( r : REAL ) : REAL; (* Returns the natural logarithm of r. *) PROCEDURE log( r : REAL ) : REAL; (* Returns the decimal logarithm of r. *) PROCEDURE sin( r : REAL ) : REAL; (* Returns the sine of r. *) PROCEDURE cos( r : REAL ) : REAL; (* Returns the cosine of r. *) PROCEDURE tan( r : REAL ) : REAL; (* Returns the tangent of r. *) PROCEDURE arcsin( r : REAL ) : REAL; (* Returns the arcsine of r. *) PROCEDURE arccos( r : REAL ) : REAL; (* Returns the arccosine of r. *) PROCEDURE arctan( r : REAL ) : REAL; (* Returns the arctangent of r. *) END Math. |