| Alternative 1 | |
|---|---|
| Accuracy | 80.5% |
| Cost | 84680 |

(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)))
(t_1 (exp (- (* t_0 y.re) (* y.im (atan2 x.im x.re)))))
(t_2 (fma t_0 y.im (* y.re (atan2 x.im x.re)))))
(if (<= y.im -1.8e+15)
(*
t_1
(sin
(fabs (fma (atan2 x.im x.re) y.re (* y.im (log (hypot x.im x.re)))))))
(if (<= y.im 6.4e+27)
(* t_1 (sin t_2))
(* t_1 (sin (pow (sqrt (pow (cbrt t_2) 2.0)) 3.0)))))))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));
double t_1 = exp(((t_0 * y_46_re) - (y_46_im * atan2(x_46_im, x_46_re))));
double t_2 = fma(t_0, y_46_im, (y_46_re * atan2(x_46_im, x_46_re)));
double tmp;
if (y_46_im <= -1.8e+15) {
tmp = t_1 * sin(fabs(fma(atan2(x_46_im, x_46_re), y_46_re, (y_46_im * log(hypot(x_46_im, x_46_re))))));
} else if (y_46_im <= 6.4e+27) {
tmp = t_1 * sin(t_2);
} else {
tmp = t_1 * sin(pow(sqrt(pow(cbrt(t_2), 2.0)), 3.0));
}
return tmp;
}
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)) t_1 = exp(Float64(Float64(t_0 * y_46_re) - Float64(y_46_im * atan(x_46_im, x_46_re)))) t_2 = fma(t_0, y_46_im, Float64(y_46_re * atan(x_46_im, x_46_re))) tmp = 0.0 if (y_46_im <= -1.8e+15) tmp = Float64(t_1 * sin(abs(fma(atan(x_46_im, x_46_re), y_46_re, Float64(y_46_im * log(hypot(x_46_im, x_46_re))))))); elseif (y_46_im <= 6.4e+27) tmp = Float64(t_1 * sin(t_2)); else tmp = Float64(t_1 * sin((sqrt((cbrt(t_2) ^ 2.0)) ^ 3.0))); end return tmp 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]}, Block[{t$95$1 = N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * y$46$im + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -1.8e+15], N[(t$95$1 * N[Sin[N[Abs[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re + N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 6.4e+27], N[(t$95$1 * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Sin[N[Power[N[Sqrt[N[Power[N[Power[t$95$2, 1/3], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], 3.0], $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)\\
t_1 := e^{t_0 \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
t_2 := \mathsf{fma}\left(t_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{if}\;y.im \leq -1.8 \cdot 10^{+15}:\\
\;\;\;\;t_1 \cdot \sin \left(\left|\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\right|\right)\\
\mathbf{elif}\;y.im \leq 6.4 \cdot 10^{+27}:\\
\;\;\;\;t_1 \cdot \sin t_2\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \sin \left({\left(\sqrt{{\left(\sqrt[3]{t_2}\right)}^{2}}\right)}^{3}\right)\\
\end{array}
Herbie found 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
if y.im < -1.8e15Initial program 26.3%
Simplified65.0%
[Start]26.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)
\] |
|---|
Applied egg-rr30.4%
[Start]65.0% | \[ 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)
\] |
|---|---|
fma-udef [=>]65.0% | \[ 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(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}
\] |
hypot-udef [=>]26.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 \left(\log \color{blue}{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)} \cdot y.im + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)
\] |
*-commutative [<=]26.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 \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \color{blue}{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re}\right)
\] |
add-sqr-sqrt [=>]10.7% | \[ 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(\sqrt{\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} \cdot \sqrt{\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)}
\] |
sqrt-unprod [=>]13.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} \cdot \sin \color{blue}{\left(\sqrt{\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) \cdot \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)}\right)}
\] |
pow2 [=>]13.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} \cdot \sin \left(\sqrt{\color{blue}{{\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}}}\right)
\] |
fma-def [=>]13.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} \cdot \sin \left(\sqrt{{\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)}}^{2}}\right)
\] |
hypot-udef [<=]30.4% | \[ 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(\sqrt{{\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)}^{2}}\right)
\] |
Simplified77.9%
[Start]30.4% | \[ 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(\sqrt{{\left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}^{2}}\right)
\] |
|---|---|
unpow2 [=>]30.4% | \[ 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(\sqrt{\color{blue}{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot \mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)}}\right)
\] |
rem-sqrt-square [=>]77.9% | \[ 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(\left|\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right|\right)}
\] |
fma-def [<=]77.9% | \[ 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(\left|\color{blue}{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re}\right|\right)
\] |
+-commutative [=>]77.9% | \[ 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(\left|\color{blue}{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im}\right|\right)
\] |
fma-def [=>]77.9% | \[ 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(\left|\color{blue}{\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)}\right|\right)
\] |
hypot-def [<=]30.7% | \[ 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(\left|\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \log \color{blue}{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)} \cdot y.im\right)\right|\right)
\] |
unpow2 [<=]30.7% | \[ 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(\left|\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \log \left(\sqrt{\color{blue}{{x.re}^{2}} + x.im \cdot x.im}\right) \cdot y.im\right)\right|\right)
\] |
unpow2 [<=]30.7% | \[ 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(\left|\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \log \left(\sqrt{{x.re}^{2} + \color{blue}{{x.im}^{2}}}\right) \cdot y.im\right)\right|\right)
\] |
+-commutative [<=]30.7% | \[ 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(\left|\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \log \left(\sqrt{\color{blue}{{x.im}^{2} + {x.re}^{2}}}\right) \cdot y.im\right)\right|\right)
\] |
*-commutative [<=]30.7% | \[ 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(\left|\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \color{blue}{y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}\right)\right|\right)
\] |
unpow2 [=>]30.7% | \[ 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(\left|\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, y.im \cdot \log \left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right)\right)\right|\right)
\] |
unpow2 [=>]30.7% | \[ 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(\left|\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, y.im \cdot \log \left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right)\right)\right|\right)
\] |
hypot-def [=>]77.9% | \[ 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(\left|\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, y.im \cdot \log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}\right)\right|\right)
\] |
if -1.8e15 < y.im < 6.4000000000000003e27Initial program 52.9%
Simplified93.3%
[Start]52.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)
\] |
|---|
if 6.4000000000000003e27 < y.im Initial program 30.7%
Simplified64.6%
[Start]30.7% | \[ 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)
\] |
|---|
Applied egg-rr71.6%
[Start]64.6% | \[ 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)
\] |
|---|---|
fma-udef [=>]64.6% | \[ 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(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}
\] |
hypot-udef [=>]30.7% | \[ 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(\log \color{blue}{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)} \cdot y.im + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)
\] |
*-commutative [<=]30.7% | \[ 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(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \color{blue}{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re}\right)
\] |
add-cube-cbrt [=>]32.6% | \[ 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(\left(\sqrt[3]{\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} \cdot \sqrt[3]{\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) \cdot \sqrt[3]{\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)}
\] |
pow3 [=>]34.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} \cdot \sin \color{blue}{\left({\left(\sqrt[3]{\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}\right)}
\] |
hypot-udef [<=]71.6% | \[ 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({\left(\sqrt[3]{\log \color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re}\right)}^{3}\right)
\] |
*-commutative [=>]71.6% | \[ 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({\left(\sqrt[3]{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im + \color{blue}{y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}}}\right)}^{3}\right)
\] |
fma-udef [<=]71.6% | \[ 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({\left(\sqrt[3]{\color{blue}{\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)}^{3}\right)
\] |
*-commutative [<=]71.6% | \[ 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({\left(\sqrt[3]{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \color{blue}{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re}\right)}\right)}^{3}\right)
\] |
Applied egg-rr79.7%
[Start]71.6% | \[ 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({\left(\sqrt[3]{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)}\right)}^{3}\right)
\] |
|---|---|
add-sqr-sqrt [=>]50.6% | \[ 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({\color{blue}{\left(\sqrt{\sqrt[3]{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)}} \cdot \sqrt{\sqrt[3]{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)}}\right)}}^{3}\right)
\] |
sqrt-unprod [=>]79.7% | \[ 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({\color{blue}{\left(\sqrt{\sqrt[3]{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)}}\right)}}^{3}\right)
\] |
pow2 [=>]79.7% | \[ 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({\left(\sqrt{\color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)}\right)}^{2}}}\right)}^{3}\right)
\] |
Final simplification86.5%
| Alternative 1 | |
|---|---|
| Accuracy | 80.5% |
| Cost | 84680 |
| Alternative 2 | |
|---|---|
| Accuracy | 80.5% |
| Cost | 78280 |
| Alternative 3 | |
|---|---|
| Accuracy | 80.4% |
| Cost | 65220 |
| Alternative 4 | |
|---|---|
| Accuracy | 80.4% |
| Cost | 58953 |
| Alternative 5 | |
|---|---|
| Accuracy | 78.8% |
| Cost | 45897 |
| Alternative 6 | |
|---|---|
| Accuracy | 78.2% |
| Cost | 45896 |
| Alternative 7 | |
|---|---|
| Accuracy | 78.8% |
| Cost | 45833 |
| Alternative 8 | |
|---|---|
| Accuracy | 78.9% |
| Cost | 45769 |
| Alternative 9 | |
|---|---|
| Accuracy | 65.3% |
| Cost | 39881 |
| Alternative 10 | |
|---|---|
| Accuracy | 60.1% |
| Cost | 39761 |
| Alternative 11 | |
|---|---|
| Accuracy | 60.6% |
| Cost | 39628 |
| Alternative 12 | |
|---|---|
| Accuracy | 64.4% |
| Cost | 39561 |
| Alternative 13 | |
|---|---|
| Accuracy | 57.1% |
| Cost | 33164 |
| Alternative 14 | |
|---|---|
| Accuracy | 59.7% |
| Cost | 26377 |
| Alternative 15 | |
|---|---|
| Accuracy | 33.0% |
| Cost | 19849 |
| Alternative 16 | |
|---|---|
| Accuracy | 40.0% |
| Cost | 19840 |
| Alternative 17 | |
|---|---|
| Accuracy | 40.2% |
| Cost | 19840 |
| Alternative 18 | |
|---|---|
| Accuracy | 27.2% |
| Cost | 19785 |
| Alternative 19 | |
|---|---|
| Accuracy | 22.7% |
| Cost | 19456 |
| Alternative 20 | |
|---|---|
| Accuracy | 13.8% |
| Cost | 6656 |
herbie shell --seed 2023178
(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)))))