| Alternative 1 | |
|---|---|
| Accuracy | 81.7% |
| Cost | 21088 |
(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 (/ y.im (hypot y.re y.im))))
(if (<= y.re -1.25e+119)
(/ (fma -1.0 (* (/ y.im y.re) x.im) (- x.re)) (hypot y.re y.im))
(if (<= y.re 300000.0)
(/ (fma x.im t_0 (/ (* y.re x.re) (hypot y.re y.im))) (hypot y.re y.im))
(/ (fma x.im t_0 x.re) (hypot y.re y.im))))))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 = y_46_im / hypot(y_46_re, y_46_im);
double tmp;
if (y_46_re <= -1.25e+119) {
tmp = fma(-1.0, ((y_46_im / y_46_re) * x_46_im), -x_46_re) / hypot(y_46_re, y_46_im);
} else if (y_46_re <= 300000.0) {
tmp = fma(x_46_im, t_0, ((y_46_re * x_46_re) / hypot(y_46_re, y_46_im))) / hypot(y_46_re, y_46_im);
} else {
tmp = fma(x_46_im, t_0, x_46_re) / hypot(y_46_re, y_46_im);
}
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(y_46_im / hypot(y_46_re, y_46_im)) tmp = 0.0 if (y_46_re <= -1.25e+119) tmp = Float64(fma(-1.0, Float64(Float64(y_46_im / y_46_re) * x_46_im), Float64(-x_46_re)) / hypot(y_46_re, y_46_im)); elseif (y_46_re <= 300000.0) tmp = Float64(fma(x_46_im, t_0, Float64(Float64(y_46_re * x_46_re) / hypot(y_46_re, y_46_im))) / hypot(y_46_re, y_46_im)); else tmp = Float64(fma(x_46_im, t_0, x_46_re) / hypot(y_46_re, y_46_im)); end return 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[(y$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -1.25e+119], N[(N[(-1.0 * N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$im), $MachinePrecision] + (-x$46$re)), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 300000.0], N[(N[(x$46$im * t$95$0 + N[(N[(y$46$re * x$46$re), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im * t$95$0 + x$46$re), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $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{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{if}\;y.re \leq -1.25 \cdot 10^{+119}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, \frac{y.im}{y.re} \cdot x.im, -x.re\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{elif}\;y.re \leq 300000:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, t_0, \frac{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, t_0, x.re\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\end{array}
if y.re < -1.25e119Initial program 35.8%
Applied egg-rr56.7%
[Start]35.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 [=>]35.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 [=>]35.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 [=>]35.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 [=>]35.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 [=>]35.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 [=>]56.7 | \[ \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-rr56.7%
[Start]56.7 | \[ \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 [=>]56.6 | \[ \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 [<=]56.6 | \[ \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 [=>]56.6 | \[ \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 [=>]56.6 | \[ \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/ [=>]56.7 | \[ \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 [<=]56.7 | \[ \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/ [=>]56.7 | \[ \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 [<=]56.7 | \[ \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)
\] |
Simplified64.1%
[Start]56.7 | \[ \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 [<=]56.7 | \[ \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* [=>]64.1 | \[ \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 [=>]64.1 | \[ \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)
\] |
Applied egg-rr37.0%
[Start]64.1 | \[ \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{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)
\] |
|---|---|
expm1-log1p-u [=>]63.0 | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right)\right)}
\] |
expm1-udef [=>]28.8 | \[ \color{blue}{e^{\mathsf{log1p}\left(\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{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right)} - 1}
\] |
associate-/r/ [<=]28.8 | \[ e^{\mathsf{log1p}\left(\color{blue}{\frac{1}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.im}} + \frac{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}}}\right)} - 1
\] |
clear-num [<=]28.8 | \[ e^{\mathsf{log1p}\left(\color{blue}{\frac{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.im}} + \frac{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}}\right)} - 1
\] |
div-inv [=>]28.8 | \[ e^{\mathsf{log1p}\left(\frac{\color{blue}{x.im \cdot \frac{1}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.im}}} + \frac{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} - 1
\] |
fma-def [=>]28.8 | \[ e^{\mathsf{log1p}\left(\frac{\color{blue}{\mathsf{fma}\left(x.im, \frac{1}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.im}}, \frac{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} - 1
\] |
clear-num [<=]28.8 | \[ e^{\mathsf{log1p}\left(\frac{\mathsf{fma}\left(x.im, \color{blue}{\frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}}, \frac{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} - 1
\] |
*-commutative [=>]28.8 | \[ e^{\mathsf{log1p}\left(\frac{\mathsf{fma}\left(x.im, \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{\color{blue}{x.re \cdot y.re}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} - 1
\] |
associate-/l* [=>]37.0 | \[ e^{\mathsf{log1p}\left(\frac{\mathsf{fma}\left(x.im, \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.re}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} - 1
\] |
Simplified64.2%
[Start]37.0 | \[ e^{\mathsf{log1p}\left(\frac{\mathsf{fma}\left(x.im, \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.re}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} - 1
\] |
|---|---|
expm1-def [=>]90.4 | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left(x.im, \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.re}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right)}
\] |
expm1-log1p [=>]99.2 | \[ \color{blue}{\frac{\mathsf{fma}\left(x.im, \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.re}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}}
\] |
associate-/r/ [=>]99.2 | \[ \frac{\mathsf{fma}\left(x.im, \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot y.re}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}
\] |
associate-*l/ [=>]64.2 | \[ \frac{\mathsf{fma}\left(x.im, \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.re \cdot y.re}{\mathsf{hypot}\left(y.re, y.im\right)}}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}
\] |
Taylor expanded in y.re around -inf 79.9%
Simplified85.5%
[Start]79.9 | \[ \frac{-1 \cdot \frac{y.im \cdot x.im}{y.re} + -1 \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}
\] |
|---|---|
fma-def [=>]79.9 | \[ \frac{\color{blue}{\mathsf{fma}\left(-1, \frac{y.im \cdot x.im}{y.re}, -1 \cdot x.re\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}
\] |
associate-/l* [=>]86.2 | \[ \frac{\mathsf{fma}\left(-1, \color{blue}{\frac{y.im}{\frac{y.re}{x.im}}}, -1 \cdot x.re\right)}{\mathsf{hypot}\left(y.re, y.im\right)}
\] |
associate-/r/ [=>]85.5 | \[ \frac{\mathsf{fma}\left(-1, \color{blue}{\frac{y.im}{y.re} \cdot x.im}, -1 \cdot x.re\right)}{\mathsf{hypot}\left(y.re, y.im\right)}
\] |
mul-1-neg [=>]85.5 | \[ \frac{\mathsf{fma}\left(-1, \frac{y.im}{y.re} \cdot x.im, \color{blue}{-x.re}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}
\] |
if -1.25e119 < y.re < 3e5Initial program 71.7%
Applied egg-rr82.7%
[Start]71.7 | \[ \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.7 | \[ \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.7 | \[ \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.7 | \[ \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.7 | \[ \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.7 | \[ \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 [=>]82.7 | \[ \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-rr82.7%
[Start]82.7 | \[ \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 [=>]82.5 | \[ \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 [<=]82.5 | \[ \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 [=>]82.5 | \[ \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 [=>]82.5 | \[ \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/ [=>]82.6 | \[ \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 [<=]82.6 | \[ \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/ [=>]82.7 | \[ \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 [<=]82.7 | \[ \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)
\] |
Simplified96.4%
[Start]82.7 | \[ \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 [<=]82.7 | \[ \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* [=>]96.4 | \[ \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 [=>]96.4 | \[ \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)
\] |
Applied egg-rr36.3%
[Start]96.4 | \[ \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{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)
\] |
|---|---|
expm1-log1p-u [=>]71.6 | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right)\right)}
\] |
expm1-udef [=>]35.5 | \[ \color{blue}{e^{\mathsf{log1p}\left(\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{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right)} - 1}
\] |
associate-/r/ [<=]35.5 | \[ e^{\mathsf{log1p}\left(\color{blue}{\frac{1}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.im}} + \frac{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}}}\right)} - 1
\] |
clear-num [<=]35.5 | \[ e^{\mathsf{log1p}\left(\color{blue}{\frac{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.im}} + \frac{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}}\right)} - 1
\] |
div-inv [=>]35.5 | \[ e^{\mathsf{log1p}\left(\frac{\color{blue}{x.im \cdot \frac{1}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.im}}} + \frac{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} - 1
\] |
fma-def [=>]35.5 | \[ e^{\mathsf{log1p}\left(\frac{\color{blue}{\mathsf{fma}\left(x.im, \frac{1}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.im}}, \frac{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} - 1
\] |
clear-num [<=]35.5 | \[ e^{\mathsf{log1p}\left(\frac{\mathsf{fma}\left(x.im, \color{blue}{\frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}}, \frac{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} - 1
\] |
*-commutative [=>]35.5 | \[ e^{\mathsf{log1p}\left(\frac{\mathsf{fma}\left(x.im, \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{\color{blue}{x.re \cdot y.re}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} - 1
\] |
associate-/l* [=>]36.3 | \[ e^{\mathsf{log1p}\left(\frac{\mathsf{fma}\left(x.im, \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.re}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} - 1
\] |
Simplified96.7%
[Start]36.3 | \[ e^{\mathsf{log1p}\left(\frac{\mathsf{fma}\left(x.im, \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.re}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} - 1
\] |
|---|---|
expm1-def [=>]73.2 | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left(x.im, \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.re}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right)}
\] |
expm1-log1p [=>]99.2 | \[ \color{blue}{\frac{\mathsf{fma}\left(x.im, \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.re}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}}
\] |
associate-/r/ [=>]98.3 | \[ \frac{\mathsf{fma}\left(x.im, \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot y.re}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}
\] |
associate-*l/ [=>]96.7 | \[ \frac{\mathsf{fma}\left(x.im, \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.re \cdot y.re}{\mathsf{hypot}\left(y.re, y.im\right)}}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}
\] |
if 3e5 < y.re Initial program 48.6%
Applied egg-rr65.1%
[Start]48.6 | \[ \frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\] |
|---|---|
*-un-lft-identity [=>]48.6 | \[ \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 [=>]48.6 | \[ \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 [=>]48.6 | \[ \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 [=>]48.6 | \[ \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 [=>]48.6 | \[ \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 [=>]65.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-rr65.1%
[Start]65.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 [=>]65.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 [<=]65.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 [=>]65.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 [=>]65.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/ [=>]65.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 [<=]65.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/ [=>]65.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 [<=]65.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)
\] |
Simplified73.9%
[Start]65.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 [<=]65.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* [=>]73.9 | \[ \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 [=>]73.9 | \[ \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)
\] |
Applied egg-rr34.4%
[Start]73.9 | \[ \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{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)
\] |
|---|---|
expm1-log1p-u [=>]66.7 | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right)\right)}
\] |
expm1-udef [=>]27.5 | \[ \color{blue}{e^{\mathsf{log1p}\left(\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{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right)} - 1}
\] |
associate-/r/ [<=]27.5 | \[ e^{\mathsf{log1p}\left(\color{blue}{\frac{1}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.im}} + \frac{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}}}\right)} - 1
\] |
clear-num [<=]27.5 | \[ e^{\mathsf{log1p}\left(\color{blue}{\frac{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.im}} + \frac{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}}\right)} - 1
\] |
div-inv [=>]27.5 | \[ e^{\mathsf{log1p}\left(\frac{\color{blue}{x.im \cdot \frac{1}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.im}}} + \frac{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} - 1
\] |
fma-def [=>]27.5 | \[ e^{\mathsf{log1p}\left(\frac{\color{blue}{\mathsf{fma}\left(x.im, \frac{1}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.im}}, \frac{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} - 1
\] |
clear-num [<=]27.5 | \[ e^{\mathsf{log1p}\left(\frac{\mathsf{fma}\left(x.im, \color{blue}{\frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}}, \frac{y.re \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} - 1
\] |
*-commutative [=>]27.5 | \[ e^{\mathsf{log1p}\left(\frac{\mathsf{fma}\left(x.im, \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{\color{blue}{x.re \cdot y.re}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} - 1
\] |
associate-/l* [=>]34.4 | \[ e^{\mathsf{log1p}\left(\frac{\mathsf{fma}\left(x.im, \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.re}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} - 1
\] |
Simplified74.1%
[Start]34.4 | \[ e^{\mathsf{log1p}\left(\frac{\mathsf{fma}\left(x.im, \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.re}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} - 1
\] |
|---|---|
expm1-def [=>]86.2 | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left(x.im, \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.re}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right)}
\] |
expm1-log1p [=>]99.6 | \[ \color{blue}{\frac{\mathsf{fma}\left(x.im, \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.re}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}}
\] |
associate-/r/ [=>]99.6 | \[ \frac{\mathsf{fma}\left(x.im, \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot y.re}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}
\] |
associate-*l/ [=>]74.1 | \[ \frac{\mathsf{fma}\left(x.im, \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.re \cdot y.re}{\mathsf{hypot}\left(y.re, y.im\right)}}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}
\] |
Taylor expanded in y.re around inf 88.5%
Final simplification92.9%
| Alternative 1 | |
|---|---|
| Accuracy | 81.7% |
| Cost | 21088 |
| Alternative 2 | |
|---|---|
| Accuracy | 92.7% |
| Cost | 20616 |
| Alternative 3 | |
|---|---|
| Accuracy | 83.7% |
| Cost | 20172 |
| Alternative 4 | |
|---|---|
| Accuracy | 83.5% |
| Cost | 14028 |
| Alternative 5 | |
|---|---|
| Accuracy | 78.2% |
| Cost | 13640 |
| Alternative 6 | |
|---|---|
| Accuracy | 68.3% |
| Cost | 1499 |
| Alternative 7 | |
|---|---|
| Accuracy | 68.5% |
| Cost | 1496 |
| Alternative 8 | |
|---|---|
| Accuracy | 68.5% |
| Cost | 1496 |
| Alternative 9 | |
|---|---|
| Accuracy | 74.8% |
| Cost | 1496 |
| Alternative 10 | |
|---|---|
| Accuracy | 75.5% |
| Cost | 1496 |
| Alternative 11 | |
|---|---|
| Accuracy | 77.9% |
| Cost | 1488 |
| Alternative 12 | |
|---|---|
| Accuracy | 62.9% |
| Cost | 986 |
| Alternative 13 | |
|---|---|
| Accuracy | 42.1% |
| Cost | 324 |
| Alternative 14 | |
|---|---|
| Accuracy | 41.5% |
| Cost | 192 |
herbie shell --seed 2023131
(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))))