dos_compilers/Digital Research PLI-86 v1/FLTPOLY2.PLI
2024-06-30 12:01:25 -07:00

39 lines
1.0 KiB
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 FLOAT BINARY data. It also traps the end-of */
/* file condition for the file SYSIN. */
/******************************************************/
fltpoly2:
procedure options(main);
%replace
false by '0'b,
true by '1'b;
declare
(x,y,z) float binary(24),
eofile bit(1) static initial(false),
sysin file;
on endfile(sysin)
eofile = true;
do while(true);
put skip(2) list('Type x,y,z: ');
get list(x,y,z);
if eofile then
stop;
put skip list(' 2');
put skip list(' x + 2y + z =',P(x,y,z));
end;
P:
procedure (x,y,z) returns (float binary(24));
declare
(x,y,z) float binary(24);
return (x * x + 2 * y + z);
end P;
end fltpoly2;