Sign in Join
FPDoc Onlineexperiment

Sqrt function

In unit System

Calculate the square root of a value.

Declaration

pascal
function Sqrt(d: ValReal): ValReal

Description

Sqrt returns the square root of its argument X, which must be positive.

Errors

If X is negative, then a run-time error is generated.

See also

Example: ex66

pascal
Program Example66;

{ Program to demonstrate the Sqrt function. }

begin
  Writeln (Sqrt(4):0:3); { Prints 2.000 }
  Writeln (Sqrt(2):0:3); { Prints 1.414 }
end.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.