SQRT(X)

Purpose

Square root.

Class

Elemental function

Argument type and attributes

X
An INTENT(IN) REAL or COMPLEX. Unless X is COMPLEX, its value must be greater than or equal to zero.

Result type and attributes

Same as X.

Result value

The -qxlf2003=signdzerointr option controls whether you get Fortran 2003 behavior. See qxlf2003

  • If the result type is complex, its value is the principal value with the real part greater than or equal to zero. If the real part is zero, the imaginary part is greater than or equal to zero.
  • Fortran 2003 begins If the result type is complex, its value is the principal value with the real part greater than or equal to zero. If the real part of the result is zero, the imaginary part has the same sign as the imaginary part of X. Fortran 2003 ends

Examples

SQRT (4.0) has the value 2.0.

Specific Name Argument Type Result Type Pass As Arg?
SQRT default real default real yes
DSQRT double precision real double precision real yes
QSQRT REAL(16) REAL(16) yes  1 
CSQRT  2  default complex default complex yes
CDSQRT  2  double complex double complex yes  1 
ZSQRT  2  COMPLEX(8) COMPLEX(8) yes  1 
CQSQRT  2  COMPLEX(16) COMPLEX(16) yes  1 
Note:
  •  1  IBM extension: the ability to pass the name as an argument.
  •  2  Given that X is a complex number in the form a + bi, where i = (-1)½, abs(X) + abs(a) must be less than or equal to 1.797693 * 10308