Chapterبەش 2 · Lectureوانە 2.3
From Binary, Octal and Hex to Decimalلە دووانی، هەشتی و شانزەییەوە بۆ دەیی
One method for every base — digit × place value, then add — with binary (and the double-and-add shortcut), octal and hexadecimal, fraction digits with negative powers, and the midterm question .
یەک ڕێگا بۆ هەموو — × ، پاشان کۆکردنەوە — بۆ (و کورتەڕێی دوو هێندەکردن و زیادکردن)، و ، بە سالب و پرسیاری نیوەی وەرز .
What you will learnچی فێر دەبیت
- Write the place value of every digit of a binary, octal or hexadecimal number, including digits after the point.
- Convert binary, octal and hexadecimal numbers to decimal by adding digit × place value.
- Use the double-and-add shortcut for long binary numbers.
- Check a conversion by converting back.
- بۆ هەر ژمارەیەکی ، یان بنووسیت، لەوانە دوای خاڵەکە.
- ژمارە ، و بە کۆکردنەوەی × بگۆڕیت بۆ .
- کورتەڕێی دوو هێندەکردن و زیادکردن بۆ ژمارە درێژەکان بەکاربهێنیت.
- گۆڕینێک بە گەڕاندنەوە بپشکنیت.
One method for every baseیەک ڕێگا بۆ هەموو بنچینەیەک
Converting to decimal is the easy direction. You already know the idea from Number systems: every digit is worth digit × place value, and the number is the sum.
گۆڕین بۆ ئاراستە ئاسانەکەیە. بیرۆکەکەت پێشتر لە سیستەمە ژمارەییەکان ناسیوە: بەهای هەر یەکسانە بە × و ژمارەکە کۆی هەموویانە.
Number the places starting at the point: 0, 1, 2, 3 … to the left and to the right.
خانەکان لە خاڵەکەوە ژمارە بکە: 0، 1، 2، 3 … بەرەو چەپ و بەرەو ڕاست.
The place value of position k is base to the power k: .
لە شوێنی k یەکسانە بە بە k: .
Multiply each digit by its place value (A–F count as 10–15).
هەر لەگەڵ لێک بدە (A–F بە 10–15 دادەنرێن).
Add all the products. The sum is the decimal number.
هەموو لێکدانەکان کۆ بکەرەوە. کۆکە ژمارە .
One method for every baseیەک ڕێگا بۆ هەموو بنچینەیەک
Counting money in bundlesژماردنی پارە بە دەستە
A shopkeeper in the bazaar counts his money in bundles: 3 bundles of 1,000 dinars, 4 of 100 and 7 single notes make dinars. A number in any base works the same way: each digit says how many bundles of one size there are. In base 8 the bundle sizes are 1, 8, 64, 512 …; in base 16 they are 1, 16, 256, 4096 ….
دوکاندارێک لە بازاڕدا پارەکەی بە دەستە دەژمێرێت: 3 دەستەی 1,000 دیناری، 4 دەستەی 100 دیناری و 7 پارەی تاک دەکاتە دینار. ژمارە لە هەر بە هەمان شێوە کار دەکات: هەر دەڵێت چەند دەستەی یەک قەبارە هەیە. لە 8دا قەبارەی دەستەکان 1، 8، 64، 512 و هتد؛ لە 16دا 1، 16، 256، 4096 و هتد.
Where the analogy stops workingسنووری ئەم نموونەیە
A shopkeeper may have 12 bundles of the same size; in a number a digit is never bigger than (base minus one), because base-many bundles are swapped for one bundle of the next size.
دوکاندار دەکرێت 12 دەستەی هەمان قەبارەی هەبێت؛ بەڵام لە ژمارەدا هەرگیز لە ( کەم یەک) گەورەتر نییە، چونکە ئەوەندە دەستە کە ژمارەیان یەکسانە بە دەگۆڕدرێنەوە بە یەک دەستەی قەبارەی دواتر.
Binary to decimalدووانی بۆ دەیی
The place values of binary are powers of 2: Every binary digit is 0 or 1, so the multiplication is trivial: add the place values of the 1 bits and skip the 0 bits. The sum is the decimal number.
2ـن: هەر 0 یان 1ـە، بۆیە لێکدانەکە زۆر ئاسانە: ئەو 1ـن کۆ بکەرەوە و 0ـەکان جێبهێڵە. کۆکە ژمارە .
| Placeخانە | ||||||||
|---|---|---|---|---|---|---|---|---|
| Place value | 8 | 4 | 2 | 1 |


