Home Tutorial Win32 API Reference Projects

 Reference Index ISO Modules Utility & Information SysClock Strings CharClass Storage ProgramArgs GeneralUserExceptions Number/text conversion ConvTypes WholeStr RealStr LongStr WholeConv RealConv LongConv Mathematics library RealMath LongMath ComplexMath LongComplexMath LowLong LowReal Standard channels, constants StdChans ChanConsts IOConsts IOLink IO on specified channels IOResult IOChan RawIO TextIO WholeIO RealIO LongIO IO on standard channels SIOResult SRawIO STextIO SWholeIO SRealIO SLongIO Files and devices SeqFile RndFile StreamFile TermFile Processes Processes Semaphores System modules SYSTEM COROUTINES EXCEPTIONS TERMINATION M2EXCEPTION

```DEFINITION MODULE LongMath;

(* Mathematical functions for the type LONGREAL *)

CONST
pi   = 3.1415926535897932384626433832795028841972;
exp1 = 2.7182818284590452353602874713526624977572;

PROCEDURE sqrt (x: LONGREAL): LONGREAL;
(* Returns the positive square root of x *)

PROCEDURE exp (x: LONGREAL): LONGREAL;
(* Returns the exponential of x *)

PROCEDURE ln (x: LONGREAL): LONGREAL;
(* Returns the natural logarithm of x *)

(* The angle in all trigonometric functions is measured in radians *)

PROCEDURE sin (x: LONGREAL): LONGREAL;
(* Returns the sine of x *)

PROCEDURE cos (x: LONGREAL): LONGREAL;
(* Returns the cosine of x *)

PROCEDURE tan (x: LONGREAL): LONGREAL;
(* Returns the tangent of x *)

PROCEDURE arcsin (x: LONGREAL): LONGREAL;
(* Returns the arcsine of x, in the range [-pi/2, pi/2] *)

PROCEDURE arccos (x: LONGREAL): LONGREAL;
(* Returns the arccosine of x, in the range [0, pi] *)

PROCEDURE arctan (x: LONGREAL): LONGREAL;
(* Returns the arctangent of x, in the range [-pi/2, pi/2] *)

PROCEDURE power (base, exponent: LONGREAL): LONGREAL;
(* Returns the value of the number base raised to the power exponent *)

PROCEDURE round (x: LONGREAL): INTEGER;
(* Returns the value of x rounded to the nearest integer *)

PROCEDURE IsRMathException (): BOOLEAN;
(* Returns TRUE if the current coroutine is in the exceptional execution state
because of the raising of the LONGMATH exception; otherwise returns FALSE.
*)

END LongMath.
```