Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo Pascal - <b> real scientific notation pp 42</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 REAL                        Scientific Notation                       pp 42


 Define:  Reals encompass the range of 1E-38 through 1E+38.

 Purpose: Provides precision mathematics and fractions.

 Notes:   Overflow during an arithmetic operation with reals causes the
          program to halt with an execution error.  An underflow condition
          results in a zero result.

          Reals are illegal to use as:

          1)  Arguments to the functions Pred and Succ.
          2)  Index subscripts for arrays.
          3)  The definition of a set base type.
          4)  The control variable in For and Case constructs.
          5)  Subranges.


 Format:  Reals occupy six bytes in memory, giving a floating point value
          with a 40 bit mantissa and an 8 bit 2's exponent.
          The exponent is stored in the first (LSB) byte and the mantissa
          in the next five bytes.


          Bit positions:         0      7  8                        47

          Component:             Exponent  LSB mantissa   MSB mantissa


          The exponent uses binary format with an offset 80 hex.

          An exponent of $84 indicates that the value of the mantissa is
          to be multiplied by  2 ^ ($84-$80).  The multiplier here is $10.
          A zero exponent results in a floating point value of zero.

          The value of the mantissa is obtained by dividing the 40 bit
          unsigned integer by  2 ^ 40.  The mantissa is always normalized,
          which means that the most significant bit (Byte 5, Bit 7) = 1.

          The sign of the mantissa is stored in Byte 5, Bit 7.
          The values are 0 for positive, and 1 for a negative number.

 Usage:
       CONST
          RealCon : Real = 1234.0 ;   { Trailing zero for whole Reals       }
          NumVar  : Real = 0.1234 ;   { Leading zero for fractional Reals   }

       VAR
          RealVar : Real;
          FracVar : Real;

       BEGIN
          FracVar := Pi;
       END.

See Also: Integer

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson