# Indicies operator in TP

Hi everyone - could somebody please tell me if

Turbo Pascal has a "to the power of" operator.

I'm trying to write some code that will quickly

work out and plot RC / LC / LR charging time

curves, unfortunately I need to calcultate powers.

2^2 = 4 2^3 = 8 10^2 = 100 5^0.5 = 2.23606 etc

Thank you

-Ralf.

• I thought it did... but now, for the life of me, and cannot

remember what it is... A Pascal textbook might be able to tell

you. So long as you only need whole powers, the following function

will work:

Function Power(Number,Pwr:Real): Real;

var

A:Word;

Temp:String;

begin;

Temp := Number;

For A := 1 to (Pwr - 1) do Temp := Temp * Number;

power := Temp;

end;

Note: I know it's not Exp(), that just returns the

number in terms of powers of e.

URL:http://acheronx.ml.org/home/

• : Hi everyone - could somebody please tell me if

: Turbo Pascal has a "to the power of" operator.

: I'm trying to write some code that will quickly

: work out and plot RC / LC / LR charging time

: curves, unfortunately I need to calcultate powers.

: 2^2 = 4 2^3 = 8 10^2 = 100 5^0.5 = 2.23606 etc

: Thank you

: -Ralf.

Just use the log and exp functions to calculate powers.

If I remember correctly, you can use some combination of them

to produce powers of numbers : exp(y*ln(x)) which is the same as

x^y.