On 30-04-2011 20:48, Simon Slavin wrote: > > On 29 Apr 2011, at 9:09pm, Jean-Marie CUAZ wrote: > >> Win XP + SQLite 3.7.4 >> >> SELECT round(8.875,2) -> 8.88 >> SELECT round(16.875,2) -> 16.87 >> SELECT round(32.875,2) -> 32.88 >> SELECT round(64.875,2) -> 64.87 > > The documentation for SQLite does not mention what rounding algorithm is used: > > http://www.sqlite.org/lang_corefunc.html > > I suspect it's using banker's rounding. That's a reasonably good rounding > method intended to round without disturbing the mean. If you think it > shouldn't, what else, and why ? > > Simon. > _______________________________________________ > sqlite-users mailing list > [email protected] > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
If thats true, than the description here is wrong: http://en.wikipedia.org/wiki/Rounding#Round_half_to_even Round half to even A tie-breaking rule that is even less biased is round half to even, namely * If the fraction of y is 0.5, then q is the even integer nearest to y. Thus, for example, +23.5 becomes +24, +22.5 becomes +22, −22.5 becomes −22, and −23.5 becomes −24. This method also treats positive and negative values symmetrically, and therefore is free of overall bias if the original numbers are positive or negative with equal probability. In addition, for most reasonable distributions of y values, the expected (average) value of the rounded numbers is essentially the same as that of the original numbers, even if the latter are all positive (or all negative). However, this rule will still introduce a positive bias for even numbers (including zero), and a negative bias for the odd ones. This variant of the round-to-nearest method is also called unbiased rounding (ambiguously, and a bit abusively), convergent rounding, statistician's rounding, Dutch rounding, Gaussian rounding, or *bankers' rounding*. This is widely used in bookkeeping. This is the default rounding mode used in IEEE 754 computing functions and operators _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

