blob: f5d8f43c7ae053e1500bb23f778a6a08085055ff [file] [log] [blame]
Guido van Rossumf9fca921996-01-12 00:47:05 +00001#ifndef COMPLEXOBJECT_H
2#define COMPLEXOBJECT_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7/* Complex number structure */
8
9typedef struct {
10 double real;
11 double imag;
Guido van Rossum519b4331996-07-21 02:24:22 +000012} Py_complex;
Guido van Rossumf9fca921996-01-12 00:47:05 +000013
14/* Operations on complex numbers from complexmodule.c */
15
Guido van Rossum652f1081996-05-24 21:01:36 +000016#define c_sum _Py_c_sum
17#define c_diff _Py_c_diff
18#define c_neg _Py_c_neg
19#define c_prod _Py_c_prod
20#define c_quot _Py_c_quot
21#define c_pow _Py_c_pow
22
Guido van Rossum8b51d221996-08-19 22:04:54 +000023extern Py_complex c_sum Py_PROTO((Py_complex, Py_complex));
24extern Py_complex c_diff Py_PROTO((Py_complex, Py_complex));
25extern Py_complex c_neg Py_PROTO((Py_complex));
26extern Py_complex c_prod Py_PROTO((Py_complex, Py_complex));
27extern Py_complex c_quot Py_PROTO((Py_complex, Py_complex));
28extern Py_complex c_pow Py_PROTO((Py_complex, Py_complex));
Guido van Rossumf9fca921996-01-12 00:47:05 +000029
30
31/* Complex object interface */
32
33/*
34PyComplexObject represents a complex number with double-precision
35real and imaginary parts.
36*/
37
38typedef struct {
39 PyObject_HEAD
Guido van Rossum519b4331996-07-21 02:24:22 +000040 Py_complex cval;
Guido van Rossumf9fca921996-01-12 00:47:05 +000041} PyComplexObject;
42
43extern DL_IMPORT(PyTypeObject) PyComplex_Type;
44
45#define PyComplex_Check(op) ((op)->ob_type == &PyComplex_Type)
46
Guido van Rossum519b4331996-07-21 02:24:22 +000047extern PyObject *PyComplex_FromCComplex Py_PROTO((Py_complex));
Guido van Rossumf9fca921996-01-12 00:47:05 +000048extern PyObject *PyComplex_FromDoubles Py_PROTO((double real, double imag));
49
50extern double PyComplex_RealAsDouble Py_PROTO((PyObject *op));
51extern double PyComplex_ImagAsDouble Py_PROTO((PyObject *op));
Guido van Rossum519b4331996-07-21 02:24:22 +000052extern Py_complex PyComplex_AsCComplex Py_PROTO((PyObject *op));
Guido van Rossumf9fca921996-01-12 00:47:05 +000053
54#ifdef __cplusplus
55}
56#endif
57#endif /* !COMPLEXOBJECT_H */