The whole part gives 15; the fraction part gives .
بەشی تەواو 15 دەدات؛ بەشی دەدات.
A short, clear way to turn a binary number into decimal: give each digit its place value and add the values under the 1s.
بۆ : لە ڕاستەوە بنووسە و هەر جارێک دوو هێندەی بکە، پاشان ئەوانە کۆ بکەرەوە کە 1یان لە ژێردایە.
Checked a frame: weights 1, 2, 4, 8, 16 written over 10110.
لە ڤیدیۆکەدا 1، 2، 4، 8، 16 لەسەر 10110 نووسراون.
Binary to decimalدووانی بۆ دەیی
A shortcut for long numbers: double and addکورتەڕێیەک بۆ ژمارەی درێژ: دوو هێندە بکە و زیاد بکە
For a long binary number you do not need a table of place values. Start with 0. Go through the bits from the left: each time, double the value you have and add the next bit.
بۆ ژمارەیەکی درێژ پێویستت بە خشتەی نییە. لە 0ـەوە دەست پێبکە. لە چەپەوە بە بڕۆ: هەر جارێک ئەو نرخەی هەتە دوو هێندە بکە و دواتری بۆ زیاد بکە.
| Bit | 1 | 1 | 0 | 1 | 1 | 0 | 1 |
|---|---|---|---|---|---|---|---|
| Value so farنرخی تا ئێستا | 1 | 3 | 6 | 13 | 27 | 54 | 109 |
Why does it work? Each doubling moves every bit you have already read one place to the left — exactly what happens to its place value when one more bit follows it. In Python the same method is a loop of three lines: see Improving the converter.
بۆچی کار دەکات؟ هەر دوو هێندەکردنێک هەموو ئەو پێشتر خوێندووتن یەک خانە بەرەو چەپ دەبات — ڕێک ئەوەی بەسەر دێت کاتێک تر دوای دێت. لە Pythonـدا هەمان ڕێگا بە و سێ دێڕ دەنووسرێت: بڕوانە باشترکردنی گۆڕەرەکە.
Octal to decimalهەشتی بۆ دەیی
The place values of octal are powers of 8: Multiply each digit by its place value and add the products.
8ـن: هەر لەگەڵ لێک بدە و لێکدانەکان کۆ بکەرەوە.
| Placeخانە | |||||||
|---|---|---|---|---|---|---|---|
| Place value | 4096 | 512 | 64 | 8 | 1 | 0.125 | 0.015625 |
| Digit | Place value | Digit × place value × |
|---|---|---|
| 1 | 64 | |
| 2 | 16 | |
| 5 | 5 | |
| Sumکۆ | — | 85 |
Hexadecimal to decimalشانزەیی بۆ دەیی
The place values of hexadecimal are powers of 16: First replace each letter by its value (), then multiply and add as before.
16ـن: سەرەتا هەر پیتێک بە نرخەکەی بگۆڕە ()، پاشان وەک پێشوو لێک بدە و کۆ بکەرەوە.
| Placeخانە | |||||||
|---|---|---|---|---|---|---|---|
| Place value | 65536 | 4096 | 256 | 16 | 1 | 0.0625 | 0.00390625 |
| Digit | Place value | Digit × place value × |
|---|---|---|
| 45056 | ||
| 2 | 512 | |
| 240 | ||
| 8 | 8 | |
| Sumکۆ | — | 45816 |
Another route: first turn each hex digit into its 4 bits (Binary, Octal and Hex Shortcuts), then add the place values of the binary number. For long numbers the direct method above is usually quicker.
ڕێگایەکی تر: سەرەتا هەر بگۆڕە بۆ 4 (کورتەڕێکانی دووانی، هەشتی و شانزەیی)، پاشان ژمارە کۆ بکەرەوە. بۆ ژمارەی درێژ ڕێگا ڕاستەوخۆکەی سەرەوە زۆربەی جار خێراترە.
Reading a hexadecimal number: each place is worth 1, 16, 256 …, and the letters A–F stand for 10–15.
خوێندنەوەی ژمارەیەکی : هەر خانەیەک بەهایەکی هەیە (1، 16، 256 …) و پیتەکانی A تا F جێگەی 10 تا 15 دەگرنەوە.
Chapter 0:15 example only (place values 256, 16, 1); the 2:49 decimal-to-hex part is not used.
تەنها نموونەکەی 0:15 ( 256، 16، 1)؛ بەشی 2:49، بۆ ، بەکار نەهێنراوە.
Exam example: 164.E4 to decimalنموونەی تاقیکردنەوە: 164.E4 بۆ دەیی
This question comes from the course's midterm exam: convert to decimal using its place values. It has digits on both sides of the point and a letter after the point.
ئەم پرسیارە لە تاقیکردنەوەی نیوەی وەرزی کۆرسەکەوە هاتووە: بە بەکارهێنانی بگۆڕە بۆ . لە هەردوو لای خاڵەکەوە هەیە و پیتێکیش دوای خاڵەکە.
Convert to its decimal equivalent using its place values.
بە بەکارهێنانی بگۆڕە بۆ هاوتا .
Hintئاماژە
. After the point the place values are and .
. دوای خاڵەکە و ـن.
Show answerوەڵامەکە پیشان بدە
| Digit | Place value | Digit × place value × |
|---|---|---|
| 1 | 256 | |
| 6 | 96 | |
| 4 | 4 | |
| 0.875 | ||
| 4 | 0.015625 | |
| Sumکۆ | — | 356.890625 |
Notice the difference from the previous lesson's exam question: going to decimal always ends, because every place value is a finite decimal. Only the other direction can produce endless digits.
سەرنجی جیاوازییەکە بدە لەگەڵ پرسیاری تاقیکردنەوەی وانەی پێشوو: گۆڕین بۆ هەمیشە کۆتایی دێت، چونکە هەموو وەک ژمارەیەکی کە کۆتایی دێت. تەنها ئاراستەکەی تر دەتوانێت بێکۆتا دروست بکات.
Common mistakesهەڵە باوەکان
| Mistakeهەڵە | Fixچارەسەر |
|---|---|
| Starting the powers at 1 (the right-hand digit gets ).دەستپێکردنی لە 1ـەوە ( لای ڕاست وەردەگرێت). | The place just left of the point is position 0: .خانەی ڕاستەوخۆ لای چەپی خاڵەکە شوێنی 0ـە: . |
| Positive powers after the point. موجەب دوای خاڵەکە. | After the point the powers are : دوای خاڵەکە ـن: |
| Reading the bits from the wrong end.خوێندنەوەی لە لای هەڵەوە. | The right-hand bit (just left of the point) is the LSB, worth 1. لای ڕاست (ڕاستەوخۆ لای چەپی خاڵەکە) LSBـە و بەهاکەی 1ـە. |
| Using the letter, not its value: writing as “B4096”.بەکارهێنانی پیتەکە نەک نرخەکەی: نووسینی وەک «B4096». | Replace A–F by 10–15 before you multiply.پێش لێکدان A–F بە 10–15 بگۆڕە. |
| Multiplying by the wrong base (powers of 10 for an octal number).لێکدان لە هەڵە ( 10 بۆ ژمارەیەکی ). | Look at the subscript first: base 8 means powers of 8.سەرەتا سەیری بکە: 8 واتە 8. |
Exercisesڕاهێنانەکان
Convert to decimal: (a) (b) (c) (d) (e)
بگۆڕە بۆ : (أ) (ب) (ج) (د) (هـ)
Show answerوەڵامەکە پیشان بدە
- (a)
- (b)
- (c)
- (d)
- (e)
- (أ)
- (ب)
- (ج)
- (د)
- (هـ)
Convert to decimal: (a) (b) (c) (d) (e)
بگۆڕە بۆ : (أ) (ب) (ج) (د) (هـ)
Show answerوەڵامەکە پیشان بدە
- (a)
- (b) — the worked example; try it again without looking
- (c)
- (d)
- (e)
- (أ)
- (ب) — نموونە شیکراوەکەیە؛ بەبێ سەیرکردن دووبارە تاقی بکەرەوە
- (ج)
- (د)
- (هـ)
Convert to decimal: (a) (b) (c) (d) (e) (f)
بگۆڕە بۆ : (أ) (ب) (ج) (د) (هـ) (و)
Show answerوەڵامەکە پیشان بدە
- (a)
- (b)
- (c)
- (d)
- (e) — the worked example; try it again without looking
- (f)
- (أ)
- (ب)
- (ج)
- (د)
- (هـ) — نموونە شیکراوەکەیە؛ بەبێ سەیرکردن دووبارە تاقی بکەرەوە
- (و)
Summaryپوختە
- To decimal from any base: digit × place value for every digit, then add. Place values are powers of the base, just left of the point and negative powers after it.
- Binary: add the place values of the 1 bits (). For long numbers, double and add from the left.
- Octal: powers of 8 (1, 8, 64, 512 …). Hexadecimal: powers of 16 (1, 16, 256, 4096 …) and the letters A to F stand for 10 to 15.
- Converting to decimal always gives a finite answer; check conversions by going back the other way.
- بۆ لە هەر : بۆ هەر × ، پاشان کۆ بکەرەوە. ، ڕاستەوخۆ لای چەپی خاڵەکە و سالب دوای ئەو.
- : 1ـەکان کۆ بکەرەوە (). بۆ ژمارەی درێژ، لە چەپەوە دوو هێندە بکە و زیاد بکە.
- : 8 (1، 8، 64، 512 …). : 16 (1، 16، 256، 4096 …) و پیتەکانی A تا F واتە 10 تا 15.
- گۆڕین بۆ هەمیشە وەڵامێکی کۆتاییدار دەدات؛ گۆڕینەکان بە گەڕانەوە بە ئاراستەکەی تر بپشکنە.
What is in decimal? بە دەیی چەندە؟
255: all eight place values, , or .
255: هەموو هەشت ، ، یان .
What is in decimal, and what is ? بە دەیی چەندە و چەندە؟
and .
و .
Why is FF the largest two-digit hex number, and what is it in decimal?بۆچی FF گەورەترین ژمارەی دوو تاکژمارەیی شانزەییە و بە دەیی چەندە؟
F is the largest hex digit: — the same as eight 1 bits, because one hex digit is 4 bits.
F گەورەترین : — هەمان هەشت 1، چونکە یەک 4 .
Videoڤیدیۆ
Watch a videoسەیری ڤیدیۆیەک بکە
A video that viewers liked a lot and praised in their comments, chosen for this lesson.ڤیدیۆیەک کە بینەران زۆریان پێ خۆش بووە و لە کۆمێنتەکانیاندا ستایشیان کردووە، بۆ ئەم وانەیە هەڵبژێردراوە.
Kurdish: binary to decimal by writing the place values 1, 2, 4, 8 … over the bits and adding where there is a 1.
بە کوردی: گۆڕینی بۆ بە نووسینی 1، 2، 4، 8 … لەسەر و کۆکردنەوەیان لە هەر شوێنێک 1 هەبێت.
Kurdish whiteboard lesson (BLUE SOFT series no. 2). Shows the lesson's one method — digit × place value — for binary.
وانەیەکی کوردی لەسەر تەختە (زنجیرەی BLUE SOFT، ژمارە 2). هەمان ڕێگای وانەکە بۆ پیشان دەدات: × .
Lesson complete!وانەکە تەواو بوو!
Well done. Review the key terms, then go on to the next lesson.دەستخۆش. سەیرێکی زاراوە سەرەکییەکان بکەرەوە، پاشان بڕۆ بۆ وانەی داهاتوو.
Key termsزاراوە سەرەکییەکان
Binary, Octal and Hex Shortcutsڕێگا کورتەکانی دووانی، هەشتی و شانزەیی
Related lecturesوانە پەیوەندیدارەکان
References and further readingسەرچاوەکان و خوێندنەوەی زیاتر
- T. L. Floyd, Digital Fundamentals, 11th ed. (Pearson, 2015), sections 2-2 Binary numbers, 2-8 Hexadecimal numbers and 2-9 Octal numbers (course textbook)
- Wikipedia: Binary number — binary to decimal, the doubling method
- Wikipedia: Positional notation — evaluating a numeral in any base
- Wikipedia: Hexadecimal
This lecture is a first edition. The Kurdish text and terminology are waiting for review by Kurdish IT teachers.ئەم وانەیە چاپی یەکەمە. دەقە کوردییەکە و زاراوەکانی چاوەڕێی پێداچوونەوەی مامۆستایانی کوردی بواری IT ن.