Average Error: 31.3 → 0.2
Time: 4.2m
Precision: 64
\[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)\]
\[\frac{\sin \left((y.im \cdot \left(\log \left(\sqrt{x.re^2 + x.im^2}^*\right)\right) + \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right))_*\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - y.re \cdot \log \left(\sqrt{x.re^2 + x.im^2}^*\right)}}\]
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)
\frac{\sin \left((y.im \cdot \left(\log \left(\sqrt{x.re^2 + x.im^2}^*\right)\right) + \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right))_*\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - y.re \cdot \log \left(\sqrt{x.re^2 + x.im^2}^*\right)}}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r1123063 = x_re;
        double r1123064 = r1123063 * r1123063;
        double r1123065 = x_im;
        double r1123066 = r1123065 * r1123065;
        double r1123067 = r1123064 + r1123066;
        double r1123068 = sqrt(r1123067);
        double r1123069 = log(r1123068);
        double r1123070 = y_re;
        double r1123071 = r1123069 * r1123070;
        double r1123072 = atan2(r1123065, r1123063);
        double r1123073 = y_im;
        double r1123074 = r1123072 * r1123073;
        double r1123075 = r1123071 - r1123074;
        double r1123076 = exp(r1123075);
        double r1123077 = r1123069 * r1123073;
        double r1123078 = r1123072 * r1123070;
        double r1123079 = r1123077 + r1123078;
        double r1123080 = sin(r1123079);
        double r1123081 = r1123076 * r1123080;
        return r1123081;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1123082 = y_im;
        double r1123083 = x_re;
        double r1123084 = x_im;
        double r1123085 = hypot(r1123083, r1123084);
        double r1123086 = log(r1123085);
        double r1123087 = atan2(r1123084, r1123083);
        double r1123088 = y_re;
        double r1123089 = r1123087 * r1123088;
        double r1123090 = fma(r1123082, r1123086, r1123089);
        double r1123091 = sin(r1123090);
        double r1123092 = r1123087 * r1123082;
        double r1123093 = r1123088 * r1123086;
        double r1123094 = r1123092 - r1123093;
        double r1123095 = exp(r1123094);
        double r1123096 = r1123091 / r1123095;
        return r1123096;
}

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Derivation

  1. Initial program 31.3

    \[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)\]
  2. Simplified0.2

    \[\leadsto \color{blue}{\frac{\sin \left((y.im \cdot \left(\log \left(\sqrt{x.re^2 + x.im^2}^*\right)\right) + \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right))_*\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - y.re \cdot \log \left(\sqrt{x.re^2 + x.im^2}^*\right)}}}\]
  3. Final simplification0.2

    \[\leadsto \frac{\sin \left((y.im \cdot \left(\log \left(\sqrt{x.re^2 + x.im^2}^*\right)\right) + \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right))_*\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - y.re \cdot \log \left(\sqrt{x.re^2 + x.im^2}^*\right)}}\]

Reproduce

herbie shell --seed 2019112 +o rules:numerics
(FPCore (x.re x.im y.re y.im)
  :name "powComplex, imaginary part"
  (* (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)))))