On Jan 4, 2008 11:31 AM, Tim Peters <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] > > Thanks for the pointer. Given that it's [round-to-even[ been an ASTM > > standard since 1940 and apparently in fairly common use since the > > early 1900s, I wonder why it's not been more widely used in the past > > in programming languages. > > Because "add a half and chop" was also in wide use for even longer, is > also (Wikipedia notwithstanding) part of many standards (for example, > the US IRS requires it if you do your taxes under the "round to whole > dollars" option), and-- probably the real driver --is a little cheaper > to implement for "normal sized" floats. Curiously, round-to-nearest > can be unboundedly more expensive to implement in some obscure > contexts when floats can have very large exponents (as they can in > Python's "decimal" module -- this is why the proposed decimal standard > allows operations like "remainder-near" to fail if applied to inputs > that are "too far apart": > > http://www2.hursley.ibm.com/decimal/daops.html#footnote.8 > > The "secret reason" is that it can be unboundedly more expensive to > determine the last bit of the quotient (to see whether it's even or > odd) than to determine an exact remainder).
Wow. Do you have an opinion as to whether we should adopt round-to-even at all (as a default)? -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com