W3C home > Mailing lists > Public > www-smil@w3.org > July to September 2007

[SMIL30 LC comment] rounding in 17.4.4 and 19.4.4

From: Dr. Olaf Hoffmann <Dr.O.Hoffmann@gmx.de>
Date: Fri, 10 Aug 2007 11:59:48 +0200
To: www-smil@w3.org
Message-Id: <200708101159.48572.Dr.O.Hoffmann@gmx.de>

Hello SMIL working group,

this does not look like an accurate method to round:

'The mathematical definition of rounding is:
coerced-integer-value = Math.floor( interpolated-value + 0.5 )'

-> There are different mathematical definitions for rounding.
This is a biased rounding because number=integer+0.5 is always
rounded up (for other cases the rounding definitions are the
same). This is not an accurate rounding method.
This means, over a larger number of rounding the average 
rounding error is not zero.
For an unbiased rounding, for example for even
integers number is rounded down, for odd up...

example:
value, top eq. 'rounding' , unbiased rounding (round to even)
0.5	1	0
1.5	2	2
2.5	3	2
3.5	4	4
4.5	5	4
5.5	6	6
6.5	7	6
7.5	8	8
8.5	9	8
9.5	10     10

average

5	5.5	5


I would like to suggest to use the unbiased or
'round to even' method ... 
Received on Friday, 10 August 2007 10:06:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:53:29 GMT