<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Sep 10, 2015 at 3:39 PM, Serhiy Storchaka <span dir="ltr"><<a href="mailto:storchaka@gmail.com" target="_blank">storchaka@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 11.09.15 00:48, Paul Moore wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 10 September 2015 at 22:13, Mark Young <<a href="mailto:marky1991@gmail.com" target="_blank">marky1991@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Pardon my ignorance, but what is the definition of round division? (if it<br>
isn't "round(a/b)")<br>
</blockquote>
<br>
I assumed it would be "what round(a/b) would give if it weren't<br>
subject to weird floating point rounding issues". To put it another<br>
way, if a / b is d remainder r, then I'd assume "round division" would<br>
be d if r < b/2, d+1 if r > b/2, and (which of d, d+1?) if r == b/2.<br>
(a, b, d and r are all integers).<br>
<br>
If not, then I also would like to know what it means...<br>
</blockquote>
<br></span>
Yes, it is what you have described. If r == b/2, the result is even (i.e. (d+1)//2*2).<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Either way, if it is introduced then it should be documented<br>
(particularly as regards what happens when one or both of a, b are<br>
negative) clearly, as it's not 100% obvious.<br>
<br>
Also, is the math module the right place? All of the operations in the<br>
math module (apart from factorial, for some reason...) are floating<br>
point.<br>
</blockquote>
<br></span>
It is the best place in the stdlib. Apart from floating point functions, the math module contains integer functions (factorial and gcd) and general number functions (floor, ceil, trunc and isclose). gcd and isclose are new in 3.5.</blockquote><div><br></div><div>well, floor, ceil, and isclose are all about floats...</div><div><br></div><div>Nevertheless, yes the math module is the place for it.</div><div><br></div><div>-CHB</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
<br>
<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R Â  Â  Â  Â  Â  Â (206) 526-6959   voice<br>7600 Sand Point Way NE Â Â (206) 526-6329   fax<br>Seattle, WA Â 98115 Â  Â  Â Â (206) 526-6317   main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</div></div>