Главная страница | назад





Article #17486: How do I create a power function?

 Question and Answer Database
FAQ2486D.txt How do I create a power function?
Category :Object Pascal
Platform :All
Product :All 32 bit
Question:
How do I create a power function?
Answer:
The following example shows how to use the example
power function to raise three to the power of 2:
function Power(x, y : extended) : extended;
begin
result := exp(y*ln(x));
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(FloatToStr(Power(3, 2)));
end;
7/16/98 4:31:28 PM

Last Modified: 01-SEP-99