I can understand the "expectation" that 3.05 would round to 3.1.
But....the more important questoin is "Does it make a difference to your
application?"
Here's the difference:
sqlite> select 3.05+.05 < 3.0999999999999999;
1
sqlite> select 3.05+.05 < 3.099999999999999;
0
So...if you need accuracy to to that many decimal places you're in trouble.
Even Las Vegas casinos wouldn't care about losing that much.
A simple floating point solution is to simply add a value in the 3rd decimal
place if you onliy need 2 decimal places. This will remove the imprecision of
the .5 representation.
sqlite> select round(3.05+.001,1);
3.1
Michael D. Black
Senior Scientist
Advanced Analytics Directorate
Northrop Grumman Information Systems
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users