[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'Math' (#rtl)

# IntPower

Return integer power.

## Declaration

Source position: math.pp line 399

`function IntPower(`
`base: Float;`
`const exponent: Integer`
`):Float;`

## Description

Intpower returns base to the power exponent, where exponent is an integer value.

## Errors

If base is zero and the exponent is negative, then an overflow error will occur.

## See also

power |  | Return real power.

## Example

    Program Example18;

    { Program to demonstrate the intpower function. }

    Uses math;

    Procedure DoIntpower (X : extended; Pow : Integer);

    begin
      writeln(X:8:4,'^',Pow:2,' = ',intpower(X,pow):8:4);
    end;

    begin
      dointpower(0.0,0);
      dointpower(1.0,0);
      dointpower(2.0,5);
      dointpower(4.0,3);
      dointpower(2.0,-1);
      dointpower(2.0,-2);
      dointpower(-2.0,4);
      dointpower(-4.0,3);
    end.