<div dir="ltr">Any bites on this?</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 24, 2014 at 12:23 PM, T J <span dir="ltr"><<a href="mailto:tjhnson@gmail.com" target="_blank">tjhnson@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Is there a ufunc for rounding away from zero? Or do I need to do<div><br></div><div>    x2 = sign(x) * ceil(abs(x))<br></div><div><br></div><div>whenever I want to round away from zero? Maybe the following is better?</div><div><br></div><div>    x_ceil = ceil(x)<br></div><div>    x_floor = floor(x)</div><div>    x2 = where(x >= 0, x_ceil, x_floor)</div><div><br></div><div>Python's round function goes away from zero, so I am looking for the NumPy equivalent (and using vectorize() seems undesirable). In this sense, it seems that having a ufunc for this type of rounding could be helpful.<br></div><div><br></div><div>Aside: Is there interest in a more general around() that allows users to specify alternative tie-breaking rules, with the default staying 'round half to nearest even'? [1] </div><div><br></div><div>Also, what is the difference between NumPy's fix() and trunc() functions? It seems like they achieve the same goal. trunc() was added in 1.3.0. So is fix() just legacy?</div><div><br></div><div>---</div><div>[1] <a href="http://stackoverflow.com/questions/16000574/tie-breaking-of-round-with-numpy" target="_blank">http://stackoverflow.com/questions/16000574/tie-breaking-of-round-with-numpy</a></div><div><br></div></div>
</blockquote></div><br></div>