Lines Matching full:real
32 r.real = a.real + b.real; in _Py_c_sum()
41 r.real = a.real - b.real; in _Py_c_diff()
50 r.real = -a.real; in _Py_c_neg()
59 r.real = a.real*b.real - a.imag*b.imag; in _Py_c_prod()
60 r.imag = a.real*b.imag + a.imag*b.real; in _Py_c_prod()
79 double d = b.real*b.real + b.imag*b.imag; in _Py_c_quot()
82 r.real = (a.real*b.real + a.imag*b.imag)/d; in _Py_c_quot()
83 r.imag = (a.imag*b.real - a.real*b.imag)/d; in _Py_c_quot()
88 * numerators and denominator by whichever of {b.real, b.imag} has in _Py_c_quot()
95 const double abs_breal = b.real < 0 ? -b.real : b.real; in _Py_c_quot()
99 /* divide tops and bottom by b.real */ in _Py_c_quot()
102 r.real = r.imag = 0.0; in _Py_c_quot()
105 const double ratio = b.imag / b.real; in _Py_c_quot()
106 const double denom = b.real + b.imag * ratio; in _Py_c_quot()
107 r.real = (a.real + a.imag * ratio) / denom; in _Py_c_quot()
108 r.imag = (a.imag - a.real * ratio) / denom; in _Py_c_quot()
113 const double ratio = b.real / b.imag; in _Py_c_quot()
114 const double denom = b.real * ratio + b.imag; in _Py_c_quot()
116 r.real = (a.real * ratio + a.imag) / denom; in _Py_c_quot()
117 r.imag = (a.imag * ratio - a.real) / denom; in _Py_c_quot()
120 /* At least one of b.real or b.imag is a NaN */ in _Py_c_quot()
121 r.real = r.imag = Py_NAN; in _Py_c_quot()
134 if (b.real == 0. && b.imag == 0.) { in _Py_c_pow()
135 r.real = 1.; in _Py_c_pow()
138 else if (a.real == 0. && a.imag == 0.) { in _Py_c_pow()
139 if (b.imag != 0. || b.real < 0.) in _Py_c_pow()
141 r.real = 0.; in _Py_c_pow()
145 vabs = hypot(a.real,a.imag); in _Py_c_pow()
146 len = pow(vabs,b.real); in _Py_c_pow()
147 at = atan2(a.imag, a.real); in _Py_c_pow()
148 phase = at*b.real; in _Py_c_pow()
153 r.real = len*cos(phase); in _Py_c_pow()
191 if (!Py_IS_FINITE(z.real) || !Py_IS_FINITE(z.imag)) { in _Py_c_abs()
192 /* C99 rules: if either the real or the imaginary part is an in _Py_c_abs()
195 if (Py_IS_INFINITY(z.real)) { in _Py_c_abs()
196 result = fabs(z.real); in _Py_c_abs()
205 /* either the real or imaginary part is a NaN, in _Py_c_abs()
209 result = hypot(z.real, z.imag); in _Py_c_abs()
242 complex_subtype_from_doubles(PyTypeObject *type, double real, double imag) in complex_subtype_from_doubles() argument
245 c.real = real; in complex_subtype_from_doubles()
251 PyComplex_FromDoubles(double real, double imag) in PyComplex_FromDoubles() argument
254 c.real = real; in PyComplex_FromDoubles()
264 double real = -1.0; in PyComplex_RealAsDouble() local
267 real = ((PyComplexObject *)op)->cval.real; in PyComplex_RealAsDouble()
272 real = ((PyComplexObject *)newop)->cval.real; in PyComplex_RealAsDouble()
275 real = PyFloat_AsDouble(op); in PyComplex_RealAsDouble()
279 return real; in PyComplex_RealAsDouble()
353 cv.real = -1.; in PyComplex_AsCComplex()
367 real part of the result, and fill in the imaginary part as 0. */ in PyComplex_AsCComplex()
370 cv.real = PyFloat_AsDouble(op); in PyComplex_AsCComplex()
393 if (v->cval.real == 0. && copysign(1.0, v->cval.real)==1.0) { in complex_repr()
394 /* Real part is +0: just output the imaginary part and do not in complex_repr()
404 /* Format imaginary part with sign, real part without. Include in complex_repr()
406 pre = PyOS_double_to_string(v->cval.real, format_code, in complex_repr()
435 hashreal = (Py_uhash_t)_Py_HashDouble((PyObject *) v, v->cval.real); in complex_hash()
465 pc->real = pc->imag = 0.0; in to_complex()
467 pc->real = PyLong_AsDouble(obj); in to_complex()
468 if (pc->real == -1.0 && PyErr_Occurred()) { in to_complex()
475 pc->real = PyFloat_AsDouble(obj); in to_complex()
547 if (b.imag == 0.0 && b.real == floor(b.real) && fabs(b.real) <= 100.0) { in complex_pow()
548 p = c_powi(a, (long)b.real); in complex_pow()
554 _Py_ADJUST_ERANGE2(p.real, p.imag); in complex_pow()
572 neg.real = -v->cval.real; in complex_neg()
605 return v->cval.real != 0.0 || v->cval.imag != 0.0; in complex_bool()
628 j = PyFloat_FromDouble(i.real); in complex_richcompare()
641 equal = (i.real == PyFloat_AsDouble(w) && i.imag == 0.0); in complex_richcompare()
647 equal = (i.real == j.real && i.imag == j.imag); in complex_richcompare()
689 return Py_BuildValue("(dd)", c.real, c.imag); in complex___getnewargs___impl()
748 {"real", Py_T_DOUBLE, offsetof(PyComplexObject, cval.real), Py_READONLY,
749 "the real part of a complex number"},
777 <float> - real part only in complex_from_string_inner()
779 <float><signed-float>j - real and imaginary parts in complex_from_string_inner()
911 real as r: object(c_default="NULL") = 0
918 If the 'real' or 'imag' arguments are given, create a complex number
919 with the specified real and imaginary components.
1000 /* If we get this far, then the "real" and "imag" parts should in complex_new_impl()
1002 complex number equal to (real + imag*1j). in complex_new_impl()
1005 form; the "real" and "imag" parts might themselves be complex in complex_new_impl()
1009 retaining its real & imag parts here, and the return in complex_new_impl()
1018 /* The "real" part really is entirely real, and contributes in complex_new_impl()
1024 than the original "real" argument. */ in complex_new_impl()
1030 cr.real = PyFloat_AsDouble(tmp); in complex_new_impl()
1035 ci.real = cr.imag; in complex_new_impl()
1042 contributes nothing in the real direction. in complex_new_impl()
1047 ci.real = PyFloat_AsDouble(tmp); in complex_new_impl()
1050 /* If the input was in canonical form, then the "real" and "imag" in complex_new_impl()
1051 parts are real numbers, so that ci.imag and cr.imag are zero. in complex_new_impl()
1052 We need this correction in case they were not real numbers. */ in complex_new_impl()
1055 cr.real -= ci.imag; in complex_new_impl()
1058 ci.real += cr.imag; in complex_new_impl()
1060 return complex_subtype_from_doubles(type, cr.real, ci.real); in complex_new_impl()