How do you translate number from binary to decimal?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/code-flow.club/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
84 views
I wonder who translates as. Maybe you know the most convenient/fastest way to transfer?
by | 84 views

7 Answers

0 like 0 dislike
If the number is small, it is enough just to remember the weight of the digits— 1, 2, 4,.... The average programmer think remember the power of two to at least 65536.
\r
And to sum the weight of those discharges in which one.
by
0 like 0 dislike
let's say you need to translate 10101. zapisyvaet power of two in a row
\r
\r16 8 4 2 1
\r
nakladyvat mask in accordance with a binary number
\r
\r16 0 4 0 1
\r
skladyvalas, get 21
\r
there is absolutely no point in setting up anything in any degree and to fence the other stats. binary system not in vain chosen as the main processor:)
by
0 like 0 dislike
1101 go from the end
1 * 2^0
+
0 * 2^1
+
1 * 2^2
+
1 * 2^3
= 13
proof m.wolframalpha.com/input/?i=bin+1101+to+decimal&x=0&y=0
by
0 like 0 dislike
Start python and write
>>> 0b101010
\r42
by
0 like 0 dislike
Convenient and quick — a standard calculator.
Or need in mind?
by
0 like 0 dislike
I once read on Habre one convenient way, but apparently forgotten it already...
About suchit:
let's say we have 101010
the first three digits(or bit right) is a 5, is simply to remember
0 is just multiplication by two, for a total of 10
1 — multiply by 2 and add unit, for a total of 21
0 — multiply by 2, total epic 42.
\r
Like everything is fine, but when I wrote the random number is more(this was 91), switch right it could not have...
Maybe someone knows about this method?
by
0 like 0 dislike
In my mind, if a short number, on the principle of 010101, where the unit, it means that there is the two in the degree equal to the number of digits from the right (counting from zero).
So: 0+_+2^4+_+2^2_+2^0
Then put. 0+16+0+4+0+1=21.
Perhaps my method is a little through J. the easiest way to use a calculator :)
by

Related questions

0 like 0 dislike
3 answers
0 like 0 dislike
5 answers
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
asked Apr 10, 2019 by cybernoob
110,608 questions
257,186 answers
0 comments
23,454 users