RANGE(X)

Purpose

Returns the decimal exponent range in the model representing integer or real numbers with the same kind type parameter as the argument.

Class

Inquiry function

Argument type and attributes

X
An INTENT(IN) INTEGER, REAL, or COMPLEX. The actual argument corresponding to X can be scalar or array valued.

Result type and attributes

Default integer scalar.

Result value

  1. For an integer argument, the result is:
    INT( LOG10( HUGE(X) ) )
  2. For a real or complex argument, the result is:
    INT( MIN( LOG10( HUGE(X) ), -LOG10( TINY(X) ) ) )
IBM extension begins Thus:
Type                     RANGE
------------------------------
integer(1)                  2
integer(2)                  4
integer(4)                  9
integer(8)                 18
real(4) , complex(4)       37
real(8) , complex(8)      307
real(16) , complex(16)    291
IBM extension ends

Examples

IBM extension begins X is of type real(4):
  • HUGE(X) = 0.34E+39
  • TINY(X) = 0.11E-37
  • RANGE(X) = 37
IBM extension ends

See Data representation models.