blob: 93d243e8d506578cac17fc48988653172425f0fd [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;
12} complex;
13
14/* Operations on complex numbers from complexmodule.c */
15
16extern complex c_sum();
17extern complex c_diff();
18extern complex c_neg();
19extern complex c_prod();
20extern complex c_quot();
21extern complex c_pow();
22
23
24/* Complex object interface */
25
26/*
27PyComplexObject represents a complex number with double-precision
28real and imaginary parts.
29*/
30
31typedef struct {
32 PyObject_HEAD
33 complex cval;
34} PyComplexObject;
35
36extern DL_IMPORT(PyTypeObject) PyComplex_Type;
37
38#define PyComplex_Check(op) ((op)->ob_type == &PyComplex_Type)
39
40extern PyObject *PyComplex_FromCComplex Py_PROTO((complex));
41extern PyObject *PyComplex_FromDoubles Py_PROTO((double real, double imag));
42
43extern double PyComplex_RealAsDouble Py_PROTO((PyObject *op));
44extern double PyComplex_ImagAsDouble Py_PROTO((PyObject *op));
Guido van Rossum59905921996-01-12 00:55:11 +000045extern complex PyComplex_AsCComplex Py_PROTO((PyObject *op));
Guido van Rossumf9fca921996-01-12 00:47:05 +000046
47#ifdef __cplusplus
48}
49#endif
50#endif /* !COMPLEXOBJECT_H */