List:General Discussion« Previous MessageNext Message »
From:Jean-Pierre Schwickerath Date:October 25 2003 10:41am
Subject:currency precision with decimal row
View as plain text  

I'm trying to write some kind of small accounting software and I got
stuck with the problem that doing a SUM() on values of a DECIMAL(7,2)
row did show problems with (relatively) small values (like 173.58). I
found a message explaining that mysql uses doubles internly to compute
the values and this would explain the behaviour. 

Now my question is how should one go around the problem for now? I
decided to use UNSIGNED INT and do a division by 100 after retrieving
a value (or a multiplication by 100 before storing a value) in the
language of the application (php). 
Is there another better way to do it?


Powered by Linux From Scratch -
PGP Key ID: 0xEE6F49B4 - AIM/Jabber: Schwicky - ICQ: 4690141

Nothing is impossible... Everything is relative!
currency precision with decimal rowJean-Pierre Schwickerath25 Oct
  • Re: currency precision with decimal rowRoger Baklund25 Oct