The problem is somewhere in this bit of code:
// f will be a double
f = PyFloat_FromDouble(power_of_ten(decimals));
if (f==NULL) return NULL;
// op1 will be division
ret = PyObject_CallFunction(op1, "OOO", a, f, out);
if (ret==NULL) goto finish;
// round in place.
tmp = PyObject_CallFunction(n_ops.rint, "OO", ret, ret);
if (tmp == NULL) {Py_DECREF(ret); ret=NULL; goto finish;}
I suspect the problem is the division, which has integer 'a', double 'f', and integer 'out'. Integer out is probably the killer. Let's see:
# use doubles for output
>>> out = zeros(1)
>>> array([66]).round(decimals=-1, out=out)
array([ 70.])
yep, that's the problem
Chuck.
<snip>