SET_EXPONENT(3) - [MODEL:COMPONENTS] real value with specified exponent
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
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.
SET_EXPONENT(3) returns the real number whose fractional part is that of X and whose exponent part is I.
o X : Shall be of type real. o I : Shall be of type integer.
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.
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_setexpResults:
> 74716.7891 74716.7891
Fortran 95
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 intrinsic descriptions
Nemo Release 3.1 | set_exponent (3fortran) | November 02, 2024 |