Basic conversion between numbering systems

I am studying computational mathematics, more specifically numbering systems and their conversion.

Numbering systems are widely used in programming and computing in general, so my study addressed more specifically the 4 essential types used in computing:

  1. decimal System N = {0,1,2,3,4,5,6,7,8,9}
  2. binary system N = {0,1}
  3. octal system N = {0,1,2,3,4,5,6,7}
  4. hexadecimal system N = {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E, F}

My question is limited to how to do the base conversion faster and more effectively?

Is there a method or methodology to perform base conversion faster and more effectively?

Knowing that to convert a number from one base to another requires a large calculation and specific rules.


Conversão de Hexadecimal para Decimal

A regra é a mesma da conversão de qualquer sistema de numeração para o decimal.

AFC0, 7D = ?

Ax163 + Fx162 + Cx161 +0x16° + 7x16-1 + Dx16-2

10x163 + 15x162 + 12x161 + 0x16° + 7x16-1 + 13x16-2

44992,4882810


Notice above that the hexadecimal system shown above is positional starting from right to left, so the base raised to (161, 16°, 16-1) and notice also that each digit has been multiplied by 16 because the hexadecimal numbering system is composed of base equal to 16. So 16 distinct digits.

Author: Leo Caracciolo, 2017-05-03

1 answers

The simplest conversions are those involving bases that are powers to each other.

Example: conversion between base 2 and base 8. How 23 = 8 we separate the digits of the torque (base 2) into groups of three (power of 2 -> 3) digits (always starting from right to left). 11101001=011.101.001

Direct conversion table binary to octal and vice versa.

binário  |  octal
 000     |     0
 001     |     1
 010     |     2
 011     |     3
 100     |     4
 101     |     5
 110     |     6
 111     |     7

So,

011 at base 2 = 3 at base 8

101 at base 2 = 5 at base 8

001 at base 2 = 1 at base 8

Therefore 111010012 = 3518

Conversion between bases 2 and 16. How 24 = 16, following the previous process, we simply separate into groups of four digits (power of 2 -> 4) and convert each group following a table similar to the previous one.

Example 11110101101 = 0111 . 1010 . 1101

Binary to hexadecimal direct conversion table and vice versa

 binário  |  Hexadecimal
 0000     |     0
 0001     |     1
 0010     |     2
 0011     |     3
 0100     |     4
 0101     |     5
 0110     |     6
 0111     |     7
 1000     |     8
 1000     |     9
 1010     |     A
 1011     |     B
 1100     |     C
 1101     |     D
 1110     |     E
 1111     |     F

0111 = 7, 1010 = A, 1101 = D

Therefore 111101011012 = 7AD16

For the other conversions is using the general expression you used.

 3
Author: Leo Caracciolo, 2017-11-08 22:29:40