ezfloat - rounding up number issue

ezfloat - rounding up number issue

Friday 27 July 2007 6:35:53 am - 1 reply

Author Message

Felipe Jaramillo

Wednesday 01 August 2007 10:15:03 am

Hi Steve,

We have now reproduced, investigated and solved the rounding issue. It is related to the default mysql database structure, where numbers (float) are 4 bytes and rounded after 6 figures by default.

We have successfully changed this to allow 15 figure numbers before rounding them. After doing the change in our test servers, it does not disrupt the existing data.

In my opinion, people should be warned about this inaccuracy as it affects any default installation and there is no alternative datatype for accurately storing long numbers other than TextLine.

This inaccuracy is present in the existing numbers 6 figure numbers and up as they are rounded. Eg. 1234567 is stored as 1234570.

To fix:

Increase length of FLOAT to 25 (8 bytes) in “data_float” field in table “ezcontentobject_attribute”, which will effectively make it a DOUBLE 8byte number, accurate to 15 figure numbers.

More info in:
http://dev.mysql.com/doc/refman/4.1/en/choosing-types.html
http://dev.mysql.com/doc/refman/4.1/en/storage-requirements.html
http://dev.mysql.com/doc/refman/4.1/en/numeric-types.html

Felipe Jaramillo
eZ Certified Extension Developer
http://www.aplyca.com | Bogotá, Colombia

You must be logged in to post messages in this topic!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.