02.07.2013 Views

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>HP</strong> <strong>Fortran</strong> statements<br />

REAL<br />

Description<br />

The REAL statement is used to declare the length and properties of data that approximate the<br />

mathematical real numbers. A kind parameter (if present) indicates the representation<br />

method.<br />

The REAL statement is constrained by the rules for all type declaration statements, including<br />

the requirement that it precede all executable statements.<br />

As a portability extension, <strong>HP</strong> <strong>Fortran</strong> allows the following syntax for specifying the length of<br />

an entity:<br />

name [*len] [( array-spec )] [= initialization-expr]<br />

If (array-spec) is specified, *len may appear on either side of (array-spec). Ifname<br />

appears with *len, it overrides the length specified by REAL*size.<br />

Examples<br />

The following are valid declarations:<br />

REAL, TARGET :: x, y<br />

REAL(KIND=16) :: z<br />

REAL(4), PARAMETER :: pi=3.14<br />

! initialize an array, using an array constructor<br />

REAL, DIMENSION(4) :: rvec=(/ 1.1,2.2,3.3,4.4 /)<br />

! use the slash notation (an <strong>HP</strong> extension) to initialize<br />

REAL x/2.87/, y/93.34/, z/13.99/ ! note, no double colon<br />

! the following declarations are equivalent; the second uses the<br />

! <strong>HP</strong> length specification extension<br />

REAL (KIND = 8) x<br />

REAL*4 x*8<br />

Related statements<br />

DOUBLE PRECISION<br />

Related concepts<br />

For related information, see the following:<br />

412<br />

“Type declaration for intrinsic types” on page 27<br />

“Implicit typing” on page 31<br />

“Array declarations” on page 57<br />

“Array constructors” on page 73<br />

“Expressions” on page 83<br />

Chapter 10

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!