We’re rewarding the question askers & reputations are being recalculated! Read more.

# Tag Info

0

It may be that the author of the C code did optimize the division/multiplication because shifting does the same as dividing/multiplying by 2 (or by powers of 2) but is faster about 100 times on most of the CPUs. But in most modern C compilers this optimization is done by compiler itself.

1

Most things can be used in multiple ways. For example, coins can be used as screwdrivers sometimes. But when a coin is used as a screwdriver, it doesn’t matter that the coin could also be used to buy stuff. Likewise, when using bit patterns as a set of “on-off switches”, the fact that the pattern also represents a number is irrelevant.

1

Binary, octal, decimal, hexadecimal are only different means to express the same number. So it’s not about a special significance, it’s just that 0100 0000 in binary, 64 in decimal and 0x40 in hexadecimal ARE mathematically speaking the same number. When you write them in binary, it’s just practical (and cheap) to implement them in computers. So the ...

0

Your question is not entirely clear, but hopefully my interpretation of it will be of some value to you. 1011 The "value" of this number is decimal 11. However, [...] the above [...] may instead be seen as 4 switches So, both the binary and the decimal number system are based on the same principle; the difference is in the number of available ...

1

No, there is no meaningful relationship between the decimal and binary notations of the numbers. One is base 10 and the other base 2 and ten is not a power of two. The reason we use base-10 Arabic numerals is probably because have ten fingers and because it's a much better system then Roman numerals. Nobody was thinking about binary digits at the time. ...

3

My question is: Is there any significance to the fact that the number we had to use to set that bit happens to be 64? There is exactly the same significance to the fact that the ascii character we had to use to set that bit happens to be @. The concept that you're scratching at is called encoding. 0100 0000 is 64. But it's also @. It's also the settings of ...

Top 50 recent answers are included