[Gambas-user] Float and decimal in MySQL

Jacky jscops at ...11...
Sat Jan 19 14:53:36 CET 2008



Hello,

After some problem with fields of type Float in MySQL here is something that 
could interest some of you.

"MySQL performs rounding when storing values, so if you insert 999.00009 into 
a FLOAT(7,4) column, the approximate result is 999.0001."

It is preferable to use a field of type DECIMAL as recommended in the material 
of MySQL:

"The DECIMAL and NUMERIC data types are used to store exact numeric data 
values. In MySQL, NUMERIC is implemented as DECIMAL. These types are used to 
store values for which it is important to preserve exact precision, for 
example with monetary data".

Jacky







More information about the User mailing list