precision

Date:

07-12-2019

NAME

PRECISION - Returns the decimal precision of a number in the real number model

SYNOPSIS

PRECISION ([X=]x)

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

Fortran

DESCRIPTION

The PRECISION intrinsic function returns the decimal precision of a number in the real number model. The real number model is described in the models(3i) man page. This function accepts the following argument:

x

Must be of type real or complex. It may be scalar or array valued.

PRECISION is an inquiry function. The name of this intrinsic cannot be passed as an argument.

RETURN VALUES

The result is a default integer scalar with the value INT((p-1)*LOG10(b))+k, where b and p are as defined in the model and where k is 1 if b is an integral power of 10 and 0 otherwise.

EXAMPLES

PRECISION(X) yields the following values:

  • 6 for REAL(KIND=4) X

  • 15 for REAL(KIND=8) X

  • 33 for REAL(KIND=16) X

SEE ALSO

models(3i)