# Different Number Types

### 2021-05-23

# 1. Difference between float and int (in general)

While both of them are 4 Bytes - 8 Bytes, the usage is different.

int is whole number without fractional parts, it can be represented in **3 number systems** (Decimal, Octal and Hexadecimal);
float number has a whole number + the fractional portion of the number, it can only be written in a decimal number system.

**All integers can be represented as floating point values. However, in programming due to the advantages like less memory occupancy, faster processing and rounding, integers are preferred.**

# 2. Difference between float and double and decimal (in general)

The Decimal, Double, and Float variable types are different in the way that they store the values. **Precision** is the main difference.

- float is a single precision (32 bit) floating point data type
- double is a double precision (64 bit) floating point data type
- decimal is a 128-bit floating point data type