
(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 11 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 (* (/ y.im (hypot y.im y.re)) (/ -1.0 (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)) * (-1.0 / 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(-1.0 / 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[(-1.0 / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $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 \left(\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{-1}{\mathsf{hypot}\left(y.im, y.re\right)}\right)\right)
\end{array}
Initial program 63.6%
div-sub61.1%
*-commutative61.1%
add-sqr-sqrt61.1%
times-frac65.3%
fma-neg65.3%
hypot-define65.3%
hypot-define79.7%
associate-/l*82.9%
add-sqr-sqrt82.9%
pow282.9%
hypot-define82.9%
Applied egg-rr82.9%
Applied egg-rr96.0%
Final simplification96.0%
(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 (/ (- (* y.re (/ x.im y.im)) x.re) y.im)))
(if (<= y.im -4.4e+164)
t_1
(if (<= y.im -5e-183)
t_0
(if (<= y.im 1.05e-116)
(/ (* x.im (- 1.0 (* x.re (/ (/ y.im x.im) y.re)))) y.re)
(if (<= y.im 6.6e+128) 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 = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -4.4e+164) {
tmp = t_1;
} else if (y_46_im <= -5e-183) {
tmp = t_0;
} else if (y_46_im <= 1.05e-116) {
tmp = (x_46_im * (1.0 - (x_46_re * ((y_46_im / x_46_im) / y_46_re)))) / y_46_re;
} else if (y_46_im <= 6.6e+128) {
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 = Float64(Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re) / y_46_im) tmp = 0.0 if (y_46_im <= -4.4e+164) tmp = t_1; elseif (y_46_im <= -5e-183) tmp = t_0; elseif (y_46_im <= 1.05e-116) tmp = Float64(Float64(x_46_im * Float64(1.0 - Float64(x_46_re * Float64(Float64(y_46_im / x_46_im) / y_46_re)))) / y_46_re); elseif (y_46_im <= 6.6e+128) 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[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -4.4e+164], t$95$1, If[LessEqual[y$46$im, -5e-183], t$95$0, If[LessEqual[y$46$im, 1.05e-116], N[(N[(x$46$im * N[(1.0 - N[(x$46$re * N[(N[(y$46$im / x$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 6.6e+128], 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 := \frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\
\mathbf{if}\;y.im \leq -4.4 \cdot 10^{+164}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq -5 \cdot 10^{-183}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 1.05 \cdot 10^{-116}:\\
\;\;\;\;\frac{x.im \cdot \left(1 - x.re \cdot \frac{\frac{y.im}{x.im}}{y.re}\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 6.6 \cdot 10^{+128}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.im < -4.40000000000000011e164 or 6.6000000000000001e128 < y.im Initial program 44.6%
Taylor expanded in y.re around 0 71.6%
+-commutative71.6%
mul-1-neg71.6%
unsub-neg71.6%
unpow271.6%
associate-/r*74.9%
div-sub74.9%
*-commutative74.9%
associate-/l*91.3%
Simplified91.3%
if -4.40000000000000011e164 < y.im < -5.0000000000000002e-183 or 1.05e-116 < y.im < 6.6000000000000001e128Initial program 71.1%
div-sub71.1%
*-commutative71.1%
add-sqr-sqrt71.1%
times-frac75.2%
fma-neg75.2%
hypot-define75.2%
hypot-define87.2%
associate-/l*90.9%
add-sqr-sqrt90.9%
pow290.9%
hypot-define90.9%
Applied egg-rr90.9%
if -5.0000000000000002e-183 < y.im < 1.05e-116Initial program 64.7%
Taylor expanded in y.re around inf 91.7%
remove-double-neg91.7%
mul-1-neg91.7%
neg-mul-191.7%
distribute-lft-in91.7%
distribute-lft-in91.7%
neg-mul-191.7%
mul-1-neg91.7%
remove-double-neg91.7%
associate-*r/91.7%
associate-*r*91.7%
neg-mul-191.7%
Simplified91.7%
Taylor expanded in x.im around inf 83.8%
mul-1-neg83.8%
unsub-neg83.8%
associate-/l*83.9%
associate-/r*92.9%
Simplified92.9%
Final simplification91.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (or (<= y.im -3.5e+100) (not (<= y.im 1.8e+128)))
(/ (- (* y.re (/ x.im y.im)) x.re) y.im)
(fma
(/ y.re (hypot y.re y.im))
(/ x.im (hypot y.re y.im))
(/ (/ (* y.im (- x.re)) (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) {
double tmp;
if ((y_46_im <= -3.5e+100) || !(y_46_im <= 1.8e+128)) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
} else {
tmp = fma((y_46_re / hypot(y_46_re, y_46_im)), (x_46_im / hypot(y_46_re, y_46_im)), (((y_46_im * -x_46_re) / hypot(y_46_im, y_46_re)) / hypot(y_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 <= -3.5e+100) || !(y_46_im <= 1.8e+128)) tmp = Float64(Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re) / y_46_im); else tmp = 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(Float64(y_46_im * Float64(-x_46_re)) / hypot(y_46_im, y_46_re)) / hypot(y_46_im, y_46_re))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -3.5e+100], N[Not[LessEqual[y$46$im, 1.8e+128]], $MachinePrecision]], N[(N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], 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[(N[(y$46$im * (-x$46$re)), $MachinePrecision] / 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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -3.5 \cdot 10^{+100} \lor \neg \left(y.im \leq 1.8 \cdot 10^{+128}\right):\\
\;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\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{y.im \cdot \left(-x.re\right)}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}\right)\\
\end{array}
\end{array}
if y.im < -3.49999999999999976e100 or 1.80000000000000014e128 < y.im Initial program 39.7%
Taylor expanded in y.re around 0 70.0%
+-commutative70.0%
mul-1-neg70.0%
unsub-neg70.0%
unpow270.0%
associate-/r*72.8%
div-sub72.8%
*-commutative72.8%
associate-/l*86.8%
Simplified86.8%
if -3.49999999999999976e100 < y.im < 1.80000000000000014e128Initial program 71.6%
div-sub68.2%
*-commutative68.2%
add-sqr-sqrt68.2%
times-frac72.7%
fma-neg72.7%
hypot-define72.7%
hypot-define87.1%
associate-/l*87.6%
add-sqr-sqrt87.6%
pow287.6%
hypot-define87.6%
Applied egg-rr87.6%
Applied egg-rr97.3%
Final simplification94.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (pow (hypot y.re y.im) 2.0))
(t_1 (/ (- x.im (* y.im (/ x.re y.re))) y.re)))
(if (<= y.re -1.85e+120)
t_1
(if (<= y.re -7.5e-145)
(fma y.re (/ x.im t_0) (* x.re (/ y.im (- t_0))))
(if (<= y.re 1.12e-145)
(/ (- (* x.im (/ y.re y.im)) x.re) y.im)
(if (<= y.re 2.8e+26)
(/ (fma x.im y.re (* y.im (- x.re))) (fma y.im y.im (* y.re y.re)))
t_1))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = pow(hypot(y_46_re, y_46_im), 2.0);
double t_1 = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
double tmp;
if (y_46_re <= -1.85e+120) {
tmp = t_1;
} else if (y_46_re <= -7.5e-145) {
tmp = fma(y_46_re, (x_46_im / t_0), (x_46_re * (y_46_im / -t_0)));
} else if (y_46_re <= 1.12e-145) {
tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
} else if (y_46_re <= 2.8e+26) {
tmp = fma(x_46_im, y_46_re, (y_46_im * -x_46_re)) / fma(y_46_im, y_46_im, (y_46_re * y_46_re));
} else {
tmp = t_1;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = hypot(y_46_re, y_46_im) ^ 2.0 t_1 = Float64(Float64(x_46_im - Float64(y_46_im * Float64(x_46_re / y_46_re))) / y_46_re) tmp = 0.0 if (y_46_re <= -1.85e+120) tmp = t_1; elseif (y_46_re <= -7.5e-145) tmp = fma(y_46_re, Float64(x_46_im / t_0), Float64(x_46_re * Float64(y_46_im / Float64(-t_0)))); elseif (y_46_re <= 1.12e-145) tmp = Float64(Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im); elseif (y_46_re <= 2.8e+26) tmp = Float64(fma(x_46_im, y_46_re, Float64(y_46_im * Float64(-x_46_re))) / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))); 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[Power[N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[(x$46$im - N[(y$46$im * N[(x$46$re / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -1.85e+120], t$95$1, If[LessEqual[y$46$re, -7.5e-145], N[(y$46$re * N[(x$46$im / t$95$0), $MachinePrecision] + N[(x$46$re * N[(y$46$im / (-t$95$0)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 1.12e-145], N[(N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 2.8e+26], N[(N[(x$46$im * y$46$re + N[(y$46$im * (-x$46$re)), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}\\
t_1 := \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re}\\
\mathbf{if}\;y.re \leq -1.85 \cdot 10^{+120}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.re \leq -7.5 \cdot 10^{-145}:\\
\;\;\;\;\mathsf{fma}\left(y.re, \frac{x.im}{t\_0}, x.re \cdot \frac{y.im}{-t\_0}\right)\\
\mathbf{elif}\;y.re \leq 1.12 \cdot 10^{-145}:\\
\;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\
\mathbf{elif}\;y.re \leq 2.8 \cdot 10^{+26}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, y.re, y.im \cdot \left(-x.re\right)\right)}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.re < -1.85000000000000012e120 or 2.8e26 < y.re Initial program 40.6%
Taylor expanded in y.re around inf 79.4%
remove-double-neg79.4%
mul-1-neg79.4%
neg-mul-179.4%
distribute-lft-in79.4%
distribute-lft-in79.4%
neg-mul-179.4%
mul-1-neg79.4%
remove-double-neg79.4%
associate-*r/79.4%
associate-*r*79.4%
neg-mul-179.4%
Simplified79.4%
Taylor expanded in x.re around 0 79.4%
mul-1-neg79.4%
*-commutative79.4%
associate-*r/86.4%
distribute-rgt-neg-out86.4%
distribute-frac-neg86.4%
Simplified86.4%
if -1.85000000000000012e120 < y.re < -7.4999999999999996e-145Initial program 79.7%
div-sub79.7%
*-commutative79.7%
associate-/l*85.5%
fma-neg85.4%
add-sqr-sqrt85.4%
pow285.4%
hypot-define85.4%
associate-/l*88.8%
add-sqr-sqrt88.8%
pow288.8%
hypot-define88.8%
Applied egg-rr88.8%
if -7.4999999999999996e-145 < y.re < 1.12000000000000001e-145Initial program 68.8%
div-sub57.9%
*-commutative57.9%
add-sqr-sqrt57.9%
times-frac60.0%
fma-neg60.0%
hypot-define60.0%
hypot-define62.1%
associate-/l*68.8%
add-sqr-sqrt68.8%
pow268.8%
hypot-define68.8%
Applied egg-rr68.8%
Applied egg-rr96.6%
Taylor expanded in y.im around -inf 87.8%
mul-1-neg87.8%
distribute-lft-out--87.8%
associate-/l*87.9%
Simplified87.9%
if 1.12000000000000001e-145 < y.re < 2.8e26Initial program 86.4%
fma-neg86.4%
distribute-rgt-neg-out86.4%
+-commutative86.4%
fma-define86.4%
Simplified86.4%
Final simplification87.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(/ (- (* y.re x.im) (* y.im x.re)) (+ (* y.re y.re) (* y.im y.im))))
(t_1 (/ (- (* y.re (/ x.im y.im)) x.re) y.im)))
(if (<= y.im -1.45e+77)
t_1
(if (<= y.im -7.2e-56)
t_0
(if (<= y.im 7.5e-62)
(/ (* x.im (- 1.0 (* x.re (/ (/ y.im x.im) y.re)))) y.re)
(if (<= y.im 2.9e+122) 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 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
double t_1 = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -1.45e+77) {
tmp = t_1;
} else if (y_46_im <= -7.2e-56) {
tmp = t_0;
} else if (y_46_im <= 7.5e-62) {
tmp = (x_46_im * (1.0 - (x_46_re * ((y_46_im / x_46_im) / y_46_re)))) / y_46_re;
} else if (y_46_im <= 2.9e+122) {
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 = ((y_46re * x_46im) - (y_46im * x_46re)) / ((y_46re * y_46re) + (y_46im * y_46im))
t_1 = ((y_46re * (x_46im / y_46im)) - x_46re) / y_46im
if (y_46im <= (-1.45d+77)) then
tmp = t_1
else if (y_46im <= (-7.2d-56)) then
tmp = t_0
else if (y_46im <= 7.5d-62) then
tmp = (x_46im * (1.0d0 - (x_46re * ((y_46im / x_46im) / y_46re)))) / y_46re
else if (y_46im <= 2.9d+122) 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 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
double t_1 = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -1.45e+77) {
tmp = t_1;
} else if (y_46_im <= -7.2e-56) {
tmp = t_0;
} else if (y_46_im <= 7.5e-62) {
tmp = (x_46_im * (1.0 - (x_46_re * ((y_46_im / x_46_im) / y_46_re)))) / y_46_re;
} else if (y_46_im <= 2.9e+122) {
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 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)) t_1 = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im tmp = 0 if y_46_im <= -1.45e+77: tmp = t_1 elif y_46_im <= -7.2e-56: tmp = t_0 elif y_46_im <= 7.5e-62: tmp = (x_46_im * (1.0 - (x_46_re * ((y_46_im / x_46_im) / y_46_re)))) / y_46_re elif y_46_im <= 2.9e+122: 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(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))) t_1 = Float64(Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re) / y_46_im) tmp = 0.0 if (y_46_im <= -1.45e+77) tmp = t_1; elseif (y_46_im <= -7.2e-56) tmp = t_0; elseif (y_46_im <= 7.5e-62) tmp = Float64(Float64(x_46_im * Float64(1.0 - Float64(x_46_re * Float64(Float64(y_46_im / x_46_im) / y_46_re)))) / y_46_re); elseif (y_46_im <= 2.9e+122) 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 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); t_1 = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im; tmp = 0.0; if (y_46_im <= -1.45e+77) tmp = t_1; elseif (y_46_im <= -7.2e-56) tmp = t_0; elseif (y_46_im <= 7.5e-62) tmp = (x_46_im * (1.0 - (x_46_re * ((y_46_im / x_46_im) / y_46_re)))) / y_46_re; elseif (y_46_im <= 2.9e+122) 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[(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]}, Block[{t$95$1 = N[(N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -1.45e+77], t$95$1, If[LessEqual[y$46$im, -7.2e-56], t$95$0, If[LessEqual[y$46$im, 7.5e-62], N[(N[(x$46$im * N[(1.0 - N[(x$46$re * N[(N[(y$46$im / x$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 2.9e+122], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\
t_1 := \frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\
\mathbf{if}\;y.im \leq -1.45 \cdot 10^{+77}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq -7.2 \cdot 10^{-56}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 7.5 \cdot 10^{-62}:\\
\;\;\;\;\frac{x.im \cdot \left(1 - x.re \cdot \frac{\frac{y.im}{x.im}}{y.re}\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 2.9 \cdot 10^{+122}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.im < -1.4500000000000001e77 or 2.9000000000000001e122 < y.im Initial program 39.6%
Taylor expanded in y.re around 0 67.1%
+-commutative67.1%
mul-1-neg67.1%
unsub-neg67.1%
unpow267.1%
associate-/r*69.8%
div-sub69.8%
*-commutative69.8%
associate-/l*85.9%
Simplified85.9%
if -1.4500000000000001e77 < y.im < -7.19999999999999956e-56 or 7.5000000000000003e-62 < y.im < 2.9000000000000001e122Initial program 81.9%
if -7.19999999999999956e-56 < y.im < 7.5000000000000003e-62Initial program 66.2%
Taylor expanded in y.re around inf 89.3%
remove-double-neg89.3%
mul-1-neg89.3%
neg-mul-189.3%
distribute-lft-in89.3%
distribute-lft-in89.3%
neg-mul-189.3%
mul-1-neg89.3%
remove-double-neg89.3%
associate-*r/89.3%
associate-*r*89.3%
neg-mul-189.3%
Simplified89.3%
Taylor expanded in x.im around inf 82.7%
mul-1-neg82.7%
unsub-neg82.7%
associate-/l*82.8%
associate-/r*89.4%
Simplified89.4%
Final simplification86.4%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -7e+21) (not (<= y.im 1.02e+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 <= -7e+21) || !(y_46_im <= 1.02e+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 <= (-7d+21)) .or. (.not. (y_46im <= 1.02d+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 <= -7e+21) || !(y_46_im <= 1.02e+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 <= -7e+21) or not (y_46_im <= 1.02e+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 <= -7e+21) || !(y_46_im <= 1.02e+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 <= -7e+21) || ~((y_46_im <= 1.02e+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, -7e+21], N[Not[LessEqual[y$46$im, 1.02e+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 -7 \cdot 10^{+21} \lor \neg \left(y.im \leq 1.02 \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 < -7e21 or 1.02e68 < y.im Initial program 48.6%
Taylor expanded in y.re around 0 68.2%
associate-*r/68.2%
neg-mul-168.2%
Simplified68.2%
if -7e21 < y.im < 1.02e68Initial program 72.0%
Taylor expanded in y.re around inf 78.4%
remove-double-neg78.4%
mul-1-neg78.4%
mul-1-neg78.4%
distribute-neg-in78.4%
distribute-neg-in78.4%
mul-1-neg78.4%
remove-double-neg78.4%
unsub-neg78.4%
associate-/l*78.4%
Simplified78.4%
Final simplification74.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -1.8e-42) (not (<= y.im 5.9e-40))) (/ (- (* y.re (/ x.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 <= -1.8e-42) || !(y_46_im <= 5.9e-40)) {
tmp = ((y_46_re * (x_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 <= (-1.8d-42)) .or. (.not. (y_46im <= 5.9d-40))) then
tmp = ((y_46re * (x_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 <= -1.8e-42) || !(y_46_im <= 5.9e-40)) {
tmp = ((y_46_re * (x_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 <= -1.8e-42) or not (y_46_im <= 5.9e-40): tmp = ((y_46_re * (x_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 <= -1.8e-42) || !(y_46_im <= 5.9e-40)) tmp = Float64(Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - 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 <= -1.8e-42) || ~((y_46_im <= 5.9e-40))) tmp = ((y_46_re * (x_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, -1.8e-42], N[Not[LessEqual[y$46$im, 5.9e-40]], $MachinePrecision]], N[(N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / 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.8 \cdot 10^{-42} \lor \neg \left(y.im \leq 5.9 \cdot 10^{-40}\right):\\
\;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - 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.8000000000000001e-42 or 5.89999999999999966e-40 < y.im Initial program 60.5%
Taylor expanded in y.re around 0 63.3%
+-commutative63.3%
mul-1-neg63.3%
unsub-neg63.3%
unpow263.3%
associate-/r*64.6%
div-sub64.6%
*-commutative64.6%
associate-/l*72.6%
Simplified72.6%
if -1.8000000000000001e-42 < y.im < 5.89999999999999966e-40Initial program 67.1%
Taylor expanded in y.re around inf 88.1%
remove-double-neg88.1%
mul-1-neg88.1%
mul-1-neg88.1%
distribute-neg-in88.1%
distribute-neg-in88.1%
mul-1-neg88.1%
remove-double-neg88.1%
unsub-neg88.1%
associate-/l*88.1%
Simplified88.1%
Final simplification79.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -1.3e-55)
(/ (- (* x.im (/ y.re y.im)) x.re) y.im)
(if (<= y.im 5.6e-43)
(/ (- x.im (* x.re (/ y.im y.re))) y.re)
(/ (- (* y.re (/ 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 tmp;
if (y_46_im <= -1.3e-55) {
tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
} else if (y_46_im <= 5.6e-43) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
}
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.3d-55)) then
tmp = ((x_46im * (y_46re / y_46im)) - x_46re) / y_46im
else if (y_46im <= 5.6d-43) then
tmp = (x_46im - (x_46re * (y_46im / y_46re))) / y_46re
else
tmp = ((y_46re * (x_46im / y_46im)) - x_46re) / y_46im
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.3e-55) {
tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
} else if (y_46_im <= 5.6e-43) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_im <= -1.3e-55: tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im elif y_46_im <= 5.6e-43: tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re else: tmp = ((y_46_re * (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) tmp = 0.0 if (y_46_im <= -1.3e-55) tmp = Float64(Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im); elseif (y_46_im <= 5.6e-43) tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); else tmp = Float64(Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re) / y_46_im); 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.3e-55) tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im; elseif (y_46_im <= 5.6e-43) tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re; else tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -1.3e-55], N[(N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 5.6e-43], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], N[(N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -1.3 \cdot 10^{-55}:\\
\;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\
\mathbf{elif}\;y.im \leq 5.6 \cdot 10^{-43}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\
\end{array}
\end{array}
if y.im < -1.2999999999999999e-55Initial program 52.6%
div-sub52.6%
*-commutative52.6%
add-sqr-sqrt52.6%
times-frac55.9%
fma-neg55.9%
hypot-define55.9%
hypot-define64.9%
associate-/l*75.4%
add-sqr-sqrt75.4%
pow275.4%
hypot-define75.4%
Applied egg-rr75.4%
Applied egg-rr94.9%
Taylor expanded in y.im around -inf 65.3%
mul-1-neg65.3%
distribute-lft-out--65.3%
associate-/l*70.2%
Simplified70.2%
if -1.2999999999999999e-55 < y.im < 5.5999999999999996e-43Initial program 66.8%
Taylor expanded in y.re around inf 88.7%
remove-double-neg88.7%
mul-1-neg88.7%
mul-1-neg88.7%
distribute-neg-in88.7%
distribute-neg-in88.7%
mul-1-neg88.7%
remove-double-neg88.7%
unsub-neg88.7%
associate-/l*88.8%
Simplified88.8%
if 5.5999999999999996e-43 < y.im Initial program 67.9%
Taylor expanded in y.re around 0 64.8%
+-commutative64.8%
mul-1-neg64.8%
unsub-neg64.8%
unpow264.8%
associate-/r*64.5%
div-sub64.5%
*-commutative64.5%
associate-/l*73.9%
Simplified73.9%
Final simplification80.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -1.65e-50) (not (<= y.im 3e-61))) (/ 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.65e-50) || !(y_46_im <= 3e-61)) {
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.65d-50)) .or. (.not. (y_46im <= 3d-61))) 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.65e-50) || !(y_46_im <= 3e-61)) {
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.65e-50) or not (y_46_im <= 3e-61): 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.65e-50) || !(y_46_im <= 3e-61)) 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.65e-50) || ~((y_46_im <= 3e-61))) 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.65e-50], N[Not[LessEqual[y$46$im, 3e-61]], $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.65 \cdot 10^{-50} \lor \neg \left(y.im \leq 3 \cdot 10^{-61}\right):\\
\;\;\;\;\frac{x.re}{-y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.im < -1.6499999999999999e-50 or 3.00000000000000012e-61 < y.im Initial program 61.1%
Taylor expanded in y.re around 0 58.3%
associate-*r/58.3%
neg-mul-158.3%
Simplified58.3%
if -1.6499999999999999e-50 < y.im < 3.00000000000000012e-61Initial program 66.5%
Taylor expanded in y.re around inf 69.9%
Final simplification63.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -1.9e+211) (not (<= y.im 1.15e+129))) (/ 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.9e+211) || !(y_46_im <= 1.15e+129)) {
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.9d+211)) .or. (.not. (y_46im <= 1.15d+129))) 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.9e+211) || !(y_46_im <= 1.15e+129)) {
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.9e+211) or not (y_46_im <= 1.15e+129): 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.9e+211) || !(y_46_im <= 1.15e+129)) tmp = Float64(x_46_re / 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.9e+211) || ~((y_46_im <= 1.15e+129))) 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.9e+211], N[Not[LessEqual[y$46$im, 1.15e+129]], $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.9 \cdot 10^{+211} \lor \neg \left(y.im \leq 1.15 \cdot 10^{+129}\right):\\
\;\;\;\;\frac{x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.im < -1.90000000000000008e211 or 1.14999999999999995e129 < y.im Initial program 52.6%
Taylor expanded in x.im around 0 50.5%
associate-/l*51.5%
associate-*r*51.5%
rem-square-sqrt51.5%
+-commutative51.5%
unpow251.5%
unpow251.5%
hypot-undefine51.5%
+-commutative51.5%
unpow251.5%
unpow251.5%
hypot-undefine51.5%
unpow251.5%
*-commutative51.5%
associate-*l*51.5%
neg-mul-151.5%
distribute-neg-frac251.5%
Simplified51.5%
Taylor expanded in y.im around inf 76.8%
*-commutative76.8%
associate-*l/77.0%
neg-mul-177.0%
add-sqr-sqrt43.6%
sqrt-unprod55.5%
sqr-neg55.5%
sqrt-unprod22.4%
add-sqr-sqrt46.9%
Applied egg-rr46.9%
if -1.90000000000000008e211 < y.im < 1.14999999999999995e129Initial program 66.0%
Taylor expanded in y.re around inf 50.0%
Final simplification49.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 63.6%
Taylor expanded in y.re around inf 43.8%
Final simplification43.8%
herbie shell --seed 2024077
(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))))