<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 19, 2018 at 3:30 AM, Matthew Brett <span dir="ltr"><<a href="mailto:matthew.brett@gmail.com" target="_blank">matthew.brett@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
Sorry for my confusion, but I noticed (as a result of the discussion<br>
here [1]) that np.rint and the fallback C function [2] seem to round<br>
to even.  But - my impression was that C rint, by default, rounds down<br>
[3].   Is numpy rint not behaving the same way as the GNU C library<br>
rint?<br>
<br>
In [4]: np.rint(np.arange(0.5, 11))<br>
Out[4]: array([ 0.,  2.,  2.,  4.,  4.,  6.,  6.,  8.,  8., 10., 10.])<br>
<br>
In [5]: np.round(np.arange(0.5, 11))<br>
Out[5]: array([ 0.,  2.,  2.,  4.,  4.,  6.,  6.,  8.,  8., 10., 10.])<br></blockquote><div><br></div><div>The GNU C documentation says that rint "round(s) x to an integer value according to the current rounding mode." The rounding mode is determined by settings in the FPU control word. Numpy runs with it set to round to even, although, IIRC, there is a bug on windows where the library is not setting those  bits correctly.<br></div><div><br></div><div>Chuck</div></div></div></div>