This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: ARGH. Who wrote intrinsic_set_exponent.f90?
On Mon, Aug 28, 2006 at 09:18:33PM +0200, Thomas Koenig wrote:
> On Mon, Aug 28, 2006 at 08:57:24AM -0700, Steve Kargl wrote:
> >but you should be able to do
> >
> > i = 2345613
> > x = tansfer(i,x)
> >
> > to get the bit pattern you want (although this isn't portable
> > because of endian issues).
>
> It should work, because both integers and reals share the
> same endianness (at least on the "usual" IEEE systems).
>
Your parenthetical comment is why it may not be portable.
Anyway, here's a conforming example.
program test
real x, y
integer n
integer :: j = 8388607 ! i = o'00037777777'
n = 128
x = transfer(j,x)
y = set_exponent (x, n)
if (exponent (y) .ne. n) call abort()
end program test
--
Steve