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
must be of type real or complex. It may 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

Therefore,

       Type               Precision
--------------------      ---------
 real(4) , complex(4)           6
 real(8) , complex(8)          15
real(16) , complex(16)         31
End of IBM Extension

Examples

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