Comment 27 for bug 511193

Revision history for this message
Zack Powers (zpowers) wrote :

I agree that with Fabien that float data-type is inadequate for the arithmetic requirements for unit conversion. In both Python[1] and PostgreSQL[2], the precision of float types are dependent on CPU architecture and Operating System. An Ideal fix would be a data type that is exact to any arbitrary number of digits precision. In Python, the decimal type defaults to 28 digits of precision[3] however has no defined maximum in implementation. In the PostgreSQL manual, the numeric data type is recommended for fields of arbitrary precision. As stated in the documentation[4] "Specifying NUMERIC without any precision or scale creates a column in which numeric values of any precision and scale can be stored, up to the implementation limit on precision.". This datatype, allows for arbitrary precision and and is arithmetically exact, and should be the proper solution for this bug.

[1]http://docs.python.org/library/stdtypes.html#numeric-types-int-float-long-complex
[2]http://www.postgresql.org/docs/8.1/static/datatype.html#DATATYPE-FLOAT
[3]http://docs.python.org/library/decimal.html#module-decimal
[4]http://www.postgresql.org/docs/8.1/static/datatype.html#DATATYPE-NUMERIC-DECIMAL