Files
Digital-Research-Source-Code/SAMPLE CODE/PLI PROG SAMPLE CODE/DECPOLY.PLI
Sepp J Morris 31738079c4 Upload
Digital Research
2020-11-06 18:50:37 +01:00

33 lines
896 B
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*****************************************************/
/* This program evaluates a polynomial expression */
/* using FIXED DECIMAL data. */
/*****************************************************/
decpoly:
procedure options(main);
%replace
true by '1'b;
declare
(x,y,z) fixed decimal(15,4);
do while(true);
put skip(2) list('Type x,y,z: ');
get list(x,y,z);
if x=0 & y=0 & z=0 then
stop;
put skip list(' 2');
put skip list(' x + 2y + z =',P(x,y,z));
end;
P:
procedure (x,y,z) returns (fixed decimal(15,4));
declare
(x,y,z) fixed decimal(15,4);
return (x * x + 2 * y + z);
end P;
end decpoly;