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 Tue, Aug 29, 2006 at 10:50:14PM +0800, Feng Wang wrote:
> --- Steve Kargl <sgk@troutmask.apl.washington.edu>????:
> > On Tue, Aug 29, 2006 at 04:06:22PM +0800, Feng Wang wrote:
> > > Steve,
> > >
> > > > With my patch?
> > >
> > > Did you mean the patch in
> > http://gcc.gnu.org/ml/fortran/2006-08/msg00371.html?
> >
> > Yes. That patch fixes the range checking as explained in the email.
> >
> > > No. I didn't apply any patch.
> > >
> > > After applying your patch, I got an error message on i686-pc-linux-gnu.
> > >
> > > [wf@WFPC bug]$ gfortran intrinsic_set_exponent.f90
> > > In file intrinsic_set_exponent.f90:39
> > >
> > > i = o'20037777777'
> > > 1
> > > Error: Arithmetic overflow converting INTEGER(8) to INTEGER(4) at (1)
> > >
> >
> > And, this is the problem that caused the start of this thread.
> >
>
> OK. I understand what you mean. I will try another way to construct these
> special floating-point numbers. Maybe TRANSFER is good choice.
>
I have not converted o'20037777777' to a decimal integer value,
so can't say if it indeed overflow. However, you can probably
use IBSET to get the bit pattern you. Note, I have not looked
into the portability or conformance of this approach.
i = 0
i = ibset(i, 23) ! Yet, another test of a standard intrinsic,
i = ...
x = transfer(i,x) ! Added testing of transfer.
Thanks for looking into this issue.
--
Steve