Should I store duplicates or decimals in mysql database?

When is the conservation of doubles preserved? Assuming you are reading data from a CSV with a decimal point (for example, with values ​​like "5.03"), does it make sense to use the mysql type DOUBLE? Will there be unnecessary rounding errors?

+3
source share
1 answer

You should use numbers doublewhen you need to store really small or huge numbers. Something like that 9.837262 x 10^-567. Other than that, I would use fixed-precision numeric types to avoid the rounding errors that you mention.

" " double , , .

+6

Source: https://habr.com/ru/post/1777048/


All Articles