Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Wrong FORMAT statement

9 views
Skip to first unread message

W. Brenig

unread,
Dec 7, 2008, 5:12:49 AM12/7/08
to
Hi,

FORTRAN is not my native tounge, yet for my other projects I need to use
it sometimes :-)

So, I have this library which used to compile with various 'GCC
gfortran' versions but with 'intels ifort' it chokes with

error #7420: A dot (.) must appear in a format list in this context. [)]
WRITE (SAVE,'(1PD24.15E4)') DREAL2
------------------------^

I checked the WWW on FORMAT specifiers, but got no clue :-(
Likely this is not a problem with ifort, but rather a general language
issue, so I hope to get an answer here. Thanks.

Xaver

michael...@compuserve.com

unread,
Dec 7, 2008, 6:01:56 AM12/7/08
to

This looks to be an error, but a more modern form, '(1Pe24.15e4)',
works.

Regards,

Mike Metcalf

W. Brenig

unread,
Dec 7, 2008, 8:37:19 AM12/7/08
to
>> gfortran' versions but with 'intels ifort' it chokes with
>>
>> error #7420: A dot (.) must appear in a format list in this context. [)]
>> WRITE (SAVE,'(1PD24.15E4)') DREAL2
>> ------------------------^
>>

> This looks to be an error, but a more modern form, '(1Pe24.15e4)',
> works.

well, kind of - but the output format is different with your suggestion.
Say, with
DOUBLE PRECISION DVALUE
DVALUE = 1.0D-3

and with
WRITE (6,'(E24.15E4)') DVALUE
you get
0.100000000000000E-0002
(having caps 'E' or 'e' doesn't matter here). However, with
WRITE (6,'(D24.15)') DVALUE
(watch the missing width specifier on the exponent) you get
0.100000000000000D-02
So there is this notorious difference between 'D' and 'E'
type of exponents. Finally with
WRITE (6,'(D24.15E4)') DVALUE
you get the aforementioned error #7420

So, it seems as if ifort does not allow you to specify the
width of a 'D'-type exponent (?).

Since the library I try to compile uses this kind of
formating in intermediate file i/o, I'm reluctant to
put a E24.15E4 specifier instead of a D24.15E4 since
I don't understand if this might cause problems further
down the line.

Best,
Xaver

michael...@compuserve.com

unread,
Dec 7, 2008, 9:01:43 AM12/7/08
to

You write: "So, it seems as if ifort does not allow you to specify
the
width of a 'D'-type exponent (?)." That is correct. It was never
allowed by any version of the Fortran standard, so can exist only as
an extension in some compilers. You appear to have inherited code that
run under such a compiler. The D edit descriptor is now sidelined
since double precision has been incorporated into real.

Regards,

Mike Metcalf

Tim Prince

unread,
Dec 7, 2008, 9:02:36 AM12/7/08
to
W. Brenig wrote:
> Finally with
> WRITE (6,'(D24.15E4)') DVALUE
> you get the aforementioned error #7420
>
> So, it seems as if ifort does not allow you to specify the
> width of a 'D'-type exponent (?).
>
> Since the library I try to compile uses this kind of
> formating in intermediate file i/o, I'm reluctant to
> put a E24.15E4 specifier instead of a D24.15E4 since
> I don't understand if this might cause problems further
> down the line.

It's clear in the f77 standard, there is no Dw.dEe format specifier. So
it seems you're saying you think that removing a non-standard extension
"might cause problems further down the line." Few, if any, compilers
implemented the exponent width option prior to f77, and f77 specified D
formats only to the extent they were present in f66, as any data type
information required can be inferred from the data type at compile time.
Michael certainly is an authority, but he didn't specify the nature of the
error he sees here. I would suggest it's user code error, broken
diagnostics in the compiler, so it would justify submission of a problem
report, if it occurs with a current version of the compiler. You still
must fix the code, unless you are waiting to see if the error diagnostic
can be corrected.

W. Brenig

unread,
Dec 7, 2008, 10:20:35 AM12/7/08
to
>> So, it seems as if ifort does not allow you to specify the
>> width of a 'D'-type exponent (?).

michael...@compuserve.com wrote:
> That is correct. It was never
> allowed by any version of the Fortran standard,

...


> You appear to have inherited code that
> run under such a compiler.

Tim Prince wrote:
> It's clear in the f77 standard, there is no Dw.dEe format specifier.

...


> I would suggest it's user code error,

ok. - got it.

The lib I'm trying to compile is a huge package at least 15
years old. It's been serving me well with no problems in the
past. A glitch in conformity to (any) standard is sure possible.
My previous GCC g77 and gfortan seem to have been less
pedantic on it.

michael...@compuserve.com wrote:
> The D edit descriptor is now sidelined
> since double precision has been incorporated into real.

So, can I interpret your 1st answer in as such that
putting '(1Pe24.15e4)' instead of '(1PD24.15E4)' (which
is not working), the rest of the library is likely to perform
with the 'E' type exponent, resulting from your formatting
statement including the 'E4' width specifier as if it would
be a 'D' type of exponent, specified with the non-conforming
'E4' width specifier ?


Best
Xaver

Tim Prince

unread,
Dec 7, 2008, 10:37:08 AM12/7/08
to
E formats have worked with all real types, including double precision,
with all standards from f77 on, which means all versions which define the
exponent width option. If you want to be extremely pedantic about it, the
original f77 standard didn't require it to work with e rather than E.

michael...@compuserve.com

unread,
Dec 7, 2008, 10:38:56 AM12/7/08
to
On Dec 7, 4:20 pm, "W. Brenig" <w.bre...@tu-bs.de> wrote:
> >> So, it seems as if ifort does not allow you to specify the
> >> width of a 'D'-type exponent (?).
> michaelmetc...@compuserve.com wrote:
> > That is correct. It was never
> > allowed by any version of the Fortran standard,
> ...
> > You appear to have inherited code that
> > run under such a compiler.
> Tim Prince wrote:
> > It's clear in the f77 standard, there is no Dw.dEe format specifier.
> ...
> > I would suggest it's user code error,
>
> ok. - got it.
>
> The lib I'm trying to compile is a huge package at least 15
> years old. It's been serving me well with no problems in the
> past. A glitch in conformity to (any) standard is sure possible.
> My previous GCC g77 and gfortan seem to have been less
> pedantic on it.
>
> michaelmetc...@compuserve.com wrote:
> > The D edit descriptor is now sidelined
> > since double precision has been incorporated into real.
>
> So, can I interpret your 1st answer in as such that
> putting '(1Pe24.15e4)' instead of '(1PD24.15E4)' (which
> is not working), the rest of the library is likely to perform
> with the 'E' type exponent, resulting from your formatting
> statement including the 'E4' width specifier as if it would
> be a 'D' type of exponent, specified with the non-conforming
> 'E4' width specifier ?
>
> Best
> Xaver

You will get the E exponent letter rather than D on output, but both
are accepted as equivalent on input, so I don't imagine that there
will be a problem.

Regards,

Mike Metcalf

nm...@cam.ac.uk

unread,
Dec 7, 2008, 10:58:38 AM12/7/08
to
In article <2b838efa-868e-47b9...@g38g2000yqn.googlegroups.com>,
<michael...@compuserve.com> wrote:

>On Dec 7, 4:20=A0pm, "W. Brenig" <w.bre...@tu-bs.de> wrote:
>>
>> So, can I interpret your 1st answer in as such that
>> putting '(1Pe24.15e4)' instead of '(1PD24.15E4)' (which
>> is not working), the rest of the library is likely to perform
>> with the 'E' type exponent, resulting from your formatting
>> statement including the 'E4' width specifier as if it would
>> be a 'D' type of exponent, specified with the non-conforming
>> 'E4' width specifier ?
>
>You will get the E exponent letter rather than D on output, but both
>are accepted as equivalent on input, so I don't imagine that there
>will be a problem.

Unless he is reading it into a program that was compiled with a
Fortran 66 compiler :-) If any still exist, which I doubt ....

An application is vastly more likely to follow the C rules and not
accept 'D' as an exponent letter. so this is likely to reduce the
chance of problems, not increase it.

Regards,
Nick Maclaren.

W. Brenig

unread,
Dec 7, 2008, 11:19:12 AM12/7/08
to
michael...@compuserve.com wrote:

> You will get the E exponent letter rather than D on output, but both
> are accepted as equivalent on input

Thanks. That helps. Best, Xaver

Steve Lionel

unread,
Dec 8, 2008, 10:26:27 AM12/8/08
to
On Sun, 07 Dec 2008 06:02:36 -0800, Tim Prince <tpr...@nospamcomputer.org>
wrote:

>error he sees here. I would suggest it's user code error, broken
>diagnostics in the compiler, so it would justify submission of a problem
>report, if it occurs with a current version of the compiler. You still
>must fix the code, unless you are waiting to see if the error diagnostic
>can be corrected.

The diagnostic in this case can certainly be improved. I have let the
developers know about this.
--
Steve Lionel
Developer Products Division
Intel Corporation
Nashua, NH

For email address, replace "invalid" with "com"

User communities for Intel Software Development Products
http://software.intel.com/en-us/forums/
Intel Fortran Support
http://support.intel.com/support/performancetools/fortran
My Fortran blog
http://www.intel.com/software/drfortran

0 new messages