# Les 2: Hexadecimale Getallen

#### De waarde van hexadecimale getallen

Een talstelsel dat wij bij het computergebruik ook tegenkomen is het hexadecimale talstelsel. Hierbij worden niet de bouwstenen “0 en 1” (binair) of “0 t/m 9” (decimaal) gebruikt maar de bouwstenen “0 t/m 9 en letters A t/m F”.

| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A  | B  | C  | D  | E  | F  |
| - | - | - | - | - | - | - | - | - | - | -- | -- | -- | -- | -- | -- |
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

Een hexadecimaal getal is een reeks van cijfers, waarbij elk cijfer gekozen kan worden uit de cijfers 0 t/m 9 en letters A t/m F. Zo is het getal 2AF3 dus een hexadecimaal getal dat bestaat uit 4 cijfers. Welke decimale waarde hoort bij dit getal?

Net zoals in decimale getallen elk cijfer een veelvoud is van een macht van 10 is en in binaire getallen elk cijfer een veelvoud is van een macht van 2 is in hexadecimale getallen elk cijfer een veelvoud van een macht van 16. De waarde van het hexadecimale getal 2AF3 is dus te berekenen en wel als volgt:

|   | Macht           | dus       |
| - | --------------- | --------- |
| 2 | 16 ^ 3 ( \* 2 ) | 4096 \* 2 |
| A | 16 ^ 2 ( \* 10) | 256 \* 10 |
| F | 16 ^ 2 ( \* 15) | 16 \* 15  |
| 3 | 16 ^ 0 ( \* 3)  | 1 \* 3    |

Het hexadecimale getal 2AF3 heeft dus de waarde 3 + 240 + 2560 + 8192 = 10995 Een eenvoudige manier om de waarde van een hexadecimaal getal te berekenen is om de bijbehorende machten van 16 onder de bits te zetten:

| 2    | A   | F  | 3 |
| ---- | --- | -- | - |
| 4096 | 256 | 16 | 1 |

3 x 1 + F x 16 + A x 256 + 2 x 4096 = \
3 x 1 + 15 x 16 + 10 x 256 + 2 x 4096 = 10995

#### Van hexadecimaal naar binair en andersom

Hexadecimale getallen zijn pas echt handig omdat je ze heel gemakkelijk kunt omzetten naar binaire getallen en andersom. DIt komt omdat 1 hexadecimaal cijfer precies uit te drukken is met een getal van 4 binaire cijfers. Hieronder een tabel:

| binair | hexadecimaal |
| ------ | ------------ |
| 0000   | 0            |
| 0001   | 1            |
| 0010   | 2            |
| 0011   | 3            |
| 0100   | 4            |
| 0101   | 5            |
| 0110   | 6            |
| 0111   | 7            |
| 1000   | 8            |
| 1001   | 9            |
| 1010   | A            |
| 1011   | B            |
| 1100   | C            |
| 1101   | D            |
| 1110   | E            |
| 1111   | F            |

Deze tabel kun je nu gebruiken om binaire getallen naar hexadecimale getallen om te zetten en andersom. Je maakt groepjes van 4 en kijkt naar de bijbehorende waarde in de tabel:

*Voorbeeld: Zet het volgende binaire getal om naar naar hexadecimaal: 0101010101010101001010111*

Eerst onderverdelen in groepjes (rechts beginnen

| 0 | 1010 | 1010 | 1010 | 0101 | 0111 |
| - | ---- | ---- | ---- | ---- | ---- |

Zoek dan de juiste waarde erbij uit de tabel boven.

| 0 | 1010 | 1010 | 1010 | 0101 | 0111 |
| - | ---- | ---- | ---- | ---- | ---- |
| 0 | A    | A    | A    | A    | 7    |

Dus:  AAAAF

*Voorbeeld: zet het volgende hexadecimale getal om naar binair:* \
*BC57*

| B    | C    | 5    | 7    |
| ---- | ---- | ---- | ---- |
| 1011 | 1100 | 0101 | 0111 |

Dus: 1011 1100 0101 0111

#### Opdrachten&#x20;

1. Maak van het volgende hexadecimale getal een decimaal getal: C2B3
2. Maak van het volgende decimale getal een hexadecimaal getal: 7824
3. Wat is het grootste hexadecimale getal van 8 cijfers ?
4. Zet de volgende hexadecimale getallen om naar binair: A1B9F & AD0BE
5. Zet de volgende binaire getallen om naar hexadecimaal: 101010101111 & 111000110101011111


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://metis-montessori-lyceum.gitbook.io/informatica/modules/informatie/les-2-hexadecimale-getallen.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
