RE: round off problem
- Posted by "Ricardo M. Forno" <rforno at uyuyuy.com> Jun 29, 2004
- 423 views
The only way I know to totally avoid this kind of problems is to make all calculations using an integer amount of cents, and then scaling the result to dollars (or whatever). Regards. ----- Original Message ----- From: George Walters <gwalters at sc.rr.com> To: EUPHORIA <EUforum at topica.com> Sent: Monday, June 28, 2004 12:14 PM Subject: round off problem > > > I have imported general ledger data from a working system in another OS > into mysql using Matt's ODBC tools. Trying to finish the EU general > ledger software, I've run into serious round off issues. Here's a > couple of examples to show the problem. > > A typical account balance: > > Mysql shows -1143.46 which is correct > EU trace shows -1143.459961 which is not accurate to 15 places as the EU > manual states. > > Totalling the credits and debits over the entire file of transactions > gives the following (printing with a mask of %12.2f.) > > Debits = 4642782.63 > Credits= 4642782.56 > > Off by 4 cents. The input data from the other OS is balanced. It looks > like there's about 8 places of accuracy not 15. > The data records are always read into a sequence, then arithmetic is > done with atoms. > > Any Ideas? > > george > > > >