Lines Matching refs:real
31 r.real = a.real + b.real;
40 r.real = a.real - b.real;
49 r.real = -a.real;
58 r.real = a.real*b.real - a.imag*b.imag;
59 r.imag = a.real*b.imag + a.imag*b.real;
78 double d = b.real*b.real + b.imag*b.imag;
81 r.real = (a.real*b.real + a.imag*b.imag)/d;
82 r.imag = (a.imag*b.real - a.real*b.imag)/d;
87 * numerators and denominator by whichever of {b.real, b.imag} has
94 const double abs_breal = b.real < 0 ? -b.real : b.real;
98 /* divide tops and bottom by b.real */
101 r.real = r.imag = 0.0;
104 const double ratio = b.imag / b.real;
105 const double denom = b.real + b.imag * ratio;
106 r.real = (a.real + a.imag * ratio) / denom;
107 r.imag = (a.imag - a.real * ratio) / denom;
112 const double ratio = b.real / b.imag;
113 const double denom = b.real * ratio + b.imag;
115 r.real = (a.real * ratio + a.imag) / denom;
116 r.imag = (a.imag * ratio - a.real) / denom;
119 /* At least one of b.real or b.imag is a NaN */
120 r.real = r.imag = Py_NAN;
133 if (b.real == 0. && b.imag == 0.) {
134 r.real = 1.;
137 else if (a.real == 0. && a.imag == 0.) {
138 if (b.imag != 0. || b.real < 0.)
140 r.real = 0.;
144 vabs = hypot(a.real,a.imag);
145 len = pow(vabs,b.real);
146 at = atan2(a.imag, a.real);
147 phase = at*b.real;
152 r.real = len*cos(phase);
190 if (!Py_IS_FINITE(z.real) || !Py_IS_FINITE(z.imag)) {
191 /* C99 rules: if either the real or the imaginary part is an
194 if (Py_IS_INFINITY(z.real)) {
195 result = fabs(z.real);
204 /* either the real or imaginary part is a NaN,
208 result = hypot(z.real, z.imag);
241 complex_subtype_from_doubles(PyTypeObject *type, double real, double imag)
244 c.real = real;
250 PyComplex_FromDoubles(double real, double imag)
253 c.real = real;
262 return ((PyComplexObject *)op)->cval.real;
327 cv.real = -1.;
341 real part of the result, and fill in the imaginary part as 0. */
344 cv.real = PyFloat_AsDouble(op);
367 if (v->cval.real == 0. && copysign(1.0, v->cval.real)==1.0) {
378 /* Format imaginary part with sign, real part without. Include
380 pre = PyOS_double_to_string(v->cval.real, format_code,
409 hashreal = (Py_uhash_t)_Py_HashDouble((PyObject *) v, v->cval.real);
439 pc->real = pc->imag = 0.0;
441 pc->real = PyLong_AsDouble(obj);
442 if (pc->real == -1.0 && PyErr_Occurred()) {
449 pc->real = PyFloat_AsDouble(obj);
522 if (b.imag == 0.0 && b.real == floor(b.real) && fabs(b.real) <= 100.0) {
523 p = c_powi(a, (long)b.real);
529 _Py_ADJUST_ERANGE2(p.real, p.imag);
547 neg.real = -v->cval.real;
581 return v->cval.real != 0.0 || v->cval.imag != 0.0;
604 j = PyFloat_FromDouble(i.real);
617 equal = (i.real == PyFloat_AsDouble(w) && i.imag == 0.0);
623 equal = (i.real == j.real && i.imag == j.imag);
666 return Py_BuildValue("(dd)", c.real, c.imag);
726 {"real", T_DOUBLE, offsetof(PyComplexObject, cval.real), READONLY,
727 "the real part of a complex number"},
755 <float> - real part only
757 <float><signed-float>j - real and imaginary parts
889 real as r: object(c_default="NULL") = 0
892 Create a complex number from a real part and an optional imaginary part.
894 This is equivalent to (real + imag*1j) where imag defaults to 0.
976 /* If we get this far, then the "real" and "imag" parts should
978 complex number equal to (real + imag*1j).
981 form; the "real" and "imag" parts might themselves be complex
985 retaining its real & imag parts here, and the return
994 /* The "real" part really is entirely real, and contributes
1000 than the original "real" argument. */
1006 cr.real = PyFloat_AsDouble(tmp);
1011 ci.real = cr.imag;
1018 contributes nothing in the real direction.
1023 ci.real = PyFloat_AsDouble(tmp);
1026 /* If the input was in canonical form, then the "real" and "imag"
1027 parts are real numbers, so that ci.imag and cr.imag are zero.
1028 We need this correction in case they were not real numbers. */
1031 cr.real -= ci.imag;
1034 ci.real += cr.imag;
1036 return complex_subtype_from_doubles(type, cr.real, ci.real);