Numeric complements

This online calculator calculates radix complement (referred to as r's complement) and diminished radix complement (referred to as (r-1)'s complement) for the given number and the given radix (base).

This page exists due to the efforts of the following people:

Timur

Timur

Created: 2020-02-05 10:00:18, Last updated: 2021-09-30 12:32:41

PLANETCALC, Complement calculator

Complement calculator

Radix complement
 
Diminished radix complement
 

Complement numbers

A complement number is a number that, when added to its counterpart, makes some other number, usually a base (radix) of a number system. In such a case, it is called radix complement. For example, 7 complements 3 to 10.

By definition, the formula of the radix complement of an n digit number y in radix b is

b^n-y

There is also a diminished radix complement, which is

(b^n-1)-y.

A diminished radix complement is easy to get by simply replacing the digits of a number with digits needed to get radix - 1. For example, for the 2 digit decimal number 56, the diminished radix complement is 43. Then you can get radix complement by simply adding the one to the diminished radix complement: 43+1=44

For the decimal system, a radix complement is known as ten's complement (10's complement), and a diminished radix complement is known as nines' complement (9's complement).

Generally, complements are used to represent a symmetric range of positive and negative integers. In other words, half of the range represents positive numbers, and their complements represent negative numbers. That is, for ten's complement, if we consider only one digit, i.e., range from 0 to 9, 3 represents +3, and 7 represents -3.

This allows technique known as method of complements, where you can calculate subtraction as addition of subtrahend complement, f.e. 622 - 451 is 622 + 549 = 1171 = 171 (the leading 1 is omitted from the result).

For the binary system radix complement is known as two's complement (2's complement) and diminished radix complement as one's complement (1's complement). One's complement can be obtained by simply inverting bits of a number. Two's complement is used in computers to represent negative integers. You can read more here: One's complement, and two's complement binary codes.

URL copied to clipboard
PLANETCALC, Numeric complements

Comments