@@ -233,6 +233,27 @@ QuadPrecision_dealloc(QuadPrecisionObject *self)
233233 Py_TYPE (self )-> tp_free ((PyObject * )self );
234234}
235235
236+ PyObject * QuadPrecision_get_pi (PyObject * self , void * closure ) {
237+ QuadPrecisionObject * new = QuadPrecision_raw_new (BACKEND_SLEEF );
238+ if (new == NULL ) return NULL ;
239+ new -> value .sleef_value = SLEEF_M_PIq ;
240+ return (PyObject * )new ;
241+ }
242+
243+ PyObject * QuadPrecision_get_e (PyObject * self , void * closure ) {
244+ QuadPrecisionObject * new = QuadPrecision_raw_new (BACKEND_SLEEF );
245+ if (new == NULL ) return NULL ;
246+ new -> value .sleef_value = SLEEF_M_Eq ;
247+ return (PyObject * )new ;
248+ }
249+
250+ // Add this to the existing QuadPrecision_Type definition
251+ static PyGetSetDef QuadPrecision_getset [] = {
252+ {"pi" , (getter )QuadPrecision_get_pi , NULL , "Pi constant" , NULL },
253+ {"e" , (getter )QuadPrecision_get_e , NULL , "Euler's number" , NULL },
254+ {NULL } /* Sentinel */
255+ };
256+
236257PyTypeObject QuadPrecision_Type = {
237258 PyVarObject_HEAD_INIT (NULL , 0 ).tp_name = "numpy_quaddtype.QuadPrecision" ,
238259 .tp_basicsize = sizeof (QuadPrecisionObject ),
@@ -243,6 +264,7 @@ PyTypeObject QuadPrecision_Type = {
243264 .tp_str = (reprfunc )QuadPrecision_str_dragon4 ,
244265 .tp_as_number = & quad_as_scalar ,
245266 .tp_richcompare = (richcmpfunc )quad_richcompare ,
267+ .tp_getset = QuadPrecision_getset ,
246268};
247269
248270int
0 commit comments