A number system is a sequence of numbers assigned various names such as whole numbers, integers, rational numbers, real numbers and complex numbers. A number system consists of two or more arithmetical systems which agree on all their elements but not necessarily on their order.
In computer science, the most common number systems are those used for floating point calculations and fixed-point calculations. The same number system is also used for fixed-point calculations, but with different precision.
A number system is a mapping of the set of integers to the set of rational numbers. That is, a number system may be described as “a bijection formula_1 between the natural numbers and the rationals”. The reason for this is that if we were to consider only those two sets, then there would be no reason why we would need any other types of numbers. An important property of a number system is that its two elements formula_2 and formula_3 are distinct; otherwise, it would be nonsensical to speak about these two elements as distinct from each other.
Integers
You’ve heard the word “integers,” and you may even know what this word means; but what are integers in computer science? In layman’s terms, there are two types of numbers: integers and non-integers. Integers consist of whole numbers (i.e., 1, 2) and their opposites (i.e., -1, -2). Non-integers consist of decimals (1.37), fractions (0.5), negative fractions (-0.5), and irrational numbers (π). Now you see why “integers” are so different.
Of course, we cannot only think about numbers. Many different mathematical concepts and counting systems (e.g., counting by twos or threes) can be defined in terms of numbers. For example, the idea of counting by twos involves a specific counting system that is based on 2 {\displaystyle 2}. It is similar to the way that we count by fives as well. However, just like specific attributes (e.g., being a number) make integers unique, particular properties make integers unique in computer science. First, computer scientists define integers as whole numbers with no fractional parts. Therefore, an integer cannot be .005.
Consequently, these integers are often called “whole numbers” or “natural numbers,” and they represent the only countably infinite set of numbers (i.e., a set of objects that can be listed as 1, 2, 3, 4…). Second, the definition of an integer involves having no negative parts. Therefore, -5 is not an integer since it has a negative amount of 5.
In computer science and digital representations of numbers in binary (i.e., base 2), one bit represents either a one or a 0 (i.e., Boolean). For example, in the number 10011010, there are 8 bits, and each bit can either be represented as a one or a 0. So to represent an integer number using binary, we combine each bit. For example, the representation of 32 would be 11001000 since 32 is equal to 2 × two × 2 × 2. Alternatively, we can represent this same number in decimal notation by dividing the number by powers of two (i.e., 8 = 23). Consequently, 32 = 27 (i.e., 29) since 27 is equivalent to 512. In addition to representing whole numbers using bits and binary arithmetic operations (i.e., addition and multiplication), we can also represent fractions using bits as well.
Rational Number
Rational number in computer science, or you may call it an actual number. A rational number can be represented by the set of all real numbers written as a fraction with two nonzero terms, one of which is equal to 1. One thing that distinguishes real numbers from other types of numbers (such as integers) is that every nonzero rational number has a unique decimal representation. Another thing about them is that for any other kind of number, if you add/subtract/multiply any small value from/to it, then it will produce an entirely different type of quantity (e.g., 3 and 8). In that sense, the actual number can be considered a foundation of general mathematics. So what is a rational number? Let us understand these from past posts.
A rational number is a number that can be written as a fraction with two nonzero terms, one of which is equal to 1. The set {0, 1} containing only the positive and negative rational numbers is denoted (0, 1) and called the real numbers. All other numbers not included in (0, 1) are irrational.
The set of whole numbers can be described by the setting of all integers, which we denote by
As you see, every whole number can be described as an integer or fraction having no repeating digits, and these sets are isomorphic, and their cardinalities are the same.
The set of all fractions describes the setting of all rational numbers. These sets are not a subset of the integers group, but an inclusion-exclusion principle states that every reasonable number can be expressed as a fraction with integer coefficients. This means that the cardinalities will be equal because being in the same set doesn’t give any advantage to either one over another.
In case you forget what “fraction” means, here’s a reminder: A fraction is a number formed by two numbers divided by another number (which we denote by ). The fraction a/b is read as “a over b” (or “b over a”). If the numerator and denominator of the fraction are both integers, it is written in reduced form: (i.e., the place value of each digit is reduced by one). If a/b is not an integer, it is written in expanded form, where the place value of each number remains unchanged.
By definition, every rational number can be expressed as a fraction with positive integer coefficients. For example, 5/6 = 2 + 3/2, 58/65 = 23 + 53/26 and 2 1/3 = 1 + 4 1/3. The set of all fractions with rational coefficients can also be constructed.
Conclusion
Integers are like whole numbers, but they include negative numbers … but still, no fractions are allowed. Represented as Z = (…, – 2, -1,0,1,2, …)
A rational number can be expressed as a fraction or a ratio. An example of this is 8 or 1/8. Represented as Q