?

Average Error: 33.3 → 3.5
Time: 31.8s
Precision: binary64
Cost: 84352

?

\[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 - {\left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\right)}^{3}} \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(\mathsf{fma}\left(t_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\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) (pow (cbrt (* (atan2 x.im x.re) y.im)) 3.0)))
    (expm1 (log1p (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) - pow(cbrt((atan2(x_46_im, x_46_re) * y_46_im)), 3.0))) * expm1(log1p(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) - (cbrt(Float64(atan(x_46_im, x_46_re) * y_46_im)) ^ 3.0))) * expm1(log1p(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[Power[N[Power[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(Exp[N[Log[1 + 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]] - 1), $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 - {\left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\right)}^{3}} \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(\mathsf{fma}\left(t_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)\right)
\end{array}

Error?

Derivation?

  1. Initial program 33.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. Simplified3.5

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

    hypot-def [=>]33.3

    \[ e^{\log \color{blue}{\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(\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) \]

    fma-def [=>]33.3

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

    hypot-def [=>]3.5

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

    *-commutative [=>]3.5

    \[ 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, \color{blue}{y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}}\right)\right) \]
  3. Applied egg-rr3.5

    \[\leadsto 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 \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
  4. Applied egg-rr3.5

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

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

Alternatives

Alternative 1
Error3.5
Cost71488
\[\begin{array}{l} t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\ \mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(\mathsf{fma}\left(t_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)\right) \cdot e^{t_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \end{array} \]
Alternative 2
Error3.5
Cost58688
\[\begin{array}{l} t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\ \sin \left(\mathsf{fma}\left(t_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot e^{t_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \end{array} \]
Alternative 3
Error3.7
Cost58628
\[\begin{array}{l} t_0 := \sin \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\ t_1 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\ t_2 := e^{t_1 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{if}\;y.im \leq -0.00024:\\ \;\;\;\;t_2 \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(t_0\right)\right)\\ \mathbf{elif}\;y.im \leq 10^{-23}:\\ \;\;\;\;\frac{\sin \left(\mathsf{fma}\left(t_1, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)}{\frac{1}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\ \mathbf{else}:\\ \;\;\;\;t_2 \cdot t_0\\ \end{array} \]
Alternative 4
Error3.7
Cost45961
\[\begin{array}{l} t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\ \mathbf{if}\;y.im \leq -0.00024 \lor \neg \left(y.im \leq 1.2 \cdot 10^{-23}\right):\\ \;\;\;\;e^{t_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin \left(\mathsf{fma}\left(t_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)}{\frac{1}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\ \end{array} \]
Alternative 5
Error4.5
Cost45896
\[\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 - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{if}\;y.im \leq -18000000000000:\\ \;\;\;\;t_1 \cdot t_2\\ \mathbf{elif}\;y.im \leq 10^{-23}:\\ \;\;\;\;\frac{\sin \left(\mathsf{fma}\left(t_0, y.im, t_1\right)\right)}{\frac{1}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\ \mathbf{else}:\\ \;\;\;\;t_2 \cdot \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\ \end{array} \]
Alternative 6
Error12.3
Cost39692
\[\begin{array}{l} t_0 := \frac{\sin \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}{\frac{1}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\ t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_2 := 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}\\ t_3 := t_1 \cdot t_2\\ \mathbf{if}\;y.im \leq -17500000000000:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y.im \leq -1.4 \cdot 10^{-143}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y.im \leq 9 \cdot 10^{-88}:\\ \;\;\;\;t_2 \cdot \sin t_1\\ \mathbf{elif}\;y.im \leq 800:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 7
Error11.9
Cost39560
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := 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}\\ \mathbf{if}\;y.re \leq -2.15 \cdot 10^{-184}:\\ \;\;\;\;t_1 \cdot \sin t_0\\ \mathbf{elif}\;y.re \leq 9.5 \cdot 10^{-108}:\\ \;\;\;\;t_1 \cdot \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot t_1\\ \end{array} \]
Alternative 8
Error12.2
Cost33424
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := t_0 \cdot 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}\\ t_2 := \frac{1}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}\\ t_3 := \frac{\sin \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}{t_2}\\ \mathbf{if}\;y.im \leq -17500000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y.im \leq -1.9 \cdot 10^{-143}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y.im \leq 9 \cdot 10^{-88}:\\ \;\;\;\;\frac{\sin t_0}{t_2}\\ \mathbf{elif}\;y.im \leq 270:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error20.7
Cost33228
\[\begin{array}{l} t_0 := \frac{1}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}\\ t_1 := \frac{\sin \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}{t_0}\\ t_2 := \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\ \mathbf{if}\;y.im \leq -1.9 \cdot 10^{-143}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y.im \leq 9 \cdot 10^{-88}:\\ \;\;\;\;\frac{t_2}{t_0}\\ \mathbf{elif}\;y.im \leq 8.5 \cdot 10^{+53}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2 \cdot e^{y.re \cdot \log x.im - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \end{array} \]
Alternative 10
Error24.1
Cost26505
\[\begin{array}{l} \mathbf{if}\;y.re \leq -2 \cdot 10^{-187} \lor \neg \left(y.re \leq 4.5 \cdot 10^{-160}\right):\\ \;\;\;\;\frac{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}{\frac{1}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)\\ \end{array} \]
Alternative 11
Error37.3
Cost26185
\[\begin{array}{l} \mathbf{if}\;y.re \leq -550 \lor \neg \left(y.re \leq 1.4 \cdot 10^{+31}\right):\\ \;\;\;\;\sin \left(\mathsf{log1p}\left({\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.im} + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)\\ \end{array} \]
Alternative 12
Error47.8
Cost19456
\[\sin \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right) \]
Alternative 13
Error53.1
Cost13320
\[\begin{array}{l} \mathbf{if}\;x.re \leq -2.1 \cdot 10^{-88}:\\ \;\;\;\;\sin \left(y.im \cdot \log \left(-x.re\right)\right)\\ \mathbf{elif}\;x.re \leq 3.5 \cdot 10^{-64}:\\ \;\;\;\;\sin \left(y.im \cdot \log \left(-x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(y.im \cdot \log x.re\right)\\ \end{array} \]
Alternative 14
Error53.6
Cost13256
\[\begin{array}{l} \mathbf{if}\;x.im \leq -1.5 \cdot 10^{-160}:\\ \;\;\;\;\sin \left(y.im \cdot \log \left(-x.im\right)\right)\\ \mathbf{elif}\;x.im \leq 8.8 \cdot 10^{-180}:\\ \;\;\;\;\sin \left(y.im \cdot \log x.re\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(y.im \cdot \log x.im\right)\\ \end{array} \]
Alternative 15
Error54.9
Cost13124
\[\begin{array}{l} \mathbf{if}\;x.re \leq 4 \cdot 10^{-176}:\\ \;\;\;\;\sin \left(y.im \cdot \log x.im\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(y.im \cdot \log x.re\right)\\ \end{array} \]
Alternative 16
Error48.5
Cost13056
\[\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im \]
Alternative 17
Error59.5
Cost12992
\[\sin \left(y.im \cdot \log x.im\right) \]

Error

Reproduce?

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