Python Tips: Must know “Decimal” Vs “Float”

Sunil Kumar
Towards Dev
Published in
2 min readJul 4, 2022

--

In Python DECIMAL and FLOAT both are used to store numerical values. It is sometimes confusing which to use when. Float is an Approximate number data type, which means a float gives you an approximation of the number you declare. Decimal is a Fixed-Precision data type which means the value in the data type is represented exactly with precision and scale, it doesn’t round up the value.

--

--

With an extensive professional experience spanning over 16 years in the IT industry, I am a seasoned expert in AWS Cloud, DevOps, FastAPI, and Python.