PRECISION(X)

Purpose

Returns the decimal precision in the model representing real numbers with the same kind type parameter as the argument.

Class

Inquiry function

Argument type and attributes

X
An INTENT(IN) REAL or COMPLEX. The actual argument corresponding to X can be scalar or array valued.

Result type and attributes

Default integer scalar.

Result value

The result is:
INT( (DIGITS(X) - 1) * LOG10(2) )
IBM extension begins Therefore,
       Type               Precision
--------------------      ---------
 real(4) , complex(4)           6
 real(8) , complex(8)          15
real(16) , complex(16)         31
IBM extension ends

Examples

IBM extension begins PRECISION (X) = INT( (24 - 1) * LOG10(2.) ) = INT(6.92 …) = 6 for X of type real(4). See Real data model. IBM extension ends