Yes.. for what it's worth, I've had this very same problem on MS SQL 2008.  
Comparing floating point values in their raw form is always dangerous.  It just 
works so much more often than not that it's easy to forget until you get that 
one number that doesn't work.

The solution for MS SQL was conversion to smallmoney.

-----Original Message-----
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Simon Slavin
Sent: Friday, March 08, 2013 1:37 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Bug on real operations


On 8 Mar 2013, at 6:24pm, Israel Lins Albuquerque <israelin...@yahoo.com.br> 
wrote:

> I don't know how postgres handle this, may be I can check

Postgres has special datatypes used especially to handle problems like this.  
It has both artbitrary precision and monetary datatypes.  If you present your 
problem to postgres and let it use floating point numbers it has the same 
problem SQLite has.

However, I used to work with banks and other financial institutions for a 
living and I can assure you that the systems I wrote and used used integer 
datatypes to handle amounts of money.  For historical reasons they do sometimes 
multiply by 10,000 instead of 100, but either way all amounts of money are 
stored as integers.  This speeds up calculations, reduces storage space, and 
reduces the complexity of testing required.

Just to underline what Richard wrote, this is not a bug in the way SQLite 
handles floating point.  The bug is in thinking you can express decimal 
fractions as binary floating point numbers and it is very familiar to computer 
scientists.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


This email and any attachments are only for use by the intended recipient(s) 
and may contain legally privileged, confidential, proprietary or otherwise 
private information. Any unauthorized use, reproduction, dissemination, 
distribution or other disclosure of the contents of this e-mail or its 
attachments is strictly prohibited. If you have received this email in error, 
please notify the sender immediately and delete the original.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to