<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 9/13/19 7:23 AM, Andras Deak wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAMEWA4NRFPduUNbmJ7n0UzTutaXz1ayiJA+p3HSAETwzmC3Y4Q@mail.gmail.com">
      <pre class="moz-quote-pre" wrap="">I just want to add that you can use literal 16.055 to reproduce this:
</pre>
      <blockquote type="cite" style="color: #000000;">
        <blockquote type="cite" style="color: #000000;">
          <blockquote type="cite" style="color: #000000;">
            <pre class="moz-quote-pre" wrap="">import numpy as np
np.set_printoptions(precision=2)
np.array([16.055]).round(2)
</pre>
          </blockquote>
        </blockquote>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">array([16.06])
</pre>
      <blockquote type="cite" style="color: #000000;">
        <blockquote type="cite" style="color: #000000;">
          <blockquote type="cite" style="color: #000000;">
            <pre class="moz-quote-pre" wrap="">np.array([16.055])
</pre>
          </blockquote>
        </blockquote>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">array([16.05])

I would think it has to do with "round to nearest even":
</pre>
      <blockquote type="cite" style="color: #000000;">
        <blockquote type="cite" style="color: #000000;">
          <blockquote type="cite" style="color: #000000;">
            <pre class="moz-quote-pre" wrap="">np.array(16.055)
</pre>
          </blockquote>
        </blockquote>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">array(16.05)
</pre>
      <blockquote type="cite" style="color: #000000;">
        <blockquote type="cite" style="color: #000000;">
          <blockquote type="cite" style="color: #000000;">
            <pre class="moz-quote-pre" wrap="">np.array(16.065)
</pre>
          </blockquote>
        </blockquote>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">array(16.07)
</pre>
      <blockquote type="cite" style="color: #000000;">
        <blockquote type="cite" style="color: #000000;">
          <blockquote type="cite" style="color: #000000;">
            <pre class="moz-quote-pre" wrap="">np.array(16.065).round(2)
</pre>
          </blockquote>
        </blockquote>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">16.07

But it's as if `round` rounded decimal digits upwards (16.055 ->
16.06, 16.065 -> 16.07), whereas the `repr` rounded to the nearest
odd(!) digit (16.055 -> 16.05, 16.065 -> 16.07). Does this make any
sense? I'm on numpy 1.17.2.
(Scalars or 1-length 1d arrays don't seem to make a difference).
Regards,

András</pre>
    </blockquote>
    <p><br>
    </p>
    <p><tt>Isn't that just for consistency with Python 3 round()?  I
        agree that the discrepancy with np.set_printoptions is not
        necessarily expected, except possibly for backwards
        compatibility.</tt></p>
    <p><tt>Phil</tt><br>
    </p>
  </body>
</html>