There are no approved revisions of this page, so it may
not have been
reviewed.
This article page is a stub, please help by expanding it.
Integer division (or Euclidean division) is an operation on integers defined as
-
where
is the
floor function. In the mapping
-
given by the
division algorithm, the
integer quotient[1] , with
as the
remainder.
[2]
Least absolute remainder
The least absolute remainder integer division (or nearest integer division) is an operation on integers defined as
-
where
is the
sign function. In the mapping
-
given by the [least absolute remainder] division algorithm, the
nearest integer quotient , with
as the
least absolute remainder.
Examples
The allowed least absolute remainders are :
- maps to
(4, 7 − 4 × 2) = (4, − 1) | , i.e. ;
- maps to
( − 3, − 7 − ( − 3) × 2) = ( − 3, − 1) | , i.e. − 7 = ( − 3) × 2 + ( − 1) | ;
- maps to
( − 4, 7 − ( − 4) × ( − 2)) = ( − 4, − 1) | , i.e. 7 = ( − 4) × ( − 2) + ( − 1) | ;
- maps to
(3, − 7 − 3 × ( − 2) = (3, − 1) | , i.e. − 7 = 3 × ( − 2) + ( − 1) | .
|
The allowed least absolute remainders are { − 128, ..., − 1, 0, 1, ..., 127} | :
- maps to
(1, 128 − 1 × 256) = (1, − 128) | , i.e. ;
- maps to
0, − 128 − 0 × 256) = (0, − 128) | , i.e. − 128 = 0 × 256 + ( − 128) | ;
- maps to
( − 1, 128 − ( − 1) × ( − 256)) = ( − 1, − 128) | , i.e. 128 = ( − 1) × ( − 256) + ( − 128) | ;
- maps to
(0, − 128 − 0 × ( − 256) = (0, − 128) | , i.e. − 128 = 0 × ( − 256) + ( − 128) | .
|
See also
Notes