Lernpfad:Das Dualsystem/10: Unterschied zwischen den Versionen
Ngb (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
Ngb (Diskussion | Beiträge) |
||
(5 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
Betrachte erneut 4-Bit Dualzahlen. Mit vier Bit können insgesamt 16 Zahlen dargestellt werden. Von <math>(0000)_2 = (0)_{10}</math> bis <math>(1111)_2 = (15)_{10}</math>. | |||
Was aber, wenn wir auch negative Zahlen im Binärsystem darstellen wollen? | Was aber, wenn wir auch negative Zahlen im Binärsystem darstellen wollen? | ||
Zeile 10: | Zeile 10: | ||
== Die Vorzeichenbit-Darstellung == | == Die Vorzeichenbit-Darstellung == | ||
Bei n-Bit Zahlen in ''Vorzeichenbit-Darstellung'' (VzD) wird das höchstwertige Bit (das Bit ganz links für die Potenz <math>2^{n−1}</math>) für das Vorzeichen reserviert (<code>0</code>=positiv, <code>1</code>=negativ). Es verbleiben also <math>n − 1</math> Bit für die Darstellung des Zahlwertes. | |||
{| width="80%" | |||
|'''4-Bit VzD''': || <math>(0011)_2 = (3)_{10}</math> || <math>(1011)_2 = (-3)_{10}</math> | |||
|- | |||
|'''7-Bit VzD''': || <math>(0001000)_2 = (8)_{10}</math> || <math>(1001000)_2 = (-8)_{10}</math> | |||
|} | |||
Für die VzD ist also von Bedeutung, wie viele Bit eine Dualzahl maximal haben kann. | |||
{{Aufgabe:Start}} | |||
Forme die '''6-Bit VzD Zahlen''' ins Dezimalsystem um: | |||
# <math>(010101)_2</math> | |||
# <math>(101010)_2</math> | |||
# <math>(000000)_2</math> | |||
# <math>(100000)_2</math> | |||
{{Aufgabe:End}} | |||
{{Lösung:Start}} | |||
Forme die '''6-Bit VzD Zahlen''' ins Dezimalsystem um: | |||
# <math>(010101)_2 = (21)_{10}</math> | |||
# <math>(101010)_2 = (-10)_{10}</math> | |||
# <math>(000000)_2 = (0)_{10}</math> | |||
# <math>(100000)_2 = (-0)_{10}</math> (!!) | |||
{{Lösung:End}} | |||
{{Aufgabe:Start}} | |||
Vervollständige den Satz: | |||
<lückentext> | |||
In der 4-Bit VzD können '''16()''' verschiedene Dualzahlen mit '''15()''' verschiedenen Werten dargestellt werden. Die kleinste | |||
mögliche Zahl (in Dezimaldarstellung) ist '''-7()''', die Größte ist '''7()'''. | |||
</lückentext> | |||
{{Aufgabe:End}} | |||
== Das Zweierkomplement == | == Das Zweierkomplement == | ||
Das ''Einerkomplement'' einer Dualzahl wird gebildet, indem die Zahl invertiert wird (aus <code>0</code> wird <code>1</code> und aus <code>1</code> wird <code>0</code>). Für das ''Zweierkomplement'' (ZkD) wird zum Einerkomplement noch <code>1</code> addiert. | |||
Bei Dualzahlen in ''Zweierkomplement-Darstellung'' (ZkD) sind negative Zahlen das Zweierkomplement ihrer positiven Gegenzahl. Das hat den zusätzlichen Vorteil, dass das höchstwertige Bit auch hier anzeigt, ob die Zahl positiv (<code>0</code>) oder negativ (<code>1</code>) ist. | |||
{| width="80%" | |||
| || Binärzahl || Einerkomplement || Zweierkomplement | |||
|- | |||
|'''4-Bit ZkD''': || <math>(0011)_2 = (3)_{10}</math> || <math>(1100)_2</math> || <math>(1101)_2 = (-3)_{10}</math> | |||
|- | |||
|'''7-Bit ZkD''': || <math>(0001000)_2 = (8)_{10}</math> || <math>(1110111)_2</math> || <math>(1111000)_2 = (-8)_{10}</math> | |||
|} | |||
{{Aufgabe:Start}} | |||
Bilde das Zweierkomplement der 4-Bit Zahlen (denke an den Überlauf). Notiere darunter auch jeweils die Dezimalzahldarstellung der Zahlen. | |||
# <math>(0001)_2</math> | |||
# <math>(1010)_2</math> | |||
# <math>(0000)_2</math> | |||
{{Aufgabe:End}} | |||
{{Aufgabe:Start}} | |||
Berechne die Summe der '''4-Bit ZkD Zahlen''' und kontrolliere die Rechnung im Dezimalsystem. | |||
# <math>(0001)_2 + (1110)_2</math> | |||
# <math>(1001)_2 + (0111)_2</math> | |||
# <math>(1011)_2 + (1000)_2</math> | |||
# <math>(1011)_2 + (0000)_2</math> | |||
{{Aufgabe:End}} | |||
{{Aufgabe:Start}} | |||
Vergleiche die beiden Darstellungen für negative Dualzahlen miteinander. Wo liegen Vorteile, was sind Probleme der Darstellungen? | |||
{{Aufgabe:End}} |
Aktuelle Version vom 30. August 2023, 09:05 Uhr
Betrachte erneut 4-Bit Dualzahlen. Mit vier Bit können insgesamt 16 Zahlen dargestellt werden. Von [math]\displaystyle{ (0000)_2 = (0)_{10} }[/math] bis [math]\displaystyle{ (1111)_2 = (15)_{10} }[/math].
Was aber, wenn wir auch negative Zahlen im Binärsystem darstellen wollen?
- Überlegt Euch, wie man negative Zahlen im Dualsystem darstellen kann.
- Welche Zahlen können nach Eurem Verfahren mit 4 Bit dargestellt werden?
- Probiert die Addition von Binärzahlen aus. Funktioniert sie noch, wie zuvor?
Die Vorzeichenbit-Darstellung
Bei n-Bit Zahlen in Vorzeichenbit-Darstellung (VzD) wird das höchstwertige Bit (das Bit ganz links für die Potenz [math]\displaystyle{ 2^{n−1} }[/math]) für das Vorzeichen reserviert (0
=positiv, 1
=negativ). Es verbleiben also [math]\displaystyle{ n − 1 }[/math] Bit für die Darstellung des Zahlwertes.
4-Bit VzD: | [math]\displaystyle{ (0011)_2 = (3)_{10} }[/math] | [math]\displaystyle{ (1011)_2 = (-3)_{10} }[/math] |
7-Bit VzD: | [math]\displaystyle{ (0001000)_2 = (8)_{10} }[/math] | [math]\displaystyle{ (1001000)_2 = (-8)_{10} }[/math] |
Für die VzD ist also von Bedeutung, wie viele Bit eine Dualzahl maximal haben kann.
Forme die 6-Bit VzD Zahlen ins Dezimalsystem um:
- [math]\displaystyle{ (010101)_2 }[/math]
- [math]\displaystyle{ (101010)_2 }[/math]
- [math]\displaystyle{ (000000)_2 }[/math]
- [math]\displaystyle{ (100000)_2 }[/math]
Forme die 6-Bit VzD Zahlen ins Dezimalsystem um:
- [math]\displaystyle{ (010101)_2 = (21)_{10} }[/math]
- [math]\displaystyle{ (101010)_2 = (-10)_{10} }[/math]
- [math]\displaystyle{ (000000)_2 = (0)_{10} }[/math]
- [math]\displaystyle{ (100000)_2 = (-0)_{10} }[/math] (!!)
Vervollständige den Satz:
In der 4-Bit VzD können 16() verschiedene Dualzahlen mit 15() verschiedenen Werten dargestellt werden. Die kleinste mögliche Zahl (in Dezimaldarstellung) ist -7(), die Größte ist 7().
Das Zweierkomplement
Das Einerkomplement einer Dualzahl wird gebildet, indem die Zahl invertiert wird (aus 0
wird 1
und aus 1
wird 0
). Für das Zweierkomplement (ZkD) wird zum Einerkomplement noch 1
addiert.
Bei Dualzahlen in Zweierkomplement-Darstellung (ZkD) sind negative Zahlen das Zweierkomplement ihrer positiven Gegenzahl. Das hat den zusätzlichen Vorteil, dass das höchstwertige Bit auch hier anzeigt, ob die Zahl positiv (0
) oder negativ (1
) ist.
Binärzahl | Einerkomplement | Zweierkomplement | |
4-Bit ZkD: | [math]\displaystyle{ (0011)_2 = (3)_{10} }[/math] | [math]\displaystyle{ (1100)_2 }[/math] | [math]\displaystyle{ (1101)_2 = (-3)_{10} }[/math] |
7-Bit ZkD: | [math]\displaystyle{ (0001000)_2 = (8)_{10} }[/math] | [math]\displaystyle{ (1110111)_2 }[/math] | [math]\displaystyle{ (1111000)_2 = (-8)_{10} }[/math] |
Bilde das Zweierkomplement der 4-Bit Zahlen (denke an den Überlauf). Notiere darunter auch jeweils die Dezimalzahldarstellung der Zahlen.
- [math]\displaystyle{ (0001)_2 }[/math]
- [math]\displaystyle{ (1010)_2 }[/math]
- [math]\displaystyle{ (0000)_2 }[/math]
Berechne die Summe der 4-Bit ZkD Zahlen und kontrolliere die Rechnung im Dezimalsystem.
- [math]\displaystyle{ (0001)_2 + (1110)_2 }[/math]
- [math]\displaystyle{ (1001)_2 + (0111)_2 }[/math]
- [math]\displaystyle{ (1011)_2 + (1000)_2 }[/math]
- [math]\displaystyle{ (1011)_2 + (0000)_2 }[/math]
Vergleiche die beiden Darstellungen für negative Dualzahlen miteinander. Wo liegen Vorteile, was sind Probleme der Darstellungen?