9.78 DIGITS — Significant binary digits function

Description:

DIGITS(X) returns the number of significant binary digits of the internal model representation of X. For example, on a system using a 32-bit floating point representation, a default real number would likely return 24.

Standard:

Fortran 95 and later

Class:

Inquiry function

Syntax:

RESULT = DIGITS(X)

Arguments:
X The type may be INTEGER or REAL.
Return value:

The return value is of type INTEGER.

Example:
program test_digits
    integer :: i = 12345
    real :: x = 3.143
    real(8) :: y = 2.33
    print *, digits(i)
    print *, digits(x)
    print *, digits(y)
end program test_digits

© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-6.4.0/gfortran/DIGITS.html