Peter said:
They invented Fields. But note that the mathematical notion of
multiplicative
inverses in Fields does not correspond to integer division with
rounding.
Division by zero is usually excluded. So division is rarely closed
in any case.
If by "division" we mean an operation which is roughly
speaking the inverse of multiplication then it may not
exist at all. The fact that "division by zero" is not defined
does not mean that it's not closed , it means that it's not
an operation in the algebraic sense. Not closed means
that a/b may not be an element of the set we're talking about.
That's too strong a statement. It is trivial to generate Rings whose
elements
are normal integers, but whose addition and multiplication functions
are
entirely different to the ordinary arithmetic of integers. The elements
are
really just labels, it's the function mappings that determine what is a
ring.
C's unsigned arithmetic uses particular mappings that just one example.
Yes, but it's unnecessary to consider rings in general in order to
understand
unsigned integers.
Hear hear for that. All the discussion about
rings does is to obfuscate the issue. It is also
out of topic.
The important part is the notion that in the abstract, the operators +
and *
are just function mappings, not 'computations'. In other words + and *
are
in essence just pure lookup tables.
One of the 2 words in "function mappings" is redundant.
"Function" and "mapping" are usually synonymous. In
mathematical parlance "operator" generally also means
function. In a ring R, + and * are functions from the cartesian
product RxR into R. Using the usual functional notation we
could write +((a,b)) and *((a,b)) for any elements of the ring a,b
but for historical reasons we write instead a+b and a*b
respectively.
For unsigned integers, the mapping/table is 'onto', that is, for every
pair (a,b) there exists a corresponding element.
That's not what "onto" means. Just by virtue of the fact
that + and * are functions we know that for every pair
(a,b) there's going to be an image under + and an image
under * ie a+b and a*b are both going to be defined. Addition
being onto would mean that for every unsigned integer c there
are unsigned integers a and b such that c=a+b. This is trivially true.
Multiplication being onto would mean that for every unsigned
integer c there are unsigned integers a and b such that c=a*b. This
is also trivially true.
Signed integer
operators are not onto since there are pairs that do not have
mappings.
No , addition and multiplication are not binary operations
on the set of signed integers of some platform. Since they
are not even functions defined on the set of ordered pairs
of signed integers it is meaningless to ask if they are onto
functions.
Because of that, C's signed integer arithmetic is not
a ring. However, the typical two's complement implementation
completes the mapping and does form a ring.
I don't see what guarantees a two's complement reprpesentation
offers in the case of overflow.