
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ (- (* x.im y.re) (* x.re 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_im * y_46_re) - (x_46_re * 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_46im * y_46re) - (x_46re * 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_im * y_46_re) - (x_46_re * 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_im * y_46_re) - (x_46_re * 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_im * y_46_re) - Float64(x_46_re * 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_im * y_46_re) - (x_46_re * 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$im * y$46$re), $MachinePrecision] - N[(x$46$re * 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.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ (- (* x.im y.re) (* x.re 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_im * y_46_re) - (x_46_re * 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_46im * y_46re) - (x_46re * 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_im * y_46_re) - (x_46_re * 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_im * y_46_re) - (x_46_re * 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_im * y_46_re) - Float64(x_46_re * 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_im * y_46_re) - (x_46_re * 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$im * y$46$re), $MachinePrecision] - N[(x$46$re * 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.im \cdot y.re - x.re \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 (fma (/ y.re (hypot y.re y.im)) (/ x.im (hypot y.re y.im)) (/ (/ x.re (/ (hypot y.im y.re) y.im)) (- (hypot y.im y.re)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return fma((y_46_re / hypot(y_46_re, y_46_im)), (x_46_im / hypot(y_46_re, y_46_im)), ((x_46_re / (hypot(y_46_im, y_46_re) / y_46_im)) / -hypot(y_46_im, y_46_re)));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) return fma(Float64(y_46_re / hypot(y_46_re, y_46_im)), Float64(x_46_im / hypot(y_46_re, y_46_im)), Float64(Float64(x_46_re / Float64(hypot(y_46_im, y_46_re) / y_46_im)) / Float64(-hypot(y_46_im, y_46_re)))) end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(y$46$re / 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] + N[(N[(x$46$re / N[(N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision] / (-N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{\frac{x.re}{\frac{\mathsf{hypot}\left(y.im, y.re\right)}{y.im}}}{-\mathsf{hypot}\left(y.im, y.re\right)}\right)
\end{array}
Initial program 59.7%
div-sub57.3%
*-commutative57.3%
add-sqr-sqrt57.3%
times-frac58.8%
fma-neg58.8%
hypot-define58.8%
hypot-define72.9%
associate-/l*77.6%
add-sqr-sqrt77.6%
pow277.6%
hypot-define77.6%
Applied egg-rr77.6%
*-un-lft-identity77.6%
unpow277.6%
times-frac94.4%
hypot-undefine77.6%
+-commutative77.6%
hypot-define94.4%
hypot-undefine77.6%
+-commutative77.6%
hypot-define94.4%
Applied egg-rr94.4%
associate-*l/94.4%
*-un-lft-identity94.4%
Applied egg-rr94.4%
associate-*r/97.6%
clear-num97.6%
un-div-inv97.6%
Applied egg-rr97.6%
Final simplification97.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(fma
(/ y.re (hypot y.re y.im))
(/ x.im (hypot y.re y.im))
(* x.re (/ y.im (- (pow (hypot y.re y.im) 2.0))))))
(t_1 (fma (* y.re (/ 1.0 y.im)) (/ x.im y.im) (/ x.re (- y.im)))))
(if (<= y.im -1.5e+146)
t_1
(if (<= y.im -3.15e-161)
t_0
(if (<= y.im 1e-199)
(/ (- x.im (* x.re (/ y.im y.re))) y.re)
(if (<= y.im 4.2e+124) 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 = fma((y_46_re / hypot(y_46_re, y_46_im)), (x_46_im / hypot(y_46_re, y_46_im)), (x_46_re * (y_46_im / -pow(hypot(y_46_re, y_46_im), 2.0))));
double t_1 = fma((y_46_re * (1.0 / y_46_im)), (x_46_im / y_46_im), (x_46_re / -y_46_im));
double tmp;
if (y_46_im <= -1.5e+146) {
tmp = t_1;
} else if (y_46_im <= -3.15e-161) {
tmp = t_0;
} else if (y_46_im <= 1e-199) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else if (y_46_im <= 4.2e+124) {
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 = fma(Float64(y_46_re / hypot(y_46_re, y_46_im)), Float64(x_46_im / hypot(y_46_re, y_46_im)), Float64(x_46_re * Float64(y_46_im / Float64(-(hypot(y_46_re, y_46_im) ^ 2.0))))) t_1 = fma(Float64(y_46_re * Float64(1.0 / y_46_im)), Float64(x_46_im / y_46_im), Float64(x_46_re / Float64(-y_46_im))) tmp = 0.0 if (y_46_im <= -1.5e+146) tmp = t_1; elseif (y_46_im <= -3.15e-161) tmp = t_0; elseif (y_46_im <= 1e-199) tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); elseif (y_46_im <= 4.2e+124) 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[(y$46$re / 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] + N[(x$46$re * N[(y$46$im / (-N[Power[N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision], 2.0], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y$46$re * N[(1.0 / y$46$im), $MachinePrecision]), $MachinePrecision] * N[(x$46$im / y$46$im), $MachinePrecision] + N[(x$46$re / (-y$46$im)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -1.5e+146], t$95$1, If[LessEqual[y$46$im, -3.15e-161], t$95$0, If[LessEqual[y$46$im, 1e-199], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 4.2e+124], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \frac{y.im}{-{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)\\
t_1 := \mathsf{fma}\left(y.re \cdot \frac{1}{y.im}, \frac{x.im}{y.im}, \frac{x.re}{-y.im}\right)\\
\mathbf{if}\;y.im \leq -1.5 \cdot 10^{+146}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq -3.15 \cdot 10^{-161}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 10^{-199}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 4.2 \cdot 10^{+124}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.im < -1.50000000000000001e146 or 4.20000000000000023e124 < y.im Initial program 30.2%
Taylor expanded in y.re around 0 80.5%
+-commutative80.5%
mul-1-neg80.5%
unsub-neg80.5%
*-commutative80.5%
associate-/l*83.9%
Simplified83.9%
*-un-lft-identity83.9%
pow283.9%
times-frac86.6%
Applied egg-rr86.6%
associate-*r*90.6%
fma-neg90.7%
Applied egg-rr90.7%
if -1.50000000000000001e146 < y.im < -3.1500000000000001e-161 or 9.99999999999999982e-200 < y.im < 4.20000000000000023e124Initial program 70.2%
div-sub69.4%
*-commutative69.4%
add-sqr-sqrt69.4%
times-frac68.5%
fma-neg68.5%
hypot-define68.5%
hypot-define82.4%
associate-/l*89.6%
add-sqr-sqrt89.6%
pow289.6%
hypot-define89.6%
Applied egg-rr89.6%
if -3.1500000000000001e-161 < y.im < 9.99999999999999982e-200Initial program 71.9%
Taylor expanded in y.re around inf 88.0%
+-commutative88.0%
mul-1-neg88.0%
unsub-neg88.0%
*-commutative88.0%
associate-/l*84.8%
Simplified84.8%
*-un-lft-identity84.8%
unpow284.8%
times-frac86.6%
Applied egg-rr86.6%
associate-*l/86.6%
*-lft-identity86.6%
Simplified86.6%
*-un-lft-identity86.6%
associate-*r/93.4%
sub-div93.4%
clear-num93.4%
un-div-inv93.4%
Applied egg-rr93.4%
*-lft-identity93.4%
associate-/r/95.0%
Simplified95.0%
Final simplification91.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (fma (/ y.re (hypot y.re y.im)) (/ x.im (hypot y.re y.im)) (* x.re (/ (/ y.im (hypot y.im y.re)) (- (hypot y.im y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return fma((y_46_re / hypot(y_46_re, y_46_im)), (x_46_im / hypot(y_46_re, y_46_im)), (x_46_re * ((y_46_im / hypot(y_46_im, y_46_re)) / -hypot(y_46_im, y_46_re))));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) return fma(Float64(y_46_re / hypot(y_46_re, y_46_im)), Float64(x_46_im / hypot(y_46_re, y_46_im)), Float64(x_46_re * Float64(Float64(y_46_im / hypot(y_46_im, y_46_re)) / Float64(-hypot(y_46_im, y_46_re))))) end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(y$46$re / 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] + N[(x$46$re * N[(N[(y$46$im / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision] / (-N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{-\mathsf{hypot}\left(y.im, y.re\right)}\right)
\end{array}
Initial program 59.7%
div-sub57.3%
*-commutative57.3%
add-sqr-sqrt57.3%
times-frac58.8%
fma-neg58.8%
hypot-define58.8%
hypot-define72.9%
associate-/l*77.6%
add-sqr-sqrt77.6%
pow277.6%
hypot-define77.6%
Applied egg-rr77.6%
*-un-lft-identity77.6%
unpow277.6%
times-frac94.4%
hypot-undefine77.6%
+-commutative77.6%
hypot-define94.4%
hypot-undefine77.6%
+-commutative77.6%
hypot-define94.4%
Applied egg-rr94.4%
associate-*l/94.4%
*-un-lft-identity94.4%
Applied egg-rr94.4%
Final simplification94.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (- x.im (* x.re (/ y.im y.re))) y.re)))
(if (<= y.im -1.2e-21)
(- (* y.re (/ (/ x.im y.im) y.im)) (/ x.re y.im))
(if (<= y.im 1e-93)
t_0
(if (<= y.im 1.46e+51)
(/ (- (* y.re x.im) (* y.im x.re)) (+ (* y.re y.re) (* y.im y.im)))
(if (<= y.im 5.8e+67)
t_0
(fma (* y.re (/ 1.0 y.im)) (/ x.im y.im) (/ x.re (- 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_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
double tmp;
if (y_46_im <= -1.2e-21) {
tmp = (y_46_re * ((x_46_im / y_46_im) / y_46_im)) - (x_46_re / y_46_im);
} else if (y_46_im <= 1e-93) {
tmp = t_0;
} else if (y_46_im <= 1.46e+51) {
tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else if (y_46_im <= 5.8e+67) {
tmp = t_0;
} else {
tmp = fma((y_46_re * (1.0 / y_46_im)), (x_46_im / y_46_im), (x_46_re / -y_46_im));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re) tmp = 0.0 if (y_46_im <= -1.2e-21) tmp = Float64(Float64(y_46_re * Float64(Float64(x_46_im / y_46_im) / y_46_im)) - Float64(x_46_re / y_46_im)); elseif (y_46_im <= 1e-93) tmp = t_0; elseif (y_46_im <= 1.46e+51) tmp = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))); elseif (y_46_im <= 5.8e+67) tmp = t_0; else tmp = fma(Float64(y_46_re * Float64(1.0 / y_46_im)), Float64(x_46_im / y_46_im), Float64(x_46_re / Float64(-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[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$im, -1.2e-21], N[(N[(y$46$re * N[(N[(x$46$im / y$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1e-93], t$95$0, If[LessEqual[y$46$im, 1.46e+51], N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $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, 5.8e+67], t$95$0, N[(N[(y$46$re * N[(1.0 / y$46$im), $MachinePrecision]), $MachinePrecision] * N[(x$46$im / y$46$im), $MachinePrecision] + N[(x$46$re / (-y$46$im)), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{if}\;y.im \leq -1.2 \cdot 10^{-21}:\\
\;\;\;\;y.re \cdot \frac{\frac{x.im}{y.im}}{y.im} - \frac{x.re}{y.im}\\
\mathbf{elif}\;y.im \leq 10^{-93}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 1.46 \cdot 10^{+51}:\\
\;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{elif}\;y.im \leq 5.8 \cdot 10^{+67}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y.re \cdot \frac{1}{y.im}, \frac{x.im}{y.im}, \frac{x.re}{-y.im}\right)\\
\end{array}
\end{array}
if y.im < -1.2e-21Initial program 47.1%
Taylor expanded in y.re around 0 76.6%
+-commutative76.6%
mul-1-neg76.6%
unsub-neg76.6%
*-commutative76.6%
associate-/l*76.8%
Simplified76.8%
*-un-lft-identity76.8%
pow276.8%
times-frac79.4%
Applied egg-rr79.4%
associate-*l/79.5%
*-un-lft-identity79.5%
Applied egg-rr79.5%
if -1.2e-21 < y.im < 9.999999999999999e-94 or 1.4600000000000001e51 < y.im < 5.80000000000000047e67Initial program 72.4%
Taylor expanded in y.re around inf 84.0%
+-commutative84.0%
mul-1-neg84.0%
unsub-neg84.0%
*-commutative84.0%
associate-/l*82.3%
Simplified82.3%
*-un-lft-identity82.3%
unpow282.3%
times-frac84.1%
Applied egg-rr84.1%
associate-*l/84.1%
*-lft-identity84.1%
Simplified84.1%
*-un-lft-identity84.1%
associate-*r/88.6%
sub-div90.4%
clear-num90.4%
un-div-inv90.4%
Applied egg-rr90.4%
*-lft-identity90.4%
associate-/r/91.3%
Simplified91.3%
if 9.999999999999999e-94 < y.im < 1.4600000000000001e51Initial program 82.8%
if 5.80000000000000047e67 < y.im Initial program 35.0%
Taylor expanded in y.re around 0 75.4%
+-commutative75.4%
mul-1-neg75.4%
unsub-neg75.4%
*-commutative75.4%
associate-/l*80.3%
Simplified80.3%
*-un-lft-identity80.3%
pow280.3%
times-frac80.3%
Applied egg-rr80.3%
associate-*r*86.2%
fma-neg86.2%
Applied egg-rr86.2%
Final simplification86.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (- x.im (* x.re (/ y.im y.re))) y.re))
(t_1 (- (* y.re (/ (/ x.im y.im) y.im)) (/ x.re y.im))))
(if (<= y.im -1.65e-22)
t_1
(if (<= y.im 1.1e-93)
t_0
(if (<= y.im 1.6e+51)
(/ (- (* y.re x.im) (* y.im x.re)) (+ (* y.re y.re) (* y.im y.im)))
(if (<= y.im 5.1e+67) 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_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
double t_1 = (y_46_re * ((x_46_im / y_46_im) / y_46_im)) - (x_46_re / y_46_im);
double tmp;
if (y_46_im <= -1.65e-22) {
tmp = t_1;
} else if (y_46_im <= 1.1e-93) {
tmp = t_0;
} else if (y_46_im <= 1.6e+51) {
tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else if (y_46_im <= 5.1e+67) {
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_46im - (x_46re * (y_46im / y_46re))) / y_46re
t_1 = (y_46re * ((x_46im / y_46im) / y_46im)) - (x_46re / y_46im)
if (y_46im <= (-1.65d-22)) then
tmp = t_1
else if (y_46im <= 1.1d-93) then
tmp = t_0
else if (y_46im <= 1.6d+51) then
tmp = ((y_46re * x_46im) - (y_46im * x_46re)) / ((y_46re * y_46re) + (y_46im * y_46im))
else if (y_46im <= 5.1d+67) 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_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
double t_1 = (y_46_re * ((x_46_im / y_46_im) / y_46_im)) - (x_46_re / y_46_im);
double tmp;
if (y_46_im <= -1.65e-22) {
tmp = t_1;
} else if (y_46_im <= 1.1e-93) {
tmp = t_0;
} else if (y_46_im <= 1.6e+51) {
tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else if (y_46_im <= 5.1e+67) {
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_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re t_1 = (y_46_re * ((x_46_im / y_46_im) / y_46_im)) - (x_46_re / y_46_im) tmp = 0 if y_46_im <= -1.65e-22: tmp = t_1 elif y_46_im <= 1.1e-93: tmp = t_0 elif y_46_im <= 1.6e+51: tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)) elif y_46_im <= 5.1e+67: 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(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re) t_1 = Float64(Float64(y_46_re * Float64(Float64(x_46_im / y_46_im) / y_46_im)) - Float64(x_46_re / y_46_im)) tmp = 0.0 if (y_46_im <= -1.65e-22) tmp = t_1; elseif (y_46_im <= 1.1e-93) tmp = t_0; elseif (y_46_im <= 1.6e+51) tmp = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))); elseif (y_46_im <= 5.1e+67) 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_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re; t_1 = (y_46_re * ((x_46_im / y_46_im) / y_46_im)) - (x_46_re / y_46_im); tmp = 0.0; if (y_46_im <= -1.65e-22) tmp = t_1; elseif (y_46_im <= 1.1e-93) tmp = t_0; elseif (y_46_im <= 1.6e+51) tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); elseif (y_46_im <= 5.1e+67) 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[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y$46$re * N[(N[(x$46$im / y$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -1.65e-22], t$95$1, If[LessEqual[y$46$im, 1.1e-93], t$95$0, If[LessEqual[y$46$im, 1.6e+51], N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $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, 5.1e+67], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
t_1 := y.re \cdot \frac{\frac{x.im}{y.im}}{y.im} - \frac{x.re}{y.im}\\
\mathbf{if}\;y.im \leq -1.65 \cdot 10^{-22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq 1.1 \cdot 10^{-93}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 1.6 \cdot 10^{+51}:\\
\;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{elif}\;y.im \leq 5.1 \cdot 10^{+67}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.im < -1.65e-22 or 5.1000000000000002e67 < y.im Initial program 42.2%
Taylor expanded in y.re around 0 76.1%
+-commutative76.1%
mul-1-neg76.1%
unsub-neg76.1%
*-commutative76.1%
associate-/l*78.2%
Simplified78.2%
*-un-lft-identity78.2%
pow278.2%
times-frac79.8%
Applied egg-rr79.8%
associate-*l/79.8%
*-un-lft-identity79.8%
Applied egg-rr79.8%
if -1.65e-22 < y.im < 1.09999999999999998e-93 or 1.6000000000000001e51 < y.im < 5.1000000000000002e67Initial program 72.4%
Taylor expanded in y.re around inf 84.0%
+-commutative84.0%
mul-1-neg84.0%
unsub-neg84.0%
*-commutative84.0%
associate-/l*82.3%
Simplified82.3%
*-un-lft-identity82.3%
unpow282.3%
times-frac84.1%
Applied egg-rr84.1%
associate-*l/84.1%
*-lft-identity84.1%
Simplified84.1%
*-un-lft-identity84.1%
associate-*r/88.6%
sub-div90.4%
clear-num90.4%
un-div-inv90.4%
Applied egg-rr90.4%
*-lft-identity90.4%
associate-/r/91.3%
Simplified91.3%
if 1.09999999999999998e-93 < y.im < 1.6000000000000001e51Initial program 82.8%
Final simplification85.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -7e-22) (not (<= y.im 1.8e+67))) (- (* y.re (/ (/ x.im y.im) y.im)) (/ x.re y.im)) (/ (- x.im (* x.re (/ 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 <= -7e-22) || !(y_46_im <= 1.8e+67)) {
tmp = (y_46_re * ((x_46_im / y_46_im) / y_46_im)) - (x_46_re / y_46_im);
} else {
tmp = (x_46_im - (x_46_re * (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 <= (-7d-22)) .or. (.not. (y_46im <= 1.8d+67))) then
tmp = (y_46re * ((x_46im / y_46im) / y_46im)) - (x_46re / y_46im)
else
tmp = (x_46im - (x_46re * (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 <= -7e-22) || !(y_46_im <= 1.8e+67)) {
tmp = (y_46_re * ((x_46_im / y_46_im) / y_46_im)) - (x_46_re / y_46_im);
} else {
tmp = (x_46_im - (x_46_re * (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 <= -7e-22) or not (y_46_im <= 1.8e+67): tmp = (y_46_re * ((x_46_im / y_46_im) / y_46_im)) - (x_46_re / y_46_im) else: tmp = (x_46_im - (x_46_re * (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 <= -7e-22) || !(y_46_im <= 1.8e+67)) tmp = Float64(Float64(y_46_re * Float64(Float64(x_46_im / y_46_im) / y_46_im)) - Float64(x_46_re / y_46_im)); else tmp = Float64(Float64(x_46_im - Float64(x_46_re * 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 <= -7e-22) || ~((y_46_im <= 1.8e+67))) tmp = (y_46_re * ((x_46_im / y_46_im) / y_46_im)) - (x_46_re / y_46_im); else tmp = (x_46_im - (x_46_re * (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, -7e-22], N[Not[LessEqual[y$46$im, 1.8e+67]], $MachinePrecision]], N[(N[(y$46$re * N[(N[(x$46$im / y$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im - N[(x$46$re * 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 -7 \cdot 10^{-22} \lor \neg \left(y.im \leq 1.8 \cdot 10^{+67}\right):\\
\;\;\;\;y.re \cdot \frac{\frac{x.im}{y.im}}{y.im} - \frac{x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\end{array}
\end{array}
if y.im < -7.00000000000000011e-22 or 1.7999999999999999e67 < y.im Initial program 42.2%
Taylor expanded in y.re around 0 76.1%
+-commutative76.1%
mul-1-neg76.1%
unsub-neg76.1%
*-commutative76.1%
associate-/l*78.2%
Simplified78.2%
*-un-lft-identity78.2%
pow278.2%
times-frac79.8%
Applied egg-rr79.8%
associate-*l/79.8%
*-un-lft-identity79.8%
Applied egg-rr79.8%
if -7.00000000000000011e-22 < y.im < 1.7999999999999999e67Initial program 74.6%
Taylor expanded in y.re around inf 79.0%
+-commutative79.0%
mul-1-neg79.0%
unsub-neg79.0%
*-commutative79.0%
associate-/l*77.4%
Simplified77.4%
*-un-lft-identity77.4%
unpow277.4%
times-frac80.1%
Applied egg-rr80.1%
associate-*l/80.1%
*-lft-identity80.1%
Simplified80.1%
*-un-lft-identity80.1%
associate-*r/84.0%
sub-div85.5%
clear-num85.5%
un-div-inv85.5%
Applied egg-rr85.5%
*-lft-identity85.5%
associate-/r/86.2%
Simplified86.2%
Final simplification83.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -1.9e-21) (not (<= y.im 2.4e+68))) (/ x.re (- y.im)) (/ (- x.im (* x.re (/ 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 <= -1.9e-21) || !(y_46_im <= 2.4e+68)) {
tmp = x_46_re / -y_46_im;
} else {
tmp = (x_46_im - (x_46_re * (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 <= (-1.9d-21)) .or. (.not. (y_46im <= 2.4d+68))) then
tmp = x_46re / -y_46im
else
tmp = (x_46im - (x_46re * (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 <= -1.9e-21) || !(y_46_im <= 2.4e+68)) {
tmp = x_46_re / -y_46_im;
} else {
tmp = (x_46_im - (x_46_re * (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 <= -1.9e-21) or not (y_46_im <= 2.4e+68): tmp = x_46_re / -y_46_im else: tmp = (x_46_im - (x_46_re * (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 <= -1.9e-21) || !(y_46_im <= 2.4e+68)) tmp = Float64(x_46_re / Float64(-y_46_im)); else tmp = Float64(Float64(x_46_im - Float64(x_46_re * 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 <= -1.9e-21) || ~((y_46_im <= 2.4e+68))) tmp = x_46_re / -y_46_im; else tmp = (x_46_im - (x_46_re * (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, -1.9e-21], N[Not[LessEqual[y$46$im, 2.4e+68]], $MachinePrecision]], N[(x$46$re / (-y$46$im)), $MachinePrecision], N[(N[(x$46$im - N[(x$46$re * 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 -1.9 \cdot 10^{-21} \lor \neg \left(y.im \leq 2.4 \cdot 10^{+68}\right):\\
\;\;\;\;\frac{x.re}{-y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\end{array}
\end{array}
if y.im < -1.8999999999999999e-21 or 2.40000000000000008e68 < y.im Initial program 42.2%
Taylor expanded in y.re around 0 71.9%
associate-*r/71.9%
neg-mul-171.9%
Simplified71.9%
if -1.8999999999999999e-21 < y.im < 2.40000000000000008e68Initial program 74.6%
Taylor expanded in y.re around inf 79.0%
+-commutative79.0%
mul-1-neg79.0%
unsub-neg79.0%
*-commutative79.0%
associate-/l*77.4%
Simplified77.4%
*-un-lft-identity77.4%
unpow277.4%
times-frac80.1%
Applied egg-rr80.1%
associate-*l/80.1%
*-lft-identity80.1%
Simplified80.1%
*-un-lft-identity80.1%
associate-*r/84.0%
sub-div85.5%
clear-num85.5%
un-div-inv85.5%
Applied egg-rr85.5%
*-lft-identity85.5%
associate-/r/86.2%
Simplified86.2%
Final simplification79.6%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -1.4e-21) (not (<= y.im 2.35e+67))) (/ x.re (- y.im)) (/ x.im 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 <= -1.4e-21) || !(y_46_im <= 2.35e+67)) {
tmp = x_46_re / -y_46_im;
} else {
tmp = x_46_im / 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 <= (-1.4d-21)) .or. (.not. (y_46im <= 2.35d+67))) then
tmp = x_46re / -y_46im
else
tmp = x_46im / 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 <= -1.4e-21) || !(y_46_im <= 2.35e+67)) {
tmp = x_46_re / -y_46_im;
} else {
tmp = x_46_im / 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 <= -1.4e-21) or not (y_46_im <= 2.35e+67): tmp = x_46_re / -y_46_im else: tmp = x_46_im / 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 <= -1.4e-21) || !(y_46_im <= 2.35e+67)) tmp = Float64(x_46_re / Float64(-y_46_im)); else tmp = Float64(x_46_im / 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 <= -1.4e-21) || ~((y_46_im <= 2.35e+67))) tmp = x_46_re / -y_46_im; else tmp = x_46_im / 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, -1.4e-21], N[Not[LessEqual[y$46$im, 2.35e+67]], $MachinePrecision]], N[(x$46$re / (-y$46$im)), $MachinePrecision], N[(x$46$im / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -1.4 \cdot 10^{-21} \lor \neg \left(y.im \leq 2.35 \cdot 10^{+67}\right):\\
\;\;\;\;\frac{x.re}{-y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.im < -1.40000000000000002e-21 or 2.35000000000000009e67 < y.im Initial program 42.2%
Taylor expanded in y.re around 0 71.9%
associate-*r/71.9%
neg-mul-171.9%
Simplified71.9%
if -1.40000000000000002e-21 < y.im < 2.35000000000000009e67Initial program 74.6%
Taylor expanded in y.re around inf 67.4%
Final simplification69.5%
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ x.im y.re))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return x_46_im / y_46_re;
}
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_46re
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_re;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return x_46_im / y_46_re
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(x_46_im / y_46_re) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = x_46_im / y_46_re; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(x$46$im / y$46$re), $MachinePrecision]
\begin{array}{l}
\\
\frac{x.im}{y.re}
\end{array}
Initial program 59.7%
Taylor expanded in y.re around inf 44.4%
Final simplification44.4%
herbie shell --seed 2024039
(FPCore (x.re x.im y.re y.im)
:name "_divideComplex, imaginary part"
:precision binary64
(/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))