FORTRAN 77 Language Reference

Real Constants

A real constant is an approximation of a real number. It can be positive, negative, or zero. It has a decimal point or an exponent. If no sign is present, the constant is assumed to be nonnegative.

Real constants, REAL*4, use 4 bytes of storage.

Basic Real Constant

A basic real constant consists of an optional plus or minus sign, followed by an integer part, followed by a decimal point, followed by a fractional part.

The integer part and the fractional part are each strings of digits, and you can omit either of these parts, but not both.

Example: Basic real constants:


+82.
-32.
90. 
98.5

Real Exponent

A real exponent consists of the letter E, followed by an optional plus or minus sign, followed by an integer.

Example: Real exponents:


E+12 
E-3 
E6

Real Constant

A real constant has one of these forms:

A real exponent denotes a power of ten. The value of a real constant is the product of that power of ten and the constant that precedes the E.

Example: Real constants:


-32. 
-32.18 
1.6E-9 
7E3 
1.6E12 
$1.0E2.0 							Invalid- $ not allowed, error message 
82							Not REAL-need decimal point or exponent 
29,002.0 							Invalid -comma not allowed, error message 
1.6E39 							Invalid-too large, machine infinity is used 
1.6E-39 							Invalid -too small, some precision is lost 

The restrictions are: