e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)e^{\log \left(e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\right)\right)\right)double f(double x_re, double x_im, double y_re, double y_im) {
double r14521 = x_re;
double r14522 = r14521 * r14521;
double r14523 = x_im;
double r14524 = r14523 * r14523;
double r14525 = r14522 + r14524;
double r14526 = sqrt(r14525);
double r14527 = log(r14526);
double r14528 = y_re;
double r14529 = r14527 * r14528;
double r14530 = atan2(r14523, r14521);
double r14531 = y_im;
double r14532 = r14530 * r14531;
double r14533 = r14529 - r14532;
double r14534 = exp(r14533);
double r14535 = r14527 * r14531;
double r14536 = r14530 * r14528;
double r14537 = r14535 + r14536;
double r14538 = sin(r14537);
double r14539 = r14534 * r14538;
return r14539;
}
double f(double x_re, double x_im, double y_re, double y_im) {
double r14540 = x_re;
double r14541 = x_im;
double r14542 = hypot(r14540, r14541);
double r14543 = log(r14542);
double r14544 = exp(r14543);
double r14545 = log(r14544);
double r14546 = y_re;
double r14547 = r14545 * r14546;
double r14548 = atan2(r14541, r14540);
double r14549 = y_im;
double r14550 = r14548 * r14549;
double r14551 = r14547 - r14550;
double r14552 = exp(r14551);
double r14553 = r14543 * r14549;
double r14554 = r14548 * r14546;
double r14555 = r14553 + r14554;
double r14556 = sin(r14555);
double r14557 = log1p(r14556);
double r14558 = expm1(r14557);
double r14559 = expm1(r14558);
double r14560 = log1p(r14559);
double r14561 = r14552 * r14560;
return r14561;
}



Bits error versus x.re



Bits error versus x.im



Bits error versus y.re



Bits error versus y.im
Results
Initial program 33.7
rmApplied hypot-def19.4
rmApplied add-exp-log19.4
Simplified3.6
rmApplied log1p-expm1-u3.6
rmApplied expm1-log1p-u3.6
Final simplification3.6
herbie shell --seed 2020025 +o rules:numerics
(FPCore (x.re x.im y.re y.im)
:name "powComplex, imaginary part"
:precision binary64
(* (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) (* (atan2 x.im x.re) y.im))) (sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))))