Hallo,
wie wandle ich aber nun Nachkommastellen einer Dezimalzahl z.B. 54,3 in eine Dualzahl um?
Einfacheres Beispiel:
9.3
1. Zerlegen in Ganzzahl und echten Bruch
= 9 + 0.3
2. Ganzzahl:
9 : 2 = 4 Rest 1
4 : 2 = 2 Rest 0
2 : 2 = 1 Rest 0
1 : 2 = 0 Rest 1
3. Bruch:
0.3 * 2 = 0.6 Ganzzahlanteil 0
0.6 * 2 = 1.2 Ganzzahlanteil 1
0.2 * 2 = 0.4 Ganzzahlanteil 0
0.4 * 2 = 0.8 Ganzzahlanteil 0
0.8 * 2 = 1.6 Ganzzahlanteil 1
0.6 * 2 = 1.2 Ganzzahlanteil 1
ab hier wirds periodisch
4. Zusammenfassen
9.3(10) = 1001.010011001100110011(2)
http://www.netzmafia.de/skripten/ad/ad6.html
Aber welche praktische Bedeutung hat das? In der Praxis werden Fließkommazahlen (floating point) benutzt.
viele Grüße
Axel