I have a float data field :
`total` float(20,2) unsigned NOT NULL,
I want to insert a float number like : "815032.68" but it's not accepted and the number is rounded to 815032.69. why?
Use a fixed-point data type
`total` DECIMAL(20,2) unsigned NOT NULL
The DECIMAL and NUMERIC types store exact numeric data values. These types are used when it is important to preserve exact precision, for example with monetary data.
MySQL Doc
Floating-point data types can only store approximate numbers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With