Sunday, November 20, 2022

NUMBER CONVERSIONS

A great deal of the tasks the developers of new engage in, require on some level, the structural converting from one number base to some other, as our natural counting bases differ from those coveted 1's and 0's, amongst others, used in our machines, to dish out the glorious codes serving to simplify both our workflows, and the means by which we interact with and automate the world around us.


And without further ado, OMNITEKK presents our rendition of NUMBER CONVERSIONS, to help you along the way to becoming the I.T. rock stars we know you all have the proclivity to be.


BASE 10 TO BINARY

While we each of us have 10 fingers and 10 toes - well most of us anyway... giving ode to the representation and relevance of our base 10 numbering system, the machines we use in our processing tasks do not.


Fact is, the innerworkings of the human readable inputs and outputs of machine processes we recognize, prove vastly different within the machines themselves, consisting only of the simplicity of low to high voltage representations of data sequences, signified by either a 1, to show a HIGH VOLTAGE or ON position of a RELAY, TRANSISTOR or SWITCH along with 0, indicating LOW VOLTAGES or OFF positions.


These are the foundational attributes of what we come to know of as the BASE 2, or BINARY numbering system.


So instead of trekking between 10 numbers to represent the culmination of data or information, our machines accomplish almost whimsical feats, by combining and grouping, masking and converting just two numbers, namely 1's and 0's. 


It's all quite fantastical if you consider it.


Likewise, converting from BASE 10, our natural counting BASE, to BASE 2, the computer's natural counting BASE, consists of multiplication and division to represent clusters of binary information.


Here's how...


Let us take the BASE 10 DECIMAL number 1 2 3 4 5 for instance. 


We simply divide the number by 2, while keeping only the remainder, in reverse order, as our BINARY number conversion result.


So, 1 2 3 4 5 becomes 0011 0000 0011 1001 in BINARY.




Likewise, to convert a BINARY number to DECIMAL, simply utilize the inverse operation of multiplying the BINARY number by 2 with increased exponentiation ranging from 0 to the BINARY number length minus 1, to retrieve its BASE 10 number equivalent, only calculating the addition of the degree values where the result is 1 or ON.


00(1*8192)+(1*5096)+  0000  00(1*32)+(1*16)+  (1* 8)+00(1*1)


BASE 8 TO BINARY

Suppose instead of having 10 fingers and toes, we instead have only 8.


In this instance, instead of counting from 0 to 9 before our number increases in degree, we only count from 0 to 7.


So counting 20 in our new number base looks like 0, 1, 2, 3, 4 ,5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20 and so on.


Thing is, we still have to represent a BASE 2 number. 


To do so, we simply utilize the same process of multiplication and division from our initial BASE to our desired BASE.


 In this instance, to retrieve the BINARY equivalent of the OCTAL value 30071, we simply process the OCTAL number by its individual numbers, and divide each of those number values by 2, discarding all but the remainder values in reverse to retrieve our BINARY equivalent in groups of 3.


So 3  0  0  7  1 in OCTAL becomes 011 000 000 111 001 in our BINARY conversion.




Likewise, to retrieve the OCTAL equivalent from our BINARY value, we simply perform the inverse  operation on our binary groups of 3, and convert each number group to their OCTAL equivalent.


0(1*2)+(1*1)   000   000   (1*4)+(1*2)+(1*1)  00(1*1)


BASE 16 TO BINARY

Now, keeping up with convention, suppose instead of having 10 fingers and toes or even eight of them, we instead have 16.


While such a conception might seem both foreign and of unpleasant inconvenience, this is the measure of our hexadecimal (hex for short), or BASE 16 numbering system - introducing instead of only the DECIMAL numbers 0 through 9, the culmination of the alphabetical letters A to F also, for total of 16 number counts before increasing the degree of the actual number.


For instance, instead of 0 1 2 3 4 5 6 7 8 9, we now have 0 1 2 3 4 5 6 7 8 9 A B C D E and F, with A having the equivalence of a BASE 10 10, B of 11, C of 12 and so on.


To convert a HEXADECIMAL number to BINARY, we simply divide the number in it's individual number values by its BASE conversion factor of 2, grouping the result by groups of 4.


So the HEXADECIMAL value ABCD  becomes 1010 1011 1100 1101.





To compute its inverse, we simply compute each group of BINARY digits to their HEX equivalent, multiplying each BINARY digit by 2 in increasing exponent order from 0, only keeping the ON or 1 values in reverse as our result.

(1*8)+0(1*2)0   (1*8)+0(1*2)+(1*1)   (1*8)+(1*4)00   (1*8)+(1*4)+0(1*1)


And that's it folks, NUMBER CONVERSIONS served!


Until our next I T. adventure my friends...OMNITEKK says be well.



No comments:

Post a Comment

BEST OF THE BEST

Codes have always been deeply interwoven into the very fabric of our human existence.  We bear witness to them in our daily lives - as diffe...