1 (* Library module defined by the International Standard
2 Information technology - programming languages
3 BS ISO/IEC 10514-1:1996E Part 1: Modula-2, Base Language.
5 Copyright ISO/IEC (International Organization for Standardization
6 and International Electrotechnical Commission) 1996-2021.
8 It may be freely copied for the purpose of implementation (see page
9 707 of the Information technology - Programming languages Part 1:
10 Modula-2, Base Language. BS ISO/IEC 10514-1:1996). *)
12 DEFINITION MODULE RealMath
;
14 (* Mathematical functions for the type REAL *)
17 pi
= 3.1415926535897932384626433832795028841972;
18 exp1
= 2.7182818284590452353602874713526624977572;
20 PROCEDURE __BUILTIN__
sqrt (x
: REAL): REAL;
21 (* Returns the positive square root of x *)
23 PROCEDURE __BUILTIN__
exp (x
: REAL): REAL;
24 (* Returns the exponential of x *)
26 PROCEDURE __BUILTIN__
ln (x
: REAL): REAL;
27 (* Returns the natural logarithm of x *)
29 (* The angle in all trigonometric functions is measured in radians *)
31 PROCEDURE __BUILTIN__
sin (x
: REAL): REAL;
32 (* Returns the sine of x *)
34 PROCEDURE __BUILTIN__
cos (x
: REAL): REAL;
35 (* Returns the cosine of x *)
37 PROCEDURE tan (x
: REAL): REAL;
38 (* Returns the tangent of x *)
40 PROCEDURE arcsin (x
: REAL): REAL;
41 (* Returns the arcsine of x *)
43 PROCEDURE arccos (x
: REAL): REAL;
44 (* Returns the arccosine of x *)
46 PROCEDURE arctan (x
: REAL): REAL;
47 (* Returns the arctangent of x *)
49 PROCEDURE power (base
, exponent
: REAL) : REAL;
50 (* Returns the value of the number base raised to the power exponent *)
52 PROCEDURE round (x
: REAL) : INTEGER;
53 (* Returns the value of x rounded to the nearest integer *)
55 PROCEDURE IsRMathException () : BOOLEAN;
56 (* Returns TRUE if the current coroutine is in the exceptional execution state
57 because of the raising of an exception in a routine from this module; otherwise