1 #ifndef Py_CPYTHON_COMPLEXOBJECT_H 2 # error "this header file must not be included directly" 3 #endif 4 5 typedef struct { 6 double real; 7 double imag; 8 } Py_complex; 9 10 // Operations on complex numbers. 11 PyAPI_FUNC(Py_complex) _Py_c_sum(Py_complex, Py_complex); 12 PyAPI_FUNC(Py_complex) _Py_c_diff(Py_complex, Py_complex); 13 PyAPI_FUNC(Py_complex) _Py_c_neg(Py_complex); 14 PyAPI_FUNC(Py_complex) _Py_c_prod(Py_complex, Py_complex); 15 PyAPI_FUNC(Py_complex) _Py_c_quot(Py_complex, Py_complex); 16 PyAPI_FUNC(Py_complex) _Py_c_pow(Py_complex, Py_complex); 17 PyAPI_FUNC(double) _Py_c_abs(Py_complex); 18 19 20 /* Complex object interface */ 21 22 /* 23 PyComplexObject represents a complex number with double-precision 24 real and imaginary parts. 25 */ 26 typedef struct { 27 PyObject_HEAD 28 Py_complex cval; 29 } PyComplexObject; 30 31 PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex); 32 33 PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op); 34