## DIGITS intrinsic function

### Standard: F77 F90 F95 F2003 F2008 F2018 Example program

### ＜Syntax＞

DIGITS ( X )

X : Integer or Real;

Result : Scalar Integer of default kind.

### ＜Semantics＞

This function returns the number of digits used in the model for number of the type and kind of X.

This is an inquiry function, so X need not be defined; indeed, it is permitted to be disassociated, unallocated, or absent.

All current machines with a Fortran compiler use binary integer arithmetic with bit lengths of 8, 16, 32 and 64; one bit is reserved for the sign, so the value of DIGITS(X) is one less than the number of bits.

The model for real type is that it may be zero or a signed fraction between 1 and 1/RADIX(X) consisting of DIGITS(X) digits, multiplied by an exponent RADIX(X)***e* with MINEXPONENT(X)≤*e*≤MAXEXPONENT(X).
For binary floating-point, DIGITS(X) is thus the number of bits in the mantissa, whereas for decimal floating-point it is the number of decimal digits.

### ＜Related＞

BIT_SIZE intrinsic function, EPSILON intrinsic function, HUGE intrinsic function, INTEGER type, MAXEXPONENT intrinsic function, MINEXPONENT intrinsic function, PRECISION intrinsic function, RADIX intrinsic function, REAL type, TINY intrinsic function