33 lines
571 B
Plaintext
33 lines
571 B
Plaintext
include c:\cxpl\codes; \intrinsic 'code' declarations
|
|
|
|
func real Power(X, Y); \X raised to the Y power; (X > 0.0)
|
|
real X; int Y;
|
|
return Exp(float(Y) * Ln(X));
|
|
|
|
func IPower(X, Y); \X raised to the Y power
|
|
int X, Y;
|
|
int P;
|
|
[P:= 1;
|
|
while Y do
|
|
[if Y&1 then P:= P*X;
|
|
X:= X*X;
|
|
Y:= Y>>1;
|
|
];
|
|
return P;
|
|
];
|
|
|
|
int X, Y;
|
|
[Format(9, 0);
|
|
for X:= 1 to 10 do
|
|
[for Y:= 0 to 7 do
|
|
RlOut(0, Power(float(X), Y));
|
|
CrLf(0);
|
|
];
|
|
CrLf(0);
|
|
for X:= 1 to 10 do
|
|
[for Y:= 0 to 7 do
|
|
[ChOut(0, 9); IntOut(0, IPower(X, Y))];
|
|
CrLf(0);
|
|
];
|
|
]
|