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