Float
A float (floating-point number) is a data type for numbers that have a decimal point, such as 3.14 or -0.5. It is used when fractional values are needed.
General Programming
Floats can store a huge range of values but only with limited precision, so tiny rounding errors can appear (for example 0.1 + 0.2 may not be exactly 0.3).
Examples
Python
price = 3.50
print(price * 2)Output:
7.0JavaScript
console.log(0.1 + 0.2);Output:
0.30000000000000004