@@ -2138,6 +2138,45 @@ static PyObject* NmzSetFaceCodimBound(PyObject* self, PyObject* args)
2138
2138
FUNC_END
2139
2139
}
2140
2140
2141
+ static PyObject* NmzSetDecimalDigits (PyObject* self, PyObject* args)
2142
+ {
2143
+
2144
+ FUNC_BEGIN
2145
+
2146
+ PyObject* cone = PyTuple_GetItem (args, 0 );
2147
+
2148
+ if (!is_cone (cone)) {
2149
+ PyErr_SetString (PyNormaliz_cppError, " First argument must be a cone" );
2150
+ return NULL ;
2151
+ }
2152
+
2153
+ PyObject* digits_py = PyTuple_GetItem (args, 1 );
2154
+
2155
+ TempSignalHandler tmpHandler; // use custom signal handler
2156
+
2157
+ int overflow;
2158
+ long digits = PyLong_AsLongLongAndOverflow (digits_py, &overflow);
2159
+ if (is_cone_mpz (cone)) {
2160
+ Cone< mpz_class >* cone_ptr = get_cone_mpz (cone);
2161
+ cone_ptr->setDecimalDigits (digits);
2162
+ Py_RETURN_TRUE;
2163
+ }
2164
+ else if (is_cone_long (cone)) {
2165
+ Cone< long long >* cone_ptr = get_cone_long (cone);
2166
+ cone_ptr->setDecimalDigits (digits);
2167
+ Py_RETURN_TRUE;
2168
+ }
2169
+ #ifdef ENFNORMALIZ
2170
+ else {
2171
+ Cone<renf_elem_class>* cone_ptr = get_cone_renf (cone);
2172
+ cone_ptr->setDecimalDigits (digits);
2173
+ Py_RETURN_TRUE;
2174
+ }
2175
+ #endif
2176
+
2177
+ FUNC_END
2178
+ }
2179
+
2141
2180
/* **************************************************************************
2142
2181
*
2143
2182
* Get Symmetrized cone
@@ -2533,7 +2572,9 @@ static PyMethodDef PyNormaliz_cppMethods[] = {
2533
2572
(PyCFunction)NmzSetNumberOfNormalizThreads, METH_VARARGS,
2534
2573
" Sets the Normaliz thread limit" },
2535
2574
{" NmzSetNrCoeffQuasiPol" , (PyCFunction)NmzSetNrCoeffQuasiPol,
2536
- METH_VARARGS, " Sets the number of computed coefficients for the quasi-polynomial" },
2575
+ METH_VARARGS, " Sets the number of computed coefficients for the quasi-polynomial" },
2576
+ {" NmzSetDecimalDigits" , (PyCFunction)NmzSetDecimalDigits,
2577
+ METH_VARARGS, " Sets the number of decimal digits for fixed precision" },
2537
2578
{" NmzSetPolynomial" , (PyCFunction)NmzSetPolynomial,
2538
2579
METH_VARARGS, " Sets the polynomial for integration and weighted series" },
2539
2580
{" NmzSetFaceCodimBound" , (PyCFunction)NmzSetFaceCodimBound,
0 commit comments