A quaternary
numeral system is
base-. It uses the
digit
Digit may refer to:
Mathematics and science
* Numerical digit, as used in mathematics or computer science
** Hindu-Arabic numerals, the most common modern representation of numerical digits
* Digit (anatomy), the most distal part of a limb, such ...
s 0, 1, 2 and 3 to represent any
real number. Conversion from
binary is straightforward.
Four is the largest number within the
subitizing
Subitizing is the rapid, accurate, and confident judgments of numbers performed for small numbers of items. The term was coined in 1949 by E. L. Kaufman et al., and is derived from the Latin adjective '' subitus'' (meaning "sudden") and captures ...
range and one of two numbers that is both a square and a
highly composite number
__FORCETOC__
A highly composite number is a positive integer with more divisors than any smaller positive integer has. The related concept of largely composite number refers to a positive integer which has at least as many divisors as any smaller ...
(the other being 36), making quaternary a convenient choice for a base at this scale. Despite being twice as large, its
radix economy is equal to that of binary. However, it fares no better in the localization of prime numbers (the smallest better base being the
primorial base six,
senary
A senary () numeral system (also known as base-6, heximal, or seximal) has 6, six as its radix, base. It has been adopted independently by a small number of cultures. Like decimal, it is a semiprime, though it is unique as the product of the only ...
).
Quaternary shares with all fixed-
radix numeral systems many properties, such as the ability to represent any real number with a canonical representation (almost unique) and the characteristics of the representations of
rational number
In mathematics, a rational number is a number that can be expressed as the quotient or fraction of two integers, a numerator and a non-zero denominator . For example, is a rational number, as is every integer (e.g. ). The set of all ra ...
s and
irrational numbers. See
decimal and
binary for a discussion of these properties.
Relation to other positional number systems
Relation to binary and hexadecimal
As with the
octal
The octal numeral system, or oct for short, is the radix, base-8 number system, and uses the Numerical digit, digits 0 to 7. This is to say that 10octal represents eight and 100octal represents sixty-four. However, English, like most languages, ...
and
hexadecimal numeral systems, quaternary has a special relation to the
binary numeral system
A binary number is a number expressed in the base-2 numeral system or binary numeral system, a method of mathematical expression which uses only two symbols: typically "0" ( zero) and "1" (one).
The base-2 numeral system is a positional notatio ...
. Each
radix 4, 8 and 16 is a power of 2, so the conversion to and from binary is implemented by matching each digit with 2, 3 or 4 binary digits, or
bit
The bit is the most basic unit of information in computing and digital communications. The name is a portmanteau of binary digit. The bit represents a logical state with one of two possible values. These values are most commonly represented a ...
s. For example, in base 4,
:230210
4 = 10 11 00 10 01 00
2.
Since 16 is a power of 4, conversion between these bases can be implemented by matching each hexadecimal digit with 2 quaternary digits. In the above example,
:23 02 10
4 = B24
16
Although octal and hexadecimal are widely used in
computing
Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, ...
and
computer programming
Computer programming is the process of performing a particular computation (or more generally, accomplishing a specific computing result), usually by designing and building an executable computer program. Programming involves tasks such as anal ...
in the discussion and analysis of binary arithmetic and logic, quaternary does not enjoy the same status.
Although quaternary has limited practical use, it can be helpful if it is ever necessary to perform hexadecimal arithmetic without a calculator. Each hexadecimal digit can be turned into a pair of quaternary digits, and then arithmetic can be performed relatively easily before converting the end result back to hexadecimal. Quaternary is convenient for this purpose, since numbers have only half the digit length compared to binary, while still having very simple multiplication and addition tables with only three unique non-trivial elements.
By analogy with ''byte'' and ''nybble'', a quaternary digit is sometimes called a ''crumb''.
Fractions
Due to having only factors of two, many quaternary fractions have repeating digits, although these tend to be fairly simple:
Occurrence in human languages
Many or all of the
Chumashan languages (spoken by the Native American
Chumash peoples) originally used a base 4 counting system, in which the names for numbers were structured according to multiples of 4 and 16 (not 10). There is a surviving list of
Ventureño language number words up to 32 written down by a Spanish priest ca. 1819.
The
Kharosthi numerals (from the languages of the tribes of Pakistan and Afghanistan) have a partial base 4 counting system from 1 to decimal 10.
Hilbert curves
Quaternary numbers are used in the representation of 2D
Hilbert curves. Here a real number between 0 and 1 is converted into the quaternary system. Every single digit now indicates in which of the respective 4 sub-quadrants the number will be projected.
Genetics
Parallels can be drawn between quaternary numerals and the way
genetic code
The genetic code is the set of rules used by living cells to translate information encoded within genetic material ( DNA or RNA sequences of nucleotide triplets, or codons) into proteins. Translation is accomplished by the ribosome, which links ...
is represented by
DNA. The four DNA
nucleotide
Nucleotides are organic molecules consisting of a nucleoside and a phosphate. They serve as monomeric units of the nucleic acid polymers – deoxyribonucleic acid (DNA) and ribonucleic acid (RNA), both of which are essential biomolecul ...
s in
alphabetical order, abbreviated
A,
C,
G and
T, can be taken to represent the quaternary digits in
numerical order 0, 1, 2, and 3. With this encoding, the
complementary digit pairs 0↔3, and 1↔2 (binary 00↔11 and 01↔10) match the complementation of the
base pairs: A↔T and C↔G and can be stored as data in DNA sequence.
For example, the nucleotide sequence GATTACA can be represented by the quaternary number 2033010 (=
decimal 9156 or
binary 10 00 11 11 00 01 00). The
human genome is 3.2 billion base pairs in length.
Data transmission
Quaternary
line codes have been used for transmission, from the
invention of the telegraph to the
2B1Q code used in modern
ISDN
Integrated Services Digital Network (ISDN) is a set of communication standards for simultaneous digital transmission of voice, video, data, and other network services over the digitalised circuits of the public switched telephone network. Wor ...
circuits.
The GDDR6X standard, developed by
Nvidia
Nvidia CorporationOfficially written as NVIDIA and stylized in its logo as VIDIA with the lowercase "n" the same height as the uppercase "VIDIA"; formerly stylized as VIDIA with a large italicized lowercase "n" on products from the mid 1990s to ...
and
Micron uses quaternary bits to transmit data
Computing
Some computers have used
quaternary floating point
In computing, floating-point arithmetic (FP) is arithmetic that represents real numbers approximately, using an integer with a fixed precision, called the significand, scaled by an integer exponent of a fixed base. For example, 12.345 can be r ...
arithmetic including the
Illinois ILLIAC II (1962)
and the Digital Field System DFS IV and DFS V high-resolution site survey systems.
See also
*
Conversion between bases
*
Moser–de Bruijn sequence, the numbers that have only 0 or 1 as their base-4 digits
References
External links
{{commons category
Quaternary Base Conversion includes fractional part, from
Math Is Fun
Mathematics is an area of knowledge that includes the topics of numbers, formulas and related structures, shapes and the spaces in which they are contained, and quantities and their changes. These topics are represented in modern mathematics ...
Base42Proposes unique symbols for Quaternary and Hexadecimal digits
Power-of-two numeral systems