Board index » delphi » Maths Functions (Delphi3)

Maths Functions (Delphi3)

Help

I am trying to raise one number to the power of another. Both numbers are
read from edit box's and consist of digits and decimals.ie 123.45. The
result is to show in a further edit box.
Im tying myself up in floating point types and getting no where !
Can anyone please give me the code for a button click event to do this ?
Paul

 

Re:Maths Functions (Delphi3)


If you have D3 Pro or C/S you have the Math-unit. In that case you can use
Power(..,..), see the OLH.
Else you have to write the function yourself. Here is an example:

function MyPower(g, e : extended) : extended;
begin
    Result := exp(e * ln(g));
end;

Alfred.

"Paul Day" <Betty...@btinternet.com> schreef in bericht
news:3bcddddf_2@dnews...

Quote
> Help

> I am trying to raise one number to the power of another. Both numbers are
> read from edit box's and consist of digits and decimals.ie 123.45. The
> result is to show in a further edit box.
> Im tying myself up in floating point types and getting no where !
> Can anyone please give me the code for a button click event to do this ?
> Paul

Re:Maths Functions (Delphi3)


Many thanks, your function works a treat
Paul

Other Threads