
(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
(if (or (<= y.im -7.2e+133) (not (<= y.im 1.32e+166)))
(/ (- (* y.re (/ x.im y.im)) x.re) y.im)
(-
(* (/ 1.0 (hypot y.re y.im)) (* y.re (/ x.im (hypot y.re y.im))))
(* y.im (/ x.re (pow (hypot y.re y.im) 2.0))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -7.2e+133) || !(y_46_im <= 1.32e+166)) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
} else {
tmp = ((1.0 / hypot(y_46_re, y_46_im)) * (y_46_re * (x_46_im / hypot(y_46_re, y_46_im)))) - (y_46_im * (x_46_re / pow(hypot(y_46_re, y_46_im), 2.0)));
}
return tmp;
}
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 <= -7.2e+133) || !(y_46_im <= 1.32e+166)) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
} else {
tmp = ((1.0 / Math.hypot(y_46_re, y_46_im)) * (y_46_re * (x_46_im / Math.hypot(y_46_re, y_46_im)))) - (y_46_im * (x_46_re / Math.pow(Math.hypot(y_46_re, y_46_im), 2.0)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (y_46_im <= -7.2e+133) or not (y_46_im <= 1.32e+166): tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im else: tmp = ((1.0 / math.hypot(y_46_re, y_46_im)) * (y_46_re * (x_46_im / math.hypot(y_46_re, y_46_im)))) - (y_46_im * (x_46_re / math.pow(math.hypot(y_46_re, y_46_im), 2.0))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_im <= -7.2e+133) || !(y_46_im <= 1.32e+166)) tmp = Float64(Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re) / y_46_im); else tmp = Float64(Float64(Float64(1.0 / hypot(y_46_re, y_46_im)) * Float64(y_46_re * Float64(x_46_im / hypot(y_46_re, y_46_im)))) - Float64(y_46_im * Float64(x_46_re / (hypot(y_46_re, y_46_im) ^ 2.0)))); 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 <= -7.2e+133) || ~((y_46_im <= 1.32e+166))) tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im; else tmp = ((1.0 / hypot(y_46_re, y_46_im)) * (y_46_re * (x_46_im / hypot(y_46_re, y_46_im)))) - (y_46_im * (x_46_re / (hypot(y_46_re, y_46_im) ^ 2.0))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -7.2e+133], N[Not[LessEqual[y$46$im, 1.32e+166]], $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[(N[(1.0 / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(y$46$re * N[(x$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y$46$im * N[(x$46$re / N[Power[N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -7.2 \cdot 10^{+133} \lor \neg \left(y.im \leq 1.32 \cdot 10^{+166}\right):\\
\;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right) - y.im \cdot \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\\
\end{array}
\end{array}
if y.im < -7.19999999999999956e133 or 1.3199999999999999e166 < y.im Initial program 30.0%
Taylor expanded in y.re around 0 77.6%
+-commutative77.6%
mul-1-neg77.6%
unsub-neg77.6%
unpow277.6%
associate-/r*84.4%
div-sub84.4%
*-commutative84.4%
associate-/l*90.1%
Simplified90.1%
if -7.19999999999999956e133 < y.im < 1.3199999999999999e166Initial program 72.5%
div-sub69.2%
*-un-lft-identity69.2%
add-sqr-sqrt69.2%
times-frac69.2%
fmm-def69.2%
hypot-define69.2%
hypot-define74.9%
associate-/l*79.2%
add-sqr-sqrt79.1%
pow279.1%
hypot-define79.1%
Applied egg-rr79.1%
fmm-undef79.1%
*-commutative79.1%
associate-/l*93.1%
associate-*r/87.3%
*-commutative87.3%
associate-/l*89.6%
Simplified89.6%
Final simplification89.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (or (<= y.im -2.5e+122) (not (<= y.im 8.2e+164)))
(/ (- (* y.re (/ x.im y.im)) x.re) y.im)
(-
(* (/ 1.0 (hypot y.re y.im)) (* x.im (/ y.re (hypot y.re y.im))))
(/ (* y.im x.re) (pow (hypot y.re y.im) 2.0)))))
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.5e+122) || !(y_46_im <= 8.2e+164)) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
} else {
tmp = ((1.0 / hypot(y_46_re, y_46_im)) * (x_46_im * (y_46_re / hypot(y_46_re, y_46_im)))) - ((y_46_im * x_46_re) / pow(hypot(y_46_re, y_46_im), 2.0));
}
return tmp;
}
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.5e+122) || !(y_46_im <= 8.2e+164)) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
} else {
tmp = ((1.0 / Math.hypot(y_46_re, y_46_im)) * (x_46_im * (y_46_re / Math.hypot(y_46_re, y_46_im)))) - ((y_46_im * x_46_re) / Math.pow(Math.hypot(y_46_re, y_46_im), 2.0));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (y_46_im <= -2.5e+122) or not (y_46_im <= 8.2e+164): tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im else: tmp = ((1.0 / math.hypot(y_46_re, y_46_im)) * (x_46_im * (y_46_re / math.hypot(y_46_re, y_46_im)))) - ((y_46_im * x_46_re) / math.pow(math.hypot(y_46_re, y_46_im), 2.0)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_im <= -2.5e+122) || !(y_46_im <= 8.2e+164)) tmp = Float64(Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re) / y_46_im); else tmp = Float64(Float64(Float64(1.0 / hypot(y_46_re, y_46_im)) * Float64(x_46_im * Float64(y_46_re / hypot(y_46_re, y_46_im)))) - Float64(Float64(y_46_im * x_46_re) / (hypot(y_46_re, y_46_im) ^ 2.0))); 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.5e+122) || ~((y_46_im <= 8.2e+164))) tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im; else tmp = ((1.0 / hypot(y_46_re, y_46_im)) * (x_46_im * (y_46_re / hypot(y_46_re, y_46_im)))) - ((y_46_im * x_46_re) / (hypot(y_46_re, y_46_im) ^ 2.0)); 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.5e+122], N[Not[LessEqual[y$46$im, 8.2e+164]], $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[(N[(1.0 / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(x$46$im * N[(y$46$re / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(y$46$im * x$46$re), $MachinePrecision] / N[Power[N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -2.5 \cdot 10^{+122} \lor \neg \left(y.im \leq 8.2 \cdot 10^{+164}\right):\\
\;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(x.im \cdot \frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right) - \frac{y.im \cdot x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\\
\end{array}
\end{array}
if y.im < -2.49999999999999994e122 or 8.20000000000000032e164 < y.im Initial program 29.2%
Taylor expanded in y.re around 0 76.8%
+-commutative76.8%
mul-1-neg76.8%
unsub-neg76.8%
unpow276.8%
associate-/r*83.4%
div-sub83.4%
*-commutative83.4%
associate-/l*89.0%
Simplified89.0%
if -2.49999999999999994e122 < y.im < 8.20000000000000032e164Initial program 73.2%
div-sub69.9%
*-un-lft-identity69.9%
add-sqr-sqrt69.9%
times-frac69.9%
fmm-def69.9%
hypot-define69.9%
hypot-define75.7%
associate-/l*79.5%
add-sqr-sqrt79.4%
pow279.4%
hypot-define79.4%
Applied egg-rr79.4%
fmm-undef79.4%
associate-/l*94.0%
associate-*r/89.2%
*-commutative89.2%
Simplified89.2%
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))))
(if (<= (/ t_0 (+ (* y.re y.re) (* y.im y.im))) 1e+273)
(* (/ 1.0 (hypot y.re y.im)) (/ t_0 (hypot y.re y.im)))
(/ (- x.im (* y.im (/ x.re y.re))) y.re))))
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);
double tmp;
if ((t_0 / ((y_46_re * y_46_re) + (y_46_im * y_46_im))) <= 1e+273) {
tmp = (1.0 / hypot(y_46_re, y_46_im)) * (t_0 / hypot(y_46_re, y_46_im));
} else {
tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
}
return tmp;
}
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);
double tmp;
if ((t_0 / ((y_46_re * y_46_re) + (y_46_im * y_46_im))) <= 1e+273) {
tmp = (1.0 / Math.hypot(y_46_re, y_46_im)) * (t_0 / Math.hypot(y_46_re, y_46_im));
} else {
tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
}
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) tmp = 0 if (t_0 / ((y_46_re * y_46_re) + (y_46_im * y_46_im))) <= 1e+273: tmp = (1.0 / math.hypot(y_46_re, y_46_im)) * (t_0 / math.hypot(y_46_re, y_46_im)) else: tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) tmp = 0.0 if (Float64(t_0 / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))) <= 1e+273) tmp = Float64(Float64(1.0 / hypot(y_46_re, y_46_im)) * Float64(t_0 / hypot(y_46_re, y_46_im))); else tmp = Float64(Float64(x_46_im - Float64(y_46_im * Float64(x_46_re / 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) t_0 = (y_46_re * x_46_im) - (y_46_im * x_46_re); tmp = 0.0; if ((t_0 / ((y_46_re * y_46_re) + (y_46_im * y_46_im))) <= 1e+273) tmp = (1.0 / hypot(y_46_re, y_46_im)) * (t_0 / hypot(y_46_re, y_46_im)); else tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+273], N[(N[(1.0 / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im - N[(y$46$im * N[(x$46$re / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot x.im - y.im \cdot x.re\\
\mathbf{if}\;\frac{t\_0}{y.re \cdot y.re + y.im \cdot y.im} \leq 10^{+273}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{t\_0}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 x.im y.re) (*.f64 x.re y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) < 9.99999999999999945e272Initial program 79.9%
*-un-lft-identity79.9%
add-sqr-sqrt79.9%
times-frac79.9%
hypot-define80.0%
hypot-define95.2%
Applied egg-rr95.2%
if 9.99999999999999945e272 < (/.f64 (-.f64 (*.f64 x.im y.re) (*.f64 x.re y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) Initial program 14.2%
Taylor expanded in y.re around inf 50.9%
mul-1-neg50.9%
unsub-neg50.9%
*-commutative50.9%
associate-/l*59.2%
Simplified59.2%
Final simplification85.0%
(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.re -9.5e+87)
(/ (- x.im (* y.im (/ x.re y.re))) y.re)
(if (<= y.re -9.8e-116)
t_0
(if (<= y.re 3.2e-63)
(/ (- (/ (* y.re x.im) y.im) x.re) y.im)
(if (<= y.re 2.5e+91)
t_0
(/ (- 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 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_re <= -9.5e+87) {
tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
} else if (y_46_re <= -9.8e-116) {
tmp = t_0;
} else if (y_46_re <= 3.2e-63) {
tmp = (((y_46_re * x_46_im) / y_46_im) - x_46_re) / y_46_im;
} else if (y_46_re <= 2.5e+91) {
tmp = t_0;
} 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) :: 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_46re <= (-9.5d+87)) then
tmp = (x_46im - (y_46im * (x_46re / y_46re))) / y_46re
else if (y_46re <= (-9.8d-116)) then
tmp = t_0
else if (y_46re <= 3.2d-63) then
tmp = (((y_46re * x_46im) / y_46im) - x_46re) / y_46im
else if (y_46re <= 2.5d+91) then
tmp = t_0
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 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_re <= -9.5e+87) {
tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
} else if (y_46_re <= -9.8e-116) {
tmp = t_0;
} else if (y_46_re <= 3.2e-63) {
tmp = (((y_46_re * x_46_im) / y_46_im) - x_46_re) / y_46_im;
} else if (y_46_re <= 2.5e+91) {
tmp = t_0;
} 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): 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_re <= -9.5e+87: tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re elif y_46_re <= -9.8e-116: tmp = t_0 elif y_46_re <= 3.2e-63: tmp = (((y_46_re * x_46_im) / y_46_im) - x_46_re) / y_46_im elif y_46_re <= 2.5e+91: tmp = t_0 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) 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_re <= -9.5e+87) tmp = Float64(Float64(x_46_im - Float64(y_46_im * Float64(x_46_re / y_46_re))) / y_46_re); elseif (y_46_re <= -9.8e-116) tmp = t_0; elseif (y_46_re <= 3.2e-63) tmp = Float64(Float64(Float64(Float64(y_46_re * x_46_im) / y_46_im) - x_46_re) / y_46_im); elseif (y_46_re <= 2.5e+91) tmp = t_0; 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) 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_re <= -9.5e+87) tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re; elseif (y_46_re <= -9.8e-116) tmp = t_0; elseif (y_46_re <= 3.2e-63) tmp = (((y_46_re * x_46_im) / y_46_im) - x_46_re) / y_46_im; elseif (y_46_re <= 2.5e+91) tmp = t_0; 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_] := 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$re, -9.5e+87], 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, -9.8e-116], t$95$0, If[LessEqual[y$46$re, 3.2e-63], N[(N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 2.5e+91], t$95$0, N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]]]]]
\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.re \leq -9.5 \cdot 10^{+87}:\\
\;\;\;\;\frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re}\\
\mathbf{elif}\;y.re \leq -9.8 \cdot 10^{-116}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 3.2 \cdot 10^{-63}:\\
\;\;\;\;\frac{\frac{y.re \cdot x.im}{y.im} - x.re}{y.im}\\
\mathbf{elif}\;y.re \leq 2.5 \cdot 10^{+91}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\end{array}
\end{array}
if y.re < -9.4999999999999992e87Initial program 37.3%
Taylor expanded in y.re around inf 74.4%
mul-1-neg74.4%
unsub-neg74.4%
*-commutative74.4%
associate-/l*85.2%
Simplified85.2%
if -9.4999999999999992e87 < y.re < -9.79999999999999955e-116 or 3.19999999999999989e-63 < y.re < 2.5000000000000001e91Initial program 75.4%
if -9.79999999999999955e-116 < y.re < 3.19999999999999989e-63Initial program 72.9%
Taylor expanded in y.im around inf 95.0%
if 2.5000000000000001e91 < y.re Initial program 41.7%
Taylor expanded in y.re around inf 83.3%
mul-1-neg83.3%
associate-/l*88.6%
Simplified88.6%
Final simplification86.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -2.2e-46) (not (<= y.im 1.36e+97))) (/ (- (* y.re (/ x.im y.im)) x.re) y.im) (/ (- x.im (/ (* y.im x.re) 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.2e-46) || !(y_46_im <= 1.36e+97)) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
} else {
tmp = (x_46_im - ((y_46_im * x_46_re) / 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.2d-46)) .or. (.not. (y_46im <= 1.36d+97))) then
tmp = ((y_46re * (x_46im / y_46im)) - x_46re) / y_46im
else
tmp = (x_46im - ((y_46im * x_46re) / 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.2e-46) || !(y_46_im <= 1.36e+97)) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
} else {
tmp = (x_46_im - ((y_46_im * x_46_re) / 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.2e-46) or not (y_46_im <= 1.36e+97): tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im else: tmp = (x_46_im - ((y_46_im * x_46_re) / 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.2e-46) || !(y_46_im <= 1.36e+97)) 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(Float64(y_46_im * x_46_re) / 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.2e-46) || ~((y_46_im <= 1.36e+97))) tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im; else tmp = (x_46_im - ((y_46_im * x_46_re) / 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.2e-46], N[Not[LessEqual[y$46$im, 1.36e+97]], $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[(N[(y$46$im * x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -2.2 \cdot 10^{-46} \lor \neg \left(y.im \leq 1.36 \cdot 10^{+97}\right):\\
\;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re}\\
\end{array}
\end{array}
if y.im < -2.2000000000000001e-46 or 1.36e97 < y.im Initial program 44.4%
Taylor expanded in y.re around 0 69.1%
+-commutative69.1%
mul-1-neg69.1%
unsub-neg69.1%
unpow269.1%
associate-/r*73.8%
div-sub74.7%
*-commutative74.7%
associate-/l*78.1%
Simplified78.1%
if -2.2000000000000001e-46 < y.im < 1.36e97Initial program 75.3%
Taylor expanded in y.re around inf 82.1%
mul-1-neg82.1%
unsub-neg82.1%
*-commutative82.1%
associate-/l*80.8%
Simplified80.8%
associate-*r/82.1%
Applied egg-rr82.1%
Final simplification80.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -2.6e-46) (not (<= y.im 1.8e+172))) (/ x.re (- y.im)) (/ (- x.im (* y.im (/ x.re 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.6e-46) || !(y_46_im <= 1.8e+172)) {
tmp = x_46_re / -y_46_im;
} else {
tmp = (x_46_im - (y_46_im * (x_46_re / 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.6d-46)) .or. (.not. (y_46im <= 1.8d+172))) then
tmp = x_46re / -y_46im
else
tmp = (x_46im - (y_46im * (x_46re / 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.6e-46) || !(y_46_im <= 1.8e+172)) {
tmp = x_46_re / -y_46_im;
} else {
tmp = (x_46_im - (y_46_im * (x_46_re / 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.6e-46) or not (y_46_im <= 1.8e+172): tmp = x_46_re / -y_46_im else: tmp = (x_46_im - (y_46_im * (x_46_re / 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.6e-46) || !(y_46_im <= 1.8e+172)) tmp = Float64(x_46_re / Float64(-y_46_im)); else tmp = Float64(Float64(x_46_im - Float64(y_46_im * Float64(x_46_re / 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.6e-46) || ~((y_46_im <= 1.8e+172))) tmp = x_46_re / -y_46_im; else tmp = (x_46_im - (y_46_im * (x_46_re / 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.6e-46], N[Not[LessEqual[y$46$im, 1.8e+172]], $MachinePrecision]], N[(x$46$re / (-y$46$im)), $MachinePrecision], N[(N[(x$46$im - N[(y$46$im * N[(x$46$re / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -2.6 \cdot 10^{-46} \lor \neg \left(y.im \leq 1.8 \cdot 10^{+172}\right):\\
\;\;\;\;\frac{x.re}{-y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re}\\
\end{array}
\end{array}
if y.im < -2.6000000000000002e-46 or 1.79999999999999987e172 < y.im Initial program 45.2%
Taylor expanded in y.re around 0 68.6%
associate-*r/68.6%
neg-mul-168.6%
Simplified68.6%
if -2.6000000000000002e-46 < y.im < 1.79999999999999987e172Initial program 71.6%
Taylor expanded in y.re around inf 77.1%
mul-1-neg77.1%
unsub-neg77.1%
*-commutative77.1%
associate-/l*77.8%
Simplified77.8%
Final simplification74.2%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -2.6e-46) (not (<= y.im 1.32e+166))) (/ 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 <= -2.6e-46) || !(y_46_im <= 1.32e+166)) {
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 <= (-2.6d-46)) .or. (.not. (y_46im <= 1.32d+166))) 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 <= -2.6e-46) || !(y_46_im <= 1.32e+166)) {
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 <= -2.6e-46) or not (y_46_im <= 1.32e+166): 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 <= -2.6e-46) || !(y_46_im <= 1.32e+166)) 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 <= -2.6e-46) || ~((y_46_im <= 1.32e+166))) 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, -2.6e-46], N[Not[LessEqual[y$46$im, 1.32e+166]], $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 -2.6 \cdot 10^{-46} \lor \neg \left(y.im \leq 1.32 \cdot 10^{+166}\right):\\
\;\;\;\;\frac{x.re}{-y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.im < -2.6000000000000002e-46 or 1.3199999999999999e166 < y.im Initial program 44.3%
Taylor expanded in y.re around 0 68.2%
associate-*r/68.2%
neg-mul-168.2%
Simplified68.2%
if -2.6000000000000002e-46 < y.im < 1.3199999999999999e166Initial program 72.6%
Taylor expanded in y.re around inf 63.4%
Final simplification65.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.im 3.2e+239) (/ 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_im <= 3.2e+239) {
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_46im <= 3.2d+239) 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_im <= 3.2e+239) {
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_im <= 3.2e+239: 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_im <= 3.2e+239) tmp = Float64(x_46_im / y_46_re); else tmp = Float64(x_46_re / y_46_im); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_im <= 3.2e+239) 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[LessEqual[y$46$im, 3.2e+239], 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.im \leq 3.2 \cdot 10^{+239}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.im}\\
\end{array}
\end{array}
if y.im < 3.2000000000000002e239Initial program 62.7%
Taylor expanded in y.re around inf 48.7%
if 3.2000000000000002e239 < y.im Initial program 40.7%
Taylor expanded in y.re around 0 79.1%
associate-*r/79.1%
neg-mul-179.1%
Simplified79.1%
add-sqr-sqrt39.2%
sqrt-unprod63.7%
sqr-neg63.7%
sqrt-unprod24.3%
add-sqr-sqrt42.5%
div-inv42.5%
Applied egg-rr42.5%
associate-*r/42.5%
*-rgt-identity42.5%
Simplified42.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.2%
Taylor expanded in y.re around inf 46.2%
herbie shell --seed 2024185
(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))))