Hi, I am new here Need help
here is my code FULL CODE HERE , but function y=10^x doesnt work right! well it works great while x = (0,1,2,3,4....) but when x is negative (-1,-2,-3) it doesnt work. I have been trying to fix it for a while now

i hope u will help my

if process_action='y=10^x' then

begin

if strtoint(edit1.text) >; 0 then
begin
calculated_value:=1;
m:=10;
for i:=1 to strtoint(edit1.text) do
calculated_value:=calculated_value*m;
end;
if strtoint(edit1.text) <; 0 then
begin
x:= strtoint(edit1.text) *-1;

calculated_value:=1/n;
n:=1;
m:=10;
for i:=1 to x do
n:=n*m;
end;
end;

i'm not with my delphi herw but try this function

function Potencia(Base, Expoente : Extended) : Extended;
begin
Potencia := Exp(Expoente * Ln(Base));
end;

its the same as Base^Expoente

PS:I put Base and Expoente cause im brazilian and that's how me call this parameters of the calc here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.