mysql - Float value conversion in the database -
in database fields (amount, balance) assigned floating value, have problem .if amount 1.56 take 1.6 alter table using round(amount,2) still shows same problem. if know please me.
the float fields must declared float(some_integer, 1) show behaviour described. first integer in such declaration tells mysql how digits should visible alltogether, ones left decimal point + ones right it. have 3 digits left , 2 right of decimal point declare float(5,2)
.
like doan cuong mentioned better if choose decimal data type.
see different behaviour of live here.
to quote manual:
the decimal , numeric types store exact numeric data values. these types used when important preserve exact precision, example monetary data.
the float , double types represent approximate numeric data values.
for additional info data types read more here.
Comments
Post a Comment