Standard mathematical functions. Provides common floating-point operations following the PIM4 library convention.
PROCEDURE sqrt(x: REAL): REAL;
PROCEDURE exp(x: REAL): REAL;
PROCEDURE ln(x: REAL): REAL;
PROCEDURE sin(x: REAL): REAL;
PROCEDURE cos(x: REAL): REAL;
PROCEDURE arctan(x: REAL): REAL;
PROCEDURE entier(x: REAL): INTEGER;
PROCEDURE real(n: INTEGER): REAL;
entierreturns the largest integer not greater thanx(floor).realconverts an integer to its floating-point representation.lnis the natural logarithm (base e).- Angles for
sin,cos, andarctanare in radians.
MODULE MathDemo;
FROM MathLib0 IMPORT sqrt, sin, cos, real;
FROM InOut IMPORT WriteString, WriteLn;
FROM RealInOut IMPORT WriteReal;
VAR hyp: REAL;
BEGIN
hyp := sqrt(real(3) * real(3) + real(4) * real(4));
WriteString("Hypotenuse: ");
WriteReal(hyp, 10);
WriteLn;
END MathDemo.