[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Floating point representation



CC: (BUG lispm) at MIT-AI

    Date: 27 SEP 1980 0832-PDT
    From: DEKLEER at PARC-MAXC2
    Subject: Floating point representation
    To:   bug-lispm at MIT-AI

    FROM-JOB:LISP-MACHINE
    SENT-BY:
    TO:"(BUG-LISPM)
    TEXT;-1
    In system 36.6 Ether, with microcode 683, on Xerox Machine 1:

    I had to write some code to convert floating-point numbers to BCPL
    floating-point format so that I could output splines to PRESS files (if
    you have already done this I would like to look at your code).  In the
    process I discovered some strangeness in the representation.  It seems
    to me that the floating-point representation of all negative integers is off
    in the bottom bit, is there some reason for this?  One would expect
    that the reader could do better.

    For example, -2e0 is represented as:

    (describe -2e0)
    -2.0 is a flonum.
      Excess-2000 exponent 2001, 32-bit mantissa 20000000000 (including sign)
      (The mantissa is less than one in the bottom bit position, result is multiplied by 2.)

    While a more accurate representation would be:

      Excess-2000 exponent 2002, 32-bit mantissa 27777777777 (including sign)
      (The mantissa is exactly 1/2, result is multiplied by 4.)
No.  The representation of -2e0 is the exact 2's complement of the representation of 2e0.
Perhaps you don't understand that the mantissa is 2's complement.  The "more accurate"
representation you suggest is in fact off by one least significant bit.