]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/m2/gm2-libs-iso/LongComplexMath.def
Merge modula-2 front end onto gcc.
[thirdparty/gcc.git] / gcc / m2 / gm2-libs-iso / LongComplexMath.def
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 LongComplexMath;
13
14 (* Mathematical functions for the type LONGCOMPLEX *)
15
16 CONST
17 i = CMPLX (0.0, 1.0);
18 one = CMPLX (1.0, 0.0);
19 zero = CMPLX (0.0, 0.0);
20
21 PROCEDURE abs (z: LONGCOMPLEX): LONGREAL;
22 (* Returns the length of z *)
23
24 PROCEDURE arg (z: LONGCOMPLEX): LONGREAL;
25 (* Returns the angle that z subtends to the positive real axis *)
26
27 PROCEDURE conj (z: LONGCOMPLEX): LONGCOMPLEX;
28 (* Returns the complex conjugate of z *)
29
30 PROCEDURE power (base: LONGCOMPLEX; exponent: LONGREAL): LONGCOMPLEX;
31 (* Returns the value of the number base raised to the power exponent *)
32
33 PROCEDURE sqrt (z: LONGCOMPLEX): LONGCOMPLEX;
34 (* Returns the principal square root of z *)
35
36 PROCEDURE exp (z: LONGCOMPLEX): LONGCOMPLEX;
37 (* Returns the complex exponential of z *)
38
39 PROCEDURE ln (z: LONGCOMPLEX): LONGCOMPLEX;
40 (* Returns the principal value of the natural logarithm of z *)
41
42 PROCEDURE sin (z: LONGCOMPLEX): LONGCOMPLEX;
43 (* Returns the sine of z *)
44
45 PROCEDURE cos (z: LONGCOMPLEX): LONGCOMPLEX;
46 (* Returns the cosine of z *)
47
48 PROCEDURE tan (z: LONGCOMPLEX): LONGCOMPLEX;
49 (* Returns the tangent of z *)
50
51 PROCEDURE arcsin (z: LONGCOMPLEX): LONGCOMPLEX;
52 (* Returns the arcsine of z *)
53
54 PROCEDURE arccos (z: LONGCOMPLEX): LONGCOMPLEX;
55 (* Returns the arccosine of z *)
56
57 PROCEDURE arctan (z: LONGCOMPLEX): LONGCOMPLEX;
58 (* Returns the arctangent of z *)
59
60 PROCEDURE polarToComplex (abs, arg: LONGREAL): LONGCOMPLEX;
61 (* Returns the complex number with the specified polar coordinates *)
62
63 PROCEDURE scalarMult (scalar: LONGREAL; z: LONGCOMPLEX): LONGCOMPLEX;
64 (* Returns the scalar product of scalar with z *)
65
66 PROCEDURE IsCMathException (): BOOLEAN;
67 (* Returns TRUE if the current coroutine is in the exceptional execution state
68 because of the raising of an exception in a routine from this module; otherwise
69 returns FALSE.
70 *)
71
72 END LongComplexMath.
73