Next: , Previous: Sqr, Up: Reference



SqRt

Synopsis

     function SqRt (x: real_type): real_type;

or

     function SqRt (z: complex_type): complex_type;

Description

Returns the positive square root of the argument.

For real arguments, it is an error if the argument is negative.

For complex arguments, SqRt returns the principal value of the root of the argument, i.e. the root with positive real part, or, if the real part is zero, that one with positive imaginary part.

Conforming to

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

Example

     program SqRtDemo;
     
     var
       m1: Complex;
     
     begin
       m1 := Cmplx (-1, 0);  { -1 }
       WriteLn (Re (SqRt (m1)) : 6 : 3, Im (SqRt (m1)) : 6 : 3);
         { yields 1.000 -1.000, i.e. the imaginary unit, i }
     end.

See also

pow, Sqr, Operators.