Real Constants

Top  Previous  Next

Real constants are distinguished from integer constants by having either a decimal point or an exponent. The exponent is indicated by an "E". For instance, "3E14" means 3 times 10 raised to the 14th power, or 3 followed by 14 zeros. The following are examples of real constants:

 

        2.5                     .2

        -1000000.               05.e-1

        1E6                     -0.00000000000000707

        6.63E-34                6.023e+023

 

In XPL0 a real number represents values ranging between ?2.23E-308 and ?1.79E+308 with 16 decimal digits (53 bits) of precision.

 

Expressions containing reals execute slower than corresponding expressions containing integers. Also, a real number requires four times as much memory as an integer. Thus when an integer is sufficient, it is preferable to a real.