The module RealMath provides the constants and functions for the type REAL, while the module LongMath provides similar constants and functions for the type LONGREAL.
The module ComplexMath provides the constants and functions for the type COMPLEX, while the module LongComplexMath provides similar functions for the type LONGCOMPLEX.
NOTE:
The above statement is merely to avoid needless repetition of the semantics for LongMath.
The units used for angular quantities are radians.
CONST pi = 3.1415926535897932384626433832795028841972; exp1 = 2.7182818284590452353602874713526624977572;
The constant pi provides an implementation-defined approximation to the mathematical constant . The constant exp1 provides an implementation-defined approximation to the mathematical constant e.
NOTE:
Due to the approximations involved, sin(pi) might not equal zero exactly; similarly, exp1 might not equal exp(1) exactly.
PROCEDURE sqrt (x: REAL): REAL; PROCEDURE sqrt (x: LONGREAL): LONGREAL;
The function procedure sqrt returns an implementation-defined approximation to the positive signed square root of x. An exception is raised if x is negative.
PROCEDURE exp (x: REAL): REAL; PROCEDURE exp (x: LONGREAL): LONGREAL;
The function procedure exp returns an implementation-defined approximation to the mathematical constant e raised to the power of x.
PROCEDURE ln (x: REAL): REAL; PROCEDURE ln (x: LONGREAL): LONGREAL;
The function procedure ln returns an implementation-defined approximation to the natural logarithm of x. An exception is raised if x is zero or negative.
PROCEDURE sin (x: REAL): REAL; PROCEDURE sin (x: LONGREAL): LONGREAL;
The function procedure sin returns an implementation-defined approximation to the sine of x.
PROCEDURE cos (x: REAL): REAL; PROCEDURE cos (x: LONGREAL): LONGREAL;
The function procedure cos returns an implementation-defined approximation to the cosine of x.
PROCEDURE tan (x: REAL): REAL; PROCEDURE tan (x: LONGREAL): LONGREAL;
The function procedure tan returns an implementation-defined approximation to the tangent of x. An exception is raised if x is an odd multiple of /2.
PROCEDURE arcsin (x: REAL): REAL; PROCEDURE arcsin (x: LONGREAL): LONGREAL;
The function procedure arcsin returns an implementation-defined approximation to the arcsine of x. An exception is raised if the absolute value of x is greater than one.
PROCEDURE arccos (x: REAL): REAL; PROCEDURE arccos (x: LONGREAL): LONGREAL;
The function procedure arccos returns an implementation-defined approximation to the arccosine of x. An exception is raised if the absolute value of x is greater than one.
PROCEDURE arctan (x: REAL): REAL; PROCEDURE arctan (x: LONGREAL): LONGREAL;
The function procedure arctan returns an implementation-defined approximation to the arctangent of x.
PROCEDURE power (base, exponent: REAL): REAL; PROCEDURE power (base, exponent: LONGREAL): LONGREAL;
The function procedure power returns an implementation-defined approximation to the result obtained by raising base to the power of exponent. An exception is raised if the value of base is zero or negative.
This function is mathematically equivalent to exp (y ln (x)) but may be computed differently.
PROCEDURE round (x: REAL): INTEGER; PROCEDURE round (x: LONGREAL): INTEGER;
The function procedure round returns the nearest integer to the value of x. The result is an implementation-defined selection of the two possible values if the value of x is midway between two integer values. An exception occurs and may be raised if the mathematical result is not within the range of the type INTEGER.
PROCEDURE IsRMathException (): BOOLEAN; PROCEDURE IsRMathException (): BOOLEAN;
If the calling coroutine is in the state of exceptional execution because of the raising of the RealMath exception, the function procedure RealMath.IsRMathException returns TRUE; otherwise the value is FALSE.
If the calling coroutine is in the state of exceptional execution because of the raising of the LongMath exception, the function procedure LongMath.IsRMathException returns TRUE; otherwise the value is FALSE.
NOTE:
The above statement is merely to avoid needless repetition of the semantics for LongComplexMath.
CONST i = CMPLX (0.0, 1.0); one = CMPLX (1.0, 0.0); zero = CMPLX (0.0, 0.0);
Modules: ComplexMath, LongComplexMath
The constants i, one, and zero are the implementation-defined approximations to the specified values.
NOTE:
These constants are provided for convenience.
PROCEDURE abs (z: COMPLEX): REAL; PROCEDURE abs (z: LONGCOMPLEX): LONGREAL;
Modules: ComplexMath, LongComplexMath
The function procedure abs returns an implementation-defined approximation to the modulus (otherwise known as the length, or absolute value) of z.
NOTE:
An overflow exception may be raised in this computation, even when the complex number is itself well defined.
PROCEDURE arg (z: COMPLEX): REAL; PROCEDURE arg (z: LONGCOMPLEX): LONGREAL;
Modules: ComplexMath, LongComplexMath
The function procedure arg returns an implementation-defined approximation to the angle that z subtends to the positive real axis in the complex plane. An exception is raised if the modulus of z is zero.
PROCEDURE conj (z: COMPLEX): COMPLEX; PROCEDURE conj (z: LONGCOMPLEX): LONGCOMPLEX;
Modules: ComplexMath, LongComplexMath
The function procedure conj returns an implementation-defined approximation to the complex conjugate of z.
PROCEDURE power (base: COMPLEX; exponent: REAL ): COMPLEX; PROCEDURE power (base: LONGCOMPLEX; exponent: LONGREAL ): LONGCOMPLEX;
Modules: ComplexMath, LongComplexMath
The function procedure power returns an implementation-defined approximation to the result obtained by raising base to the power of exponent.
PROCEDURE sqrt (z: COMPLEX): COMPLEX; PROCEDURE sqrt (z: LONGCOMPLEX): LONGCOMPLEX;
Modules: ComplexMath, LongComplexMath
The function procedure sqrt returns an implementation-defined approximation to the principal square root of z.
NOTE:
That is, the result is the complex number with an argument of half the value of the argument of z, and whose modulus has the value of the positive square root of the modulus of z.
PROCEDURE exp (z: COMPLEX): COMPLEX; PROCEDURE exp (z: LONGCOMPLEX): LONGCOMPLEX;
Modules: ComplexMath, LongComplexMath
The function procedure exp returns an implementation-defined approximation to the mathematical constant e raised to the power of z.
PROCEDURE ln (z: COMPLEX): COMPLEX; PROCEDURE ln (z: LONGCOMPLEX): LONGCOMPLEX;
Modules: ComplexMath, LongComplexMath
The function procedure ln returns an implementation-defined approximation to the principal value of the natural logarithm of z.
PROCEDURE sin (z: COMPLEX): COMPLEX; PROCEDURE sin (z: LONGCOMPLEX): LONGCOMPLEX;
Modules: ComplexMath, LongComplexMath
The function procedure sin returns an implementation-defined approximation to the complex sine of z.
PROCEDURE cos (z: COMPLEX): COMPLEX; PROCEDURE cos (z: LONGCOMPLEX): LONGCOMPLEX;
Modules: ComplexMath, LongComplexMath
The function procedure cos returns an implementation-defined approximation to the complex cosine of z.
PROCEDURE tan (z: COMPLEX): COMPLEX; PROCEDURE tan (z: LONGCOMPLEX): LONGCOMPLEX;
Modules: ComplexMath, LongComplexMath
The function procedure tan returns an implementation-defined approximation to the complex tangent of z. An exception is raised if z is an odd multiple of /2.
PROCEDURE arcsin (z: LONGCOMPLEX): LONGCOMPLEX; PROCEDURE arcsin (z: COMPLEX): COMPLEX;
Modules: ComplexMath, LongComplexMath
The function procedure arcsin returns an implementation-defined approximation to the principal value of the complex arcsine of z.
PROCEDURE arccos (z: COMPLEX): COMPLEX; PROCEDURE arccos (z: LONGCOMPLEX): LONGCOMPLEX;
Modules: ComplexMath, LongComplexMath
The function procedure arccos returns an implementation-defined approximation to the complex arccosine of z.
PROCEDURE arctan (z: COMPLEX): COMPLEX; PROCEDURE arctan (z: LONGCOMPLEX): LONGCOMPLEX;
Modules: ComplexMath, LongComplexMath
The function procedure arctan returns an implementation-defined approximation to the complex arctangent of z.
PROCEDURE polarToComplex (abs, arg: REAL): COMPLEX; PROCEDURE polarToComplex (abs, arg: LONGREAL): LONGCOMPLEX;
Modules: ComplexMath, LongComplexMath
The function procedure polarToComplex returns an implementation-defined approximation to the complex number that has a modulus given by abs and an argument given by arg.
PROCEDURE scalarMult (scalar: REAL; z: COMPLEX ): COMPLEX; PROCEDURE scalarMult (scalar: LONGREAL; z: LONGCOMPLEX ): LONGCOMPLEX;
Modules: ComplexMath, LongComplexMath
The function procedure scalarMult returns an implementation-defined approximation to the scalar product of the real value scalar with the complex value z.
PROCEDURE IsCMathException (): BOOLEAN; PROCEDURE IsCMathException (): BOOLEAN;
Modules: ComplexMath, LongComplexMath
If the calling coroutine is in the state of exceptional execution because of the raising of a ComplexMath exception, the function procedure ComplexMath.IsCMathException returns TRUE; otherwise it returns FALSE.
If the calling coroutine is in the state of exceptional execution because of the raising of a LongComplexMath exception, the function procedure LongComplexMath.IsCMathException returns TRUE; otherwise it returns FALSE.