OSCommerce Product Manager

OSCommerce Product Manager for Windows
Tasklist

FS#264 - Rounding errors using floating-point variables.

Attached to Project: OSCommerce Product Manager
Opened by Mario A. Valdez-Ramirez (mvaldez) - Wednesday, 07 September 2005, 09:05 GMT-6
Last edited by Mario A. Valdez-Ramirez (mvaldez) - Sunday, 11 September 2005, 00:09 GMT-6
Task Type Bug Report
Category Backend / Core
Status Closed
Assigned To Mario A. Valdez-Ramirez (mvaldez)
Operating System All
Severity Low
Priority Normal
Reported Version any
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

At several places in the source-code, we are using double/real variables (floating-point). Because they are rounded when being displayed and when entered in the database, we are not noticing rounding-errors.

However, while writting the Currency Management funtions, we saw lot of rounding errors. The ultimate cause is that the table Currencies of osCommerce is using a FLOAT field type for the currency value (the product prices, taxes and other data is being stored as DECIMAL).

All usage of DOUBLE/REAL variables in the client-side (Delphi code) should be replaced by fixed-point variables (CURRENCY). We already do for most operations, but we need to do it everywhere.
This task depends upon

Closed by  Mario A. Valdez-Ramirez (mvaldez)
Sunday, 11 September 2005, 00:09 GMT-6
Reason for closing:  
Comment by Mario A. Valdez-Ramirez (mvaldez) - Sunday, 11 September 2005, 00:09 GMT-6

Fixed. Closing.

There is one item which still has rounding error but at the database: the currency value (as explained before). We try to minimize the problem by assigning currency-rounded (four decimal places) values to it.

Loading...