RosettaCodeData/Task/Arithmetic-Complex/PL-I/arithmetic-complex.pli
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

21 lines
652 B
Text

/* 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. */