
(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
(let* ((t_0 (- (* x.im (/ y.re y.im)) x.re)) (t_1 (/ 1.0 (hypot y.re y.im))))
(if (<= y.re -8.2e+19)
(* t_1 (fma x.re (/ y.im y.re) (- x.im)))
(if (<= y.re -1.4e-175)
(* t_1 (/ (* y.im t_0) (hypot y.re y.im)))
(if (<= y.re 210.0)
(/ t_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 t_0 = (x_46_im * (y_46_re / y_46_im)) - x_46_re;
double t_1 = 1.0 / hypot(y_46_re, y_46_im);
double tmp;
if (y_46_re <= -8.2e+19) {
tmp = t_1 * fma(x_46_re, (y_46_im / y_46_re), -x_46_im);
} else if (y_46_re <= -1.4e-175) {
tmp = t_1 * ((y_46_im * t_0) / hypot(y_46_re, y_46_im));
} else if (y_46_re <= 210.0) {
tmp = t_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) t_0 = Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) t_1 = Float64(1.0 / hypot(y_46_re, y_46_im)) tmp = 0.0 if (y_46_re <= -8.2e+19) tmp = Float64(t_1 * fma(x_46_re, Float64(y_46_im / y_46_re), Float64(-x_46_im))); elseif (y_46_re <= -1.4e-175) tmp = Float64(t_1 * Float64(Float64(y_46_im * t_0) / hypot(y_46_re, y_46_im))); elseif (y_46_re <= 210.0) tmp = Float64(t_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
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -8.2e+19], N[(t$95$1 * N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision] + (-x$46$im)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, -1.4e-175], N[(t$95$1 * N[(N[(y$46$im * t$95$0), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 210.0], N[(t$95$0 / 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}
t_0 := x.im \cdot \frac{y.re}{y.im} - x.re\\
t_1 := \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{if}\;y.re \leq -8.2 \cdot 10^{+19}:\\
\;\;\;\;t\_1 \cdot \mathsf{fma}\left(x.re, \frac{y.im}{y.re}, -x.im\right)\\
\mathbf{elif}\;y.re \leq -1.4 \cdot 10^{-175}:\\
\;\;\;\;t\_1 \cdot \frac{y.im \cdot t\_0}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{elif}\;y.re \leq 210:\\
\;\;\;\;\frac{t\_0}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\end{array}
\end{array}
if y.re < -8.2e19Initial program 57.6%
*-un-lft-identity57.6%
add-sqr-sqrt57.6%
times-frac57.5%
hypot-define57.5%
fma-neg57.6%
distribute-rgt-neg-in57.6%
hypot-define72.9%
Applied egg-rr72.9%
Taylor expanded in y.re around -inf 81.4%
associate-*r/86.1%
+-commutative86.1%
fma-define86.1%
mul-1-neg86.1%
Simplified86.1%
if -8.2e19 < y.re < -1.4e-175Initial program 85.6%
*-un-lft-identity85.6%
add-sqr-sqrt85.6%
times-frac85.7%
hypot-define85.7%
fma-neg85.7%
distribute-rgt-neg-in85.7%
hypot-define94.1%
Applied egg-rr94.1%
Taylor expanded in y.im around inf 94.2%
+-commutative94.2%
mul-1-neg94.2%
unsub-neg94.2%
associate-/l*93.9%
Simplified93.9%
if -1.4e-175 < y.re < 210Initial program 72.6%
*-un-lft-identity72.6%
add-sqr-sqrt72.6%
times-frac72.6%
hypot-define72.6%
fma-neg72.6%
distribute-rgt-neg-in72.6%
hypot-define77.7%
Applied egg-rr77.7%
Taylor expanded in y.im around inf 88.6%
+-commutative88.6%
mul-1-neg88.6%
unsub-neg88.6%
associate-/l*89.6%
Simplified89.6%
if 210 < y.re Initial program 48.0%
Taylor expanded in y.re around inf 73.9%
mul-1-neg73.9%
unsub-neg73.9%
associate-/l*83.1%
Simplified83.1%
Final simplification87.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<=
(/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im)))
1e+267)
(*
(/ 1.0 (hypot y.re y.im))
(/ (fma x.im y.re (* x.re (- y.im))) (hypot y.re y.im)))
(/ (- x.im (/ x.re (/ y.re y.im))) y.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))) <= 1e+267) {
tmp = (1.0 / hypot(y_46_re, y_46_im)) * (fma(x_46_im, y_46_re, (x_46_re * -y_46_im)) / hypot(y_46_re, y_46_im));
} else {
tmp = (x_46_im - (x_46_re / (y_46_re / y_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 (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))) <= 1e+267) tmp = Float64(Float64(1.0 / hypot(y_46_re, y_46_im)) * Float64(fma(x_46_im, y_46_re, Float64(x_46_re * Float64(-y_46_im))) / hypot(y_46_re, y_46_im))); else tmp = Float64(Float64(x_46_im - Float64(x_46_re / Float64(y_46_re / y_46_im))) / y_46_re); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[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], 1e+267], N[(N[(1.0 / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(x$46$im * y$46$re + N[(x$46$re * (-y$46$im)), $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im - N[(x$46$re / N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \leq 10^{+267}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\mathsf{fma}\left(x.im, y.re, x.re \cdot \left(-y.im\right)\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - \frac{x.re}{\frac{y.re}{y.im}}}{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.9999999999999997e266Initial program 85.9%
*-un-lft-identity85.9%
add-sqr-sqrt85.9%
times-frac85.9%
hypot-define85.9%
fma-neg85.9%
distribute-rgt-neg-in85.9%
hypot-define97.1%
Applied egg-rr97.1%
if 9.9999999999999997e266 < (/.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 8.9%
Taylor expanded in y.re around inf 47.3%
mul-1-neg47.3%
unsub-neg47.3%
associate-/l*60.9%
Simplified60.9%
clear-num60.9%
clear-num60.9%
un-div-inv60.9%
clear-num61.0%
Applied egg-rr61.0%
Final simplification87.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -7e+141)
(* (/ 1.0 (hypot y.re y.im)) (fma x.re (/ y.im y.re) (- x.im)))
(if (<= y.re -1.9e-163)
(/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im)))
(if (<= y.re 1550.0)
(/ (- (* x.im (/ y.re y.im)) x.re) y.im)
(/ (- x.im (* x.re (/ y.im y.re))) y.re)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -7e+141) {
tmp = (1.0 / hypot(y_46_re, y_46_im)) * fma(x_46_re, (y_46_im / y_46_re), -x_46_im);
} else if (y_46_re <= -1.9e-163) {
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));
} else if (y_46_re <= 1550.0) {
tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
} else {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -7e+141) tmp = Float64(Float64(1.0 / hypot(y_46_re, y_46_im)) * fma(x_46_re, Float64(y_46_im / y_46_re), Float64(-x_46_im))); elseif (y_46_re <= -1.9e-163) tmp = 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))); elseif (y_46_re <= 1550.0) tmp = Float64(Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im); else tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -7e+141], N[(N[(1.0 / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision] + (-x$46$im)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, -1.9e-163], 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], If[LessEqual[y$46$re, 1550.0], N[(N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -7 \cdot 10^{+141}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \mathsf{fma}\left(x.re, \frac{y.im}{y.re}, -x.im\right)\\
\mathbf{elif}\;y.re \leq -1.9 \cdot 10^{-163}:\\
\;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{elif}\;y.re \leq 1550:\\
\;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\end{array}
\end{array}
if y.re < -6.9999999999999999e141Initial program 19.5%
*-un-lft-identity19.5%
add-sqr-sqrt19.5%
times-frac19.5%
hypot-define19.5%
fma-neg19.5%
distribute-rgt-neg-in19.5%
hypot-define51.3%
Applied egg-rr51.3%
Taylor expanded in y.re around -inf 74.9%
associate-*r/88.1%
+-commutative88.1%
fma-define88.1%
mul-1-neg88.1%
Simplified88.1%
if -6.9999999999999999e141 < y.re < -1.9e-163Initial program 90.0%
if -1.9e-163 < y.re < 1550Initial program 72.7%
*-un-lft-identity72.7%
add-sqr-sqrt72.7%
times-frac72.7%
hypot-define72.7%
fma-neg72.7%
distribute-rgt-neg-in72.7%
hypot-define78.6%
Applied egg-rr78.6%
Taylor expanded in y.im around inf 88.2%
+-commutative88.2%
mul-1-neg88.2%
unsub-neg88.2%
associate-/l*89.1%
Simplified89.1%
if 1550 < y.re Initial program 48.0%
Taylor expanded in y.re around inf 73.9%
mul-1-neg73.9%
unsub-neg73.9%
associate-/l*83.1%
Simplified83.1%
Final simplification87.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -1.1e+138)
(/ (- x.im (/ x.re (/ y.re y.im))) y.re)
(if (<= y.re -1.9e-163)
(/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im)))
(if (<= y.re 1650.0)
(/ (- (* x.im (/ y.re y.im)) x.re) y.im)
(/ (- x.im (* x.re (/ y.im y.re))) y.re)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -1.1e+138) {
tmp = (x_46_im - (x_46_re / (y_46_re / y_46_im))) / y_46_re;
} else if (y_46_re <= -1.9e-163) {
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));
} else if (y_46_re <= 1650.0) {
tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
} else {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46re <= (-1.1d+138)) then
tmp = (x_46im - (x_46re / (y_46re / y_46im))) / y_46re
else if (y_46re <= (-1.9d-163)) then
tmp = ((x_46im * y_46re) - (x_46re * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
else if (y_46re <= 1650.0d0) then
tmp = ((x_46im * (y_46re / y_46im)) - x_46re) / y_46im
else
tmp = (x_46im - (x_46re * (y_46im / y_46re))) / y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -1.1e+138) {
tmp = (x_46_im - (x_46_re / (y_46_re / y_46_im))) / y_46_re;
} else if (y_46_re <= -1.9e-163) {
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));
} else if (y_46_re <= 1650.0) {
tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
} else {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_re <= -1.1e+138: tmp = (x_46_im - (x_46_re / (y_46_re / y_46_im))) / y_46_re elif y_46_re <= -1.9e-163: 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)) elif y_46_re <= 1650.0: tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im else: tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -1.1e+138) tmp = Float64(Float64(x_46_im - Float64(x_46_re / Float64(y_46_re / y_46_im))) / y_46_re); elseif (y_46_re <= -1.9e-163) tmp = 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))); elseif (y_46_re <= 1650.0) tmp = Float64(Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im); else tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_re <= -1.1e+138) tmp = (x_46_im - (x_46_re / (y_46_re / y_46_im))) / y_46_re; elseif (y_46_re <= -1.9e-163) 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)); elseif (y_46_re <= 1650.0) tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im; else tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -1.1e+138], N[(N[(x$46$im - N[(x$46$re / N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -1.9e-163], 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], If[LessEqual[y$46$re, 1650.0], N[(N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1.1 \cdot 10^{+138}:\\
\;\;\;\;\frac{x.im - \frac{x.re}{\frac{y.re}{y.im}}}{y.re}\\
\mathbf{elif}\;y.re \leq -1.9 \cdot 10^{-163}:\\
\;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{elif}\;y.re \leq 1650:\\
\;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\end{array}
\end{array}
if y.re < -1.1e138Initial program 22.2%
Taylor expanded in y.re around inf 75.8%
mul-1-neg75.8%
unsub-neg75.8%
associate-/l*88.3%
Simplified88.3%
clear-num88.4%
clear-num88.4%
un-div-inv88.4%
clear-num88.4%
Applied egg-rr88.4%
if -1.1e138 < y.re < -1.9e-163Initial program 89.9%
if -1.9e-163 < y.re < 1650Initial program 72.7%
*-un-lft-identity72.7%
add-sqr-sqrt72.7%
times-frac72.7%
hypot-define72.7%
fma-neg72.7%
distribute-rgt-neg-in72.7%
hypot-define78.6%
Applied egg-rr78.6%
Taylor expanded in y.im around inf 88.2%
+-commutative88.2%
mul-1-neg88.2%
unsub-neg88.2%
associate-/l*89.1%
Simplified89.1%
if 1650 < y.re Initial program 48.0%
Taylor expanded in y.re around inf 73.9%
mul-1-neg73.9%
unsub-neg73.9%
associate-/l*83.1%
Simplified83.1%
Final simplification87.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -7.2e-104) (not (<= y.re 0.0027))) (/ (- x.im (* x.re (/ y.im y.re))) 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_re <= -7.2e-104) || !(y_46_re <= 0.0027)) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / 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_46re <= (-7.2d-104)) .or. (.not. (y_46re <= 0.0027d0))) then
tmp = (x_46im - (x_46re * (y_46im / y_46re))) / 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_re <= -7.2e-104) || !(y_46_re <= 0.0027)) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / 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_re <= -7.2e-104) or not (y_46_re <= 0.0027): tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / 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_re <= -7.2e-104) || !(y_46_re <= 0.0027)) tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); else tmp = Float64(x_46_re / Float64(-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_re <= -7.2e-104) || ~((y_46_re <= 0.0027))) tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / 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[Or[LessEqual[y$46$re, -7.2e-104], N[Not[LessEqual[y$46$re, 0.0027]], $MachinePrecision]], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], N[(x$46$re / (-y$46$im)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -7.2 \cdot 10^{-104} \lor \neg \left(y.re \leq 0.0027\right):\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{-y.im}\\
\end{array}
\end{array}
if y.re < -7.1999999999999996e-104 or 0.0027000000000000001 < y.re Initial program 58.4%
Taylor expanded in y.re around inf 73.8%
mul-1-neg73.8%
unsub-neg73.8%
associate-/l*79.7%
Simplified79.7%
if -7.1999999999999996e-104 < y.re < 0.0027000000000000001Initial program 73.3%
Taylor expanded in y.re around 0 68.5%
associate-*r/68.5%
neg-mul-168.5%
Simplified68.5%
Final simplification74.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -1.72e-20) (not (<= y.re 4600.0))) (/ (- x.im (* x.re (/ y.im y.re))) y.re) (/ (- (* x.im (/ y.re 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_re <= -1.72e-20) || !(y_46_re <= 4600.0)) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else {
tmp = ((x_46_im * (y_46_re / 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_46re <= (-1.72d-20)) .or. (.not. (y_46re <= 4600.0d0))) then
tmp = (x_46im - (x_46re * (y_46im / y_46re))) / y_46re
else
tmp = ((x_46im * (y_46re / 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_re <= -1.72e-20) || !(y_46_re <= 4600.0)) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else {
tmp = ((x_46_im * (y_46_re / 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_re <= -1.72e-20) or not (y_46_re <= 4600.0): tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re else: tmp = ((x_46_im * (y_46_re / 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_re <= -1.72e-20) || !(y_46_re <= 4600.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(x_46_im * Float64(y_46_re / y_46_im)) - 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_re <= -1.72e-20) || ~((y_46_re <= 4600.0))) tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re; else tmp = ((x_46_im * (y_46_re / 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[Or[LessEqual[y$46$re, -1.72e-20], N[Not[LessEqual[y$46$re, 4600.0]], $MachinePrecision]], 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[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1.72 \cdot 10^{-20} \lor \neg \left(y.re \leq 4600\right):\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\
\end{array}
\end{array}
if y.re < -1.7199999999999999e-20 or 4600 < y.re Initial program 54.7%
Taylor expanded in y.re around inf 76.6%
mul-1-neg76.6%
unsub-neg76.6%
associate-/l*83.2%
Simplified83.2%
if -1.7199999999999999e-20 < y.re < 4600Initial program 75.1%
*-un-lft-identity75.1%
add-sqr-sqrt75.1%
times-frac75.1%
hypot-define75.1%
fma-neg75.1%
distribute-rgt-neg-in75.1%
hypot-define81.5%
Applied egg-rr81.5%
Taylor expanded in y.im around inf 84.3%
+-commutative84.3%
mul-1-neg84.3%
unsub-neg84.3%
associate-/l*85.0%
Simplified85.0%
Final simplification84.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -2.05e-26) (not (<= y.re 1.7e+53))) (/ 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_re <= -2.05e-26) || !(y_46_re <= 1.7e+53)) {
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_46re <= (-2.05d-26)) .or. (.not. (y_46re <= 1.7d+53))) 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_re <= -2.05e-26) || !(y_46_re <= 1.7e+53)) {
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_re <= -2.05e-26) or not (y_46_re <= 1.7e+53): 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_re <= -2.05e-26) || !(y_46_re <= 1.7e+53)) tmp = Float64(x_46_im / y_46_re); else tmp = Float64(x_46_re / Float64(-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_re <= -2.05e-26) || ~((y_46_re <= 1.7e+53))) 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[Or[LessEqual[y$46$re, -2.05e-26], N[Not[LessEqual[y$46$re, 1.7e+53]], $MachinePrecision]], 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.re \leq -2.05 \cdot 10^{-26} \lor \neg \left(y.re \leq 1.7 \cdot 10^{+53}\right):\\
\;\;\;\;\frac{x.im}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{-y.im}\\
\end{array}
\end{array}
if y.re < -2.0499999999999999e-26 or 1.69999999999999999e53 < y.re Initial program 53.4%
Taylor expanded in y.re around inf 64.3%
if -2.0499999999999999e-26 < y.re < 1.69999999999999999e53Initial program 74.8%
Taylor expanded in y.re around 0 61.3%
associate-*r/61.3%
neg-mul-161.3%
Simplified61.3%
Final simplification62.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -5.4e+94) (not (<= y.im 1.6e+115))) (/ 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 <= -5.4e+94) || !(y_46_im <= 1.6e+115)) {
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 <= (-5.4d+94)) .or. (.not. (y_46im <= 1.6d+115))) 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 <= -5.4e+94) || !(y_46_im <= 1.6e+115)) {
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 <= -5.4e+94) or not (y_46_im <= 1.6e+115): 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 <= -5.4e+94) || !(y_46_im <= 1.6e+115)) 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 <= -5.4e+94) || ~((y_46_im <= 1.6e+115))) 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, -5.4e+94], N[Not[LessEqual[y$46$im, 1.6e+115]], $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 -5.4 \cdot 10^{+94} \lor \neg \left(y.im \leq 1.6 \cdot 10^{+115}\right):\\
\;\;\;\;\frac{x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.im < -5.4000000000000003e94 or 1.6e115 < y.im Initial program 42.8%
*-un-lft-identity42.8%
add-sqr-sqrt42.8%
times-frac42.8%
hypot-define42.8%
fma-neg42.8%
distribute-rgt-neg-in42.8%
hypot-define56.7%
Applied egg-rr56.7%
Taylor expanded in y.re around 0 56.8%
Taylor expanded in y.im around -inf 32.4%
if -5.4000000000000003e94 < y.im < 1.6e115Initial program 75.0%
Taylor expanded in y.re around inf 52.2%
Final simplification45.9%
(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 64.8%
*-un-lft-identity64.8%
add-sqr-sqrt64.8%
times-frac64.9%
hypot-define64.9%
fma-neg64.9%
distribute-rgt-neg-in64.9%
hypot-define74.0%
Applied egg-rr74.0%
Taylor expanded in y.re around 0 34.3%
Taylor expanded in y.re around inf 7.8%
Final simplification7.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ x.im y.re))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return x_46_im / y_46_re;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = x_46im / y_46re
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return x_46_im / y_46_re;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return x_46_im / y_46_re
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(x_46_im / y_46_re) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = x_46_im / y_46_re; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(x$46$im / y$46$re), $MachinePrecision]
\begin{array}{l}
\\
\frac{x.im}{y.re}
\end{array}
Initial program 64.8%
Taylor expanded in y.re around inf 39.7%
Final simplification39.7%
herbie shell --seed 2024076
(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))))