Node:Sqr, Next:, Previous:SmallInt, Up:Reference



Sqr

Synopsis


function Sqr (i: integer_type): integer_type;
or
function Sqr (x: real_type): real_type;
or
function Sqr (z: complex_type): complex_type;

Description

Returns the square of the argument:

function Sqr (x: some_type): some_type;
begin
  Sqr := x * x  { or: x pow 2 }
end;

Conforming to

The function Sqr is defined in ISO 7185 Pascal; its application to complex values is defined in ISO 10206 Extended Pascal.

Example


program SqrDemo;

var
  i: Complex;

begin
  i := Cmplx (0, 1);
  WriteLn (Re (Sqr (i)) : 0 : 3)  { yields -1.000 }
end.

See also

pow, SqRt, Abs, Operators.