[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Real                     Floating-Point Numbers                  Numeric Type

    The data type Real represents floating-point numbers (443.1, -0.0093,
    5.8837E+25). Exponential notation is allowed. Thus, 5.8837E+25 is
    interpreted as "5.8837 times 10 to the 25th power" (5.8837 * 10^25).

    Integer values can be assigned to real variables and used in real
    expressions; in both cases, the integer value is first converted to a
    real value. Real values within the range -MaxInt..MaxInt can be
    converted to an integer value using the predefined functions Round and
    Trunc. Real values can never be directly assigned to an integer
    variable, and the use of a real value (or the real operator /) in an
    expression automatically converts the entire expression to real.

    Reals in Turbo Pascal occupy six bytes, with the exponent in the first
    byte and the mantissa in the remaining five bytes (least significant
    byte first). Real values have (roughly) eleven significant decimal
    digits of accuracy and an exponent range of (roughly) 10**.38.

    The exponent byte represents a power of two in excess-128 format; that
    is, the range 0..255 is interpreted as -128..127.

    The mantissa is considered to be a normalized 40-bit binary fraction,
    stored in unsigned form. In other words, the mantissa takes the form
    0.1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, where 'x' is a binary
    digit (0 or 1). Since there are only 39 x's required, the 40th (and
    most significant) bit of the mantissa is used to store the sign bit: 0
    if positive, 1 if negative.

    The real number range is 1E-38 to 1E+38.

    Overflow involving a real number will generate runtime error 1 ($1)
    and program execution will terminate. Underflow will result in the
    value 0.

    The following is a list of the differences between real and scalar
    numbers:

         Reals can't be used in array indexing
         Reals can't be used to control FOR and CASE statements
         Subranges of Reals are not allowed
         Reals can't be used to define a set's base type
         Functions Pred and Succ can't take real values

  -------------------------------- Example ---------------------------------

           var
             Iota,Able,Fred : Real;

           begin
             Iota :=  32.0;       { Iota gets  32.0 }
             Able := -9.3873E+12; { Able gets -9,378,300,000,000 }
             Fred :=  2.3882E-7;  { Fred gets  0.00000023882 }
           end.

See Also: Integer
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson