EXPONENT

Elemental Intrinsic Function (Generic): Returns the exponent part of the argument when represented as a model number.

Syntax

result = EXPONENT (x)

x
(Input) must be of type real.

Results:

The result is of type default integer. If x is not equal to zero, the result value is the exponent part of x. The exponent must be within default integer range; otherwise, the result is undefined.

If x is zero, the exponent of x is zero. For more information on the exponent part (e) in the real model, see Model for Real Data.

Compatibility

CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS DLL LIB

See Also: DIGITS, RADIX, FRACTION, MAXEXPONENT, MINEXPONENT, Data Representation Models

Examples

EXPONENT (2.0) has the value 2.

If 4.1 is a REAL(4) value, EXPONENT (4.1) has the value 3.

The following shows another example:

  REAL(4) r1, r2
  REAL(8) r3, r4
  r1 = 1.0
  r2 = 123456.7
  r3 = 1.0D0
  r4 = 123456789123456.7
  write(*,*) EXPONENT(r1) ! prints 1
  write(*,*) EXPONENT(r2) ! prints 17
  write(*,*) EXPONENT(r3) ! prints 1
  write(*,*) EXPONENT(r4) ! prints 47
  END