
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = ((x_46im * y_46re) - (x_46re * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(Float64(Float64(x_46_im * y_46_re) - Float64(x_46_re * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = ((x_46im * y_46re) - (x_46re * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(Float64(Float64(x_46_im * y_46_re) - Float64(x_46_re * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\end{array}
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (pow (hypot y.im y.re) 2.0))
(t_1 (/ (- (/ y.re (/ y.im x.im)) x.re) y.im)))
(if (<= y.im -4e+95)
t_1
(if (<= y.im -2.1e-79)
(- (* x.im (/ y.re t_0)) (* y.im (/ x.re t_0)))
(if (<= y.im 1.12e+45) (/ (- x.im (* x.re (/ y.im y.re))) y.re) t_1)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = pow(hypot(y_46_im, y_46_re), 2.0);
double t_1 = ((y_46_re / (y_46_im / x_46_im)) - x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -4e+95) {
tmp = t_1;
} else if (y_46_im <= -2.1e-79) {
tmp = (x_46_im * (y_46_re / t_0)) - (y_46_im * (x_46_re / t_0));
} else if (y_46_im <= 1.12e+45) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else {
tmp = t_1;
}
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 = Math.pow(Math.hypot(y_46_im, y_46_re), 2.0);
double t_1 = ((y_46_re / (y_46_im / x_46_im)) - x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -4e+95) {
tmp = t_1;
} else if (y_46_im <= -2.1e-79) {
tmp = (x_46_im * (y_46_re / t_0)) - (y_46_im * (x_46_re / t_0));
} else if (y_46_im <= 1.12e+45) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else {
tmp = t_1;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.pow(math.hypot(y_46_im, y_46_re), 2.0) t_1 = ((y_46_re / (y_46_im / x_46_im)) - x_46_re) / y_46_im tmp = 0 if y_46_im <= -4e+95: tmp = t_1 elif y_46_im <= -2.1e-79: tmp = (x_46_im * (y_46_re / t_0)) - (y_46_im * (x_46_re / t_0)) elif y_46_im <= 1.12e+45: tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re else: tmp = t_1 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = hypot(y_46_im, y_46_re) ^ 2.0 t_1 = Float64(Float64(Float64(y_46_re / Float64(y_46_im / x_46_im)) - x_46_re) / y_46_im) tmp = 0.0 if (y_46_im <= -4e+95) tmp = t_1; elseif (y_46_im <= -2.1e-79) tmp = Float64(Float64(x_46_im * Float64(y_46_re / t_0)) - Float64(y_46_im * Float64(x_46_re / t_0))); elseif (y_46_im <= 1.12e+45) tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); 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 = hypot(y_46_im, y_46_re) ^ 2.0; t_1 = ((y_46_re / (y_46_im / x_46_im)) - x_46_re) / y_46_im; tmp = 0.0; if (y_46_im <= -4e+95) tmp = t_1; elseif (y_46_im <= -2.1e-79) tmp = (x_46_im * (y_46_re / t_0)) - (y_46_im * (x_46_re / t_0)); elseif (y_46_im <= 1.12e+45) tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re; 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[Power[N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(y$46$re / N[(y$46$im / x$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -4e+95], t$95$1, If[LessEqual[y$46$im, -2.1e-79], N[(N[(x$46$im * N[(y$46$re / t$95$0), $MachinePrecision]), $MachinePrecision] - N[(y$46$im * N[(x$46$re / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.12e+45], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}\\
t_1 := \frac{\frac{y.re}{\frac{y.im}{x.im}} - x.re}{y.im}\\
\mathbf{if}\;y.im \leq -4 \cdot 10^{+95}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq -2.1 \cdot 10^{-79}:\\
\;\;\;\;x.im \cdot \frac{y.re}{t\_0} - y.im \cdot \frac{x.re}{t\_0}\\
\mathbf{elif}\;y.im \leq 1.12 \cdot 10^{+45}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.im < -4.00000000000000008e95 or 1.12e45 < y.im Initial program 52.1%
Taylor expanded in y.re around 0 80.6%
+-commutative80.6%
mul-1-neg80.6%
unsub-neg80.6%
unpow280.6%
associate-/r*86.3%
div-sub86.3%
*-commutative86.3%
associate-/l*90.4%
Simplified90.4%
clear-num90.4%
un-div-inv90.4%
Applied egg-rr90.4%
if -4.00000000000000008e95 < y.im < -2.0999999999999999e-79Initial program 89.5%
Taylor expanded in x.im around 0 89.5%
+-commutative89.5%
mul-1-neg89.5%
unsub-neg89.5%
associate-/l*93.0%
rem-square-sqrt93.0%
+-commutative93.0%
unpow293.0%
unpow293.0%
hypot-undefine93.0%
+-commutative93.0%
unpow293.0%
unpow293.0%
hypot-undefine93.0%
unpow293.0%
associate-*r/89.7%
Simplified93.1%
if -2.0999999999999999e-79 < y.im < 1.12e45Initial program 70.8%
Taylor expanded in y.re around inf 91.4%
mul-1-neg91.4%
unsub-neg91.4%
remove-double-neg91.4%
mul-1-neg91.4%
neg-mul-191.4%
unsub-neg91.4%
mul-1-neg91.4%
distribute-lft-in91.4%
distribute-lft-in91.4%
mul-1-neg91.4%
unsub-neg91.4%
neg-mul-191.4%
mul-1-neg91.4%
remove-double-neg91.4%
associate-/l*91.8%
Simplified91.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (- (/ y.re (/ y.im x.im)) x.re) y.im)))
(if (<= y.im -3.3e+95)
t_0
(if (<= y.im -5.5e-172)
(/ (- (* y.re x.im) (* y.im x.re)) (+ (* y.re y.re) (* y.im y.im)))
(if (<= y.im 6.8e+48) (/ (- x.im (* x.re (/ y.im y.re))) y.re) t_0)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = ((y_46_re / (y_46_im / x_46_im)) - x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -3.3e+95) {
tmp = t_0;
} else if (y_46_im <= -5.5e-172) {
tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else if (y_46_im <= 6.8e+48) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else {
tmp = t_0;
}
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 / (y_46im / x_46im)) - x_46re) / y_46im
if (y_46im <= (-3.3d+95)) then
tmp = t_0
else if (y_46im <= (-5.5d-172)) then
tmp = ((y_46re * x_46im) - (y_46im * x_46re)) / ((y_46re * y_46re) + (y_46im * y_46im))
else if (y_46im <= 6.8d+48) then
tmp = (x_46im - (x_46re * (y_46im / y_46re))) / y_46re
else
tmp = t_0
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 / (y_46_im / x_46_im)) - x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -3.3e+95) {
tmp = t_0;
} else if (y_46_im <= -5.5e-172) {
tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else if (y_46_im <= 6.8e+48) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else {
tmp = t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = ((y_46_re / (y_46_im / x_46_im)) - x_46_re) / y_46_im tmp = 0 if y_46_im <= -3.3e+95: tmp = t_0 elif y_46_im <= -5.5e-172: tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)) elif y_46_im <= 6.8e+48: tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re else: tmp = t_0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(Float64(Float64(y_46_re / Float64(y_46_im / x_46_im)) - x_46_re) / y_46_im) tmp = 0.0 if (y_46_im <= -3.3e+95) tmp = t_0; elseif (y_46_im <= -5.5e-172) tmp = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))); elseif (y_46_im <= 6.8e+48) tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); else tmp = t_0; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = ((y_46_re / (y_46_im / x_46_im)) - x_46_re) / y_46_im; tmp = 0.0; if (y_46_im <= -3.3e+95) tmp = t_0; elseif (y_46_im <= -5.5e-172) tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); elseif (y_46_im <= 6.8e+48) tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re; else tmp = t_0; 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 / N[(y$46$im / x$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -3.3e+95], t$95$0, If[LessEqual[y$46$im, -5.5e-172], N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 6.8e+48], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{y.re}{\frac{y.im}{x.im}} - x.re}{y.im}\\
\mathbf{if}\;y.im \leq -3.3 \cdot 10^{+95}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq -5.5 \cdot 10^{-172}:\\
\;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{elif}\;y.im \leq 6.8 \cdot 10^{+48}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -3.2999999999999998e95 or 6.8000000000000006e48 < y.im Initial program 52.1%
Taylor expanded in y.re around 0 80.6%
+-commutative80.6%
mul-1-neg80.6%
unsub-neg80.6%
unpow280.6%
associate-/r*86.3%
div-sub86.3%
*-commutative86.3%
associate-/l*90.4%
Simplified90.4%
clear-num90.4%
un-div-inv90.4%
Applied egg-rr90.4%
if -3.2999999999999998e95 < y.im < -5.5000000000000004e-172Initial program 91.0%
if -5.5000000000000004e-172 < y.im < 6.8000000000000006e48Initial program 66.6%
Taylor expanded in y.re around inf 91.5%
mul-1-neg91.5%
unsub-neg91.5%
remove-double-neg91.5%
mul-1-neg91.5%
neg-mul-191.5%
unsub-neg91.5%
mul-1-neg91.5%
distribute-lft-in91.5%
distribute-lft-in91.5%
mul-1-neg91.5%
unsub-neg91.5%
neg-mul-191.5%
mul-1-neg91.5%
remove-double-neg91.5%
associate-/l*91.9%
Simplified91.9%
Final simplification91.2%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -9e+16) (not (<= y.im 1.9e+46))) (/ (- (/ y.re (/ y.im x.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 <= -9e+16) || !(y_46_im <= 1.9e+46)) {
tmp = ((y_46_re / (y_46_im / x_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 <= (-9d+16)) .or. (.not. (y_46im <= 1.9d+46))) then
tmp = ((y_46re / (y_46im / x_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 <= -9e+16) || !(y_46_im <= 1.9e+46)) {
tmp = ((y_46_re / (y_46_im / x_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 <= -9e+16) or not (y_46_im <= 1.9e+46): tmp = ((y_46_re / (y_46_im / x_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 <= -9e+16) || !(y_46_im <= 1.9e+46)) tmp = Float64(Float64(Float64(y_46_re / Float64(y_46_im / x_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 <= -9e+16) || ~((y_46_im <= 1.9e+46))) tmp = ((y_46_re / (y_46_im / x_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, -9e+16], N[Not[LessEqual[y$46$im, 1.9e+46]], $MachinePrecision]], N[(N[(N[(y$46$re / N[(y$46$im / x$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 -9 \cdot 10^{+16} \lor \neg \left(y.im \leq 1.9 \cdot 10^{+46}\right):\\
\;\;\;\;\frac{\frac{y.re}{\frac{y.im}{x.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 < -9e16 or 1.9e46 < y.im Initial program 56.5%
Taylor expanded in y.re around 0 80.1%
+-commutative80.1%
mul-1-neg80.1%
unsub-neg80.1%
unpow280.1%
associate-/r*85.2%
div-sub85.2%
*-commutative85.2%
associate-/l*88.8%
Simplified88.8%
clear-num88.8%
un-div-inv88.8%
Applied egg-rr88.8%
if -9e16 < y.im < 1.9e46Initial program 72.8%
Taylor expanded in y.re around inf 87.3%
mul-1-neg87.3%
unsub-neg87.3%
remove-double-neg87.3%
mul-1-neg87.3%
neg-mul-187.3%
unsub-neg87.3%
mul-1-neg87.3%
distribute-lft-in87.3%
distribute-lft-in87.3%
mul-1-neg87.3%
unsub-neg87.3%
neg-mul-187.3%
mul-1-neg87.3%
remove-double-neg87.3%
associate-/l*87.7%
Simplified87.7%
Final simplification88.2%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -3.8e-19) (not (<= y.im 9e+51))) (/ (- (* y.re (/ x.im y.im)) x.re) y.im) (/ (- x.im (* x.re (/ y.im y.re))) y.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -3.8e-19) || !(y_46_im <= 9e+51)) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
} else {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if ((y_46im <= (-3.8d-19)) .or. (.not. (y_46im <= 9d+51))) then
tmp = ((y_46re * (x_46im / y_46im)) - x_46re) / y_46im
else
tmp = (x_46im - (x_46re * (y_46im / y_46re))) / y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -3.8e-19) || !(y_46_im <= 9e+51)) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
} else {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (y_46_im <= -3.8e-19) or not (y_46_im <= 9e+51): tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im else: tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_im <= -3.8e-19) || !(y_46_im <= 9e+51)) tmp = Float64(Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re) / y_46_im); else tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if ((y_46_im <= -3.8e-19) || ~((y_46_im <= 9e+51))) tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im; else tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -3.8e-19], N[Not[LessEqual[y$46$im, 9e+51]], $MachinePrecision]], N[(N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -3.8 \cdot 10^{-19} \lor \neg \left(y.im \leq 9 \cdot 10^{+51}\right):\\
\;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\end{array}
\end{array}
if y.im < -3.8e-19 or 8.9999999999999999e51 < y.im Initial program 59.5%
Taylor expanded in y.re around 0 78.2%
+-commutative78.2%
mul-1-neg78.2%
unsub-neg78.2%
unpow278.2%
associate-/r*82.9%
div-sub82.9%
*-commutative82.9%
associate-/l*86.3%
Simplified86.3%
if -3.8e-19 < y.im < 8.9999999999999999e51Initial program 71.3%
Taylor expanded in y.re around inf 89.3%
mul-1-neg89.3%
unsub-neg89.3%
remove-double-neg89.3%
mul-1-neg89.3%
neg-mul-189.3%
unsub-neg89.3%
mul-1-neg89.3%
distribute-lft-in89.3%
distribute-lft-in89.3%
mul-1-neg89.3%
unsub-neg89.3%
neg-mul-189.3%
mul-1-neg89.3%
remove-double-neg89.3%
associate-/l*89.7%
Simplified89.7%
Final simplification88.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -1.4e+19) (not (<= y.im 2.4e+95))) (/ (- 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.4e+19) || !(y_46_im <= 2.4e+95)) {
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 <= (-1.4d+19)) .or. (.not. (y_46im <= 2.4d+95))) 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 <= -1.4e+19) || !(y_46_im <= 2.4e+95)) {
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 <= -1.4e+19) or not (y_46_im <= 2.4e+95): 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 <= -1.4e+19) || !(y_46_im <= 2.4e+95)) 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 <= -1.4e+19) || ~((y_46_im <= 2.4e+95))) 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, -1.4e+19], N[Not[LessEqual[y$46$im, 2.4e+95]], $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 -1.4 \cdot 10^{+19} \lor \neg \left(y.im \leq 2.4 \cdot 10^{+95}\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 < -1.4e19 or 2.4e95 < y.im Initial program 56.9%
Taylor expanded in y.re around 0 78.0%
associate-*r/78.0%
neg-mul-178.0%
Simplified78.0%
if -1.4e19 < y.im < 2.4e95Initial program 71.8%
Taylor expanded in y.re around inf 84.9%
mul-1-neg84.9%
unsub-neg84.9%
remove-double-neg84.9%
mul-1-neg84.9%
neg-mul-184.9%
unsub-neg84.9%
mul-1-neg84.9%
distribute-lft-in84.9%
distribute-lft-in84.9%
mul-1-neg84.9%
unsub-neg84.9%
neg-mul-184.9%
mul-1-neg84.9%
remove-double-neg84.9%
associate-/l*85.8%
Simplified85.8%
Final simplification82.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -1.9e-20) (not (<= y.im 2.4e+95))) (/ (- 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 <= -1.9e-20) || !(y_46_im <= 2.4e+95)) {
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 <= (-1.9d-20)) .or. (.not. (y_46im <= 2.4d+95))) 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 <= -1.9e-20) || !(y_46_im <= 2.4e+95)) {
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 <= -1.9e-20) or not (y_46_im <= 2.4e+95): 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 <= -1.9e-20) || !(y_46_im <= 2.4e+95)) 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 <= -1.9e-20) || ~((y_46_im <= 2.4e+95))) 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, -1.9e-20], N[Not[LessEqual[y$46$im, 2.4e+95]], $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 -1.9 \cdot 10^{-20} \lor \neg \left(y.im \leq 2.4 \cdot 10^{+95}\right):\\
\;\;\;\;\frac{-x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.im < -1.8999999999999999e-20 or 2.4e95 < y.im Initial program 60.1%
Taylor expanded in y.re around 0 75.2%
associate-*r/75.2%
neg-mul-175.2%
Simplified75.2%
if -1.8999999999999999e-20 < y.im < 2.4e95Initial program 70.3%
Taylor expanded in y.re around inf 67.3%
Final simplification70.6%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -6.8e+165) (not (<= y.im 5.5e+97))) (/ 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.8e+165) || !(y_46_im <= 5.5e+97)) {
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.8d+165)) .or. (.not. (y_46im <= 5.5d+97))) 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.8e+165) || !(y_46_im <= 5.5e+97)) {
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.8e+165) or not (y_46_im <= 5.5e+97): 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.8e+165) || !(y_46_im <= 5.5e+97)) tmp = 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.8e+165) || ~((y_46_im <= 5.5e+97))) 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.8e+165], N[Not[LessEqual[y$46$im, 5.5e+97]], $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.8 \cdot 10^{+165} \lor \neg \left(y.im \leq 5.5 \cdot 10^{+97}\right):\\
\;\;\;\;\frac{x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.im < -6.80000000000000022e165 or 5.50000000000000021e97 < y.im Initial program 48.9%
fma-neg48.9%
distribute-rgt-neg-out48.9%
*-un-lft-identity48.9%
add-sqr-sqrt48.9%
times-frac48.9%
hypot-define48.9%
add-sqr-sqrt26.1%
sqrt-unprod33.0%
distribute-rgt-neg-out33.0%
distribute-rgt-neg-out33.0%
sqr-neg33.0%
sqrt-unprod17.3%
add-sqr-sqrt36.5%
hypot-define44.3%
Applied egg-rr44.3%
Taylor expanded in y.re around 0 33.3%
if -6.80000000000000022e165 < y.im < 5.50000000000000021e97Initial program 72.5%
Taylor expanded in y.re around inf 59.4%
Final simplification52.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 66.0%
Taylor expanded in y.re around inf 45.2%
(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 66.0%
fma-neg66.0%
distribute-rgt-neg-out66.0%
*-un-lft-identity66.0%
add-sqr-sqrt66.0%
times-frac66.0%
hypot-define66.0%
add-sqr-sqrt35.8%
sqrt-unprod48.1%
distribute-rgt-neg-out48.1%
distribute-rgt-neg-out48.1%
sqr-neg48.1%
sqrt-unprod27.8%
add-sqr-sqrt43.2%
hypot-define50.1%
Applied egg-rr50.1%
Taylor expanded in y.re around 0 32.7%
+-commutative32.7%
associate-/l*33.4%
fma-define33.4%
Simplified33.4%
Taylor expanded in y.re around inf 9.5%
herbie shell --seed 2024099
(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))))