Base conversion between Numbering Systems

Asked

Viewed 394 times

4

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 focused more specifically on the 4 essential types used in computing:

  1. Sistema decimal 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. Sistema hexadecimal N = {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F}

My doubt is limited to how to make the base conversion faster and more effective?

There is a method or methodology to perform the base conversion faster and more effectively?

Knowing that to convert a number from one base to another is necessary 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 = ?

Ax16³ + Fx16² + Cx16¹ + 0x16° + 7x16-¹ + Dx16-²

10x16³ + 15x16² + 12x16¹ + 0x16° + 7x16-¹ + 13x16-²

44992,4882810


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

  • 1

    I think only by understanding each system itself, then the conversion becomes more fluid. Understanding the formula is simpler than memorizing it.

1 answer

3

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

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

Direct binary to octal conversion table 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 in base 2 = 5 in base 8

001 in base 2 = 1 in base 8

therefore 111010012 = 3518

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

Example 11110101101 = 0111 . 1010 . 1101

Direct binary to hexadecimal 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.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.