adonisslanic Posted October 14, 2010 Report Share Posted October 14, 2010 (edited) In primul rand, am cautat pe forum si nu am gasit nimic pe genul... so... let's start! Codul binar, sau sistemul numeric in baza 2, este format doar din 2 elemente: 0 si 1 Pe baza acestui principiu, toate sistemele digitale din ziua de azi functioneaza... Sa luam de exemplu codul: 01101. Ca sa putem citi usor pentru inceput, ia o foaie si un pix (nu un text editor, serios) si noteaza vertical codul, uite asa: 01101Apoi pe baza acestei formule, calculezi: cifra*(2^y) unde y ia valori de la 0 la cate cifre are codul. Luand ca exemplu codul anterior, avem:0 * 2 ^ 4 = 0 * 16 = 0 1 * 2 ^ 3 = 1 * 8 = 81 * 2 ^ 2 = 1 * 4 = 40 * 2 ^ 1 = 0 * 2 = 01 * 2 ^ 0 = 1 * 1 = 1 Apoi adunam rezultatele: 1+0+4+8+0=13 Deci 01101 este in cod decimal 13 Deci trebuie luate in considerare niste chestii: 1. Daca elementul e 0, ia-l ca atare, adica noteaza 0 si incrementeaza y-ul cu 1 2. Dupa cum vezi, daca stii bazele lui 2, poti citi foarte usor codul binar O sa mai updatez acest scurt tutorial cu posturile voastre si cu alte chestii utile legate de acest sistem numeric care sta la baza civilizatiei moderne. P.S. : mayasii lucrau in baza 60 si noi lucram in baza 2 Useful links: [Python] Float Base Converter (console) [cmiN] -> Convertor dintr-o baza intr-alta vezi pe wiki daca nu se intelege usor din cod. Edited February 6, 2011 by adonisslanic Quote Link to comment Share on other sites More sharing options...
bcman Posted October 14, 2010 Report Share Posted October 14, 2010 Poti spune cum se face invers? Ca am uitat Adica din baza 2 in baza 10.PS: Din cate cunosc forumul si unii membrii ai acestuia, sigur vor aparea discutii de genul "ba ejti prost" "ratat" etc. Asta este, nu imi mai aduc aminte. Voua nu vi s-a intamplat niciodata? Quote Link to comment Share on other sites More sharing options...
enigmas Posted October 14, 2010 Report Share Posted October 14, 2010 In other words:11101010 = 8charsso the formula will be[1x(2^7)]+[1x(2^6)]+[1x(2^5)]+[0x(2^4)]+[1x(2^3)]+[0x(2^2)]+[1x(2^1)]+[1x(2^0)]=(1x128)+(1x64)+(1x32)+(0x16)+(1x8)+(0x4)+(1x2)+(1x1)=128+64+32+0+8+0+1+1=234 Quote Link to comment Share on other sites More sharing options...
enigmas Posted October 14, 2010 Report Share Posted October 14, 2010 You'll need base 2 table which looks like:2^0=12^1=22^2=42^3=82^4=162^5=322^6=642^7=1282^8=256...and you put 1 every time you can subtract the base two value from your number and 0 when you can't when you subtract you make the differences and compare the values again.234 < 256 we will start from 128234 - 128 = 106 -> 1106 - 64 = 42 -> 1 42 - 32 = 10 -> 1 10 < 16 -> 0 10 - 8 = 2 -> 1 2 < 4 -> 0 2 - 2 = 0 -> 1 1 > 0 -> 0 Quote Link to comment Share on other sites More sharing options...
blech Posted October 14, 2010 Report Share Posted October 14, 2010 eu am invatat asta de aici Academic Earth | Online Courses | Academic Video Lecturesnu e nici un fel de reclama... e un loc bun de studiu daca vrei sa vezi cum si ce se preda in state... eu unu m-am minunat cand am vazut cum preda un profesor de acolo, cum explica si cum interactioneaza.pacat ca m-am nascut in romania! Quote Link to comment Share on other sites More sharing options...
bcman Posted October 14, 2010 Report Share Posted October 14, 2010 ^^ Thanks Quote Link to comment Share on other sites More sharing options...
adonisslanic Posted October 14, 2010 Author Report Share Posted October 14, 2010 maine o sa adaug mai multe informatii postate de voi si o sa incep sa mai fac tutoriale ca imi place sa ajut oameni ca voi <(^.^)> Quote Link to comment Share on other sites More sharing options...
bambocha42 Posted October 14, 2010 Report Share Posted October 14, 2010 Deabia ce am terminat la scoala despre bin , octa , dec , hexa... Quote Link to comment Share on other sites More sharing options...
UnixDevel Posted October 14, 2010 Report Share Posted October 14, 2010 chiar aseara am stat si mi-am batut capul cu codul binar de ce naiba nu am gasit asta mai devreme , oricum bv insf am inteles si eu cum e ...apropo poate facem si ceva probleme de aritmetica cu traducerea lor in C++ ,eu zic ca e o idee buna !? Quote Link to comment Share on other sites More sharing options...
florin1000 Posted October 14, 2010 Report Share Posted October 14, 2010 Am citit chestiile astea intr-un tutorial acum cateva saptmani... dar nu am inteles cum se face interpretarea.. se face zecimal sau binar. adica procesorul face o intructiune dupa numarul 13 sau face o succesiune de 5 instructiuni dupa codul 01101? Quote Link to comment Share on other sites More sharing options...
enigmas Posted October 15, 2010 Report Share Posted October 15, 2010 Is more complicated than that, but in short words 5 instructions is based on AND / OR circuits, let's say millions of transistors which acts as micro switches, and combination between them. Quote Link to comment Share on other sites More sharing options...
adonisslanic Posted October 15, 2010 Author Report Share Posted October 15, 2010 good info enigmas Quote Link to comment Share on other sites More sharing options...
cmiN Posted October 16, 2010 Report Share Posted October 16, 2010 http://rstcenter.com/forum/18173-python-float-base-converter-console-cmin.rst -> Convertor dintr-o baza intr-alta vezi pe wiki daca nu se intelege usor din cod. Quote Link to comment Share on other sites More sharing options...