Numeral system
:Occasionally the term "number system" is used for this concept, but that is also the name of an altogether different concept; see number system.
Change of radix
A simple algorithm for converting integers between positive-integer radices is repeated division by the target radix; the remainders give the "digits" starting at the least significant. E.g., 1020304 base 10 into base 7:
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
1020304 / 7 = 145757 r 5
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
145757 / 7 = 20822 r 3
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
20822 / 7 = 2974 r 4
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
2974 / 7 = 424 r 6
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
424 / 7 = 60 r 4
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
60 / 7 = 8 r 4
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
8 / 7 = 1 r 1 => 11446435
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
E.g., 10110111 base 2 into base 5:
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
10110111 / 101 = 100100 r 11 (3)
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
100100 / 101 = 111 r 1 (1)
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
111 / 101 = 1 r 10 (2) => 1213
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
To convert a "decimal" fraction, do repeated multiplication, taking the protruding integer parts as the "digits". Unfortunately even a terminating fraction in one base may not terminate in another. E.g., 0.1A4C base 16 into base 9:
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
0.1A4C × 9 = 0.ECAC
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
0.ECAC × 9 = 8.520C
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
0.520C × 9 = 2.E26C
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
0.E26C × 9 = 7.F5CC
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
0.F5CC × 9 = 8.A42C
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
0.A42C × 9 = 5.C58C => 0.082785...
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ Table of Content ~
| ► | Introduction |
| ► | Types of numeral systems |
| ► | History |
| ► | Bases used |
| ► | Positional systems in detail |
| ► | Change of radix |
| ► | Generalized variable-length integers |
| ► | See also |
| ► | References |
| ► | External links |
~ What's Hot ~
~ Community ~
| ► | History Forum Come and discuss about History, Civilizations, Historical Events and Figures |
| ► | History Web-Ring A community of sites, blogs and forums dedicated to History. Do not hesitate to submit your site. |
and are licensed under the GNU Free Documentation License.
Lexicon - Privacy Policy - Spiritus-Temporis.com ©2005.
