In
mathematical notation
Mathematical notation consists of using glossary of mathematical symbols, symbols for representing operation (mathematics), operations, unspecified numbers, relation (mathematics), relations, and any other mathematical objects and assembling ...
for
number
A number is a mathematical object used to count, measure, and label. The most basic examples are the natural numbers 1, 2, 3, 4, and so forth. Numbers can be represented in language with number words. More universally, individual numbers can ...
s, a signed-digit representation is a
positional numeral system
Positional notation, also known as place-value notation, positional numeral system, or simply place value, usually denotes the extension to any base of the Hindu–Arabic numeral system (or decimal system). More generally, a positional system ...
with a set of
signed
digits used to
encode the
integers
An integer is the number zero (0), a positive natural number (1, 2, 3, ...), or the negation of a positive natural number (−1, −2, −3, ...). The negations or additive inverses of the positive natural numbers are referred to as negative in ...
.
Signed-digit representation can be used to accomplish fast addition of integers because it can eliminate chains of dependent carries. In the
binary numeral system
A binary number is a number expressed in the base-2 numeral system or binary numeral system, a method for representing numbers that uses only two symbols for the natural numbers: typically "0" ( zero) and "1" ( one). A ''binary number'' may als ...
, a special case signed-digit representation is the ''
non-adjacent form'', which can offer speed benefits with minimal space overhead.
History
Challenges in
calculation
A calculation is a deliberate mathematical process that transforms a plurality of inputs into a singular or plurality of outputs, known also as a result or results. The term is used in a variety of senses, from the very definite arithmetical ...
stimulated early authors Colson (1726) and Cauchy (1840) to use signed-digit representation. The further step of replacing negated digits with new ones was suggested by Selling (1887) and Cajori (1928).
In 1928,
Florian Cajori noted the recurring theme of signed digits, starting with
Colson (1726) and
Cauchy (1840). In his book ''History of Mathematical Notations'', Cajori titled the section "Negative numerals". For completeness, Colson uses examples and describes
addition
Addition (usually signified by the Plus and minus signs#Plus sign, plus symbol, +) is one of the four basic Operation (mathematics), operations of arithmetic, the other three being subtraction, multiplication, and Division (mathematics), divis ...
(pp. 163–4),
multiplication
Multiplication is one of the four elementary mathematical operations of arithmetic, with the other ones being addition, subtraction, and division (mathematics), division. The result of a multiplication operation is called a ''Product (mathem ...
(pp. 165–6) and
division (pp. 170–1) using a table of multiples of the divisor. He explains the convenience of approximation by truncation in multiplication. Colson also devised an instrument (Counting Table) that calculated using signed digits.
Eduard Selling advocated inverting the digits 1, 2, 3, 4, and 5 to indicate the negative sign. He also suggested ''snie'', ''jes'', ''jerd'', ''reff'', and ''niff'' as names to use vocally. Most of the other early sources used a bar over a digit to indicate a negative sign for it. Another German usage of signed-digits was described in 1902 in
Klein's encyclopedia.
Definition and properties
Digit set
Let
be a
finite set
In mathematics, particularly set theory, a finite set is a set that has a finite number of elements. Informally, a finite set is a set which one could in principle count and finish counting. For example,
is a finite set with five elements. Th ...
of
numerical digits with
cardinality
The thumb is the first digit of the hand, next to the index finger. When a person is standing in the medical anatomical position (where the palm is facing to the front), the thumb is the outermost digit. The Medical Latin English noun for thum ...
(If
, then the positional number system is
trivial and only represents the
trivial ring), with each digit denoted as
for
is known as the
radix
In a positional numeral system, the radix (radices) or base is the number of unique digits, including the digit zero, used to represent numbers. For example, for the decimal system (the most common system in use today) the radix is ten, becaus ...
or
number base.
can be used for a signed-digit representation if it's associated with a unique
function such that
for all
This function,
is what rigorously and formally establishes how integer values are assigned to the symbols/glyphs in
One benefit of this formalism is that the definition of "the integers" (however they may be defined) is not conflated with any particular system for writing/representing them; in this way, these two distinct (albeit closely related) concepts are kept separate.
can be
partitioned into three distinct sets
,
, and
, representing the positive, zero, and negative digits respectively, such that all digits
satisfy
, all digits
satisfy
and all digits
satisfy
. The cardinality of
is
, the cardinality of
is
, and the cardinality of
is
, giving the number of positive and negative digits respectively, such that
.
Balanced form representations
Balanced form representations are representations where for every positive digit
, there exist a corresponding negative digit
such that
. It follows that
. Only
odd bases can have balanced form representations, as otherwise
has to be the opposite of itself and hence 0, but
. In balanced form, the negative digits
are usually denoted as positive digits with a bar over the digit, as
for
. For example, the digit set of
balanced ternary would be
with
,
, and
. This convention is adopted in
finite field
In mathematics, a finite field or Galois field (so-named in honor of Évariste Galois) is a field (mathematics), field that contains a finite number of Element (mathematics), elements. As with any field, a finite field is a Set (mathematics), s ...
s of odd
prime order
:
:
Dual signed-digit representation
Every digit set
has a
dual digit set
given by the
inverse order of the digits with an
isomorphism
In mathematics, an isomorphism is a structure-preserving mapping or morphism between two structures of the same type that can be reversed by an inverse mapping. Two mathematical structures are isomorphic if an isomorphism exists between the ...
defined by
. As a result, for any signed-digit representations
of a number system
ring constructed from
with
valuation , there exists a dual signed-digit representations of
,
, constructed from
with
valuation , and an isomorphism
defined by
, where
is the additive inverse operator of
. The digit set for balanced form representations is
self-dual.
For integers
Given the digit set
and function
as defined above, let us define an
integer
An integer is the number zero (0), a positive natural number (1, 2, 3, ...), or the negation of a positive natural number (−1, −2, −3, ...). The negations or additive inverses of the positive natural numbers are referred to as negative in ...
endofunction as the following:
:
If the only
periodic point of
is the
fixed point , then the set of all signed-digit representations of the
integers
An integer is the number zero (0), a positive natural number (1, 2, 3, ...), or the negation of a positive natural number (−1, −2, −3, ...). The negations or additive inverses of the positive natural numbers are referred to as negative in ...
using
is given by the
Kleene plus , the set of all finite
concatenated strings of digits
with at least one digit, with
. Each signed-digit representation
has a
valuation
:
.
Examples include
balanced ternary with digits
.
Otherwise, if there exist a non-zero
periodic point of
, then there exist integers that are represented by an infinite number of non-zero digits in
. Examples include the standard
decimal numeral system with the digit set
, which requires an
infinite number of the digit to represent the
additive inverse
In mathematics, the additive inverse of an element , denoted , is the element that when added to , yields the additive identity, 0 (zero). In the most familiar cases, this is the number 0, but it can also refer to a more generalized zero el ...
, as
, and the positional numeral system with the digit set
with
, which requires an infinite number of the digit
to represent the number
, as
.
For decimal fractions
If the integers can be represented by the
Kleene plus , then the set of all signed-digit representations of the
decimal fraction
The decimal numeral system (also called the base-ten positional numeral system and denary or decanary) is the standard system for denoting integer and non-integer numbers. It is the extension to non-integer numbers (''decimal fractions'') of the ...
s, or
-adic rationals