DIGITS(3) - [MODEL:NUMERIC] Significant digits in the numeric model
result = digits(x)
integer function digits(x)TYPE(kind=KIND),intent(in) :: x(..)
o X an integer or real scalar or array o The return value is an integer of default kind.
DIGITS(3) 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.
o X : a value of the type and kind to query
The number of significant digits in a variable of the type and kind of X.
Sample program:
program demo_digits implicit none character(len=*),parameter :: all=(*(g0:,1x)) integer :: i = 12345 real :: x = 3.143 doubleprecision :: y = 2.33d0 print all, default integer: , digits(i) print all, default real: , digits(x) print all, default doubleprecision:, digits(y) end program demo_digitsResults:
> default integer: 31 > default real: 24 > default doubleprecision: 53
Fortran 95
EPSILON(3), EXPONENT(3), FRACTION(3), HUGE(3), MAXEXPONENT(3), MINEXPONENT(3), NEAREST(3), PRECISION(3), RADIX(3), RANGE(3), RRSPACING(3), SCALE(3), SET_EXPONENT(3), SPACING(3), TINY(3)
Fortran intrinsic descriptions (license: MIT) @urbanjost
Nemo Release 3.1 | digits (3fortran) | November 02, 2024 |