J
J
James_Obry2021-10-29 17:52:07
SQLite
James_Obry, 2021-10-29 17:52:07

Error when adding float numbers, what's wrong?

there is a database where real numbers are stored, I pull them out from there and add them to the total number, but for some reason 325.40000000000003 comes out of these numbers 23.0 / 15.0 / 70.0 / 61.0 / 61.2 / 6.0 / 33.0 / 15.0 / 35.3 - these the numbers that I pull out of the database, which are stored there as real
But in python, floating point numbers are floats - maybe this is the case?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Drill, 2021-10-29
@James_Obry

Use the data type for storage in the database not Float, but Decimal
What is the difference between Float, Double and Decimal in MySQL

V
Vadim Shatalov, 2021-10-29
@netpastor

There is another option to add them in the database with a query

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question