Problem logging small floating point values

I am attempting to use FactorySQL to log some Float (4) values to a MySQL database. They show up correctly in the FactorySQL front-end but not in the MySQL database. As the number decreases the value in MySQL looses precision, i.e. 6.3178432e-6 shows up as 6.3e-6 and 1.997898e-7 shows up as 1e-7. Numbers less than 1e-7 show up as 0. I have written to the MySQL table using SQL commands numbers such as 2.89994e-8 and they are recorded properly so the problem appears to reside in the way FactorySQL is writing the values. Is this a known problem and is there a solution for it?


Yes, it actually is a known issue, due to an internal optimization in FSQL. The usual workaround is to use scaling in order to store to the database as a larger number. Then you can simply scale it back on the other end, or as part of the SQL query. Of course you have to make sure to standardize how much you’re scaling so that both sides know very well what value to use.

Now, that said, we agree that it’s not correct as-is, and will be looking into fixing this as soon as possible. I’ll keep this thread updated.