Average Error: 31.1 → 0.2
Time: 3.8m
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 r354247 = x_re;
        double r354248 = r354247 * r354247;
        double r354249 = x_im;
        double r354250 = r354249 * r354249;
        double r354251 = r354248 + r354250;
        double r354252 = sqrt(r354251);
        double r354253 = log(r354252);
        double r354254 = y_re;
        double r354255 = r354253 * r354254;
        double r354256 = atan2(r354249, r354247);
        double r354257 = y_im;
        double r354258 = r354256 * r354257;
        double r354259 = r354255 - r354258;
        double r354260 = exp(r354259);
        double r354261 = r354253 * r354257;
        double r354262 = r354256 * r354254;
        double r354263 = r354261 + r354262;
        double r354264 = sin(r354263);
        double r354265 = r354260 * r354264;
        return r354265;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r354266 = y_im;
        double r354267 = x_re;
        double r354268 = x_im;
        double r354269 = hypot(r354267, r354268);
        double r354270 = log(r354269);
        double r354271 = atan2(r354268, r354267);
        double r354272 = y_re;
        double r354273 = r354271 * r354272;
        double r354274 = fma(r354266, r354270, r354273);
        double r354275 = sin(r354274);
        double r354276 = r354271 * r354266;
        double r354277 = r354272 * r354270;
        double r354278 = r354276 - r354277;
        double r354279 = exp(r354278);
        double r354280 = r354275 / r354279;
        return r354280;
}

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.1

    \[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 2019104 +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)))))