6

How does 0x12.2P2 equal 72.5?

I know that the value following the P, called the binary exponent, indicates the power-of-two by which the number is multiplied?

The Guy with The Hat
  • 10,836
  • 8
  • 57
  • 75
Farhan stands with Palestine
  • 13,890
  • 13
  • 58
  • 105

1 Answers1

19

0x12.2P2 is 0x122 / 1610 * 22

  • 0x122 = 29010
  • divided by 1610 = 18.12510
  • multiplied by 22 leads to 72.510

More formally (?), for the part before the P, you can use this very classic conversion table:

     decimal point here  ▼
+-----+-----+-----+-----+-+-----+-----+-----+
| 16³ | 16² | 16¹ | 16⁰ | | 16⁻¹| 16⁻²| 16⁻³|
+-----------------------------------------+
|     |     |  1  |  2  |.|  2  |     |     |
+-----+-----+-----+-----+-+-----+-----+-----+

So 0x12.2 is 1⨯16¹+2x16⁰+2⨯16⁻¹ = 18.125

Sylvain Leroux
  • 50,096
  • 7
  • 103
  • 125