Re: BOZ literal constants, a puzzle for us Standard-loving types.
- From: glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx>
- Date: Wed, 28 Mar 2007 20:01:28 -0800
Brooks Moses wrote:
(snip)
Yes. On the other hand, G77 had an extension of defining BOZ-literals as being a form of integer literal that could be in most (possibly all) places that other forms of integer literals could be used.
Thus, it would interpret real(-Z'00008000') by taking Z'00008000' as an integer constant, negating it, and then converting it to a real number as one would with any other integer constant.
Ok, then -real(Z'00008000'). I was taking the value from the INTEGER
case and changing it to REAL.
I'm not exactly sure what you expected real(-Z'00008000') to do under the F2003 rules, but it ought to throw a syntax error due to the minus sign. :)
Without the extraneous minus sign, however, real(Z'00008000') presents a bit of a conundrum for GFortran. G77 has long-standing semantics for what that should mean. F2003, as you point out, also has a definition for what it should mean, and the two versions are quite different.
You could do it based on -std= values.
At this point, GFortran is supposed to be an (essentially) complete implementation of G77's extensions, but it's not claiming to be a complete implementation of F2003, so we provide the G77 semantics, but that's obviously not the right long-term solution.
IBM OS/360 Fortran and VAX/VMS Fortran allow initializing REAL
variables with Z constants in DATA statements as bit patterns,
no REAL() needed or allowed. (Note that in both cases the ''s
are not used. DATA R/Z80C00000/) gfortran should supply a way
to initialize negative integers and bit pattern reals, for
both backward and forward compatibility.
(Note that REAL variables in VAX are middle endian, so
DATA R/Z000080C0/)
-- glen
.
- Follow-Ups:
- Re: BOZ literal constants, a puzzle for us Standard-loving types.
- From: Brooks Moses
- Re: BOZ literal constants, a puzzle for us Standard-loving types.
- From: Steven G. Kargl
- Re: BOZ literal constants, a puzzle for us Standard-loving types.
- References:
- BOZ literal constants, a puzzle for us Standard-loving types.
- From: Toon Moene
- Re: BOZ literal constants, a puzzle for us Standard-loving types.
- From: Steven G. Kargl
- Re: BOZ literal constants, a puzzle for us Standard-loving types.
- From: glen herrmannsfeldt
- Re: BOZ literal constants, a puzzle for us Standard-loving types.
- From: Steven G. Kargl
- Re: BOZ literal constants, a puzzle for us Standard-loving types.
- From: glen herrmannsfeldt
- Re: BOZ literal constants, a puzzle for us Standard-loving types.
- From: Steven G. Kargl
- Re: BOZ literal constants, a puzzle for us Standard-loving types.
- From: glen herrmannsfeldt
- Re: BOZ literal constants, a puzzle for us Standard-loving types.
- From: Brooks Moses
- BOZ literal constants, a puzzle for us Standard-loving types.
- Prev by Date: Re: BOZ literal constants, a puzzle for us Standard-loving types.
- Next by Date: Re: calculation accuracy
- Previous by thread: Re: BOZ literal constants, a puzzle for us Standard-loving types.
- Next by thread: Re: BOZ literal constants, a puzzle for us Standard-loving types.
- Index(es):