22 lines
652 B
Plaintext
22 lines
652 B
Plaintext
/* PL/I complex numbers may be integer or floating-point. */
|
|
/* In this example, the variables are floating-pint. */
|
|
/* For integer variables, change 'float' to 'fixed binary' */
|
|
|
|
declare (a, b) complex float;
|
|
a = 2+5i;
|
|
b = 7-6i;
|
|
|
|
put skip list (a+b);
|
|
put skip list (a - b);
|
|
put skip list (a*b);
|
|
put skip list (a/b);
|
|
put skip list (a**b);
|
|
put skip list (1/a);
|
|
put skip list (conjg(a)); /* gives the conjugate of 'a'. */
|
|
|
|
/* Functions exist for extracting the real and imaginary parts */
|
|
/* of a complex number. */
|
|
|
|
/* As well, trigonometric functions may be used with complex */
|
|
/* numbers, such as SIN, COS, TAN, ATAN, and so on. */
|