10
can be represented like this in binary:0000 1010
.0000 1010
written in rows from starting with the right most digit:
0*1 = 0*1 = 0
1*2 = 1*2 = 2
0*2*2 = 0*4 = 0
1*2*2*2 = 1*8 = 8
... (leaving the last four calculations for the left four bits out cause those are all zeros)
Now you calculate the values you got together: 8+0+2+0=10
.1111 1111
and you should get 255
.0010 1010
.42
.
1111
in decimal?
It is 15
(1+2+4+8)!0000 1010
, for which we know is 10
in decimal, we put in A
.DEC | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
HEX | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
1111 1111
you simply have two blocks with F: FF
.0010 1010
.2
A
FF
back to decimal you do this:
F*1 = 15*1 = 15
F*16 = 15*16 = 240
Add that (240+15) and you get 255
(the 256th number when counting from zero)!01 A4
(0000 0001 1010 0100
in binary):
4*1 = 4*1 = 4
A*16 = 10*16 = 160
1*16*16 = 1*256 = 256
0*16*16*16 = 0*4096 = 0
Add that together (256+160+4) and we get 420
in decimal 🥦#
(usually HEX color. E.g. #FF0000 for red; #00FF00 for green; #0000FF for blue)0x
(most common one. Used e.g. for address and offset. E.g. 0xFFFF; 0xA; 0x1B)h
(may be used when calculating on paper e.g. 1h; Ah; 11h)d
after the value (useful on paper when multiple systems are used. E.g. 1d; 10d; 17d).0b
(E.g. 0b0001; 0b1010; 0b10001)
b
(again, useful on paper. E.g. 0001b; 1010b; 00010001b)
4
integer result = 9/2
print "9 divided by 2? valueOfvariable(result)."
HEX | C0 | D0 | 00 | 00 | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
BIN | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Sign | Exponent | Mantissa | ||||||||||||||||||||||||||||||
negative | 129 (-127) ⇒ +2 | 1.mantissa (w/o trailing zeros) ⇒ 1.101 |
HEX | 3E | 50 | 00 | 00 | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
BIN | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Sign | Exponent | Mantissa | ||||||||||||||||||||||||||||||
positive | 124 (-127) ⇒ -3 | 1.mantissa (w/o trailing zeros) ⇒ 1.101 |
Start: | 1 | . | 1 | 0 | 1 | ||||||||
→ | 1 | 1 | 0 | . | 1 |
Start: | 1 | . | 1 | 0 | 1 | ||||||||
← | 0 | . | 0 | 0 | 1 | 1 | 0 | 1 |
Exponentiations | 2² | 2¹ | 2⁰ | 2⁻¹ | 2⁻² | 2⁻³ | |||
Decimal value | 4 | 2 | 1 | 0.5 | 0.25 | 0.125 | |||
Binary | Decimal | ||||||||
Start: | 1 | . | 1 | 0 | 1 | 1.625 | |||
×2: | 1 | 1 | . | 0 | 1 | 3.25 | |||
×2: | 1 | 1 | 0 | . | 1 | 6.5 |
Exponentiations | 2² | 2¹ | 2⁰ | 2⁻¹ | 2⁻² | 2⁻³ | 2⁻⁴ | 2⁻⁵ | 2⁻⁶ | |||
Decimal value | 4 | 2 | 1 | 0.5 | 0.25 | 0.125 | 0.0625 | 0.03125 | 0.015625 | |||
Binary | Decimal | |||||||||||
Start: | 1 | . | 1 | 0 | 1 | 1.625 | ||||||
÷2: | 0 | . | 1 | 1 | 0 | 1 | 0.8125 | |||||
÷2: | 0 | . | 0 | 1 | 1 | 0 | 1 | 0.40625 | ||||
÷2: | 0 | . | 0 | 0 | 1 | 1 | 0 | 1 | 0.203125 |
168.0
120.0