@@ -80,14 +80,17 @@ get_sleef_constant(PyObject *self, PyObject *args)
80
80
else if (strcmp (constant_name , "precision" ) == 0 ) {
81
81
Py_DECREF (result );
82
82
// precision = int(-log10(epsilon))
83
- int64_t precision = Sleef_cast_to_int64q1 (Sleef_negq1 (Sleef_log10q1_u10 (SLEEF_QUAD_EPSILON )));
83
+ int64_t precision =
84
+ Sleef_cast_to_int64q1 (Sleef_negq1 (Sleef_log10q1_u10 (SLEEF_QUAD_EPSILON )));
84
85
return PyLong_FromLong (precision );
85
86
}
86
87
else if (strcmp (constant_name , "resolution" ) == 0 ) {
87
88
// precision = int(-log10(epsilon))
88
- int64_t precision = Sleef_cast_to_int64q1 (Sleef_negq1 (Sleef_log10q1_u10 (SLEEF_QUAD_EPSILON )));
89
+ int64_t precision =
90
+ Sleef_cast_to_int64q1 (Sleef_negq1 (Sleef_log10q1_u10 (SLEEF_QUAD_EPSILON )));
89
91
// resolution = 10 ** (-precision)
90
- result -> value .sleef_value = Sleef_powq1_u10 (Sleef_cast_from_int64q1 (10 ), Sleef_cast_from_int64q1 (- precision ));
92
+ result -> value .sleef_value =
93
+ Sleef_powq1_u10 (Sleef_cast_from_int64q1 (10 ), Sleef_cast_from_int64q1 (- precision ));
91
94
}
92
95
else {
93
96
PyErr_SetString (PyExc_ValueError , "Unknown constant name" );
@@ -109,9 +112,12 @@ static PyMethodDef module_methods[] = {
109
112
{NULL , NULL , 0 , NULL }};
110
113
111
114
static struct PyModuleDef moduledef = {
112
- PyModuleDef_HEAD_INIT , .m_name = "_quaddtype_main" ,
115
+ PyModuleDef_HEAD_INIT ,
116
+ .m_name = "_quaddtype_main" ,
113
117
.m_doc = "Quad (128-bit) floating point Data Type for NumPy with multiple backends" ,
114
- .m_size = -1 , .m_methods = module_methods };
118
+ .m_size = -1 ,
119
+ .m_methods = module_methods ,
120
+ };
115
121
116
122
PyMODINIT_FUNC
117
123
PyInit__quaddtype_main (void )
@@ -123,6 +129,10 @@ PyInit__quaddtype_main(void)
123
129
return NULL ;
124
130
}
125
131
132
+ #ifdef Py_GIL_DISABLED
133
+ PyUnstable_Module_SetGIL (m , Py_MOD_GIL_NOT_USED );
134
+ #endif
135
+
126
136
if (init_quadprecision_scalar () < 0 )
127
137
goto error ;
128
138
0 commit comments