Failure of implicit real*8
Michael D. Berger
m_d_berger_1900@yahoo.com
Mon Feb 21 02:11:00 GMT 2011
On Sun, 20 Feb 2011 09:55:03 +0100, Tobias Burnus wrote:
> Michael D. Berger wrote:
[...]
> Note of caution when not using -fdefault-real-8: 1.0 is a default-real
> variable, thus for, e.g.,
> real*8 sqrt
> sq2 = sqrt(2.0)
I am surprised about this. I would have thought the conversion to
2.0d0 would take place internally as soon as the argument is
passed. Now for something like sqrt(2.123456789), I could understand
a truncation.
> you loose precision, unless you do
> sq2 = sqrt(2.0d0)
> Tobias
How about:
real*8 sq2
sq2 = dsqrt(2.0d0)
Does the dsqrt work like the real*8 sqrt?
Mike.
More information about the Fortran
mailing list