Re: BOZ literal constants, a puzzle for us Standard-loving types.
- From: glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx>
- Date: Wed, 28 Mar 2007 15:17:17 -0800
Steven G. Kargl wrote:
(snip)
int(123) and real(1.23) aren't valid data-stmt-constants. Lahey's web base checker gives
It seems that initialization expressions are allowed in PARAMETERs,
and parameters in DATA statements, but initialization expressions
are not allowed in DATA statements.
program test
integer, parameter :: ip = int(-Z'00008000')
real, parameter :: rp = real(-Z'00008000')
integer i
data i/ip/
data r/rp/
print *, i, r
end
Then initializes i as appropriate for the OP on twos complement
machines. It does seem that F2003 doesn't supply a way to
initialize the bit pattern for integers in DATA statements.
The variable r is not initialized to the bit pattern of the BOZ
constant, but to its integer value.
For Fortran 2003 intrinsic REAL function:
"If A is a boz-literal-constant, the value of the result is equal to
the value that a variable of the same type and kind type parameters
as the result would have if its value was the bit pattern specified
by the boz-literal-constant. The interpretation of the value of the
bit pattern is processor dependent. "
Fortran 66 and Fortran 77 compilers with BOZ constants as an extension
would use the bit value of the constant.
-- 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.
- 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
- BOZ literal constants, a puzzle for us Standard-loving types.
- Prev by Date: Re: calculation accuracy
- Next by Date: Re: BOZ literal constants, a puzzle for us Standard-loving types.
- 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):
Relevant Pages
|
|