g77 fortran bug ??
Guilherme Regis
lgemedia@200-171-183-182.dsl.telesp.net.br
Wed Sep 18 18:21:00 GMT 2002
Dear Toon Moene,
Thanks a lot for the information.
Would you please provide the directions to a document
about single and double precision representations, exponent,
mantissa, etc, in g77 ?
Thanks again,
Luiz
On Wed, 18 Sep 2002, Toon Moene wrote:
> Guilherme Regis wrote:
>
> > Here is a simple test code called bug.F which
> > reads a number from a file and writes it on screen
> > and to an output file bug.out:
> >
> > program bug
> > real*4 vec
> > open(1,file='bug.dat',status='old')
> > open(2,file='bug.out',status='new')
> > read(1,*)vec
> > write(2,*)vec
> > write(6,*)' vec =',vec
> > stop
> > end
> >
> > where bug.dat contains the line:
> >
> > lgemedia:~$ more bug.dat
> > 839380840
> >
> > The result is in bug.out:
> >
> > lgemedia:~$ more bug.out
> > 839380864.
>
> REAL*4 (or just REAL) in g77 is mapped on most target architectures to
> IEEE-754 single precision floating point numbers.
>
> The exponent range gives you numbers between 10**(-38) .. 10**38, but
> that doesn't mean *arbitrary* numbers between those ...
>
> IEEE-754 single has a 24-bit mantissa, which means that every number
> thus represented has about 7 decimal digits of accuracy.
>
> The above numbers differ in the 8th decimal, which is in good agreement
> with the above observation.
>
> Hope this helps,
>
>
More information about the Gcc-bugs
mailing list