HP Fortran Programmer's Reference (September 2007)

Data types and data objects
Intrinsic data types
Chapter 5 117
The intrinsic functions INT, LOGICAL, REAL, DBLE, DREAL, CMPLX, and DCMPLX are available
to force a BOZ constant to a specific type. If a BOZ constant is specified as an argument to
these functions, its assumed type is determined as follows:
For functions INT and LOGICAL the assumed type will be (respectively)
INTEGER(KIND=4) and LOGICAL(KIND=4), if the constant occupies 1 to 4 bytes;
otherwise, the type is assumed to be INTEGER(KIND=8) and LOGICAL(KIND=8).
For the functions REAL, DBLE, DREAL, CMPLX, and DCMPLX an argument of type
REAL(KIND=4) is assumed if the constant occupies 1 to 4 bytes, REAL(KIND=8) if it
occupies 5 to 8 bytes, and REAL(KIND=16) otherwise.
The following examples illustrate the extended use of BOZ constants:
! The value is 20 (constant treated as INTEGER(2) and
! truncated on the left).
10_2 + Z'1000A'
LOGICAL(2) :: lgl2
! Constant treated as LOGICAL(2), the type of the variable.
lgl2 = B'1'
! Constant treated as INTEGER(4); IABS is used.
ABS(Z'41')
! Constant treated as REAL(8) as it is more than 4 bytes.
REAL(Z'3FF0000000000000')
Real constants
A signed real literal constant is one of:
[
sign
]
digit-string
[[.[
digit-string
]]][
exponent
][_
kind-parameter
]
exponent
takes the form:
exponent-letter
[
sign
]
digit-string
exponent-letter
is the character E, D, or Q. Q is an HP Fortran extension.
sign
and
digit-string
are explained in “Integer constants” on page 114.
If no kind parameter is present, or if the
exponent letter
E is present, the default kind
representation is used; see Table 5-1. If the
exponent letter
is D, the kind parameter is 8,
and if the
exponent letter
is Q, the kind parameter is 16. If both an
exponent
and a kind
parameter are specified, the
exponent letter
must be E.