Manual Reference Pages  - set_exponent (3fortran)

NAME

SET_EXPONENT(3) - [MODEL_COMPONENTS] real value with specified exponent

SYNOPSIS

result = set_exponent(x, i)

         elemental real(kind=KIND) function set_exponent(x,i)

real(kind=KIND),intent(in) :: x integer(kind=**),intent(in) :: i

CHARACTERISTICS

o X is type real
o I is type integer
o a kind designated as ** may be any supported kind for the type
o The return value is of the same type and kind as X.

DESCRIPTION

SET_EXPONENT(3) returns the real number whose fractional part is that of X and whose exponent part is I.

OPTIONS

o X : Shall be of type real.
o I : Shall be of type integer.

RESULT

The return value is of the same type and kind as X. The real number whose fractional part is that of X and whose exponent part if I is returned; it is FRACTION(X) * RADIX(X)**I.

If X has the value zero, the result has the same value as X.

If X is an IEEE infinity, the result is an IEEE NaN.

If X is an IEEE NaN, the result is the same NaN.

EXAMPLES

Sample program:

    program demo_setexp
    implicit none
    real :: x = 178.1387e-4
    integer :: i = 17
       print *, set_exponent(x, i), fraction(x) * radix(x)**i
    end program demo_setexp

Results:

          74716.7891       74716.7891

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), RANGE(3), RRSPACING(3), SCALE(3), SPACING(3), TINY(3)

fortran-lang intrinsic descriptions


Nemo Release 3.1 set_exponent (3fortran) April 28, 2024
Generated by manServer 1.08 from 78a564bc-3359-4c78-a285-f1e69b19560f using man macros.