@@ -2138,6 +2138,45 @@ static PyObject* NmzSetFaceCodimBound(PyObject* self, PyObject* args)
21382138 FUNC_END
21392139}
21402140
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+
21412180/* **************************************************************************
21422181 *
21432182 * Get Symmetrized cone
@@ -2533,7 +2572,9 @@ static PyMethodDef PyNormaliz_cppMethods[] = {
25332572 (PyCFunction)NmzSetNumberOfNormalizThreads, METH_VARARGS,
25342573 " Sets the Normaliz thread limit" },
25352574 {" 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" },
25372578 {" NmzSetPolynomial" , (PyCFunction)NmzSetPolynomial,
25382579 METH_VARARGS, " Sets the polynomial for integration and weighted series" },
25392580 {" NmzSetFaceCodimBound" , (PyCFunction)NmzSetFaceCodimBound,
0 commit comments