Commit 0e983327 authored by Jay Belanger's avatar Jay Belanger
Browse files

(Radix Modes): Clarify two's complement notation.

parent fd471993
2009-12-15 Jay Belanger <jay.p.belanger@gmail.com>
* calc/calc.texi (Radix Modes): Clarify two's complement notation.
2009-12-14 Chong Yidong <cyd@stupidchicken.com>
* sem-user.texi (Semantic mode, Idle Scheduler, Smart Completion)
......
......@@ -13173,34 +13173,36 @@ are displayed with at least enough digits to represent
in the current radix. (Larger integers will still be displayed in their
entirety.)
Calc can display @expr{w}-bit integers using two's complement notation
and binary, octal or hexadecimal display radix with the commands
@kbd{C-u d 2}, @kbd{C-u d 8} or @kbd{C-u d 6}, respectively. In this
case a negative word size might be appropriate (@pxref{Binary Functions}).
The integers in the symmetric interval from
@cindex Two's complements
With the binary, octal and hexadecimal display modes, Calc can
display @expr{w}-bit integers using two's complement notation. These
versions of the display radices are selected with the key sequences
@kbd{C-u d 2}, @kbd{C-u d 8} and @kbd{C-u d 6}, respectively.
In these cases a negative word size might be appropriate
(@pxref{Binary Functions}). In two's complement notation, the integers
in the (nearly) symmetric interval from
@texline @math{-2^{w-1}}
@infoline @expr{-2^(w-1)}
to
@texline @math{2^{w-1}-1}
@infoline @expr{2^(w-1)-1}
will be represented by using the integers from @expr{0} to @expr{2^w};
are represented by the integers from @expr{0} to @expr{2^w-1}:
the integers from @expr{0} to
@texline @math{2^{w-1}-1}
@infoline @expr{2^(w-1)-1}
will be represented by themselves and the integers
from
are represented by themselves and the integers from
@texline @math{-2^{w-1}}
@infoline @expr{-2^(w-1)}
to @expr{-1} will have @expr{2^w} added to them, so they will be
represented by the integers from
to @expr{-1} are represented by the integers from
@texline @math{2^{w-1}}
@infoline @expr{2^(w-1)}
to @expr{2^w}. Calc will represent a twos-complement integer
by the radix (either @expr{2}, @expr{8} or @expr{16}), two @kbd{#}
symbols, and then the digits (including any necessary leading zeros to
include all @expr{w} bits). Numbers that are not displayed in
twos-complement notation (i.e., that aren't integers from
to @expr{2^w-1} (the integer @expr{k} is represented by @expr{k+2^w}).
Calc will display a two's complement integer by the radix (either
@expr{2}, @expr{8} or @expr{16}), two @kbd{#} symbols, and then its
representation (including any leading zeros necessary to include all
@expr{w} bits). In a two's complement display mode, numbers that
are not displayed in two's complement notation (i.e., that aren't
integers from
@texline @math{-2^{w-1}}
@infoline @expr{-2^(w-1)}
to
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment