CodeSteps

Python, C, C++, C#, PowerShell, Android, Visual C++, Java ...

Numeric types and their representation

In every day life we work with Numbers. Numbers are different types and most of us know integer and real numbers. There are different types of Numbers. In this Article, I will explain Numeric types and their representation.

There are different numeric types; mainly we use Integers, Floating point numbers and Complex numbers.

Integers

Integers are whole numbers whose can have positive, negative or zero values. Integers do not have a fractional part. For example, -5, , -123, +10, 5978 and 0 (zero) are integers.

We represent integers in their base system. Commonly we use base 10 system to represent the numbers. We use 0 to 9 digits to represent the numbers. For example, 1, 2, 3, 45, -74509, 0, 8975… etc, are the numbers representation using base 10 system.

Computers can understand only 1’s and 0’s; hence we use base 2 system in computers. To represent 2 in base 2 system, we write it as 10; 90 as 1011010; and 3 as 11 etc., These are called binary numbers.

We also use base 16 system representing hexadecimal numbers. These numbers have A to F alphabets to represent the values 10 to 15. For example, we write 10 as A; 90 as 5A etc,. in hexadecimal representation.

Another system we use representing the numbers is base 8 system. And the numbers we call octal numbers. Octal numbers have the digits 0 to 7. To represent 8, we write it as 11 in octal; 90 as 132 etc,.

Floating point numbers

Floating point numbers are also called as real numbers have the fractional part. These numbers contains two parts; one part which is before the decimal is called integer part and after the decimal is called fractional part. Examples of floating point numbers are; 2.3, -3.5, etc,.

Complex numbers

Complex numbers are the numbers in the form “x + iy“. Where “x” and “y” are real numbers and “i” is the imaginary number. These numbers contains real and imaginary parts. In “x + iy“, real part is “x” and the imaginary part is “y“.

We will discuss more topics in my upcoming Articles.

// Malin

Numeric types and their representation

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top