Re: Compiling in 32 vs 64 platform problem
- From: nospam@xxxxxxxxxxxxx (Richard Maine)
- Date: Wed, 26 Apr 2006 07:46:51 -0700
Klaus Wacker <wacker@xxxxxxxxxxxxxxxxxxxxxx> wrote:
Patrick Begou <Patrick.Begou@xxxxxxxxxxx> wrote:
I've discovered that floating point constants in ifort seems to be REAL
and lead to a loss of precision when initializing a DOUBLE PRECISION
variable.
DOUBLE PRECISION t=2.33D0
is not the same than
DOUBLE PRECISION t=2.33
This has nothing to do with ifort or any other particular compiler.
The Fortran standard (at least since F90) implies that 2.33 is a real
(i.e. single precision) constant.
It more than implies it. It says that in black and white, and has since
f66.
Some compilers have taken it on themselves to "help" users by trying to
figure out what the user meant, as opposed to what the user said. There
is a school of interpretation that says compiler were allowed to do this
prior to f90, but no longer are allowed to do so as of f90. That is, the
debate is about whether compilers are allowed to do this as an extension
to the standard or whether a compiler that does this violates the
standard. THat is a subtle debate, but in any case...
There has *NEVER* been any question as to what the user code means
according to the standard. It means a single precision literal. The only
point of any debate at all has been whether compiler are allowed to
"fix" what it and do what they think the user meant. This is a debate
for the compiler writers - not for the users. There is not even a hint
of justification in any version of the standard to suggest that users
are allowed to assume the compiler will "fix" this; users who assume
that are counting on behavior not specified by the standard - either an
extension or a violation, depending on your interpretation of the fine
points.
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.
- References:
- Re: Compiling in 32 vs 64 platform problem
- From: Patrick Begou
- Re: Compiling in 32 vs 64 platform problem
- From: Klaus Wacker
- Re: Compiling in 32 vs 64 platform problem
- Prev by Date: Re: New style DO syntax?
- Next by Date: Re: New style DO syntax?
- Previous by thread: Re: Compiling in 32 vs 64 platform problem
- Next by thread: Re: Compiling in 32 vs 64 platform problem
- Index(es):
Relevant Pages
|
|