[issue28717] rounding error in % operator

2016-11-16 Thread William McIlhagga
William McIlhagga added the comment: Thanks, maybe I should get off my ass and contribute to the documentation then ... On 16 November 2016 at 22:30, Mark Dickinson wrote: > > Mark Dickinson added the comment: > > > Is this behaviour documented? Or are you just expected to know what C > does?

[issue28717] rounding error in % operator

2016-11-16 Thread Mark Dickinson
Mark Dickinson added the comment: > Is this behaviour documented? Or are you just expected to know what C does? Indeed, it's not as well documented as it should be. I think that's partly for historical reasons: before Python 2.7, Python's % formatting more-or-less delegated directly to the und

[issue28717] rounding error in % operator

2016-11-16 Thread William McIlhagga
William McIlhagga added the comment: OK, not wrong, just unexpected. Is this behaviour documented? Or are you just expected to know what C does? On 16 November 2016 at 21:37, Mark Dickinson wrote: > > Mark Dickinson added the comment: > > You don't say why you think this behaviour is wrong, o

[issue28717] rounding error in % operator

2016-11-16 Thread Mark Dickinson
Mark Dickinson added the comment: You don't say why you think this behaviour is wrong, or what you'd expect to see instead. Nevertheless, this behaviour is by design: the code `'%.1f' % x` rounds `x` to the nearest one-digit-after-the-point decimal number, and returns a string representation

[issue28717] rounding error in % operator

2016-11-16 Thread William McIlhagga
New submission from William McIlhagga: '%.1f' % 0.25 yields the string '0.2' '%.1f' % 0.75 yields the string '0.8' This is wrong. -- messages: 280984 nosy: William McIlhagga priority: normal severity: normal status: open title: rounding error in % operator type: behav