The SET_EXPONENT function returns the model representation of a number with the exponent part set to a power of two.

## Syntax

SET_EXPONENT (x,i)

*x* is an INTENT(IN) scalar or array of type REAL.

*i* is an INTENT(IN) scalar or array of type INTEGER.

If both arguments are arrays, they must have the same shape.

The result is of the same type and kind as *x*. Its value is FRACTION(*x*)*2^{i}.

If either or both arguments are arrays, the result is an array with the same shape. The value of each result element is as though the scalar SET_EXPONENT operation were performed for each respective element of the input arrays.

## Example

real ::x.4.3,xa(2)=(/1.5,2.5/) integer :: i=2,ia(2)=(/4,5/) write(*,*) fraction(x)*2**i ! writes 2.15 write(*,*) set_exponent(x,i) ! writes 2.15 write(*,*) set_exponent(xa,i) ! writes 3.0 2.5 write(*,*) set_exponent(x,ia) ! writes 8.6 17.2 write(*,*) set_exponent(xa,ia) ! writes 12.0 20.0