
(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
(let* ((t_0 (/ x.re (- y.im)))
(t_1 (/ x.im (hypot y.re y.im)))
(t_2 (/ y.re (hypot y.re y.im)))
(t_3 (fma t_2 t_1 (* x.re (/ (- y.im) (pow (hypot y.re y.im) 2.0))))))
(if (<= y.im -6.6e+138)
(fma t_2 (* x.im (/ 1.0 (hypot y.re y.im))) t_0)
(if (<= y.im -1.5e-136)
t_3
(if (<= y.im 5e-188)
(/ (- x.im (* x.re (/ y.im y.re))) y.re)
(if (<= y.im 1.3e+18) t_3 (fma t_2 t_1 t_0)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = x_46_re / -y_46_im;
double t_1 = x_46_im / hypot(y_46_re, y_46_im);
double t_2 = y_46_re / hypot(y_46_re, y_46_im);
double t_3 = fma(t_2, t_1, (x_46_re * (-y_46_im / pow(hypot(y_46_re, y_46_im), 2.0))));
double tmp;
if (y_46_im <= -6.6e+138) {
tmp = fma(t_2, (x_46_im * (1.0 / hypot(y_46_re, y_46_im))), t_0);
} else if (y_46_im <= -1.5e-136) {
tmp = t_3;
} else if (y_46_im <= 5e-188) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else if (y_46_im <= 1.3e+18) {
tmp = t_3;
} else {
tmp = fma(t_2, t_1, t_0);
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(x_46_re / Float64(-y_46_im)) t_1 = Float64(x_46_im / hypot(y_46_re, y_46_im)) t_2 = Float64(y_46_re / hypot(y_46_re, y_46_im)) t_3 = fma(t_2, t_1, Float64(x_46_re * Float64(Float64(-y_46_im) / (hypot(y_46_re, y_46_im) ^ 2.0)))) tmp = 0.0 if (y_46_im <= -6.6e+138) tmp = fma(t_2, Float64(x_46_im * Float64(1.0 / hypot(y_46_re, y_46_im))), t_0); elseif (y_46_im <= -1.5e-136) tmp = t_3; elseif (y_46_im <= 5e-188) tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); elseif (y_46_im <= 1.3e+18) tmp = t_3; else tmp = fma(t_2, t_1, t_0); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(x$46$re / (-y$46$im)), $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[(y$46$re / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * 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]}, If[LessEqual[y$46$im, -6.6e+138], N[(t$95$2 * N[(x$46$im * N[(1.0 / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[y$46$im, -1.5e-136], t$95$3, If[LessEqual[y$46$im, 5e-188], 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.3e+18], t$95$3, N[(t$95$2 * t$95$1 + t$95$0), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x.re}{-y.im}\\
t_1 := \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\
t_2 := \frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}\\
t_3 := \mathsf{fma}\left(t\_2, t\_1, x.re \cdot \frac{-y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)\\
\mathbf{if}\;y.im \leq -6.6 \cdot 10^{+138}:\\
\;\;\;\;\mathsf{fma}\left(t\_2, x.im \cdot \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, t\_0\right)\\
\mathbf{elif}\;y.im \leq -1.5 \cdot 10^{-136}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;y.im \leq 5 \cdot 10^{-188}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 1.3 \cdot 10^{+18}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_2, t\_1, t\_0\right)\\
\end{array}
\end{array}
if y.im < -6.59999999999999956e138Initial program 36.2%
div-sub36.2%
*-commutative36.2%
add-sqr-sqrt36.2%
times-frac36.7%
fma-neg36.7%
hypot-define36.7%
hypot-define49.7%
associate-/l*50.6%
add-sqr-sqrt50.6%
pow250.6%
hypot-define50.6%
Applied egg-rr50.6%
Taylor expanded in y.im around inf 98.1%
div-inv98.2%
Applied egg-rr98.2%
if -6.59999999999999956e138 < y.im < -1.4999999999999999e-136 or 5.0000000000000001e-188 < y.im < 1.3e18Initial program 69.9%
div-sub68.8%
*-commutative68.8%
add-sqr-sqrt68.8%
times-frac70.4%
fma-neg70.4%
hypot-define70.4%
hypot-define90.8%
associate-/l*94.6%
add-sqr-sqrt94.7%
pow294.7%
hypot-define94.7%
Applied egg-rr94.7%
if -1.4999999999999999e-136 < y.im < 5.0000000000000001e-188Initial program 71.8%
Taylor expanded in y.re around inf 88.8%
mul-1-neg88.8%
unsub-neg88.8%
associate-/l*90.2%
Simplified90.2%
if 1.3e18 < y.im Initial program 46.6%
div-sub46.6%
*-commutative46.6%
add-sqr-sqrt46.6%
times-frac46.9%
fma-neg46.9%
hypot-define46.9%
hypot-define62.5%
associate-/l*65.3%
add-sqr-sqrt65.3%
pow265.3%
hypot-define65.3%
Applied egg-rr65.3%
Taylor expanded in y.im around inf 96.0%
Final simplification94.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (or (<= y.im -4.3e-54) (not (<= y.im 3.9e-15)))
(fma
(/ y.re (hypot y.re y.im))
(/ x.im (hypot 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_im <= -4.3e-54) || !(y_46_im <= 3.9e-15)) {
tmp = 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));
} 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 <= -4.3e-54) || !(y_46_im <= 3.9e-15)) 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(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
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -4.3e-54], N[Not[LessEqual[y$46$im, 3.9e-15]], $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[(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 -4.3 \cdot 10^{-54} \lor \neg \left(y.im \leq 3.9 \cdot 10^{-15}\right):\\
\;\;\;\;\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{else}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\end{array}
\end{array}
if y.im < -4.3e-54 or 3.90000000000000026e-15 < y.im Initial program 49.9%
div-sub49.9%
*-commutative49.9%
add-sqr-sqrt49.9%
times-frac51.1%
fma-neg51.1%
hypot-define51.1%
hypot-define65.2%
associate-/l*70.2%
add-sqr-sqrt70.2%
pow270.2%
hypot-define70.2%
Applied egg-rr70.2%
Taylor expanded in y.im around inf 92.0%
if -4.3e-54 < y.im < 3.90000000000000026e-15Initial program 72.4%
Taylor expanded in y.re around inf 85.3%
mul-1-neg85.3%
unsub-neg85.3%
associate-/l*86.1%
Simplified86.1%
Final simplification89.1%
(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 -6.2e+60)
(/ (- (* y.re (/ x.im y.im)) x.re) y.im)
(if (<= y.im -1e-138)
t_0
(if (<= y.im 1.9e-131)
(/ (- x.im (* x.re (/ y.im y.re))) y.re)
(if (<= y.im 7.6e+62)
t_0
(fma
(/ y.re (hypot y.re 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 = ((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 <= -6.2e+60) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
} else if (y_46_im <= -1e-138) {
tmp = t_0;
} else if (y_46_im <= 1.9e-131) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else if (y_46_im <= 7.6e+62) {
tmp = t_0;
} else {
tmp = fma((y_46_re / hypot(y_46_re, 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(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 <= -6.2e+60) tmp = Float64(Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re) / y_46_im); elseif (y_46_im <= -1e-138) tmp = t_0; elseif (y_46_im <= 1.9e-131) tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); elseif (y_46_im <= 7.6e+62) tmp = t_0; else tmp = fma(Float64(y_46_re / hypot(y_46_re, 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[(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, -6.2e+60], 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, -1e-138], t$95$0, If[LessEqual[y$46$im, 1.9e-131], 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, 7.6e+62], t$95$0, N[(N[(y$46$re / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $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{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 -6.2 \cdot 10^{+60}:\\
\;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\
\mathbf{elif}\;y.im \leq -1 \cdot 10^{-138}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 1.9 \cdot 10^{-131}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 7.6 \cdot 10^{+62}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{y.im}, \frac{x.re}{-y.im}\right)\\
\end{array}
\end{array}
if y.im < -6.2000000000000001e60Initial program 41.8%
Taylor expanded in y.re around 0 77.6%
+-commutative77.6%
mul-1-neg77.6%
unsub-neg77.6%
unpow277.6%
associate-/r*81.1%
div-sub81.1%
*-commutative81.1%
associate-/l*88.1%
Simplified88.1%
if -6.2000000000000001e60 < y.im < -1.00000000000000007e-138 or 1.89999999999999997e-131 < y.im < 7.59999999999999967e62Initial program 84.3%
if -1.00000000000000007e-138 < y.im < 1.89999999999999997e-131Initial program 65.3%
Taylor expanded in y.re around inf 90.5%
mul-1-neg90.5%
unsub-neg90.5%
associate-/l*91.7%
Simplified91.7%
if 7.59999999999999967e62 < y.im Initial program 37.7%
div-sub37.7%
*-commutative37.7%
add-sqr-sqrt37.7%
times-frac38.2%
fma-neg38.2%
hypot-define38.2%
hypot-define56.3%
associate-/l*59.6%
add-sqr-sqrt59.6%
pow259.6%
hypot-define59.6%
Applied egg-rr59.6%
Taylor expanded in y.im around inf 95.4%
Taylor expanded in y.re around 0 84.2%
Final simplification87.6%
(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 -4.2e+61)
t_1
(if (<= y.im -2.5e-139)
t_0
(if (<= y.im 5.5e-125)
(/ (- x.im (* x.re (/ y.im y.re))) y.re)
(if (<= y.im 2.1e+77) 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 <= -4.2e+61) {
tmp = t_1;
} else if (y_46_im <= -2.5e-139) {
tmp = t_0;
} else if (y_46_im <= 5.5e-125) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else if (y_46_im <= 2.1e+77) {
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 <= (-4.2d+61)) then
tmp = t_1
else if (y_46im <= (-2.5d-139)) then
tmp = t_0
else if (y_46im <= 5.5d-125) then
tmp = (x_46im - (x_46re * (y_46im / y_46re))) / y_46re
else if (y_46im <= 2.1d+77) 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 <= -4.2e+61) {
tmp = t_1;
} else if (y_46_im <= -2.5e-139) {
tmp = t_0;
} else if (y_46_im <= 5.5e-125) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else if (y_46_im <= 2.1e+77) {
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 <= -4.2e+61: tmp = t_1 elif y_46_im <= -2.5e-139: tmp = t_0 elif y_46_im <= 5.5e-125: tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re elif y_46_im <= 2.1e+77: 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 <= -4.2e+61) tmp = t_1; elseif (y_46_im <= -2.5e-139) tmp = t_0; elseif (y_46_im <= 5.5e-125) 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.1e+77) 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 <= -4.2e+61) tmp = t_1; elseif (y_46_im <= -2.5e-139) tmp = t_0; elseif (y_46_im <= 5.5e-125) tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re; elseif (y_46_im <= 2.1e+77) 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, -4.2e+61], t$95$1, If[LessEqual[y$46$im, -2.5e-139], t$95$0, If[LessEqual[y$46$im, 5.5e-125], 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.1e+77], 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 -4.2 \cdot 10^{+61}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq -2.5 \cdot 10^{-139}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 5.5 \cdot 10^{-125}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 2.1 \cdot 10^{+77}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.im < -4.2000000000000002e61 or 2.0999999999999999e77 < y.im Initial program 40.4%
Taylor expanded in y.re around 0 77.0%
+-commutative77.0%
mul-1-neg77.0%
unsub-neg77.0%
unpow277.0%
associate-/r*80.1%
div-sub80.1%
*-commutative80.1%
associate-/l*87.2%
Simplified87.2%
if -4.2000000000000002e61 < y.im < -2.50000000000000017e-139 or 5.4999999999999997e-125 < y.im < 2.0999999999999999e77Initial program 83.2%
if -2.50000000000000017e-139 < y.im < 5.4999999999999997e-125Initial program 65.3%
Taylor expanded in y.re around inf 90.5%
mul-1-neg90.5%
unsub-neg90.5%
associate-/l*91.7%
Simplified91.7%
Final simplification87.6%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -5.5e-17) (not (<= y.im 1.5e+77))) (/ 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 <= -5.5e-17) || !(y_46_im <= 1.5e+77)) {
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 <= (-5.5d-17)) .or. (.not. (y_46im <= 1.5d+77))) 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 <= -5.5e-17) || !(y_46_im <= 1.5e+77)) {
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 <= -5.5e-17) or not (y_46_im <= 1.5e+77): 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 <= -5.5e-17) || !(y_46_im <= 1.5e+77)) 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 <= -5.5e-17) || ~((y_46_im <= 1.5e+77))) 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, -5.5e-17], N[Not[LessEqual[y$46$im, 1.5e+77]], $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 -5.5 \cdot 10^{-17} \lor \neg \left(y.im \leq 1.5 \cdot 10^{+77}\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 < -5.50000000000000001e-17 or 1.4999999999999999e77 < y.im Initial program 44.1%
Taylor expanded in y.re around 0 74.5%
associate-*r/74.5%
neg-mul-174.5%
Simplified74.5%
if -5.50000000000000001e-17 < y.im < 1.4999999999999999e77Initial program 73.9%
Taylor expanded in y.re around inf 80.8%
mul-1-neg80.8%
unsub-neg80.8%
associate-/l*81.6%
Simplified81.6%
Final simplification78.5%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -5.2e-17) (not (<= y.im 1.02e+18))) (/ (- (* 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_im <= -5.2e-17) || !(y_46_im <= 1.02e+18)) {
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_46im <= (-5.2d-17)) .or. (.not. (y_46im <= 1.02d+18))) 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_im <= -5.2e-17) || !(y_46_im <= 1.02e+18)) {
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_im <= -5.2e-17) or not (y_46_im <= 1.02e+18): 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_im <= -5.2e-17) || !(y_46_im <= 1.02e+18)) 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_im <= -5.2e-17) || ~((y_46_im <= 1.02e+18))) 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[Or[LessEqual[y$46$im, -5.2e-17], N[Not[LessEqual[y$46$im, 1.02e+18]], $MachinePrecision]], 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.im \leq -5.2 \cdot 10^{-17} \lor \neg \left(y.im \leq 1.02 \cdot 10^{+18}\right):\\
\;\;\;\;\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.im < -5.20000000000000006e-17 or 1.02e18 < y.im Initial program 47.0%
div-sub47.0%
*-commutative47.0%
add-sqr-sqrt47.0%
times-frac48.2%
fma-neg48.2%
hypot-define48.2%
hypot-define62.0%
associate-/l*67.4%
add-sqr-sqrt67.4%
pow267.4%
hypot-define67.4%
Applied egg-rr67.4%
Taylor expanded in y.re around 0 73.7%
*-commutative73.7%
unpow273.7%
associate-/l/76.2%
*-commutative76.2%
div-sub76.2%
associate-/l*80.5%
Simplified80.5%
if -5.20000000000000006e-17 < y.im < 1.02e18Initial program 73.1%
Taylor expanded in y.re around inf 83.1%
mul-1-neg83.1%
unsub-neg83.1%
associate-/l*83.9%
Simplified83.9%
Final simplification82.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -5.5e-17) (not (<= y.im 9.6e+17))) (/ (- (* 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 <= -5.5e-17) || !(y_46_im <= 9.6e+17)) {
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 <= (-5.5d-17)) .or. (.not. (y_46im <= 9.6d+17))) 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 <= -5.5e-17) || !(y_46_im <= 9.6e+17)) {
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 <= -5.5e-17) or not (y_46_im <= 9.6e+17): 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 <= -5.5e-17) || !(y_46_im <= 9.6e+17)) 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 <= -5.5e-17) || ~((y_46_im <= 9.6e+17))) 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, -5.5e-17], N[Not[LessEqual[y$46$im, 9.6e+17]], $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 -5.5 \cdot 10^{-17} \lor \neg \left(y.im \leq 9.6 \cdot 10^{+17}\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 < -5.50000000000000001e-17 or 9.6e17 < y.im Initial program 47.0%
Taylor expanded in y.re around 0 73.7%
+-commutative73.7%
mul-1-neg73.7%
unsub-neg73.7%
unpow273.7%
associate-/r*76.2%
div-sub76.2%
*-commutative76.2%
associate-/l*81.9%
Simplified81.9%
if -5.50000000000000001e-17 < y.im < 9.6e17Initial program 73.1%
Taylor expanded in y.re around inf 83.1%
mul-1-neg83.1%
unsub-neg83.1%
associate-/l*83.9%
Simplified83.9%
Final simplification83.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -4.2e-18) (not (<= y.im 5.2e+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 <= -4.2e-18) || !(y_46_im <= 5.2e+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 <= (-4.2d-18)) .or. (.not. (y_46im <= 5.2d+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 <= -4.2e-18) || !(y_46_im <= 5.2e+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 <= -4.2e-18) or not (y_46_im <= 5.2e+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 <= -4.2e-18) || !(y_46_im <= 5.2e+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 <= -4.2e-18) || ~((y_46_im <= 5.2e+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, -4.2e-18], N[Not[LessEqual[y$46$im, 5.2e+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 -4.2 \cdot 10^{-18} \lor \neg \left(y.im \leq 5.2 \cdot 10^{+67}\right):\\
\;\;\;\;\frac{x.re}{-y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.im < -4.19999999999999999e-18 or 5.2000000000000001e67 < y.im Initial program 44.6%
Taylor expanded in y.re around 0 74.0%
associate-*r/74.0%
neg-mul-174.0%
Simplified74.0%
if -4.19999999999999999e-18 < y.im < 5.2000000000000001e67Initial program 73.7%
Taylor expanded in y.re around inf 66.0%
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 61.0%
Taylor expanded in y.re around inf 44.2%
Final simplification44.2%
herbie shell --seed 2024067
(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))))