| 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. |
| 4 |
|
| 5 |
Copyright ISO/IEC (International Organization for Standardization |
| 6 |
and International Electrotechnical Commission) 1996-2021. |
| 7 |
|
| 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). *) |
| 11 |
|
| 12 |
DEFINITION MODULE LongMath; |
| 13 |
|
| 14 |
(* Mathematical functions for the type LONGREAL *) |
| 15 |
|
| 16 |
CONST |
| 17 |
pi = 3.1415926535897932384626433832795028841972; |
| 18 |
exp1 = 2.7182818284590452353602874713526624977572; |
| 19 |
|
| 20 |
PROCEDURE __BUILTIN__ sqrt (x: LONGREAL): LONGREAL; |
| 21 |
(* Returns the positive square root of x *) |
| 22 |
|
| 23 |
PROCEDURE __BUILTIN__ exp (x: LONGREAL): LONGREAL; |
| 24 |
(* Returns the exponential of x *) |
| 25 |
|
| 26 |
PROCEDURE __BUILTIN__ ln (x: LONGREAL): LONGREAL; |
| 27 |
(* Returns the natural logarithm of x *) |
| 28 |
|
| 29 |
(* The angle in all trigonometric functions is measured in radians *) |
| 30 |
|
| 31 |
PROCEDURE __BUILTIN__ sin (x: LONGREAL): LONGREAL; |
| 32 |
(* Returns the sine of x *) |
| 33 |
|
| 34 |
PROCEDURE __BUILTIN__ cos (x: LONGREAL): LONGREAL; |
| 35 |
(* Returns the cosine of x *) |
| 36 |
|
| 37 |
PROCEDURE tan (x: LONGREAL): LONGREAL; |
| 38 |
(* Returns the tangent of x *) |
| 39 |
|
| 40 |
PROCEDURE arcsin (x: LONGREAL): LONGREAL; |
| 41 |
(* Returns the arcsine of x *) |
| 42 |
|
| 43 |
PROCEDURE arccos (x: LONGREAL): LONGREAL; |
| 44 |
(* Returns the arccosine of x *) |
| 45 |
|
| 46 |
PROCEDURE arctan (x: LONGREAL): LONGREAL; |
| 47 |
(* Returns the arctangent of x *) |
| 48 |
|
| 49 |
PROCEDURE power (base, exponent: LONGREAL): LONGREAL; |
| 50 |
(* Returns the value of the number base raised to the power exponent *) |
| 51 |
|
| 52 |
PROCEDURE round (x: LONGREAL): INTEGER; |
| 53 |
(* Returns the value of x rounded to the nearest integer *) |
| 54 |
|
| 55 |
PROCEDURE IsRMathException (): BOOLEAN; |
| 56 |
(* Returns TRUE if the current coroutine is in the exceptional |
| 57 |
execution state because of the raising of an exception in a |
| 58 |
routine from this module; otherwise returns FALSE. |
| 59 |
*) |
| 60 |
|
| 61 |
END LongMath. |
| 62 |
|