
(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 7 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 (/ 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 -2.2e+145)
t_3
(if (<= y.im -1e-158)
t_2
(if (<= y.im 2.25e-132)
(/ (- x.im (* x.re (/ y.im y.re))) y.re)
(if (<= y.im 1.25e+98) 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 <= -2.2e+145) {
tmp = t_3;
} else if (y_46_im <= -1e-158) {
tmp = t_2;
} else if (y_46_im <= 2.25e-132) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else if (y_46_im <= 1.25e+98) {
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(y_46_im / Float64(-(hypot(y_46_re, y_46_im) ^ 2.0))))) t_3 = fma(t_0, t_1, Float64(Float64(-x_46_re) / y_46_im)) tmp = 0.0 if (y_46_im <= -2.2e+145) tmp = t_3; elseif (y_46_im <= -1e-158) tmp = t_2; elseif (y_46_im <= 2.25e-132) 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.25e+98) 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, -2.2e+145], t$95$3, If[LessEqual[y$46$im, -1e-158], t$95$2, If[LessEqual[y$46$im, 2.25e-132], 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.25e+98], 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 -2.2 \cdot 10^{+145}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;y.im \leq -1 \cdot 10^{-158}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y.im \leq 2.25 \cdot 10^{-132}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 1.25 \cdot 10^{+98}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if y.im < -2.20000000000000009e145 or 1.25e98 < y.im Initial program 40.2%
div-sub40.2%
*-commutative40.2%
fma-define40.2%
add-sqr-sqrt40.2%
times-frac40.5%
fma-neg40.5%
fma-define40.5%
hypot-define40.5%
fma-define40.5%
hypot-define55.9%
associate-/l*62.9%
fma-define62.9%
add-sqr-sqrt62.9%
pow262.9%
Applied egg-rr62.9%
Taylor expanded in y.im around inf 96.3%
if -2.20000000000000009e145 < y.im < -1.00000000000000006e-158 or 2.25e-132 < y.im < 1.25e98Initial program 78.9%
div-sub78.9%
*-commutative78.9%
fma-define78.9%
add-sqr-sqrt78.9%
times-frac79.1%
fma-neg79.1%
fma-define79.1%
hypot-define79.1%
fma-define79.1%
hypot-define90.4%
associate-/l*95.2%
fma-define95.2%
add-sqr-sqrt95.2%
pow295.2%
Applied egg-rr95.2%
if -1.00000000000000006e-158 < y.im < 2.25e-132Initial program 72.1%
Taylor expanded in y.re around inf 93.8%
mul-1-neg93.8%
unsub-neg93.8%
associate-/l*95.1%
Simplified95.1%
Final simplification95.5%
(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
(fma
(/ y.re (hypot y.re y.im))
(/ x.im (hypot y.re y.im))
(/ (- x.re) y.im))))
(if (<= y.im -1.8e+87)
t_1
(if (<= y.im -9.5e-159)
t_0
(if (<= y.im 5.4e-92)
(/ (- x.im (* x.re (/ y.im y.re))) y.re)
(if (<= y.im 1.3e+93) 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 = 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 <= -1.8e+87) {
tmp = t_1;
} else if (y_46_im <= -9.5e-159) {
tmp = t_0;
} else if (y_46_im <= 5.4e-92) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else if (y_46_im <= 1.3e+93) {
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 = fma(Float64(y_46_re / hypot(y_46_re, y_46_im)), Float64(x_46_im / hypot(y_46_re, y_46_im)), Float64(Float64(-x_46_re) / y_46_im)) tmp = 0.0 if (y_46_im <= -1.8e+87) tmp = t_1; elseif (y_46_im <= -9.5e-159) tmp = t_0; elseif (y_46_im <= 5.4e-92) 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+93) tmp = t_0; else tmp = t_1; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(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[(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, -1.8e+87], t$95$1, If[LessEqual[y$46$im, -9.5e-159], t$95$0, If[LessEqual[y$46$im, 5.4e-92], 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+93], 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 := \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 -1.8 \cdot 10^{+87}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq -9.5 \cdot 10^{-159}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 5.4 \cdot 10^{-92}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 1.3 \cdot 10^{+93}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.im < -1.79999999999999997e87 or 1.3e93 < y.im Initial program 39.6%
div-sub39.6%
*-commutative39.6%
fma-define39.6%
add-sqr-sqrt39.6%
times-frac41.1%
fma-neg41.1%
fma-define41.1%
hypot-define41.1%
fma-define41.1%
hypot-define55.7%
associate-/l*64.6%
fma-define64.6%
add-sqr-sqrt64.6%
pow264.6%
Applied egg-rr64.6%
Taylor expanded in y.im around inf 95.5%
if -1.79999999999999997e87 < y.im < -9.4999999999999997e-159 or 5.3999999999999999e-92 < y.im < 1.3e93Initial program 81.2%
if -9.4999999999999997e-159 < y.im < 5.3999999999999999e-92Initial program 72.8%
Taylor expanded in y.re around inf 93.3%
mul-1-neg93.3%
unsub-neg93.3%
associate-/l*94.5%
Simplified94.5%
Final simplification90.4%
(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 (/ (- (* x.im (/ y.re y.im)) x.re) y.im)))
(if (<= y.im -2.7e+84)
t_1
(if (<= y.im -2.06e-159)
t_0
(if (<= y.im 1.4e-97)
(/ (- x.im (* x.re (/ y.im y.re))) y.re)
(if (<= y.im 6.7e+93) 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 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -2.7e+84) {
tmp = t_1;
} else if (y_46_im <= -2.06e-159) {
tmp = t_0;
} else if (y_46_im <= 1.4e-97) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else if (y_46_im <= 6.7e+93) {
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 = ((x_46im * (y_46re / y_46im)) - x_46re) / y_46im
if (y_46im <= (-2.7d+84)) then
tmp = t_1
else if (y_46im <= (-2.06d-159)) then
tmp = t_0
else if (y_46im <= 1.4d-97) then
tmp = (x_46im - (x_46re * (y_46im / y_46re))) / y_46re
else if (y_46im <= 6.7d+93) 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 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -2.7e+84) {
tmp = t_1;
} else if (y_46_im <= -2.06e-159) {
tmp = t_0;
} else if (y_46_im <= 1.4e-97) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else if (y_46_im <= 6.7e+93) {
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 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im tmp = 0 if y_46_im <= -2.7e+84: tmp = t_1 elif y_46_im <= -2.06e-159: tmp = t_0 elif y_46_im <= 1.4e-97: tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re elif y_46_im <= 6.7e+93: 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(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im) tmp = 0.0 if (y_46_im <= -2.7e+84) tmp = t_1; elseif (y_46_im <= -2.06e-159) tmp = t_0; elseif (y_46_im <= 1.4e-97) tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); elseif (y_46_im <= 6.7e+93) 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 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im; tmp = 0.0; if (y_46_im <= -2.7e+84) tmp = t_1; elseif (y_46_im <= -2.06e-159) tmp = t_0; elseif (y_46_im <= 1.4e-97) tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re; elseif (y_46_im <= 6.7e+93) 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[(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, -2.7e+84], t$95$1, If[LessEqual[y$46$im, -2.06e-159], t$95$0, If[LessEqual[y$46$im, 1.4e-97], 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, 6.7e+93], 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{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\
\mathbf{if}\;y.im \leq -2.7 \cdot 10^{+84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq -2.06 \cdot 10^{-159}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 1.4 \cdot 10^{-97}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 6.7 \cdot 10^{+93}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.im < -2.7e84 or 6.69999999999999965e93 < y.im Initial program 39.6%
div-sub39.6%
*-commutative39.6%
fma-define39.6%
add-sqr-sqrt39.6%
times-frac41.1%
fma-neg41.1%
fma-define41.1%
hypot-define41.1%
fma-define41.1%
hypot-define55.7%
associate-/l*64.6%
fma-define64.6%
add-sqr-sqrt64.6%
pow264.6%
Applied egg-rr64.6%
Taylor expanded in y.im around inf 80.4%
associate-/l*87.6%
Simplified87.6%
if -2.7e84 < y.im < -2.05999999999999989e-159 or 1.4000000000000001e-97 < y.im < 6.69999999999999965e93Initial program 81.2%
if -2.05999999999999989e-159 < y.im < 1.4000000000000001e-97Initial program 72.8%
Taylor expanded in y.re around inf 93.3%
mul-1-neg93.3%
unsub-neg93.3%
associate-/l*94.5%
Simplified94.5%
Final simplification87.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -2.7e+97) (not (<= y.im 1.02e+97))) (/ (- 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 <= -2.7e+97) || !(y_46_im <= 1.02e+97)) {
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 <= (-2.7d+97)) .or. (.not. (y_46im <= 1.02d+97))) 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 <= -2.7e+97) || !(y_46_im <= 1.02e+97)) {
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 <= -2.7e+97) or not (y_46_im <= 1.02e+97): 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 <= -2.7e+97) || !(y_46_im <= 1.02e+97)) tmp = Float64(Float64(-x_46_re) / y_46_im); else tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if ((y_46_im <= -2.7e+97) || ~((y_46_im <= 1.02e+97))) 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, -2.7e+97], N[Not[LessEqual[y$46$im, 1.02e+97]], $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 -2.7 \cdot 10^{+97} \lor \neg \left(y.im \leq 1.02 \cdot 10^{+97}\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 < -2.69999999999999993e97 or 1.02000000000000003e97 < y.im Initial program 40.0%
Taylor expanded in y.re around 0 75.1%
associate-*r/75.1%
neg-mul-175.1%
Simplified75.1%
if -2.69999999999999993e97 < y.im < 1.02000000000000003e97Initial program 76.6%
Taylor expanded in y.re around inf 77.1%
mul-1-neg77.1%
unsub-neg77.1%
associate-/l*78.8%
Simplified78.8%
Final simplification77.6%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -1.6e+84) (not (<= y.im 1.85e-10))) (/ (- (* 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 <= -1.6e+84) || !(y_46_im <= 1.85e-10)) {
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 <= (-1.6d+84)) .or. (.not. (y_46im <= 1.85d-10))) 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 <= -1.6e+84) || !(y_46_im <= 1.85e-10)) {
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 <= -1.6e+84) or not (y_46_im <= 1.85e-10): 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 <= -1.6e+84) || !(y_46_im <= 1.85e-10)) 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 <= -1.6e+84) || ~((y_46_im <= 1.85e-10))) 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, -1.6e+84], N[Not[LessEqual[y$46$im, 1.85e-10]], $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 -1.6 \cdot 10^{+84} \lor \neg \left(y.im \leq 1.85 \cdot 10^{-10}\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 < -1.60000000000000005e84 or 1.85000000000000007e-10 < y.im Initial program 48.8%
div-sub48.8%
*-commutative48.8%
fma-define48.9%
add-sqr-sqrt48.9%
times-frac50.0%
fma-neg50.0%
fma-define50.0%
hypot-define50.0%
fma-define50.0%
hypot-define63.5%
associate-/l*71.9%
fma-define71.9%
add-sqr-sqrt71.9%
pow271.9%
Applied egg-rr71.9%
Taylor expanded in y.im around inf 74.2%
associate-/l*79.6%
Simplified79.6%
if -1.60000000000000005e84 < y.im < 1.85000000000000007e-10Initial program 77.1%
Taylor expanded in y.re around inf 84.9%
mul-1-neg84.9%
unsub-neg84.9%
associate-/l*85.6%
Simplified85.6%
Final simplification83.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -6.6e-79) (not (<= y.im 1.8e-10))) (/ (- 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 <= -6.6e-79) || !(y_46_im <= 1.8e-10)) {
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 <= (-6.6d-79)) .or. (.not. (y_46im <= 1.8d-10))) 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 <= -6.6e-79) || !(y_46_im <= 1.8e-10)) {
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 <= -6.6e-79) or not (y_46_im <= 1.8e-10): 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 <= -6.6e-79) || !(y_46_im <= 1.8e-10)) tmp = Float64(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 <= -6.6e-79) || ~((y_46_im <= 1.8e-10))) 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, -6.6e-79], N[Not[LessEqual[y$46$im, 1.8e-10]], $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 -6.6 \cdot 10^{-79} \lor \neg \left(y.im \leq 1.8 \cdot 10^{-10}\right):\\
\;\;\;\;\frac{-x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.im < -6.5999999999999996e-79 or 1.8e-10 < y.im Initial program 55.2%
Taylor expanded in y.re around 0 62.1%
associate-*r/62.1%
neg-mul-162.1%
Simplified62.1%
if -6.5999999999999996e-79 < y.im < 1.8e-10Initial program 76.7%
Taylor expanded in y.re around inf 73.2%
Final simplification67.0%
(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 64.7%
Taylor expanded in y.re around inf 44.5%
Final simplification44.5%
herbie shell --seed 2024084
(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))))