Manual Reference Pages  - range (3fortran)

NAME

RANGE(3) - [MODEL:NUMERIC] Decimal exponent range of a numeric kind

SYNOPSIS

result = range(x)

          integer function range (x)

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

CHARACTERISTICS

o X may be of type integer, real, or complex. It may be a scalar or an array.
o KIND is any kind supported by the type of X
o the result is a default integer scalar

DESCRIPTION

RANGE(3) returns the decimal exponent range in the model of the type of X.

Since X is only used to determine the type and kind being interrogated, the value need not be defined.

OPTIONS

o X : the value whose type and kind are used for the query

RESULT

Case (i) : For an integer argument, the result has the value

        int (log10 (huge(x)))

Case (ii) : For a real argument, the result has the value

         int(min (log10 (huge(x)), -log10(tiny(x) )))

Case (iii) : For a complex argument, the result has the value

        range(real(x))

EXAMPLES

Sample program:

    program demo_range
    use,intrinsic :: iso_fortran_env, only : dp=>real64,sp=>real32
    implicit none
    real(kind=sp)    :: x(2)
    complex(kind=dp) :: y
       print *, precision(x), range(x)
       print *, precision(y), range(y)
    end program demo_range

Results:

     >            6          37
     >           15         307

STANDARD

Fortran 95

SEE ALSO

DIGITS(3), EPSILON(3), EXPONENT(3), FRACTION(3), HUGE(3), MAXEXPONENT(3), MINEXPONENT(3), NEAREST(3), PRECISION(3), RADIX(3), RRSPACING(3), SCALE(3), SET_EXPONENT(3), SPACING(3), TINY(3)

Fortran intrinsic descriptions (license: MIT) @urbanjost


Nemo Release 3.1 range (3fortran) November 02, 2024
Generated by manServer 1.08 from 985ea304-4877-4a86-83ae-32bb2e0e954b using man macros.