Average Error: 33.4 → 22.4
Time: 58.3s
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)\]
\[\begin{array}{l} \mathbf{if}\;x.re \le -1.268561801443751443420750158344177566524 \cdot 10^{-33}:\\ \;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right)\\ \mathbf{elif}\;x.re \le -4.748647839754184914598042097095996307345 \cdot 10^{-157}:\\ \;\;\;\;\sin \left(y.im \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \left(\log \left(\sqrt[3]{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right) + \log \left(\sqrt[3]{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sqrt[3]{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right)\right)}\\ \mathbf{elif}\;x.re \le -5.14895897848334923648626165768820920285 \cdot 10^{-306}:\\ \;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right)\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + \log x.re \cdot y.im\right)\\ \end{array}\]
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)
\begin{array}{l}
\mathbf{if}\;x.re \le -1.268561801443751443420750158344177566524 \cdot 10^{-33}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right)\\

\mathbf{elif}\;x.re \le -4.748647839754184914598042097095996307345 \cdot 10^{-157}:\\
\;\;\;\;\sin \left(y.im \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \left(\log \left(\sqrt[3]{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right) + \log \left(\sqrt[3]{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sqrt[3]{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right)\right)}\\

\mathbf{elif}\;x.re \le -5.14895897848334923648626165768820920285 \cdot 10^{-306}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right)\\

\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + \log x.re \cdot y.im\right)\\

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r1429636 = x_re;
        double r1429637 = r1429636 * r1429636;
        double r1429638 = x_im;
        double r1429639 = r1429638 * r1429638;
        double r1429640 = r1429637 + r1429639;
        double r1429641 = sqrt(r1429640);
        double r1429642 = log(r1429641);
        double r1429643 = y_re;
        double r1429644 = r1429642 * r1429643;
        double r1429645 = atan2(r1429638, r1429636);
        double r1429646 = y_im;
        double r1429647 = r1429645 * r1429646;
        double r1429648 = r1429644 - r1429647;
        double r1429649 = exp(r1429648);
        double r1429650 = r1429642 * r1429646;
        double r1429651 = r1429645 * r1429643;
        double r1429652 = r1429650 + r1429651;
        double r1429653 = sin(r1429652);
        double r1429654 = r1429649 * r1429653;
        return r1429654;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1429655 = x_re;
        double r1429656 = -1.2685618014437514e-33;
        bool r1429657 = r1429655 <= r1429656;
        double r1429658 = y_re;
        double r1429659 = r1429655 * r1429655;
        double r1429660 = x_im;
        double r1429661 = r1429660 * r1429660;
        double r1429662 = r1429659 + r1429661;
        double r1429663 = sqrt(r1429662);
        double r1429664 = log(r1429663);
        double r1429665 = r1429658 * r1429664;
        double r1429666 = atan2(r1429660, r1429655);
        double r1429667 = y_im;
        double r1429668 = r1429666 * r1429667;
        double r1429669 = r1429665 - r1429668;
        double r1429670 = exp(r1429669);
        double r1429671 = r1429666 * r1429658;
        double r1429672 = -r1429655;
        double r1429673 = log(r1429672);
        double r1429674 = r1429667 * r1429673;
        double r1429675 = r1429671 + r1429674;
        double r1429676 = sin(r1429675);
        double r1429677 = r1429670 * r1429676;
        double r1429678 = -4.748647839754185e-157;
        bool r1429679 = r1429655 <= r1429678;
        double r1429680 = r1429667 * r1429664;
        double r1429681 = r1429680 + r1429671;
        double r1429682 = sin(r1429681);
        double r1429683 = exp(r1429668);
        double r1429684 = cbrt(r1429683);
        double r1429685 = log(r1429684);
        double r1429686 = r1429684 * r1429684;
        double r1429687 = log(r1429686);
        double r1429688 = r1429685 + r1429687;
        double r1429689 = r1429665 - r1429688;
        double r1429690 = exp(r1429689);
        double r1429691 = r1429682 * r1429690;
        double r1429692 = -5.148958978483349e-306;
        bool r1429693 = r1429655 <= r1429692;
        double r1429694 = log(r1429655);
        double r1429695 = r1429694 * r1429667;
        double r1429696 = r1429671 + r1429695;
        double r1429697 = sin(r1429696);
        double r1429698 = r1429670 * r1429697;
        double r1429699 = r1429693 ? r1429677 : r1429698;
        double r1429700 = r1429679 ? r1429691 : r1429699;
        double r1429701 = r1429657 ? r1429677 : r1429700;
        return r1429701;
}

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if x.re < -1.2685618014437514e-33 or -4.748647839754185e-157 < x.re < -5.148958978483349e-306

    1. Initial program 35.9

      \[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. Taylor expanded around -inf 21.2

      \[\leadsto 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 \color{blue}{\left(-1 \cdot x.re\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
    3. Simplified21.2

      \[\leadsto 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 \color{blue}{\left(-x.re\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]

    if -1.2685618014437514e-33 < x.re < -4.748647839754185e-157

    1. Initial program 16.4

      \[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. Using strategy rm
    3. Applied add-log-exp19.0

      \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \color{blue}{\log \left(e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\right)}} \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)\]
    4. Using strategy rm
    5. Applied add-cube-cbrt19.0

      \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \log \color{blue}{\left(\left(\sqrt[3]{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sqrt[3]{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right) \cdot \sqrt[3]{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right)}} \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)\]
    6. Applied log-prod19.0

      \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \color{blue}{\left(\log \left(\sqrt[3]{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sqrt[3]{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right) + \log \left(\sqrt[3]{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right)\right)}} \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)\]

    if -5.148958978483349e-306 < x.re

    1. Initial program 34.9

      \[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. Taylor expanded around inf 23.9

      \[\leadsto 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 \color{blue}{x.re} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
  3. Recombined 3 regimes into one program.
  4. Final simplification22.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \le -1.268561801443751443420750158344177566524 \cdot 10^{-33}:\\ \;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right)\\ \mathbf{elif}\;x.re \le -4.748647839754184914598042097095996307345 \cdot 10^{-157}:\\ \;\;\;\;\sin \left(y.im \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \left(\log \left(\sqrt[3]{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right) + \log \left(\sqrt[3]{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sqrt[3]{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right)\right)}\\ \mathbf{elif}\;x.re \le -5.14895897848334923648626165768820920285 \cdot 10^{-306}:\\ \;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right)\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + \log x.re \cdot y.im\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019168 
(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)))))