Fortran Wiki
digits

Description

digits(x) returns the number of significant 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

category: intrinsics