0 like 0 dislike
199 views
I wonder who translates as. Maybe you know the most convenient/fastest way to transfer?
| 199 views

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
\r`16 8 4 2 1`
\r
\r
\r`16 0 4 0 1`
\r
\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
\r`42 `
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...
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...
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

0 like 0 dislike