Re: Fortran compiler for Linux/Alpha

Craig Burley (burley@gnu.ai.mit.edu)
Thu, 17 Oct 1996 12:59:51 -0400

>Why "float"? However, the following fortran source fixes the problem:
>
> c72=DBLE(0.30901699437494742)

The constant is a single-precision floating-point constant. If you
want double-precision, which looks to be the case given all the digits
you've specified, rewrite the above statement to:

c72 = 0.30901699437494742d0

The "d0" says "this is a double-precision constant" just like the
appended "l" or "ll" tells C compilers that a constant is long or (for
gcc) long long. The "d0" makes _all_ standard-conforming Fortran
compilers interpret the constant as double-precision -- without it,
some will interpret it as single-precision and convert it, resulting
in a double-precision value that is likely to differ beyond the precision
offered by single-precision numbers on that machine.

The g77 documentation has a lot more to say about constants, and the
reason g77 doesn't attempt to use context to determine the intended type
of the constant (as some compilers do, leading to inconsistent behavior
in all sorts of cases).

If, after reading that, you have some desire to learn more about the
issue, comp.lang.fortran is a good place.

tq vm, (burley)

--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null



Feedback | Store | News | Support | Product Errata | About Us | Linux Info | Search | JumpWords
No Frames | Show Frames

Copyright © 1995-1997 Red Hat Software. Legal notices