
(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 (/ (/ 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 60.1%
div-sub58.4%
*-commutative58.4%
add-sqr-sqrt58.4%
times-frac61.5%
fma-neg61.5%
hypot-define61.5%
hypot-define78.2%
associate-/l*81.9%
add-sqr-sqrt81.9%
pow281.9%
hypot-define81.9%
Applied egg-rr81.9%
*-un-lft-identity81.9%
unpow281.9%
times-frac96.7%
hypot-undefine81.9%
+-commutative81.9%
hypot-define96.7%
hypot-undefine81.9%
+-commutative81.9%
hypot-define96.7%
Applied egg-rr96.7%
associate-*l/96.7%
*-lft-identity96.7%
Simplified96.7%
Final simplification96.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ y.re (hypot y.re y.im)))
(t_1 (/ x.im (hypot y.re y.im)))
(t_2 (fma t_0 t_1 (* x.re (/ (- y.im) (pow (hypot y.re y.im) 2.0)))))
(t_3 (fma t_0 t_1 (/ x.re (- y.im)))))
(if (<= y.im -7e+131)
t_3
(if (<= y.im -1e-134)
t_2
(if (<= y.im 460.0)
(/ (- x.im (* x.re (/ y.im y.re))) y.re)
(if (<= y.im 2.6e+147) t_2 t_3))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re / hypot(y_46_re, y_46_im);
double t_1 = x_46_im / hypot(y_46_re, y_46_im);
double t_2 = fma(t_0, t_1, (x_46_re * (-y_46_im / pow(hypot(y_46_re, y_46_im), 2.0))));
double t_3 = fma(t_0, t_1, (x_46_re / -y_46_im));
double tmp;
if (y_46_im <= -7e+131) {
tmp = t_3;
} else if (y_46_im <= -1e-134) {
tmp = t_2;
} else if (y_46_im <= 460.0) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else if (y_46_im <= 2.6e+147) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re / hypot(y_46_re, y_46_im)) t_1 = Float64(x_46_im / hypot(y_46_re, y_46_im)) t_2 = fma(t_0, t_1, Float64(x_46_re * Float64(Float64(-y_46_im) / (hypot(y_46_re, y_46_im) ^ 2.0)))) t_3 = fma(t_0, t_1, Float64(x_46_re / Float64(-y_46_im))) tmp = 0.0 if (y_46_im <= -7e+131) tmp = t_3; elseif (y_46_im <= -1e-134) tmp = t_2; elseif (y_46_im <= 460.0) tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); elseif (y_46_im <= 2.6e+147) tmp = t_2; else tmp = t_3; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * t$95$1 + 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$3 = N[(t$95$0 * t$95$1 + N[(x$46$re / (-y$46$im)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -7e+131], t$95$3, If[LessEqual[y$46$im, -1e-134], t$95$2, If[LessEqual[y$46$im, 460.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, 2.6e+147], t$95$2, t$95$3]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}\\
t_1 := \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\
t_2 := \mathsf{fma}\left(t\_0, t\_1, x.re \cdot \frac{-y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)\\
t_3 := \mathsf{fma}\left(t\_0, t\_1, \frac{x.re}{-y.im}\right)\\
\mathbf{if}\;y.im \leq -7 \cdot 10^{+131}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;y.im \leq -1 \cdot 10^{-134}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y.im \leq 460:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 2.6 \cdot 10^{+147}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if y.im < -6.9999999999999998e131 or 2.5999999999999999e147 < y.im Initial program 31.5%
div-sub31.5%
*-commutative31.5%
add-sqr-sqrt31.5%
times-frac31.8%
fma-neg31.8%
hypot-define31.8%
hypot-define49.6%
associate-/l*53.9%
add-sqr-sqrt53.9%
pow253.9%
hypot-define53.9%
Applied egg-rr53.9%
Taylor expanded in y.im around inf 93.9%
if -6.9999999999999998e131 < y.im < -1.00000000000000004e-134 or 460 < y.im < 2.5999999999999999e147Initial program 72.4%
div-sub72.4%
*-commutative72.4%
add-sqr-sqrt72.4%
times-frac77.0%
fma-neg77.0%
hypot-define77.0%
hypot-define88.5%
associate-/l*93.7%
add-sqr-sqrt93.7%
pow293.7%
hypot-define93.7%
Applied egg-rr93.7%
if -1.00000000000000004e-134 < y.im < 460Initial program 66.2%
Taylor expanded in y.re around inf 93.5%
remove-double-neg93.5%
mul-1-neg93.5%
neg-mul-193.5%
distribute-lft-in93.5%
mul-1-neg93.5%
distribute-neg-in93.5%
mul-1-neg93.5%
remove-double-neg93.5%
unsub-neg93.5%
associate-/l*94.4%
Simplified94.4%
Final simplification94.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)))))
(if (<= y.im -4.6e+102)
t_0
(if (<= y.im -3.15e-50)
(/ (- (* y.re x.im) (* y.im x.re)) (+ (* y.re y.re) (* y.im y.im)))
(if (<= y.im 35000000000.0)
(/ (- x.im (* x.re (/ y.im y.re))) y.re)
t_0)))))
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));
double tmp;
if (y_46_im <= -4.6e+102) {
tmp = t_0;
} else if (y_46_im <= -3.15e-50) {
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 <= 35000000000.0) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else {
tmp = t_0;
}
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))) tmp = 0.0 if (y_46_im <= -4.6e+102) tmp = t_0; elseif (y_46_im <= -3.15e-50) 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 <= 35000000000.0) tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); else tmp = t_0; 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 / (-y$46$im)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -4.6e+102], t$95$0, If[LessEqual[y$46$im, -3.15e-50], 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, 35000000000.0], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]]
\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)}, \frac{x.re}{-y.im}\right)\\
\mathbf{if}\;y.im \leq -4.6 \cdot 10^{+102}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq -3.15 \cdot 10^{-50}:\\
\;\;\;\;\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 35000000000:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -4.5999999999999998e102 or 3.5e10 < y.im Initial program 44.9%
div-sub44.9%
*-commutative44.9%
add-sqr-sqrt44.9%
times-frac46.2%
fma-neg46.2%
hypot-define46.2%
hypot-define61.3%
associate-/l*70.0%
add-sqr-sqrt70.0%
pow270.0%
hypot-define70.0%
Applied egg-rr70.0%
Taylor expanded in y.im around inf 91.7%
if -4.5999999999999998e102 < y.im < -3.15000000000000011e-50Initial program 83.0%
if -3.15000000000000011e-50 < y.im < 3.5e10Initial program 65.6%
Taylor expanded in y.re around inf 91.5%
remove-double-neg91.5%
mul-1-neg91.5%
neg-mul-191.5%
distribute-lft-in91.5%
mul-1-neg91.5%
distribute-neg-in91.5%
mul-1-neg91.5%
remove-double-neg91.5%
unsub-neg91.5%
associate-/l*92.3%
Simplified92.3%
Final simplification90.8%
(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)))))
(if (<= y.im -1.7e+106)
(/ (- (* y.re (/ x.im y.im)) x.re) y.im)
(if (<= y.im -2.4e-45)
t_0
(if (<= y.im 460.0)
(/ (- x.im (* x.re (/ y.im y.re))) y.re)
(if (<= y.im 3.5e+75)
t_0
(/ (- (* x.im (/ y.re 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 = ((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 tmp;
if (y_46_im <= -1.7e+106) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
} else if (y_46_im <= -2.4e-45) {
tmp = t_0;
} else if (y_46_im <= 460.0) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else if (y_46_im <= 3.5e+75) {
tmp = t_0;
} else {
tmp = ((x_46_im * (y_46_re / 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) :: t_0
real(8) :: tmp
t_0 = ((y_46re * x_46im) - (y_46im * x_46re)) / ((y_46re * y_46re) + (y_46im * y_46im))
if (y_46im <= (-1.7d+106)) then
tmp = ((y_46re * (x_46im / y_46im)) - x_46re) / y_46im
else if (y_46im <= (-2.4d-45)) then
tmp = t_0
else if (y_46im <= 460.0d0) then
tmp = (x_46im - (x_46re * (y_46im / y_46re))) / y_46re
else if (y_46im <= 3.5d+75) then
tmp = t_0
else
tmp = ((x_46im * (y_46re / 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 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 tmp;
if (y_46_im <= -1.7e+106) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
} else if (y_46_im <= -2.4e-45) {
tmp = t_0;
} else if (y_46_im <= 460.0) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else if (y_46_im <= 3.5e+75) {
tmp = t_0;
} else {
tmp = ((x_46_im * (y_46_re / 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): 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)) tmp = 0 if y_46_im <= -1.7e+106: tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im elif y_46_im <= -2.4e-45: tmp = t_0 elif y_46_im <= 460.0: tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re elif y_46_im <= 3.5e+75: tmp = t_0 else: tmp = ((x_46_im * (y_46_re / 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(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))) tmp = 0.0 if (y_46_im <= -1.7e+106) tmp = Float64(Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re) / y_46_im); elseif (y_46_im <= -2.4e-45) tmp = t_0; elseif (y_46_im <= 460.0) tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); elseif (y_46_im <= 3.5e+75) tmp = t_0; else tmp = Float64(Float64(Float64(x_46_im * Float64(y_46_re / 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) 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)); tmp = 0.0; if (y_46_im <= -1.7e+106) tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im; elseif (y_46_im <= -2.4e-45) tmp = t_0; elseif (y_46_im <= 460.0) tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re; elseif (y_46_im <= 3.5e+75) tmp = t_0; else tmp = ((x_46_im * (y_46_re / 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_] := 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]}, If[LessEqual[y$46$im, -1.7e+106], 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, -2.4e-45], t$95$0, If[LessEqual[y$46$im, 460.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, 3.5e+75], t$95$0, N[(N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]]]]]]
\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}\\
\mathbf{if}\;y.im \leq -1.7 \cdot 10^{+106}:\\
\;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\
\mathbf{elif}\;y.im \leq -2.4 \cdot 10^{-45}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 460:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 3.5 \cdot 10^{+75}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\
\end{array}
\end{array}
if y.im < -1.69999999999999997e106Initial program 33.7%
Taylor expanded in y.re around 0 71.8%
+-commutative71.8%
mul-1-neg71.8%
unsub-neg71.8%
unpow271.8%
associate-/r*79.2%
div-sub79.2%
*-commutative79.2%
associate-/l*87.8%
Simplified87.8%
if -1.69999999999999997e106 < y.im < -2.3999999999999999e-45 or 460 < y.im < 3.4999999999999998e75Initial program 86.2%
if -2.3999999999999999e-45 < y.im < 460Initial program 65.6%
Taylor expanded in y.re around inf 91.5%
remove-double-neg91.5%
mul-1-neg91.5%
neg-mul-191.5%
distribute-lft-in91.5%
mul-1-neg91.5%
distribute-neg-in91.5%
mul-1-neg91.5%
remove-double-neg91.5%
unsub-neg91.5%
associate-/l*92.3%
Simplified92.3%
if 3.4999999999999998e75 < y.im Initial program 38.1%
div-sub38.1%
*-commutative38.1%
add-sqr-sqrt38.1%
times-frac40.4%
fma-neg40.4%
hypot-define40.4%
hypot-define51.2%
associate-/l*63.2%
add-sqr-sqrt63.2%
pow263.2%
hypot-define63.2%
Applied egg-rr63.2%
Taylor expanded in y.im around inf 71.7%
associate-*r/78.7%
Simplified78.7%
Final simplification88.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -1.3e-51) (not (<= y.re 1.3e-210))) (/ (- x.im (* x.re (/ y.im y.re))) y.re) (/ 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_re <= -1.3e-51) || !(y_46_re <= 1.3e-210)) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else {
tmp = 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_46re <= (-1.3d-51)) .or. (.not. (y_46re <= 1.3d-210))) then
tmp = (x_46im - (x_46re * (y_46im / y_46re))) / y_46re
else
tmp = 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_re <= -1.3e-51) || !(y_46_re <= 1.3e-210)) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else {
tmp = 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_re <= -1.3e-51) or not (y_46_re <= 1.3e-210): tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re else: tmp = 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_re <= -1.3e-51) || !(y_46_re <= 1.3e-210)) tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); else tmp = Float64(x_46_re / Float64(-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_re <= -1.3e-51) || ~((y_46_re <= 1.3e-210))) tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re; else tmp = 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[Or[LessEqual[y$46$re, -1.3e-51], N[Not[LessEqual[y$46$re, 1.3e-210]], $MachinePrecision]], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], N[(x$46$re / (-y$46$im)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1.3 \cdot 10^{-51} \lor \neg \left(y.re \leq 1.3 \cdot 10^{-210}\right):\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{-y.im}\\
\end{array}
\end{array}
if y.re < -1.3e-51 or 1.2999999999999999e-210 < y.re Initial program 55.7%
Taylor expanded in y.re around inf 75.9%
remove-double-neg75.9%
mul-1-neg75.9%
neg-mul-175.9%
distribute-lft-in75.9%
mul-1-neg75.9%
distribute-neg-in75.9%
mul-1-neg75.9%
remove-double-neg75.9%
unsub-neg75.9%
associate-/l*78.7%
Simplified78.7%
if -1.3e-51 < y.re < 1.2999999999999999e-210Initial program 69.9%
Taylor expanded in y.re around 0 81.9%
associate-*r/81.9%
neg-mul-181.9%
Simplified81.9%
Final simplification79.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -2.6e-51)
(/ (- x.im (* y.im (/ x.re y.re))) y.re)
(if (<= y.re 1.22e-210)
(/ 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_re <= -2.6e-51) {
tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
} else if (y_46_re <= 1.22e-210) {
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_46re <= (-2.6d-51)) then
tmp = (x_46im - (y_46im * (x_46re / y_46re))) / y_46re
else if (y_46re <= 1.22d-210) 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_re <= -2.6e-51) {
tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
} else if (y_46_re <= 1.22e-210) {
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_re <= -2.6e-51: tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re elif y_46_re <= 1.22e-210: 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_re <= -2.6e-51) tmp = Float64(Float64(x_46_im - Float64(y_46_im * Float64(x_46_re / y_46_re))) / y_46_re); elseif (y_46_re <= 1.22e-210) 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_re <= -2.6e-51) tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re; elseif (y_46_re <= 1.22e-210) 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[LessEqual[y$46$re, -2.6e-51], 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.22e-210], 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.re \leq -2.6 \cdot 10^{-51}:\\
\;\;\;\;\frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re}\\
\mathbf{elif}\;y.re \leq 1.22 \cdot 10^{-210}:\\
\;\;\;\;\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.re < -2.6e-51Initial program 54.5%
div-sub54.5%
*-commutative54.5%
add-sqr-sqrt54.5%
times-frac62.8%
fma-neg62.8%
hypot-define62.8%
hypot-define91.3%
associate-/l*90.2%
add-sqr-sqrt90.2%
pow290.2%
hypot-define90.2%
Applied egg-rr90.2%
Taylor expanded in y.re around inf 83.7%
mul-1-neg83.7%
unsub-neg83.7%
*-commutative83.7%
Simplified83.7%
associate-/l*83.8%
Applied egg-rr83.8%
if -2.6e-51 < y.re < 1.22e-210Initial program 69.9%
Taylor expanded in y.re around 0 81.9%
associate-*r/81.9%
neg-mul-181.9%
Simplified81.9%
if 1.22e-210 < y.re Initial program 56.6%
Taylor expanded in y.re around inf 69.8%
remove-double-neg69.8%
mul-1-neg69.8%
neg-mul-169.8%
distribute-lft-in69.8%
mul-1-neg69.8%
distribute-neg-in69.8%
mul-1-neg69.8%
remove-double-neg69.8%
unsub-neg69.8%
associate-/l*74.8%
Simplified74.8%
Final simplification79.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -6.2e-51)
(/ (- x.im (* y.im (/ x.re y.re))) y.re)
(if (<= y.re 8.5e-47)
(/ (- (* x.im (/ y.re 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_re <= -6.2e-51) {
tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
} else if (y_46_re <= 8.5e-47) {
tmp = ((x_46_im * (y_46_re / 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_46re <= (-6.2d-51)) then
tmp = (x_46im - (y_46im * (x_46re / y_46re))) / y_46re
else if (y_46re <= 8.5d-47) then
tmp = ((x_46im * (y_46re / 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_re <= -6.2e-51) {
tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
} else if (y_46_re <= 8.5e-47) {
tmp = ((x_46_im * (y_46_re / 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_re <= -6.2e-51: tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re elif y_46_re <= 8.5e-47: tmp = ((x_46_im * (y_46_re / 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_re <= -6.2e-51) tmp = Float64(Float64(x_46_im - Float64(y_46_im * Float64(x_46_re / y_46_re))) / y_46_re); elseif (y_46_re <= 8.5e-47) tmp = Float64(Float64(Float64(x_46_im * Float64(y_46_re / 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_re <= -6.2e-51) tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re; elseif (y_46_re <= 8.5e-47) tmp = ((x_46_im * (y_46_re / 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[LessEqual[y$46$re, -6.2e-51], 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, 8.5e-47], N[(N[(N[(x$46$im * N[(y$46$re / 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.re \leq -6.2 \cdot 10^{-51}:\\
\;\;\;\;\frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re}\\
\mathbf{elif}\;y.re \leq 8.5 \cdot 10^{-47}:\\
\;\;\;\;\frac{x.im \cdot \frac{y.re}{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.re < -6.1999999999999995e-51Initial program 54.5%
div-sub54.5%
*-commutative54.5%
add-sqr-sqrt54.5%
times-frac62.8%
fma-neg62.8%
hypot-define62.8%
hypot-define91.3%
associate-/l*90.2%
add-sqr-sqrt90.2%
pow290.2%
hypot-define90.2%
Applied egg-rr90.2%
Taylor expanded in y.re around inf 83.7%
mul-1-neg83.7%
unsub-neg83.7%
*-commutative83.7%
Simplified83.7%
associate-/l*83.8%
Applied egg-rr83.8%
if -6.1999999999999995e-51 < y.re < 8.4999999999999999e-47Initial program 68.5%
div-sub64.1%
*-commutative64.1%
add-sqr-sqrt64.1%
times-frac63.3%
fma-neg63.3%
hypot-define63.4%
hypot-define66.6%
associate-/l*75.3%
add-sqr-sqrt75.3%
pow275.3%
hypot-define75.3%
Applied egg-rr75.3%
Taylor expanded in y.im around inf 83.6%
associate-*r/83.7%
Simplified83.7%
if 8.4999999999999999e-47 < y.re Initial program 54.4%
Taylor expanded in y.re around inf 77.3%
remove-double-neg77.3%
mul-1-neg77.3%
neg-mul-177.3%
distribute-lft-in77.3%
mul-1-neg77.3%
distribute-neg-in77.3%
mul-1-neg77.3%
remove-double-neg77.3%
unsub-neg77.3%
associate-/l*82.5%
Simplified82.5%
Final simplification83.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -6.8e-51) (not (<= y.re 4.8e-47))) (/ x.im y.re) (/ 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_re <= -6.8e-51) || !(y_46_re <= 4.8e-47)) {
tmp = x_46_im / y_46_re;
} else {
tmp = 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_46re <= (-6.8d-51)) .or. (.not. (y_46re <= 4.8d-47))) then
tmp = x_46im / y_46re
else
tmp = 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_re <= -6.8e-51) || !(y_46_re <= 4.8e-47)) {
tmp = x_46_im / y_46_re;
} else {
tmp = 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_re <= -6.8e-51) or not (y_46_re <= 4.8e-47): tmp = x_46_im / y_46_re else: tmp = 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_re <= -6.8e-51) || !(y_46_re <= 4.8e-47)) tmp = Float64(x_46_im / y_46_re); else tmp = Float64(x_46_re / Float64(-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_re <= -6.8e-51) || ~((y_46_re <= 4.8e-47))) tmp = x_46_im / y_46_re; else tmp = 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[Or[LessEqual[y$46$re, -6.8e-51], N[Not[LessEqual[y$46$re, 4.8e-47]], $MachinePrecision]], N[(x$46$im / y$46$re), $MachinePrecision], N[(x$46$re / (-y$46$im)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -6.8 \cdot 10^{-51} \lor \neg \left(y.re \leq 4.8 \cdot 10^{-47}\right):\\
\;\;\;\;\frac{x.im}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{-y.im}\\
\end{array}
\end{array}
if y.re < -6.80000000000000005e-51 or 4.7999999999999999e-47 < y.re Initial program 54.5%
Taylor expanded in y.re around inf 67.8%
if -6.80000000000000005e-51 < y.re < 4.7999999999999999e-47Initial program 68.5%
Taylor expanded in y.re around 0 73.9%
associate-*r/73.9%
neg-mul-173.9%
Simplified73.9%
Final simplification70.2%
(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 60.1%
Taylor expanded in y.re around inf 45.9%
Final simplification45.9%
herbie shell --seed 2024096
(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))))