?

Average Accuracy: 31.3% → 61.0%
Time: 23.1s
Precision: binary64
Cost: 71552

?

\[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} t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\ e^{t_0 \cdot y.re - \sqrt{{\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}^{2}}} \cdot \sin \left(\mathsf{fma}\left(t_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :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)))))
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (log (hypot x.re x.im))))
   (*
    (exp (- (* t_0 y.re) (sqrt (pow (* y.im (atan2 x.im x.re)) 2.0))))
    (sin (fma t_0 y.im (* y.re (atan2 x.im x.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * sin(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = log(hypot(x_46_re, x_46_im));
	return exp(((t_0 * y_46_re) - sqrt(pow((y_46_im * atan2(x_46_im, x_46_re)), 2.0)))) * sin(fma(t_0, y_46_im, (y_46_re * atan2(x_46_im, x_46_re))));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(exp(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * sin(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re))))
end
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = log(hypot(x_46_re, x_46_im))
	return Float64(exp(Float64(Float64(t_0 * y_46_re) - sqrt((Float64(y_46_im * atan(x_46_im, x_46_re)) ^ 2.0)))) * sin(fma(t_0, y_46_im, Float64(y_46_re * atan(x_46_im, x_46_re)))))
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[Exp[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[Sqrt[N[Power[N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(t$95$0 * y$46$im + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
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}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
e^{t_0 \cdot y.re - \sqrt{{\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}^{2}}} \cdot \sin \left(\mathsf{fma}\left(t_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)
\end{array}

Error?

Derivation?

  1. Initial program 32.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. Simplified68.8%

    \[\leadsto \color{blue}{e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)} \]
    Proof

    [Start]32.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) \]
  3. Applied egg-rr69.0%

    \[\leadsto e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \color{blue}{\sqrt{{\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}^{2}}}} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \]
    Proof

    [Start]68.8

    \[ e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \]

    add-sqr-sqrt [=>]52.8

    \[ e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \color{blue}{\sqrt{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sqrt{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \]

    sqrt-unprod [=>]69.0

    \[ e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \color{blue}{\sqrt{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right) \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right)}}} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \]

    pow2 [=>]69.0

    \[ e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \sqrt{\color{blue}{{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right)}^{2}}}} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \]

    *-commutative [=>]69.0

    \[ e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \sqrt{{\color{blue}{\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}}^{2}}} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \]
  4. Final simplification69.0%

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

Alternatives

Alternative 1
Accuracy61.1%
Cost58688
\[\begin{array}{l} t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\ e^{t_0 \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\mathsf{fma}\left(t_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \end{array} \]
Alternative 2
Accuracy60.4%
Cost52425
\[\begin{array}{l} t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\ t_1 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_2 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ \mathbf{if}\;y.re \leq -1.1 \cdot 10^{-61} \lor \neg \left(y.re \leq 8.2 \cdot 10^{-22}\right):\\ \;\;\;\;e^{t_0 \cdot y.re - \sqrt{{t_1}^{2}}} \cdot \sin t_2\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin \left(\mathsf{fma}\left(t_0, y.im, t_2\right)\right)}{e^{t_1}}\\ \end{array} \]
Alternative 3
Accuracy60.8%
Cost45832
\[\begin{array}{l} t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\ t_1 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_2 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_3 := e^{t_0 \cdot y.re - t_1}\\ \mathbf{if}\;y.re \leq -1.22 \cdot 10^{-13}:\\ \;\;\;\;t_2 \cdot t_3\\ \mathbf{elif}\;y.re \leq 5 \cdot 10^{-20}:\\ \;\;\;\;\frac{\sin \left(\mathsf{fma}\left(t_0, y.im, t_2\right)\right)}{e^{t_1}}\\ \mathbf{else}:\\ \;\;\;\;t_3 \cdot \sin t_2\\ \end{array} \]
Alternative 4
Accuracy49.6%
Cost39560
\[\begin{array}{l} t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\ t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_2 := e^{t_0 \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{if}\;y.re \leq -1.8 \cdot 10^{-144}:\\ \;\;\;\;t_1 \cdot t_2\\ \mathbf{elif}\;y.re \leq 2 \cdot 10^{-237}:\\ \;\;\;\;\sin \left(\mathsf{fma}\left(t_0, y.im, t_1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_2 \cdot \sin t_1\\ \end{array} \]
Alternative 5
Accuracy49.7%
Cost39560
\[\begin{array}{l} t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\ t_1 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_2 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_3 := e^{t_0 \cdot y.re - t_1}\\ \mathbf{if}\;y.re \leq -1.1 \cdot 10^{-144}:\\ \;\;\;\;t_2 \cdot t_3\\ \mathbf{elif}\;y.re \leq 7.8 \cdot 10^{-239}:\\ \;\;\;\;\frac{\sin \left(\mathsf{fma}\left(t_0, y.im, t_2\right)\right)}{t_1 + 1}\\ \mathbf{else}:\\ \;\;\;\;t_3 \cdot \sin t_2\\ \end{array} \]
Alternative 6
Accuracy49.5%
Cost33161
\[\begin{array}{l} t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\ t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ \mathbf{if}\;y.re \leq -9.5 \cdot 10^{-145} \lor \neg \left(y.re \leq 3.3 \cdot 10^{-239}\right):\\ \;\;\;\;t_1 \cdot e^{t_0 \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\mathsf{fma}\left(t_0, y.im, t_1\right)\right)\\ \end{array} \]
Alternative 7
Accuracy43.5%
Cost33028
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, t_0\right)\right)\\ \mathbf{if}\;y.im \leq -0.19:\\ \;\;\;\;\sin t_0 \cdot e^{y.re \cdot \log \left(-x.im\right) - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{elif}\;y.im \leq -1.95 \cdot 10^{-69}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y.im \leq 3.2 \cdot 10^{-218}:\\ \;\;\;\;t_0 \cdot e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}\\ \mathbf{elif}\;y.im \leq 2.7 \cdot 10^{-62}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y.im \leq 2.7 \cdot 10^{+35}:\\ \;\;\;\;t_0 \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)}\\ \end{array} \]
Alternative 8
Accuracy43.9%
Cost32976
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, t_0\right)\right)\\ t_2 := t_0 \cdot e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)}\\ \mathbf{if}\;y.im \leq -22500000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y.im \leq -6.2 \cdot 10^{-65}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y.im \leq 2.55 \cdot 10^{-216}:\\ \;\;\;\;t_0 \cdot e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}\\ \mathbf{elif}\;y.im \leq 1.15 \cdot 10^{-66}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y.im \leq 8.5 \cdot 10^{+33}:\\ \;\;\;\;t_0 \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 9
Accuracy42.7%
Cost26441
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ \mathbf{if}\;y.im \leq -12000 \lor \neg \left(y.im \leq 5 \cdot 10^{-22}\right):\\ \;\;\;\;t_0 \cdot e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}\\ \end{array} \]
Alternative 10
Accuracy38.3%
Cost20105
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ \mathbf{if}\;y.re \leq -1.35 \cdot 10^{+19} \lor \neg \left(y.re \leq 4.6 \cdot 10^{+58}\right):\\ \;\;\;\;\frac{t_0}{\frac{1}{{x.im}^{y.re}}}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)}\\ \end{array} \]
Alternative 11
Accuracy28.2%
Cost19912
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \sin t_0\\ \mathbf{if}\;y.re \leq -42:\\ \;\;\;\;\frac{t_0}{\frac{1}{{x.im}^{y.re}}}\\ \mathbf{elif}\;y.re \leq 7.6 \cdot 10^{-7}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot {x.im}^{y.re}\\ \end{array} \]
Alternative 12
Accuracy28.2%
Cost13641
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ \mathbf{if}\;y.re \leq -450 \lor \neg \left(y.re \leq 1.6 \cdot 10^{-6}\right):\\ \;\;\;\;\frac{t_0}{\frac{1}{{x.im}^{y.re}}}\\ \mathbf{else}:\\ \;\;\;\;\sin t_0\\ \end{array} \]
Alternative 13
Accuracy13.9%
Cost13056
\[\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
Alternative 14
Accuracy13.8%
Cost6656
\[y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} \]

Error

Reproduce?

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