
(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 10 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 (<= y.im -2.5e+49)
(/ x.re (- (- y.im) (* y.re (/ y.re y.im))))
(if (<= y.im 1650.0)
(/ (- x.im (* x.re (/ y.im y.re))) y.re)
(/ (- (* y.re (/ x.im y.im)) x.re) (hypot y.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 <= -2.5e+49) {
tmp = x_46_re / (-y_46_im - (y_46_re * (y_46_re / y_46_im)));
} else if (y_46_im <= 1650.0) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / hypot(y_46_re, y_46_im);
}
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+49) {
tmp = x_46_re / (-y_46_im - (y_46_re * (y_46_re / y_46_im)));
} else if (y_46_im <= 1650.0) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / Math.hypot(y_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 <= -2.5e+49: tmp = x_46_re / (-y_46_im - (y_46_re * (y_46_re / y_46_im))) elif y_46_im <= 1650.0: tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re else: tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / math.hypot(y_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 <= -2.5e+49) tmp = Float64(x_46_re / Float64(Float64(-y_46_im) - Float64(y_46_re * Float64(y_46_re / y_46_im)))); elseif (y_46_im <= 1650.0) tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); else tmp = Float64(Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re) / hypot(y_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 <= -2.5e+49) tmp = x_46_re / (-y_46_im - (y_46_re * (y_46_re / y_46_im))); elseif (y_46_im <= 1650.0) tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re; else tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / hypot(y_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, -2.5e+49], N[(x$46$re / N[((-y$46$im) - N[(y$46$re * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1650.0], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], N[(N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -2.5 \cdot 10^{+49}:\\
\;\;\;\;\frac{x.re}{\left(-y.im\right) - y.re \cdot \frac{y.re}{y.im}}\\
\mathbf{elif}\;y.im \leq 1650:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\end{array}
\end{array}
if y.im < -2.5000000000000002e49Initial program 49.3%
Taylor expanded in x.im around 0 40.2%
associate-*r/40.2%
mul-1-neg40.2%
distribute-rgt-neg-out40.2%
associate-/l*52.1%
unpow252.1%
fma-def52.1%
unpow252.1%
Simplified52.1%
Taylor expanded in y.re around 0 79.4%
distribute-lft-out79.4%
unpow279.4%
associate-*r/84.3%
Simplified84.3%
if -2.5000000000000002e49 < y.im < 1650Initial program 72.4%
*-un-lft-identity72.4%
add-sqr-sqrt72.4%
times-frac72.2%
hypot-def72.2%
hypot-def81.6%
Applied egg-rr81.6%
Taylor expanded in y.re around inf 81.7%
metadata-eval81.7%
unpow281.7%
cancel-sign-sub-inv81.7%
*-commutative81.7%
*-rgt-identity81.7%
associate-/r*88.6%
associate-*r/88.5%
div-sub90.1%
Simplified90.1%
if 1650 < y.im Initial program 45.4%
*-un-lft-identity45.4%
add-sqr-sqrt45.4%
times-frac45.5%
hypot-def45.5%
hypot-def62.8%
Applied egg-rr62.8%
Taylor expanded in y.re around 0 83.2%
neg-mul-183.2%
unsub-neg83.2%
*-lft-identity83.2%
times-frac85.9%
/-rgt-identity85.9%
Simplified85.9%
expm1-log1p-u73.0%
expm1-udef33.3%
associate-*l/33.3%
*-un-lft-identity33.3%
Applied egg-rr33.3%
expm1-def73.2%
expm1-log1p86.2%
Simplified86.2%
Final simplification87.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -2.15e+49) (not (<= y.im 1.46e+26))) (* (- (* y.re (/ x.im y.im)) x.re) (/ 1.0 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.15e+49) || !(y_46_im <= 1.46e+26)) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) * (1.0 / 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.15d+49)) .or. (.not. (y_46im <= 1.46d+26))) then
tmp = ((y_46re * (x_46im / y_46im)) - x_46re) * (1.0d0 / 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.15e+49) || !(y_46_im <= 1.46e+26)) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) * (1.0 / 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.15e+49) or not (y_46_im <= 1.46e+26): tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) * (1.0 / 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.15e+49) || !(y_46_im <= 1.46e+26)) tmp = Float64(Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re) * Float64(1.0 / 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.15e+49) || ~((y_46_im <= 1.46e+26))) tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) * (1.0 / 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.15e+49], N[Not[LessEqual[y$46$im, 1.46e+26]], $MachinePrecision]], N[(N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] * N[(1.0 / 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 -2.15 \cdot 10^{+49} \lor \neg \left(y.im \leq 1.46 \cdot 10^{+26}\right):\\
\;\;\;\;\left(y.re \cdot \frac{x.im}{y.im} - x.re\right) \cdot \frac{1}{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.15e49 or 1.45999999999999992e26 < y.im Initial program 46.0%
*-un-lft-identity46.0%
add-sqr-sqrt46.0%
times-frac46.1%
hypot-def46.1%
hypot-def65.8%
Applied egg-rr65.8%
Taylor expanded in y.re around 0 56.9%
neg-mul-156.9%
unsub-neg56.9%
*-lft-identity56.9%
times-frac58.6%
/-rgt-identity58.6%
Simplified58.6%
Taylor expanded in y.re around 0 86.2%
if -2.15e49 < y.im < 1.45999999999999992e26Initial program 71.8%
*-un-lft-identity71.8%
add-sqr-sqrt71.8%
times-frac71.6%
hypot-def71.6%
hypot-def80.5%
Applied egg-rr80.5%
Taylor expanded in y.re around inf 79.9%
metadata-eval79.9%
unpow279.9%
cancel-sign-sub-inv79.9%
*-commutative79.9%
*-rgt-identity79.9%
associate-/r*86.4%
associate-*r/86.4%
div-sub87.8%
Simplified87.8%
Final simplification87.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -7e+53) (not (<= y.im 1.46e+26))) (- (* (/ y.re y.im) (/ 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 <= -7e+53) || !(y_46_im <= 1.46e+26)) {
tmp = ((y_46_re / y_46_im) * (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 <= (-7d+53)) .or. (.not. (y_46im <= 1.46d+26))) then
tmp = ((y_46re / y_46im) * (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 <= -7e+53) || !(y_46_im <= 1.46e+26)) {
tmp = ((y_46_re / y_46_im) * (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 <= -7e+53) or not (y_46_im <= 1.46e+26): tmp = ((y_46_re / y_46_im) * (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 <= -7e+53) || !(y_46_im <= 1.46e+26)) tmp = Float64(Float64(Float64(y_46_re / y_46_im) * Float64(x_46_im / y_46_im)) - 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 <= -7e+53) || ~((y_46_im <= 1.46e+26))) tmp = ((y_46_re / y_46_im) * (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, -7e+53], N[Not[LessEqual[y$46$im, 1.46e+26]], $MachinePrecision]], N[(N[(N[(y$46$re / y$46$im), $MachinePrecision] * N[(x$46$im / y$46$im), $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 -7 \cdot 10^{+53} \lor \neg \left(y.im \leq 1.46 \cdot 10^{+26}\right):\\
\;\;\;\;\frac{y.re}{y.im} \cdot \frac{x.im}{y.im} - \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 < -7.00000000000000038e53 or 1.45999999999999992e26 < y.im Initial program 46.0%
Taylor expanded in y.re around 0 81.0%
+-commutative81.0%
mul-1-neg81.0%
unsub-neg81.0%
unpow281.0%
times-frac86.5%
Simplified86.5%
if -7.00000000000000038e53 < y.im < 1.45999999999999992e26Initial program 71.8%
*-un-lft-identity71.8%
add-sqr-sqrt71.8%
times-frac71.6%
hypot-def71.6%
hypot-def80.5%
Applied egg-rr80.5%
Taylor expanded in y.re around inf 79.9%
metadata-eval79.9%
unpow279.9%
cancel-sign-sub-inv79.9%
*-commutative79.9%
*-rgt-identity79.9%
associate-/r*86.4%
associate-*r/86.4%
div-sub87.8%
Simplified87.8%
Final simplification87.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -3.1e+50)
(- (/ y.re (/ (* y.im y.im) x.im)) (/ x.re y.im))
(if (<= y.im 1.3e+26)
(/ (- x.im (* x.re (/ y.im y.re))) y.re)
(- (* (/ 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 tmp;
if (y_46_im <= -3.1e+50) {
tmp = (y_46_re / ((y_46_im * y_46_im) / x_46_im)) - (x_46_re / y_46_im);
} else if (y_46_im <= 1.3e+26) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else {
tmp = ((y_46_re / y_46_im) * (x_46_im / y_46_im)) - (x_46_re / y_46_im);
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46im <= (-3.1d+50)) then
tmp = (y_46re / ((y_46im * y_46im) / x_46im)) - (x_46re / y_46im)
else if (y_46im <= 1.3d+26) then
tmp = (x_46im - (x_46re * (y_46im / y_46re))) / y_46re
else
tmp = ((y_46re / y_46im) * (x_46im / y_46im)) - (x_46re / y_46im)
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_im <= -3.1e+50) {
tmp = (y_46_re / ((y_46_im * y_46_im) / x_46_im)) - (x_46_re / y_46_im);
} else if (y_46_im <= 1.3e+26) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else {
tmp = ((y_46_re / y_46_im) * (x_46_im / y_46_im)) - (x_46_re / y_46_im);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_im <= -3.1e+50: tmp = (y_46_re / ((y_46_im * y_46_im) / x_46_im)) - (x_46_re / y_46_im) elif y_46_im <= 1.3e+26: tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re else: tmp = ((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) tmp = 0.0 if (y_46_im <= -3.1e+50) tmp = Float64(Float64(y_46_re / Float64(Float64(y_46_im * y_46_im) / x_46_im)) - Float64(x_46_re / y_46_im)); elseif (y_46_im <= 1.3e+26) tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); else tmp = Float64(Float64(Float64(y_46_re / y_46_im) * Float64(x_46_im / y_46_im)) - 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.1e+50) tmp = (y_46_re / ((y_46_im * y_46_im) / x_46_im)) - (x_46_re / y_46_im); elseif (y_46_im <= 1.3e+26) tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re; else tmp = ((y_46_re / y_46_im) * (x_46_im / y_46_im)) - (x_46_re / y_46_im); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -3.1e+50], N[(N[(y$46$re / N[(N[(y$46$im * y$46$im), $MachinePrecision] / x$46$im), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.3e+26], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], N[(N[(N[(y$46$re / y$46$im), $MachinePrecision] * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -3.1 \cdot 10^{+50}:\\
\;\;\;\;\frac{y.re}{\frac{y.im \cdot y.im}{x.im}} - \frac{x.re}{y.im}\\
\mathbf{elif}\;y.im \leq 1.3 \cdot 10^{+26}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{y.re}{y.im} \cdot \frac{x.im}{y.im} - \frac{x.re}{y.im}\\
\end{array}
\end{array}
if y.im < -3.10000000000000003e50Initial program 49.3%
Taylor expanded in y.re around 0 79.6%
+-commutative79.6%
mul-1-neg79.6%
unsub-neg79.6%
associate-/l*82.8%
unpow282.8%
Simplified82.8%
if -3.10000000000000003e50 < y.im < 1.30000000000000001e26Initial program 71.8%
*-un-lft-identity71.8%
add-sqr-sqrt71.8%
times-frac71.6%
hypot-def71.6%
hypot-def80.5%
Applied egg-rr80.5%
Taylor expanded in y.re around inf 79.9%
metadata-eval79.9%
unpow279.9%
cancel-sign-sub-inv79.9%
*-commutative79.9%
*-rgt-identity79.9%
associate-/r*86.4%
associate-*r/86.4%
div-sub87.8%
Simplified87.8%
if 1.30000000000000001e26 < y.im Initial program 43.4%
Taylor expanded in y.re around 0 82.0%
+-commutative82.0%
mul-1-neg82.0%
unsub-neg82.0%
unpow282.0%
times-frac89.9%
Simplified89.9%
Final simplification87.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -9.5e+49)
(/ x.re (- (- y.im) (* y.re (/ y.re y.im))))
(if (<= y.im 1.25e+26)
(/ (- x.im (* x.re (/ y.im y.re))) y.re)
(- (* (/ 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 tmp;
if (y_46_im <= -9.5e+49) {
tmp = x_46_re / (-y_46_im - (y_46_re * (y_46_re / y_46_im)));
} else if (y_46_im <= 1.25e+26) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else {
tmp = ((y_46_re / y_46_im) * (x_46_im / y_46_im)) - (x_46_re / y_46_im);
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46im <= (-9.5d+49)) then
tmp = x_46re / (-y_46im - (y_46re * (y_46re / y_46im)))
else if (y_46im <= 1.25d+26) then
tmp = (x_46im - (x_46re * (y_46im / y_46re))) / y_46re
else
tmp = ((y_46re / y_46im) * (x_46im / y_46im)) - (x_46re / y_46im)
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_im <= -9.5e+49) {
tmp = x_46_re / (-y_46_im - (y_46_re * (y_46_re / y_46_im)));
} else if (y_46_im <= 1.25e+26) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else {
tmp = ((y_46_re / y_46_im) * (x_46_im / y_46_im)) - (x_46_re / y_46_im);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_im <= -9.5e+49: tmp = x_46_re / (-y_46_im - (y_46_re * (y_46_re / y_46_im))) elif y_46_im <= 1.25e+26: tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re else: tmp = ((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) tmp = 0.0 if (y_46_im <= -9.5e+49) tmp = Float64(x_46_re / Float64(Float64(-y_46_im) - Float64(y_46_re * Float64(y_46_re / y_46_im)))); elseif (y_46_im <= 1.25e+26) tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); else tmp = Float64(Float64(Float64(y_46_re / y_46_im) * Float64(x_46_im / y_46_im)) - 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 <= -9.5e+49) tmp = x_46_re / (-y_46_im - (y_46_re * (y_46_re / y_46_im))); elseif (y_46_im <= 1.25e+26) tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re; else tmp = ((y_46_re / y_46_im) * (x_46_im / y_46_im)) - (x_46_re / y_46_im); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -9.5e+49], N[(x$46$re / N[((-y$46$im) - N[(y$46$re * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.25e+26], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], N[(N[(N[(y$46$re / y$46$im), $MachinePrecision] * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -9.5 \cdot 10^{+49}:\\
\;\;\;\;\frac{x.re}{\left(-y.im\right) - y.re \cdot \frac{y.re}{y.im}}\\
\mathbf{elif}\;y.im \leq 1.25 \cdot 10^{+26}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{y.re}{y.im} \cdot \frac{x.im}{y.im} - \frac{x.re}{y.im}\\
\end{array}
\end{array}
if y.im < -9.49999999999999969e49Initial program 49.3%
Taylor expanded in x.im around 0 40.2%
associate-*r/40.2%
mul-1-neg40.2%
distribute-rgt-neg-out40.2%
associate-/l*52.1%
unpow252.1%
fma-def52.1%
unpow252.1%
Simplified52.1%
Taylor expanded in y.re around 0 79.4%
distribute-lft-out79.4%
unpow279.4%
associate-*r/84.3%
Simplified84.3%
if -9.49999999999999969e49 < y.im < 1.25e26Initial program 71.8%
*-un-lft-identity71.8%
add-sqr-sqrt71.8%
times-frac71.6%
hypot-def71.6%
hypot-def80.5%
Applied egg-rr80.5%
Taylor expanded in y.re around inf 79.9%
metadata-eval79.9%
unpow279.9%
cancel-sign-sub-inv79.9%
*-commutative79.9%
*-rgt-identity79.9%
associate-/r*86.4%
associate-*r/86.4%
div-sub87.8%
Simplified87.8%
if 1.25e26 < y.im Initial program 43.4%
Taylor expanded in y.re around 0 82.0%
+-commutative82.0%
mul-1-neg82.0%
unsub-neg82.0%
unpow282.0%
times-frac89.9%
Simplified89.9%
Final simplification87.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -4.5e+87) (not (<= y.im 3.4e+21))) (/ (- 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.5e+87) || !(y_46_im <= 3.4e+21)) {
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 <= (-4.5d+87)) .or. (.not. (y_46im <= 3.4d+21))) 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 <= -4.5e+87) || !(y_46_im <= 3.4e+21)) {
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 <= -4.5e+87) or not (y_46_im <= 3.4e+21): 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 <= -4.5e+87) || !(y_46_im <= 3.4e+21)) 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 <= -4.5e+87) || ~((y_46_im <= 3.4e+21))) 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, -4.5e+87], N[Not[LessEqual[y$46$im, 3.4e+21]], $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 -4.5 \cdot 10^{+87} \lor \neg \left(y.im \leq 3.4 \cdot 10^{+21}\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 < -4.5000000000000003e87 or 3.4e21 < y.im Initial program 45.6%
Taylor expanded in y.re around 0 80.3%
associate-*r/80.3%
neg-mul-180.3%
Simplified80.3%
if -4.5000000000000003e87 < y.im < 3.4e21Initial program 71.0%
*-un-lft-identity71.0%
add-sqr-sqrt71.0%
times-frac70.8%
hypot-def70.8%
hypot-def79.3%
Applied egg-rr79.3%
Taylor expanded in y.re around inf 77.4%
metadata-eval77.4%
unpow277.4%
cancel-sign-sub-inv77.4%
*-commutative77.4%
*-rgt-identity77.4%
associate-/r*83.6%
associate-*r/84.9%
div-sub86.3%
Simplified86.3%
Final simplification83.6%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -2.8e+48) (not (<= y.im 1.65e+20))) (/ (- 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.8e+48) || !(y_46_im <= 1.65e+20)) {
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.8d+48)) .or. (.not. (y_46im <= 1.65d+20))) 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.8e+48) || !(y_46_im <= 1.65e+20)) {
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.8e+48) or not (y_46_im <= 1.65e+20): 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.8e+48) || !(y_46_im <= 1.65e+20)) 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 <= -2.8e+48) || ~((y_46_im <= 1.65e+20))) 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.8e+48], N[Not[LessEqual[y$46$im, 1.65e+20]], $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.8 \cdot 10^{+48} \lor \neg \left(y.im \leq 1.65 \cdot 10^{+20}\right):\\
\;\;\;\;\frac{-x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.im < -2.80000000000000012e48 or 1.65e20 < y.im Initial program 46.8%
Taylor expanded in y.re around 0 77.8%
associate-*r/77.8%
neg-mul-177.8%
Simplified77.8%
if -2.80000000000000012e48 < y.im < 1.65e20Initial program 71.4%
Taylor expanded in y.re around inf 72.1%
Final simplification74.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.im -4.5e+117) (/ x.re y.im) (if (<= y.im 6.6e+144) (/ 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 <= -4.5e+117) {
tmp = x_46_re / y_46_im;
} else if (y_46_im <= 6.6e+144) {
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 <= (-4.5d+117)) then
tmp = x_46re / y_46im
else if (y_46im <= 6.6d+144) 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 <= -4.5e+117) {
tmp = x_46_re / y_46_im;
} else if (y_46_im <= 6.6e+144) {
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 <= -4.5e+117: tmp = x_46_re / y_46_im elif y_46_im <= 6.6e+144: 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 <= -4.5e+117) tmp = Float64(x_46_re / y_46_im); elseif (y_46_im <= 6.6e+144) 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 <= -4.5e+117) tmp = x_46_re / y_46_im; elseif (y_46_im <= 6.6e+144) 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, -4.5e+117], N[(x$46$re / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 6.6e+144], 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 -4.5 \cdot 10^{+117}:\\
\;\;\;\;\frac{x.re}{y.im}\\
\mathbf{elif}\;y.im \leq 6.6 \cdot 10^{+144}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.im}\\
\end{array}
\end{array}
if y.im < -4.5e117 or 6.6e144 < y.im Initial program 34.8%
*-un-lft-identity34.8%
add-sqr-sqrt34.8%
times-frac34.8%
hypot-def34.8%
hypot-def62.0%
Applied egg-rr62.0%
Taylor expanded in y.re around 0 59.6%
neg-mul-159.6%
unsub-neg59.6%
*-lft-identity59.6%
times-frac62.0%
/-rgt-identity62.0%
Simplified62.0%
Taylor expanded in y.im around -inf 26.9%
if -4.5e117 < y.im < 6.6e144Initial program 71.0%
Taylor expanded in y.re around inf 59.9%
Final simplification49.6%
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ x.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_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_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_im;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return x_46_im / y_46_im
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(x_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_im; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(x$46$im / y$46$im), $MachinePrecision]
\begin{array}{l}
\\
\frac{x.im}{y.im}
\end{array}
Initial program 59.7%
*-un-lft-identity59.7%
add-sqr-sqrt59.7%
times-frac59.6%
hypot-def59.7%
hypot-def73.6%
Applied egg-rr73.6%
Taylor expanded in y.re around 0 33.8%
neg-mul-133.8%
unsub-neg33.8%
*-lft-identity33.8%
times-frac34.2%
/-rgt-identity34.2%
Simplified34.2%
Taylor expanded in y.re around inf 10.2%
Final simplification10.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 59.7%
Taylor expanded in y.re around inf 44.9%
Final simplification44.9%
herbie shell --seed 2023172
(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))))