Retrieving Parameters of Numeric Representations

Visual Fortran includes several intrinsic functions that return details about the numeric representation. These are listed in the following table and described fully in the Language Reference.

Functions that Return Numeric Parameters

Name Description Argument/Function Type
DIGITS DIGITS(x). Returns number of significant digits for data of the same type as x. x: Integer or Real
result: INTEGER(4)
EPSILON EPSILON(x). Returns the smallest positive number that when added to one produces a number greater than one for data of the same type as x. x: Real
result: same type as x
EXPONENT EXPONENT(x). Returns the exponent part of the representation of x. x: Real
result: INTEGER(4)
FRACTION FRACTION(x). Returns the fractional part (significand) of the representation of x. x: Real
result: same type as x
HUGE HUGE(x). Returns largest number that can be represented by data of type x. x: Integer or Real
result: same type as x
MAXEXPONENT MAXEXPONENT(x). Returns the largest positive decimal exponent for data of the same type as x. x: Real
result: INTEGER(4)
MINEXPONENT MINEXPONENT(x). Returns the largest negative decimal exponent for data of the same type as x. x: Real
result: INTEGER(4)
NEAREST NEAREST(x, s). Returns the nearest different machine representable number to x in the direction of the sign of s. x: Real
s: Real and not zero
result: same type as x
PRECISION PRECISION(x). Returns the number of significant digits for data of the same type as x. x: Real or Complex
result: INTEGER(4)
RADIX RADIX(x). Returns the base for data of the same type as x. x: Integer or Real
result: INTEGER(4)
RANGE RANGE(x). Returns the decimal exponent range for data of the same type as x. x: Integer, Real or Complex
result: INTEGER(4)
RRSPACING RRSPACING(x). Returns the reciprocal of the relative spacing of numbers near x. x: Real
result: same type as x
SCALE SCALE(x, i). Multiplies x by 2 raised to the power of i. x: Real
i: Integer
result: same type as x
SET_EXPONENT SET_EXPONENT(x,i). Returns a number whose fractional part is x and whose exponential part is i. x: Real
i: Integer
result: same type as x
SPACING SPACING(x). Returns the absolute spacing of numbers near x. x: Real
result: same type as x
TINY TINY(x). Returns smallest positive number that can be represented by data of type x. x: Real
result: same type as x