Manual Reference Pages  - digits (3fortran)

NAME

DIGITS(3) - [MODEL:NUMERIC] Significant digits in the numeric model

SYNOPSIS

result = digits(x)

         integer function digits(x)

TYPE(kind=KIND),intent(in) :: x(..)

CHARACTERISTICS

o X an integer or real scalar or array
o The return value is an integer of default kind.

DESCRIPTION

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.

OPTIONS

o X : a value of the type and kind to query

RESULT

The number of significant digits in a variable of the type and kind of X.

EXAMPLES

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_digits

Results:

     > default integer:         31
     > default real:            24
     > default doubleprecision: 53

STANDARD

Fortran 95

SEE ALSO

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
Generated by manServer 1.08 from b8f4b9dd-f523-4d18-bd01-8c7fd12887b7 using man macros.