
(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))))
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));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = ((x_46re * y_46re) + (x_46im * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
end function
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));
}
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))
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 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
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]
\begin{array}{l}
\\
\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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))))
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));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = ((x_46re * y_46re) + (x_46im * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
end function
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));
}
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))
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 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
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]
\begin{array}{l}
\\
\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\end{array}
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -2.1e-155)
(*
(/ x.im (hypot y.re y.im))
(/ (+ y.im (/ (* x.re y.re) x.im)) (hypot y.re y.im)))
(if (<= y.im 7e-114)
(/ (fma x.im (/ y.im y.re) x.re) y.re)
(if (<= y.im 1.8e+29)
(/
(/ (fma x.re y.re (* x.im y.im)) (hypot y.re y.im))
(hypot y.re y.im))
(/ (+ x.im (* x.re (/ y.re y.im))) y.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_im <= -2.1e-155) {
tmp = (x_46_im / hypot(y_46_re, y_46_im)) * ((y_46_im + ((x_46_re * y_46_re) / x_46_im)) / hypot(y_46_re, y_46_im));
} else if (y_46_im <= 7e-114) {
tmp = fma(x_46_im, (y_46_im / y_46_re), x_46_re) / y_46_re;
} else if (y_46_im <= 1.8e+29) {
tmp = (fma(x_46_re, y_46_re, (x_46_im * y_46_im)) / hypot(y_46_re, y_46_im)) / hypot(y_46_re, y_46_im);
} else {
tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_im <= -2.1e-155) tmp = Float64(Float64(x_46_im / hypot(y_46_re, y_46_im)) * Float64(Float64(y_46_im + Float64(Float64(x_46_re * y_46_re) / x_46_im)) / hypot(y_46_re, y_46_im))); elseif (y_46_im <= 7e-114) tmp = Float64(fma(x_46_im, Float64(y_46_im / y_46_re), x_46_re) / y_46_re); elseif (y_46_im <= 1.8e+29) tmp = Float64(Float64(fma(x_46_re, y_46_re, Float64(x_46_im * y_46_im)) / hypot(y_46_re, y_46_im)) / hypot(y_46_re, y_46_im)); else tmp = Float64(Float64(x_46_im + Float64(x_46_re * Float64(y_46_re / y_46_im))) / y_46_im); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -2.1e-155], N[(N[(x$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(y$46$im + N[(N[(x$46$re * y$46$re), $MachinePrecision] / x$46$im), $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 7e-114], N[(N[(x$46$im * N[(y$46$im / y$46$re), $MachinePrecision] + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 1.8e+29], N[(N[(N[(x$46$re * y$46$re + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im + N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -2.1 \cdot 10^{-155}:\\
\;\;\;\;\frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{y.im + \frac{x.re \cdot y.re}{x.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{elif}\;y.im \leq 7 \cdot 10^{-114}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 1.8 \cdot 10^{+29}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(x.re, y.re, x.im \cdot y.im\right)}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im + x.re \cdot \frac{y.re}{y.im}}{y.im}\\
\end{array}
\end{array}
if y.im < -2.1000000000000002e-155Initial program 61.3%
Taylor expanded in x.im around inf 59.1%
associate-/l*51.4%
Simplified51.4%
*-commutative51.4%
add-sqr-sqrt51.4%
hypot-undefine51.4%
hypot-undefine51.4%
times-frac86.6%
+-commutative86.6%
fma-define86.6%
Applied egg-rr86.6%
fma-undefine86.6%
associate-*r/94.3%
Applied egg-rr94.3%
if -2.1000000000000002e-155 < y.im < 7e-114Initial program 67.3%
Taylor expanded in y.re around inf 94.6%
+-commutative94.6%
associate-/l*94.8%
fma-define94.8%
Simplified94.8%
if 7e-114 < y.im < 1.79999999999999988e29Initial program 87.5%
*-un-lft-identity87.5%
add-sqr-sqrt87.5%
times-frac87.4%
hypot-define87.4%
fma-define87.4%
hypot-define94.0%
Applied egg-rr94.0%
associate-*l/94.2%
*-un-lft-identity94.2%
Applied egg-rr94.2%
if 1.79999999999999988e29 < y.im Initial program 49.1%
Taylor expanded in y.im around inf 84.8%
associate-/l*88.4%
Simplified88.4%
Final simplification93.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<=
(/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im)))
5e+297)
(/ (/ (fma x.re y.re (* x.im y.im)) (hypot y.re y.im)) (hypot y.re y.im))
(/
1.0
(/
(hypot y.re y.im)
(* x.im (/ (fma x.re (/ y.re x.im) y.im) (hypot y.re y.im)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))) <= 5e+297) {
tmp = (fma(x_46_re, y_46_re, (x_46_im * y_46_im)) / hypot(y_46_re, y_46_im)) / hypot(y_46_re, y_46_im);
} else {
tmp = 1.0 / (hypot(y_46_re, y_46_im) / (x_46_im * (fma(x_46_re, (y_46_re / x_46_im), y_46_im) / hypot(y_46_re, y_46_im))));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (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))) <= 5e+297) tmp = Float64(Float64(fma(x_46_re, y_46_re, Float64(x_46_im * y_46_im)) / hypot(y_46_re, y_46_im)) / hypot(y_46_re, y_46_im)); else tmp = Float64(1.0 / Float64(hypot(y_46_re, y_46_im) / Float64(x_46_im * Float64(fma(x_46_re, Float64(y_46_re / x_46_im), y_46_im) / hypot(y_46_re, y_46_im))))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[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], 5e+297], N[(N[(N[(x$46$re * y$46$re + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision] / N[(x$46$im * N[(N[(x$46$re * N[(y$46$re / x$46$im), $MachinePrecision] + y$46$im), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \leq 5 \cdot 10^{+297}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(x.re, y.re, x.im \cdot y.im\right)}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{x.im \cdot \frac{\mathsf{fma}\left(x.re, \frac{y.re}{x.im}, y.im\right)}{\mathsf{hypot}\left(y.re, y.im\right)}}}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 x.re y.re) (*.f64 x.im y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) < 4.9999999999999998e297Initial program 82.0%
*-un-lft-identity82.0%
add-sqr-sqrt82.0%
times-frac82.0%
hypot-define82.0%
fma-define82.0%
hypot-define97.7%
Applied egg-rr97.7%
associate-*l/97.8%
*-un-lft-identity97.8%
Applied egg-rr97.8%
if 4.9999999999999998e297 < (/.f64 (+.f64 (*.f64 x.re y.re) (*.f64 x.im y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) Initial program 15.4%
Taylor expanded in x.im around inf 15.4%
associate-/l*15.4%
Simplified15.4%
*-commutative15.4%
add-sqr-sqrt15.4%
hypot-undefine15.4%
hypot-undefine15.4%
times-frac71.5%
+-commutative71.5%
fma-define71.5%
Applied egg-rr71.5%
fma-undefine71.5%
associate-*r/65.9%
Applied egg-rr65.9%
associate-*r/67.7%
clear-num67.5%
associate-/l*73.2%
fma-define73.2%
Applied egg-rr73.2%
Final simplification91.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<=
(/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im)))
5e+297)
(/ (/ (fma x.re y.re (* x.im y.im)) (hypot y.re y.im)) (hypot y.re y.im))
(*
(/ (fma x.re (/ y.re x.im) y.im) (hypot y.re y.im))
(/ x.im (hypot y.re y.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))) <= 5e+297) {
tmp = (fma(x_46_re, y_46_re, (x_46_im * y_46_im)) / hypot(y_46_re, y_46_im)) / hypot(y_46_re, y_46_im);
} else {
tmp = (fma(x_46_re, (y_46_re / x_46_im), y_46_im) / hypot(y_46_re, y_46_im)) * (x_46_im / hypot(y_46_re, y_46_im));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (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))) <= 5e+297) tmp = Float64(Float64(fma(x_46_re, y_46_re, Float64(x_46_im * y_46_im)) / hypot(y_46_re, y_46_im)) / hypot(y_46_re, y_46_im)); else tmp = Float64(Float64(fma(x_46_re, Float64(y_46_re / x_46_im), y_46_im) / hypot(y_46_re, y_46_im)) * Float64(x_46_im / hypot(y_46_re, y_46_im))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[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], 5e+297], N[(N[(N[(x$46$re * y$46$re + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision], N[(N[(N[(x$46$re * N[(y$46$re / x$46$im), $MachinePrecision] + y$46$im), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(x$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \leq 5 \cdot 10^{+297}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(x.re, y.re, x.im \cdot y.im\right)}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.re, \frac{y.re}{x.im}, y.im\right)}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 x.re y.re) (*.f64 x.im y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) < 4.9999999999999998e297Initial program 82.0%
*-un-lft-identity82.0%
add-sqr-sqrt82.0%
times-frac82.0%
hypot-define82.0%
fma-define82.0%
hypot-define97.7%
Applied egg-rr97.7%
associate-*l/97.8%
*-un-lft-identity97.8%
Applied egg-rr97.8%
if 4.9999999999999998e297 < (/.f64 (+.f64 (*.f64 x.re y.re) (*.f64 x.im y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) Initial program 15.4%
Taylor expanded in x.im around inf 15.4%
associate-/l*15.4%
Simplified15.4%
*-commutative15.4%
add-sqr-sqrt15.4%
hypot-undefine15.4%
hypot-undefine15.4%
times-frac71.5%
+-commutative71.5%
fma-define71.5%
Applied egg-rr71.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -1.12e-159)
(*
(/ x.im (hypot y.re y.im))
(/ (+ y.im (/ (* x.re y.re) x.im)) (hypot y.re y.im)))
(if (<= y.im 6.2e-119)
(/ (fma x.im (/ y.im y.re) x.re) y.re)
(if (<= y.im 1.65e+29)
(/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im)))
(/ (+ x.im (* x.re (/ y.re y.im))) y.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_im <= -1.12e-159) {
tmp = (x_46_im / hypot(y_46_re, y_46_im)) * ((y_46_im + ((x_46_re * y_46_re) / x_46_im)) / hypot(y_46_re, y_46_im));
} else if (y_46_im <= 6.2e-119) {
tmp = fma(x_46_im, (y_46_im / y_46_re), x_46_re) / y_46_re;
} else if (y_46_im <= 1.65e+29) {
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));
} else {
tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_im <= -1.12e-159) tmp = Float64(Float64(x_46_im / hypot(y_46_re, y_46_im)) * Float64(Float64(y_46_im + Float64(Float64(x_46_re * y_46_re) / x_46_im)) / hypot(y_46_re, y_46_im))); elseif (y_46_im <= 6.2e-119) tmp = Float64(fma(x_46_im, Float64(y_46_im / y_46_re), x_46_re) / y_46_re); elseif (y_46_im <= 1.65e+29) tmp = 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))); else tmp = Float64(Float64(x_46_im + Float64(x_46_re * Float64(y_46_re / y_46_im))) / y_46_im); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -1.12e-159], N[(N[(x$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(y$46$im + N[(N[(x$46$re * y$46$re), $MachinePrecision] / x$46$im), $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 6.2e-119], N[(N[(x$46$im * N[(y$46$im / y$46$re), $MachinePrecision] + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 1.65e+29], 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], N[(N[(x$46$im + N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -1.12 \cdot 10^{-159}:\\
\;\;\;\;\frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{y.im + \frac{x.re \cdot y.re}{x.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{elif}\;y.im \leq 6.2 \cdot 10^{-119}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 1.65 \cdot 10^{+29}:\\
\;\;\;\;\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im + x.re \cdot \frac{y.re}{y.im}}{y.im}\\
\end{array}
\end{array}
if y.im < -1.12000000000000006e-159Initial program 61.3%
Taylor expanded in x.im around inf 59.1%
associate-/l*51.4%
Simplified51.4%
*-commutative51.4%
add-sqr-sqrt51.4%
hypot-undefine51.4%
hypot-undefine51.4%
times-frac86.6%
+-commutative86.6%
fma-define86.6%
Applied egg-rr86.6%
fma-undefine86.6%
associate-*r/94.3%
Applied egg-rr94.3%
if -1.12000000000000006e-159 < y.im < 6.19999999999999956e-119Initial program 67.3%
Taylor expanded in y.re around inf 94.6%
+-commutative94.6%
associate-/l*94.8%
fma-define94.8%
Simplified94.8%
if 6.19999999999999956e-119 < y.im < 1.64999999999999992e29Initial program 87.5%
if 1.64999999999999992e29 < y.im Initial program 49.1%
Taylor expanded in y.im around inf 84.8%
associate-/l*88.4%
Simplified88.4%
Final simplification92.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im)))))
(if (<= y.im -4.8e+47)
(* (/ x.im (hypot y.re y.im)) (/ y.im (hypot y.re y.im)))
(if (<= y.im -2e-152)
t_0
(if (<= y.im 3.1e-118)
(/ (fma x.im (/ y.im y.re) x.re) y.re)
(if (<= y.im 1.8e+29)
t_0
(/ (+ x.im (* x.re (/ y.re y.im))) y.im)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = ((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 tmp;
if (y_46_im <= -4.8e+47) {
tmp = (x_46_im / hypot(y_46_re, y_46_im)) * (y_46_im / hypot(y_46_re, y_46_im));
} else if (y_46_im <= -2e-152) {
tmp = t_0;
} else if (y_46_im <= 3.1e-118) {
tmp = fma(x_46_im, (y_46_im / y_46_re), x_46_re) / y_46_re;
} else if (y_46_im <= 1.8e+29) {
tmp = t_0;
} else {
tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = 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))) tmp = 0.0 if (y_46_im <= -4.8e+47) tmp = Float64(Float64(x_46_im / hypot(y_46_re, y_46_im)) * Float64(y_46_im / hypot(y_46_re, y_46_im))); elseif (y_46_im <= -2e-152) tmp = t_0; elseif (y_46_im <= 3.1e-118) tmp = Float64(fma(x_46_im, Float64(y_46_im / y_46_re), x_46_re) / y_46_re); elseif (y_46_im <= 1.8e+29) tmp = t_0; else tmp = Float64(Float64(x_46_im + Float64(x_46_re * Float64(y_46_re / y_46_im))) / y_46_im); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = 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]}, If[LessEqual[y$46$im, -4.8e+47], N[(N[(x$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(y$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, -2e-152], t$95$0, If[LessEqual[y$46$im, 3.1e-118], N[(N[(x$46$im * N[(y$46$im / y$46$re), $MachinePrecision] + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 1.8e+29], t$95$0, N[(N[(x$46$im + N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{if}\;y.im \leq -4.8 \cdot 10^{+47}:\\
\;\;\;\;\frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{elif}\;y.im \leq -2 \cdot 10^{-152}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 3.1 \cdot 10^{-118}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 1.8 \cdot 10^{+29}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im + x.re \cdot \frac{y.re}{y.im}}{y.im}\\
\end{array}
\end{array}
if y.im < -4.80000000000000037e47Initial program 43.3%
Taylor expanded in x.im around inf 41.6%
associate-/l*32.8%
Simplified32.8%
*-commutative32.8%
add-sqr-sqrt32.8%
hypot-undefine32.8%
hypot-undefine32.8%
times-frac84.1%
+-commutative84.1%
fma-define84.1%
Applied egg-rr84.1%
Taylor expanded in x.re around 0 89.1%
if -4.80000000000000037e47 < y.im < -2.00000000000000013e-152 or 3.1000000000000001e-118 < y.im < 1.79999999999999988e29Initial program 89.1%
if -2.00000000000000013e-152 < y.im < 3.1000000000000001e-118Initial program 68.1%
Taylor expanded in y.re around inf 94.7%
+-commutative94.7%
associate-/l*94.9%
fma-define94.9%
Simplified94.9%
if 1.79999999999999988e29 < y.im Initial program 49.1%
Taylor expanded in y.im around inf 84.8%
associate-/l*88.4%
Simplified88.4%
Final simplification90.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))
(t_1 (/ (+ x.im (* x.re (/ y.re y.im))) y.im)))
(if (<= y.im -3.8e+138)
t_1
(if (<= y.im -5.9e-149)
t_0
(if (<= y.im 1.55e-116)
(/ (fma x.im (/ y.im y.re) x.re) y.re)
(if (<= y.im 1.8e+29) t_0 t_1))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = ((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 t_1 = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im;
double tmp;
if (y_46_im <= -3.8e+138) {
tmp = t_1;
} else if (y_46_im <= -5.9e-149) {
tmp = t_0;
} else if (y_46_im <= 1.55e-116) {
tmp = fma(x_46_im, (y_46_im / y_46_re), x_46_re) / y_46_re;
} else if (y_46_im <= 1.8e+29) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = 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))) t_1 = Float64(Float64(x_46_im + Float64(x_46_re * Float64(y_46_re / y_46_im))) / y_46_im) tmp = 0.0 if (y_46_im <= -3.8e+138) tmp = t_1; elseif (y_46_im <= -5.9e-149) tmp = t_0; elseif (y_46_im <= 1.55e-116) tmp = Float64(fma(x_46_im, Float64(y_46_im / y_46_re), x_46_re) / y_46_re); elseif (y_46_im <= 1.8e+29) tmp = t_0; else tmp = t_1; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = 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]}, Block[{t$95$1 = N[(N[(x$46$im + N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -3.8e+138], t$95$1, If[LessEqual[y$46$im, -5.9e-149], t$95$0, If[LessEqual[y$46$im, 1.55e-116], N[(N[(x$46$im * N[(y$46$im / y$46$re), $MachinePrecision] + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 1.8e+29], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\
t_1 := \frac{x.im + x.re \cdot \frac{y.re}{y.im}}{y.im}\\
\mathbf{if}\;y.im \leq -3.8 \cdot 10^{+138}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq -5.9 \cdot 10^{-149}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 1.55 \cdot 10^{-116}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 1.8 \cdot 10^{+29}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.im < -3.80000000000000012e138 or 1.79999999999999988e29 < y.im Initial program 40.6%
Taylor expanded in y.im around inf 86.3%
associate-/l*89.4%
Simplified89.4%
if -3.80000000000000012e138 < y.im < -5.9000000000000002e-149 or 1.55000000000000009e-116 < y.im < 1.79999999999999988e29Initial program 87.5%
if -5.9000000000000002e-149 < y.im < 1.55000000000000009e-116Initial program 68.1%
Taylor expanded in y.re around inf 94.7%
+-commutative94.7%
associate-/l*94.9%
fma-define94.9%
Simplified94.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))
(t_1 (/ (+ x.im (* x.re (/ y.re y.im))) y.im)))
(if (<= y.im -1.45e+128)
t_1
(if (<= y.im -2.95e-151)
t_0
(if (<= y.im 1.4e-116)
(/ (+ x.re (* x.im (/ y.im y.re))) y.re)
(if (<= y.im 1.65e+29) t_0 t_1))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = ((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 t_1 = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im;
double tmp;
if (y_46_im <= -1.45e+128) {
tmp = t_1;
} else if (y_46_im <= -2.95e-151) {
tmp = t_0;
} else if (y_46_im <= 1.4e-116) {
tmp = (x_46_re + (x_46_im * (y_46_im / y_46_re))) / y_46_re;
} else if (y_46_im <= 1.65e+29) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((x_46re * y_46re) + (x_46im * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
t_1 = (x_46im + (x_46re * (y_46re / y_46im))) / y_46im
if (y_46im <= (-1.45d+128)) then
tmp = t_1
else if (y_46im <= (-2.95d-151)) then
tmp = t_0
else if (y_46im <= 1.4d-116) then
tmp = (x_46re + (x_46im * (y_46im / y_46re))) / y_46re
else if (y_46im <= 1.65d+29) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = ((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 t_1 = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im;
double tmp;
if (y_46_im <= -1.45e+128) {
tmp = t_1;
} else if (y_46_im <= -2.95e-151) {
tmp = t_0;
} else if (y_46_im <= 1.4e-116) {
tmp = (x_46_re + (x_46_im * (y_46_im / y_46_re))) / y_46_re;
} else if (y_46_im <= 1.65e+29) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)) t_1 = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im tmp = 0 if y_46_im <= -1.45e+128: tmp = t_1 elif y_46_im <= -2.95e-151: tmp = t_0 elif y_46_im <= 1.4e-116: tmp = (x_46_re + (x_46_im * (y_46_im / y_46_re))) / y_46_re elif y_46_im <= 1.65e+29: tmp = t_0 else: tmp = t_1 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = 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))) t_1 = Float64(Float64(x_46_im + Float64(x_46_re * Float64(y_46_re / y_46_im))) / y_46_im) tmp = 0.0 if (y_46_im <= -1.45e+128) tmp = t_1; elseif (y_46_im <= -2.95e-151) tmp = t_0; elseif (y_46_im <= 1.4e-116) tmp = Float64(Float64(x_46_re + Float64(x_46_im * Float64(y_46_im / y_46_re))) / y_46_re); elseif (y_46_im <= 1.65e+29) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); t_1 = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im; tmp = 0.0; if (y_46_im <= -1.45e+128) tmp = t_1; elseif (y_46_im <= -2.95e-151) tmp = t_0; elseif (y_46_im <= 1.4e-116) tmp = (x_46_re + (x_46_im * (y_46_im / y_46_re))) / y_46_re; elseif (y_46_im <= 1.65e+29) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = 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]}, Block[{t$95$1 = N[(N[(x$46$im + N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -1.45e+128], t$95$1, If[LessEqual[y$46$im, -2.95e-151], t$95$0, If[LessEqual[y$46$im, 1.4e-116], N[(N[(x$46$re + N[(x$46$im * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 1.65e+29], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\
t_1 := \frac{x.im + x.re \cdot \frac{y.re}{y.im}}{y.im}\\
\mathbf{if}\;y.im \leq -1.45 \cdot 10^{+128}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq -2.95 \cdot 10^{-151}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 1.4 \cdot 10^{-116}:\\
\;\;\;\;\frac{x.re + x.im \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 1.65 \cdot 10^{+29}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.im < -1.45e128 or 1.64999999999999992e29 < y.im Initial program 40.6%
Taylor expanded in y.im around inf 86.3%
associate-/l*89.4%
Simplified89.4%
if -1.45e128 < y.im < -2.95e-151 or 1.3999999999999999e-116 < y.im < 1.64999999999999992e29Initial program 87.5%
if -2.95e-151 < y.im < 1.3999999999999999e-116Initial program 68.1%
Taylor expanded in y.re around inf 94.7%
associate-/l*94.9%
Simplified94.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -4.4e-10) (not (<= y.im 3e-7))) (/ (+ x.im (* x.re (/ y.re y.im))) y.im) (/ (+ x.re (* x.im (/ y.im y.re))) y.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -4.4e-10) || !(y_46_im <= 3e-7)) {
tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im;
} else {
tmp = (x_46_re + (x_46_im * (y_46_im / y_46_re))) / y_46_re;
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if ((y_46im <= (-4.4d-10)) .or. (.not. (y_46im <= 3d-7))) then
tmp = (x_46im + (x_46re * (y_46re / y_46im))) / y_46im
else
tmp = (x_46re + (x_46im * (y_46im / y_46re))) / y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -4.4e-10) || !(y_46_im <= 3e-7)) {
tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im;
} else {
tmp = (x_46_re + (x_46_im * (y_46_im / y_46_re))) / y_46_re;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (y_46_im <= -4.4e-10) or not (y_46_im <= 3e-7): tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im else: tmp = (x_46_re + (x_46_im * (y_46_im / y_46_re))) / y_46_re return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_im <= -4.4e-10) || !(y_46_im <= 3e-7)) tmp = Float64(Float64(x_46_im + Float64(x_46_re * Float64(y_46_re / y_46_im))) / y_46_im); else tmp = Float64(Float64(x_46_re + Float64(x_46_im * Float64(y_46_im / y_46_re))) / y_46_re); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if ((y_46_im <= -4.4e-10) || ~((y_46_im <= 3e-7))) tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im; else tmp = (x_46_re + (x_46_im * (y_46_im / y_46_re))) / y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -4.4e-10], N[Not[LessEqual[y$46$im, 3e-7]], $MachinePrecision]], N[(N[(x$46$im + N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], N[(N[(x$46$re + N[(x$46$im * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -4.4 \cdot 10^{-10} \lor \neg \left(y.im \leq 3 \cdot 10^{-7}\right):\\
\;\;\;\;\frac{x.im + x.re \cdot \frac{y.re}{y.im}}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re + x.im \cdot \frac{y.im}{y.re}}{y.re}\\
\end{array}
\end{array}
if y.im < -4.3999999999999998e-10 or 2.9999999999999999e-7 < y.im Initial program 53.3%
Taylor expanded in y.im around inf 82.9%
associate-/l*85.2%
Simplified85.2%
if -4.3999999999999998e-10 < y.im < 2.9999999999999999e-7Initial program 74.8%
Taylor expanded in y.re around inf 87.4%
associate-/l*87.5%
Simplified87.5%
Final simplification86.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -7e+36)
(/ 1.0 (/ y.re x.re))
(if (<= y.re 550000000000.0)
(/ (+ x.im (* x.re (/ y.re y.im))) y.im)
(/ x.re y.re))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -7e+36) {
tmp = 1.0 / (y_46_re / x_46_re);
} else if (y_46_re <= 550000000000.0) {
tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im;
} else {
tmp = x_46_re / y_46_re;
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46re <= (-7d+36)) then
tmp = 1.0d0 / (y_46re / x_46re)
else if (y_46re <= 550000000000.0d0) then
tmp = (x_46im + (x_46re * (y_46re / y_46im))) / y_46im
else
tmp = x_46re / y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -7e+36) {
tmp = 1.0 / (y_46_re / x_46_re);
} else if (y_46_re <= 550000000000.0) {
tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im;
} else {
tmp = x_46_re / y_46_re;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_re <= -7e+36: tmp = 1.0 / (y_46_re / x_46_re) elif y_46_re <= 550000000000.0: tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im else: tmp = x_46_re / y_46_re return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -7e+36) tmp = Float64(1.0 / Float64(y_46_re / x_46_re)); elseif (y_46_re <= 550000000000.0) tmp = Float64(Float64(x_46_im + Float64(x_46_re * Float64(y_46_re / y_46_im))) / y_46_im); else tmp = Float64(x_46_re / y_46_re); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_re <= -7e+36) tmp = 1.0 / (y_46_re / x_46_re); elseif (y_46_re <= 550000000000.0) tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im; else tmp = x_46_re / y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -7e+36], N[(1.0 / N[(y$46$re / x$46$re), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 550000000000.0], N[(N[(x$46$im + N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], N[(x$46$re / y$46$re), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -7 \cdot 10^{+36}:\\
\;\;\;\;\frac{1}{\frac{y.re}{x.re}}\\
\mathbf{elif}\;y.re \leq 550000000000:\\
\;\;\;\;\frac{x.im + x.re \cdot \frac{y.re}{y.im}}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\end{array}
\end{array}
if y.re < -6.9999999999999996e36Initial program 50.1%
Taylor expanded in y.re around inf 63.7%
clear-num65.0%
inv-pow65.0%
Applied egg-rr65.0%
unpow-165.0%
Simplified65.0%
if -6.9999999999999996e36 < y.re < 5.5e11Initial program 68.9%
Taylor expanded in y.im around inf 84.6%
associate-/l*85.2%
Simplified85.2%
if 5.5e11 < y.re Initial program 63.5%
Taylor expanded in y.re around inf 72.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -6e-52) (not (<= y.im 7.5e-8))) (/ x.im y.im) (/ x.re y.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -6e-52) || !(y_46_im <= 7.5e-8)) {
tmp = x_46_im / y_46_im;
} else {
tmp = x_46_re / y_46_re;
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if ((y_46im <= (-6d-52)) .or. (.not. (y_46im <= 7.5d-8))) then
tmp = x_46im / y_46im
else
tmp = x_46re / y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -6e-52) || !(y_46_im <= 7.5e-8)) {
tmp = x_46_im / y_46_im;
} else {
tmp = x_46_re / y_46_re;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (y_46_im <= -6e-52) or not (y_46_im <= 7.5e-8): tmp = x_46_im / y_46_im else: tmp = x_46_re / y_46_re return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_im <= -6e-52) || !(y_46_im <= 7.5e-8)) tmp = Float64(x_46_im / y_46_im); else tmp = Float64(x_46_re / y_46_re); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if ((y_46_im <= -6e-52) || ~((y_46_im <= 7.5e-8))) tmp = x_46_im / y_46_im; else tmp = x_46_re / y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -6e-52], N[Not[LessEqual[y$46$im, 7.5e-8]], $MachinePrecision]], N[(x$46$im / y$46$im), $MachinePrecision], N[(x$46$re / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -6 \cdot 10^{-52} \lor \neg \left(y.im \leq 7.5 \cdot 10^{-8}\right):\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\end{array}
\end{array}
if y.im < -6e-52 or 7.4999999999999997e-8 < y.im Initial program 55.0%
Taylor expanded in y.re around 0 73.1%
if -6e-52 < y.im < 7.4999999999999997e-8Initial program 74.2%
Taylor expanded in y.re around inf 67.3%
Final simplification70.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ x.im y.im))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return x_46_im / y_46_im;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = x_46im / y_46im
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return x_46_im / y_46_im;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return x_46_im / y_46_im
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(x_46_im / y_46_im) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = x_46_im / y_46_im; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(x$46$im / y$46$im), $MachinePrecision]
\begin{array}{l}
\\
\frac{x.im}{y.im}
\end{array}
Initial program 64.1%
Taylor expanded in y.re around 0 47.6%
herbie shell --seed 2024132
(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))))