[Numpy-discussion] Round away from zero (towards +/- infinity)

John Zwinck jzwinck at gmail.com
Thu Oct 2 23:00:15 EDT 2014


On 3 Oct 2014 07:09, "T J" <tjhnson at gmail.com> wrote:
>
> Any bites on this?
>
> On Wed, Sep 24, 2014 at 12:23 PM, T J <tjhnson at gmail.com> wrote:
>> 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.
>>
>> 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]
>> ---
>> [1]
http://stackoverflow.com/questions/16000574/tie-breaking-of-round-with-numpy

I like the solution given in that Stack Overflow post, namely using ctypes
to call fesetround(). Does that work for you?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20141003/92b65545/attachment.html>


More information about the NumPy-Discussion mailing list