Skip to content

This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.

Create positional number system.md

Abdul Wahab Junaid3a0c7977fc34
diff --git a/Assembly language/New Assembly Work/Assembly Language/positional number system.md b/Assembly language/New Assembly Work/Assembly Language/positional number system.md
new file mode 100644
index 0000000..89ce1c1
--- /dev/null
+++ b/Assembly language/New Assembly Work/Assembly Language/positional number system.md
@@ -0,0 +1,148 @@
+A **Positional Number System** is a way of representing numbers in which the position of each digit determines its value. The value of a number is calculated based on both the digit itself and its position (or place) in the sequence of digits. In contrast to non-positional systems (like Roman numerals), positional systems are much more efficient for performing arithmetic and representing large numbers.
+
+### Key Characteristics of Positional Number Systems
+
+1. **Base or Radix**:
+ The **base** (also called **radix**) of a positional number system is the number of unique digits, including zero, that the system uses to represent numbers. Common bases include:
+ - **Base-10 (Decimal)**: Uses digits 0 through 9 (10 digits).
+ - **Base-2 (Binary)**: Uses digits 0 and 1 (2 digits).
+ - **Base-8 (Octal)**: Uses digits 0 through 7 (8 digits).
+ - **Base-16 (Hexadecimal)**: Uses digits 0 through 9 and letters A through F (16 digits, where A = 10, B = 11, ..., F = 15).
+
+2. **Digits and Powers of the Base**:
+ Each digit in a number has a value determined by its **position** in the number, with positions representing increasing powers of the base from right to left. For example, in a base-10 system, the rightmost position represents $\(10^0\)$, the next position represents $\(10^1\)$, the next $\(10^2\)$, and so on.
+
+3. **Positional Notation**:
+ The value of a number in a positional system is calculated by multiplying each digit by its positional value (which is a power of the base) and then summing all the products.
+
+ **General formula**:
+ If a number is represented as $\(d_n d_{n-1} \dots d_1 d_0.d_{-1} d_{-2} \dots d_{-m}\)$ in base $\(B\)$, its value is:
+ $\[
+ V = d_n \times B^n + d_{n-1} \times B^{n-1} + \dots + d_0 \times B^0 + d_{-1} \times B^{-1} + d_{-2} \times B^{-2} + \dots + d_{-m} \times B^{-m}
+ \]$
+
+ Where:
+ - $\(B\)$ is the base of the number system.
+ - $\(d_n, d_{n-1}, \dots, d_{-m}\)$ are the digits of the number.
+ - The integer part (left of the decimal) consists of positive powers of the base.
+ - The fractional part (right of the decimal) consists of negative powers of the base.
+
+---
+
+### Examples of Positional Number Systems
+
+#### 1. **Decimal System (Base-10)**
+ - **Digits**: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
+ - **Place values**: Powers of 10 (i.e., $\(10^0\)$, $\(10^1\)$, $\(10^2\)$, etc.)
+
+ **Example**:
+ The number **3725** in base-10:
+ $\[
+ 3725 = (3 \times 10^3) + (7 \times 10^2) + (2 \times 10^1) + (5 \times 10^0)
+ \]
+ \[
+ 3725 = 3000 + 700 + 20 + 5 = 3725
+ \]$
+
+#### 2. **Binary System (Base-2)**
+ - **Digits**: 0, 1
+ - **Place values**: Powers of 2 (i.e., $\(2^0\)$, $\(2^1\)$, $\(2^2\)$, etc.)
+
+ **Example**:
+ The binary number **1011** in base-2:
+ $\[
+ 1011_2 = (1 \times 2^3) + (0 \times 2^2) + (1 \times 2^1) + (1 \times 2^0)
+ \]
+ \[
+ 1011_2 = 8 + 0 + 2 + 1 = 11_{10}
+ \]$
+
+#### 3. **Octal System (Base-8)**
+ - **Digits**: 0, 1, 2, 3, 4, 5, 6, 7
+ - **Place values**: Powers of 8 (i.e., $\(8^0\)$, $\(8^1\)$, $\(8^2\)$, etc.)
+
+ **Example**:
+ The octal number **725** in base-8:
+ $\[
+ 725_8 = (7 \times 8^2) + (2 \times 8^1) + (5 \times 8^0)
+ \]
+ \[
+ 725_8 = 448 + 16 + 5 = 469_{10}
+ \]$
+
+#### 4. **Hexadecimal System (Base-16)**
+ - **Digits**: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A (10), B (11), C (12), D (13), E (14), F (15)
+ - **Place values**: Powers of 16 (i.e., \(16^0\), \(16^1\), \(16^2\), etc.)
+
+ **Example**:
+ The hexadecimal number **2A3** in base-16:
+ $\[
+ 2A3_{16} = (2 \times 16^2) + (A \times 16^1) + (3 \times 16^0)
+ \]
+ Since \(A = 10\):
+ \[
+ 2A3_{16} = (2 \times 256) + (10 \times 16) + (3 \times 1)
+ \]
+ \[
+ 2A3_{16} = 512 + 160 + 3 = 675_{10}
+ \]$
+
+---
+
+### Advantages of Positional Number Systems
+
+1. **Simplicity in Arithmetic**:
+ Positional systems make arithmetic operations like addition, subtraction, multiplication, and division easier to perform. This is because the place value of each digit simplifies calculations.
+
+2. **Efficient Representation of Large Numbers**:
+ Positional notation allows for the representation of large numbers without using an excessive number of symbols. For example, a number like **1,000,000** can be easily represented and understood in base-10.
+
+3. **Scalability**:
+ Positional systems can easily scale up for very large numbers or down for very small (fractional) numbers, as demonstrated by the use of decimal points and scientific notation.
+
+---
+
+### Conversion Between Positional Number Systems
+
+To convert between different bases, several methods can be used:
+
+1. **Converting from Base-\(X\) to Base-10 (Decimal)**:
+ To convert a number in any base to decimal, multiply each digit by its corresponding power of the base and sum the results.
+
+ **Example** (Binary to Decimal):
+ Convert **1011** from base-2 to base-10:
+ $\[
+ 1011_2 = (1 \times 2^3) + (0 \times 2^2) + (1 \times 2^1) + (1 \times 2^0) = 8 + 0 + 2 + 1 = 11_{10}
+ \]$
+
+2. **Converting from Base-10 to Another Base**:
+ To convert a decimal number to another base, repeatedly divide the number by the base, recording the remainders. The remainders give the digits of the new base, read from bottom to top.
+
+ **Example** (Decimal to Binary):
+ Convert **19** from base-10 to base-2:
+ $\[
+ 19 \div 2 = 9 \text{ remainder } 1
+ \]$
+
+ $\[
+ 9 \div 2 = 4 \text{ remainder } 1
+ \]$
+
+ $\[
+ 4 \div 2 = 2 \text{ remainder } 0
+ \]$
+
+ $\[
+ 2 \div 2 = 1 \text{ remainder } 0
+ \]$
+
+ $\[
+ 1 \div 2 = 0 \text{ remainder } 1
+ \]$
+ So, $\(19_{10} = 10011_2\)$.
+
+---
+
+### Conclusion
+
+A **positional number system** is an efficient and scalable way to represent numbers. The most commonly used system, **decimal (base-10)**, is intuitive due to its familiarity, but other systems like **binary (base-2)**, **octal (base-8)**, and **hexadecimal (base-16)** are also widely used in fields like computer science and engineering. These systems simplify arithmetic and make large and small numbers manageable through positional notation based on powers of the base.