| Alternative 1 | |
|---|---|
| Accuracy | 85.3% |
| Cost | 20168 |
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ 1.0 (hypot y.re y.im)))
(t_1 (/ x.im (/ (hypot y.re y.im) y.im))))
(if (<= y.re -1.9e+125)
(* (+ x.re (/ y.im (/ y.re x.im))) (/ -1.0 (hypot y.re y.im)))
(if (<= y.re 1e+94)
(* t_0 (+ t_1 (/ (* y.re x.re) (hypot y.re y.im))))
(* t_0 (+ x.re t_1))))))double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = 1.0 / hypot(y_46_re, y_46_im);
double t_1 = x_46_im / (hypot(y_46_re, y_46_im) / y_46_im);
double tmp;
if (y_46_re <= -1.9e+125) {
tmp = (x_46_re + (y_46_im / (y_46_re / x_46_im))) * (-1.0 / hypot(y_46_re, y_46_im));
} else if (y_46_re <= 1e+94) {
tmp = t_0 * (t_1 + ((y_46_re * x_46_re) / hypot(y_46_re, y_46_im)));
} else {
tmp = t_0 * (x_46_re + t_1);
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = 1.0 / Math.hypot(y_46_re, y_46_im);
double t_1 = x_46_im / (Math.hypot(y_46_re, y_46_im) / y_46_im);
double tmp;
if (y_46_re <= -1.9e+125) {
tmp = (x_46_re + (y_46_im / (y_46_re / x_46_im))) * (-1.0 / Math.hypot(y_46_re, y_46_im));
} else if (y_46_re <= 1e+94) {
tmp = t_0 * (t_1 + ((y_46_re * x_46_re) / Math.hypot(y_46_re, y_46_im)));
} else {
tmp = t_0 * (x_46_re + t_1);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = 1.0 / math.hypot(y_46_re, y_46_im) t_1 = x_46_im / (math.hypot(y_46_re, y_46_im) / y_46_im) tmp = 0 if y_46_re <= -1.9e+125: tmp = (x_46_re + (y_46_im / (y_46_re / x_46_im))) * (-1.0 / math.hypot(y_46_re, y_46_im)) elif y_46_re <= 1e+94: tmp = t_0 * (t_1 + ((y_46_re * x_46_re) / math.hypot(y_46_re, y_46_im))) else: tmp = t_0 * (x_46_re + t_1) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(Float64(Float64(x_46_re * y_46_re) + Float64(x_46_im * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))) end
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(1.0 / hypot(y_46_re, y_46_im)) t_1 = Float64(x_46_im / Float64(hypot(y_46_re, y_46_im) / y_46_im)) tmp = 0.0 if (y_46_re <= -1.9e+125) tmp = Float64(Float64(x_46_re + Float64(y_46_im / Float64(y_46_re / x_46_im))) * Float64(-1.0 / hypot(y_46_re, y_46_im))); elseif (y_46_re <= 1e+94) tmp = Float64(t_0 * Float64(t_1 + Float64(Float64(y_46_re * x_46_re) / hypot(y_46_re, y_46_im)))); else tmp = Float64(t_0 * Float64(x_46_re + t_1)); end return tmp end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = 1.0 / hypot(y_46_re, y_46_im); t_1 = x_46_im / (hypot(y_46_re, y_46_im) / y_46_im); tmp = 0.0; if (y_46_re <= -1.9e+125) tmp = (x_46_re + (y_46_im / (y_46_re / x_46_im))) * (-1.0 / hypot(y_46_re, y_46_im)); elseif (y_46_re <= 1e+94) tmp = t_0 * (t_1 + ((y_46_re * x_46_re) / hypot(y_46_re, y_46_im))); else tmp = t_0 * (x_46_re + t_1); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[(x$46$re * y$46$re), $MachinePrecision] + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x$46$im / N[(N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -1.9e+125], N[(N[(x$46$re + N[(y$46$im / N[(y$46$re / x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 1e+94], N[(t$95$0 * N[(t$95$1 + N[(N[(y$46$re * x$46$re), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(x$46$re + t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\begin{array}{l}
t_0 := \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}\\
t_1 := \frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.im}}\\
\mathbf{if}\;y.re \leq -1.9 \cdot 10^{+125}:\\
\;\;\;\;\left(x.re + \frac{y.im}{\frac{y.re}{x.im}}\right) \cdot \frac{-1}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{elif}\;y.re \leq 10^{+94}:\\
\;\;\;\;t_0 \cdot \left(t_1 + \frac{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(x.re + t_1\right)\\
\end{array}
Results
if y.re < -1.90000000000000001e125Initial program 35.0%
Applied egg-rr55.9%
[Start]35.0 | \[ \frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\] |
|---|---|
*-un-lft-identity [=>]35.0 | \[ \frac{\color{blue}{1 \cdot \left(x.re \cdot y.re + x.im \cdot y.im\right)}}{y.re \cdot y.re + y.im \cdot y.im}
\] |
add-sqr-sqrt [=>]35.0 | \[ \frac{1 \cdot \left(x.re \cdot y.re + x.im \cdot y.im\right)}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}
\] |
times-frac [=>]35.0 | \[ \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.re \cdot y.re + x.im \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}
\] |
hypot-def [=>]35.0 | \[ \frac{1}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot \frac{x.re \cdot y.re + x.im \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}
\] |
fma-def [=>]35.0 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\color{blue}{\mathsf{fma}\left(x.re, y.re, x.im \cdot y.im\right)}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}
\] |
hypot-def [=>]55.9 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\mathsf{fma}\left(x.re, y.re, x.im \cdot y.im\right)}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}
\] |
Taylor expanded in y.re around -inf 81.6%
Simplified88.4%
[Start]81.6 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(-1 \cdot \frac{y.im \cdot x.im}{y.re} + -1 \cdot x.re\right)
\] |
|---|---|
distribute-lft-out [=>]81.6 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(-1 \cdot \left(\frac{y.im \cdot x.im}{y.re} + x.re\right)\right)}
\] |
+-commutative [<=]81.6 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(-1 \cdot \color{blue}{\left(x.re + \frac{y.im \cdot x.im}{y.re}\right)}\right)
\] |
associate-/l* [=>]88.4 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(-1 \cdot \left(x.re + \color{blue}{\frac{y.im}{\frac{y.re}{x.im}}}\right)\right)
\] |
if -1.90000000000000001e125 < y.re < 1e94Initial program 71.5%
Applied egg-rr81.4%
[Start]71.5 | \[ \frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\] |
|---|---|
*-un-lft-identity [=>]71.5 | \[ \frac{\color{blue}{1 \cdot \left(x.re \cdot y.re + x.im \cdot y.im\right)}}{y.re \cdot y.re + y.im \cdot y.im}
\] |
add-sqr-sqrt [=>]71.5 | \[ \frac{1 \cdot \left(x.re \cdot y.re + x.im \cdot y.im\right)}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}
\] |
times-frac [=>]71.5 | \[ \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.re \cdot y.re + x.im \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}
\] |
hypot-def [=>]71.5 | \[ \frac{1}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot \frac{x.re \cdot y.re + x.im \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}
\] |
fma-def [=>]71.5 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\color{blue}{\mathsf{fma}\left(x.re, y.re, x.im \cdot y.im\right)}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}
\] |
hypot-def [=>]81.4 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\mathsf{fma}\left(x.re, y.re, x.im \cdot y.im\right)}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}
\] |
Applied egg-rr81.4%
[Start]81.4 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\mathsf{fma}\left(x.re, y.re, x.im \cdot y.im\right)}{\mathsf{hypot}\left(y.re, y.im\right)}
\] |
|---|---|
div-inv [=>]81.2 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\mathsf{fma}\left(x.re, y.re, x.im \cdot y.im\right) \cdot \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}\right)}
\] |
*-commutative [<=]81.2 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \mathsf{fma}\left(x.re, y.re, x.im \cdot y.im\right)\right)}
\] |
fma-udef [=>]81.2 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(x.re \cdot y.re + x.im \cdot y.im\right)}\right)
\] |
distribute-lft-in [=>]81.2 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(x.re \cdot y.re\right) + \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(x.im \cdot y.im\right)\right)}
\] |
associate-*l/ [=>]81.3 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\color{blue}{\frac{1 \cdot \left(x.re \cdot y.re\right)}{\mathsf{hypot}\left(y.re, y.im\right)}} + \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(x.im \cdot y.im\right)\right)
\] |
*-un-lft-identity [<=]81.3 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\frac{\color{blue}{x.re \cdot y.re}}{\mathsf{hypot}\left(y.re, y.im\right)} + \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(x.im \cdot y.im\right)\right)
\] |
associate-*l/ [=>]81.4 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\frac{x.re \cdot y.re}{\mathsf{hypot}\left(y.re, y.im\right)} + \color{blue}{\frac{1 \cdot \left(x.im \cdot y.im\right)}{\mathsf{hypot}\left(y.re, y.im\right)}}\right)
\] |
*-un-lft-identity [<=]81.4 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\frac{x.re \cdot y.re}{\mathsf{hypot}\left(y.re, y.im\right)} + \frac{\color{blue}{x.im \cdot y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)
\] |
Simplified95.2%
[Start]81.4 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\frac{x.re \cdot y.re}{\mathsf{hypot}\left(y.re, y.im\right)} + \frac{x.im \cdot y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)
\] |
|---|---|
+-commutative [=>]81.4 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\frac{x.im \cdot y.im}{\mathsf{hypot}\left(y.re, y.im\right)} + \frac{x.re \cdot y.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)}
\] |
associate-/l* [=>]95.2 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\color{blue}{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.im}}} + \frac{x.re \cdot y.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)
\] |
*-commutative [=>]95.2 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.im}} + \frac{\color{blue}{y.re \cdot x.re}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)
\] |
if 1e94 < y.re Initial program 40.8%
Applied egg-rr61.1%
[Start]40.8 | \[ \frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\] |
|---|---|
*-un-lft-identity [=>]40.8 | \[ \frac{\color{blue}{1 \cdot \left(x.re \cdot y.re + x.im \cdot y.im\right)}}{y.re \cdot y.re + y.im \cdot y.im}
\] |
add-sqr-sqrt [=>]40.8 | \[ \frac{1 \cdot \left(x.re \cdot y.re + x.im \cdot y.im\right)}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}
\] |
times-frac [=>]40.8 | \[ \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.re \cdot y.re + x.im \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}
\] |
hypot-def [=>]40.8 | \[ \frac{1}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot \frac{x.re \cdot y.re + x.im \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}
\] |
fma-def [=>]40.8 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\color{blue}{\mathsf{fma}\left(x.re, y.re, x.im \cdot y.im\right)}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}
\] |
hypot-def [=>]61.1 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\mathsf{fma}\left(x.re, y.re, x.im \cdot y.im\right)}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}
\] |
Applied egg-rr61.1%
[Start]61.1 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\mathsf{fma}\left(x.re, y.re, x.im \cdot y.im\right)}{\mathsf{hypot}\left(y.re, y.im\right)}
\] |
|---|---|
div-inv [=>]61.0 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\mathsf{fma}\left(x.re, y.re, x.im \cdot y.im\right) \cdot \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}\right)}
\] |
*-commutative [<=]61.0 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \mathsf{fma}\left(x.re, y.re, x.im \cdot y.im\right)\right)}
\] |
fma-udef [=>]61.0 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(x.re \cdot y.re + x.im \cdot y.im\right)}\right)
\] |
distribute-lft-in [=>]61.0 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(x.re \cdot y.re\right) + \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(x.im \cdot y.im\right)\right)}
\] |
associate-*l/ [=>]61.0 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\color{blue}{\frac{1 \cdot \left(x.re \cdot y.re\right)}{\mathsf{hypot}\left(y.re, y.im\right)}} + \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(x.im \cdot y.im\right)\right)
\] |
*-un-lft-identity [<=]61.0 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\frac{\color{blue}{x.re \cdot y.re}}{\mathsf{hypot}\left(y.re, y.im\right)} + \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(x.im \cdot y.im\right)\right)
\] |
associate-*l/ [=>]61.1 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\frac{x.re \cdot y.re}{\mathsf{hypot}\left(y.re, y.im\right)} + \color{blue}{\frac{1 \cdot \left(x.im \cdot y.im\right)}{\mathsf{hypot}\left(y.re, y.im\right)}}\right)
\] |
*-un-lft-identity [<=]61.1 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\frac{x.re \cdot y.re}{\mathsf{hypot}\left(y.re, y.im\right)} + \frac{\color{blue}{x.im \cdot y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)
\] |
Simplified68.8%
[Start]61.1 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\frac{x.re \cdot y.re}{\mathsf{hypot}\left(y.re, y.im\right)} + \frac{x.im \cdot y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)
\] |
|---|---|
+-commutative [=>]61.1 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\frac{x.im \cdot y.im}{\mathsf{hypot}\left(y.re, y.im\right)} + \frac{x.re \cdot y.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)}
\] |
associate-/l* [=>]68.8 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\color{blue}{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.im}}} + \frac{x.re \cdot y.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)
\] |
*-commutative [=>]68.8 | \[ \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.im}} + \frac{\color{blue}{y.re \cdot x.re}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)
\] |
Taylor expanded in y.re around inf 92.4%
Final simplification93.7%
| Alternative 1 | |
|---|---|
| Accuracy | 85.3% |
| Cost | 20168 |
| Alternative 2 | |
|---|---|
| Accuracy | 82.9% |
| Cost | 14028 |
| Alternative 3 | |
|---|---|
| Accuracy | 80.3% |
| Cost | 13904 |
| Alternative 4 | |
|---|---|
| Accuracy | 81.2% |
| Cost | 7300 |
| Alternative 5 | |
|---|---|
| Accuracy | 81.0% |
| Cost | 2000 |
| Alternative 6 | |
|---|---|
| Accuracy | 78.4% |
| Cost | 1884 |
| Alternative 7 | |
|---|---|
| Accuracy | 71.7% |
| Cost | 1234 |
| Alternative 8 | |
|---|---|
| Accuracy | 74.7% |
| Cost | 1234 |
| Alternative 9 | |
|---|---|
| Accuracy | 68.6% |
| Cost | 1233 |
| Alternative 10 | |
|---|---|
| Accuracy | 69.0% |
| Cost | 1233 |
| Alternative 11 | |
|---|---|
| Accuracy | 74.8% |
| Cost | 1232 |
| Alternative 12 | |
|---|---|
| Accuracy | 75.0% |
| Cost | 1232 |
| Alternative 13 | |
|---|---|
| Accuracy | 41.0% |
| Cost | 456 |
| Alternative 14 | |
|---|---|
| Accuracy | 64.0% |
| Cost | 456 |
| Alternative 15 | |
|---|---|
| Accuracy | 40.7% |
| Cost | 192 |
herbie shell --seed 2023133
(FPCore (x.re x.im y.re y.im)
:name "_divideComplex, real part"
:precision binary64
(/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))