
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ (+ (* x.re y.re) (* x.im 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_re * y_46_re) + (x_46_im * 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_46re * y_46re) + (x_46im * 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_re * y_46_re) + (x_46_im * 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_re * y_46_re) + (x_46_im * 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_re * y_46_re) + Float64(x_46_im * 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_re * y_46_re) + (x_46_im * 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$re * y$46$re), $MachinePrecision] + N[(x$46$im * 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.re \cdot y.re + x.im \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.re y.re) (* x.im 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_re * y_46_re) + (x_46_im * 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_46re * y_46re) + (x_46im * 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_re * y_46_re) + (x_46_im * 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_re * y_46_re) + (x_46_im * 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_re * y_46_re) + Float64(x_46_im * 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_re * y_46_re) + (x_46_im * 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$re * y$46$re), $MachinePrecision] + N[(x$46$im * 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.re \cdot y.re + x.im \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 (fma y.im y.im (* y.re y.re)))
(t_1 (fma x.im (/ y.im t_0) (/ (fma x.re y.re 0.0) t_0))))
(if (<= y.im -1.4e+115)
(/ (fma (/ x.re y.im) y.re x.im) y.im)
(if (<= y.im -8e-146)
t_1
(if (<= y.im 2.4e-52)
(/ (fma y.im (/ x.im y.re) x.re) y.re)
(if (<= y.im 8.4e+124)
t_1
(/ (fma x.re (/ y.re y.im) x.im) y.im)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = fma(y_46_im, y_46_im, (y_46_re * y_46_re));
double t_1 = fma(x_46_im, (y_46_im / t_0), (fma(x_46_re, y_46_re, 0.0) / t_0));
double tmp;
if (y_46_im <= -1.4e+115) {
tmp = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
} else if (y_46_im <= -8e-146) {
tmp = t_1;
} else if (y_46_im <= 2.4e-52) {
tmp = fma(y_46_im, (x_46_im / y_46_re), x_46_re) / y_46_re;
} else if (y_46_im <= 8.4e+124) {
tmp = t_1;
} else {
tmp = fma(x_46_re, (y_46_re / y_46_im), x_46_im) / y_46_im;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re)) t_1 = fma(x_46_im, Float64(y_46_im / t_0), Float64(fma(x_46_re, y_46_re, 0.0) / t_0)) tmp = 0.0 if (y_46_im <= -1.4e+115) tmp = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im); elseif (y_46_im <= -8e-146) tmp = t_1; elseif (y_46_im <= 2.4e-52) tmp = Float64(fma(y_46_im, Float64(x_46_im / y_46_re), x_46_re) / y_46_re); elseif (y_46_im <= 8.4e+124) tmp = t_1; else tmp = Float64(fma(x_46_re, Float64(y_46_re / y_46_im), x_46_im) / y_46_im); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x$46$im * N[(y$46$im / t$95$0), $MachinePrecision] + N[(N[(x$46$re * y$46$re + 0.0), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -1.4e+115], N[(N[(N[(x$46$re / y$46$im), $MachinePrecision] * y$46$re + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, -8e-146], t$95$1, If[LessEqual[y$46$im, 2.4e-52], N[(N[(y$46$im * N[(x$46$im / y$46$re), $MachinePrecision] + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 8.4e+124], t$95$1, N[(N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)\\
t_1 := \mathsf{fma}\left(x.im, \frac{y.im}{t\_0}, \frac{\mathsf{fma}\left(x.re, y.re, 0\right)}{t\_0}\right)\\
\mathbf{if}\;y.im \leq -1.4 \cdot 10^{+115}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\mathbf{elif}\;y.im \leq -8 \cdot 10^{-146}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq 2.4 \cdot 10^{-52}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.im, \frac{x.im}{y.re}, x.re\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 8.4 \cdot 10^{+124}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.re, \frac{y.re}{y.im}, x.im\right)}{y.im}\\
\end{array}
\end{array}
if y.im < -1.4e115Initial program 42.3%
Taylor expanded in y.im around inf
/-lowering-/.f64N/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6483.8
Simplified83.8%
associate-*r/N/A
*-commutativeN/A
associate-*r/N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6486.5
Applied egg-rr86.5%
if -1.4e115 < y.im < -8.00000000000000021e-146 or 2.4000000000000002e-52 < y.im < 8.40000000000000046e124Initial program 74.8%
Taylor expanded in x.re around 0
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
unpow2N/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6483.9
Simplified83.9%
if -8.00000000000000021e-146 < y.im < 2.4000000000000002e-52Initial program 69.1%
Taylor expanded in y.re around inf
/-lowering-/.f64N/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6492.6
Simplified92.6%
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6492.8
Applied egg-rr92.8%
if 8.40000000000000046e124 < y.im Initial program 29.0%
Taylor expanded in y.im around inf
/-lowering-/.f64N/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6491.4
Simplified91.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (fma (/ x.re y.im) y.re x.im) y.im)))
(if (<= y.im -6.5e+42)
t_0
(if (<= y.im -1.2e-139)
(/ (fma x.re y.re (* y.im x.im)) (fma y.re y.re (* y.im y.im)))
(if (<= y.im 1.1e-15) (/ (fma y.im (/ x.im y.re) x.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 = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
double tmp;
if (y_46_im <= -6.5e+42) {
tmp = t_0;
} else if (y_46_im <= -1.2e-139) {
tmp = fma(x_46_re, y_46_re, (y_46_im * x_46_im)) / fma(y_46_re, y_46_re, (y_46_im * y_46_im));
} else if (y_46_im <= 1.1e-15) {
tmp = fma(y_46_im, (x_46_im / y_46_re), x_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(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im) tmp = 0.0 if (y_46_im <= -6.5e+42) tmp = t_0; elseif (y_46_im <= -1.2e-139) tmp = Float64(fma(x_46_re, y_46_re, Float64(y_46_im * x_46_im)) / fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im))); elseif (y_46_im <= 1.1e-15) tmp = Float64(fma(y_46_im, Float64(x_46_im / y_46_re), x_46_re) / y_46_re); else tmp = t_0; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(x$46$re / y$46$im), $MachinePrecision] * y$46$re + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -6.5e+42], t$95$0, If[LessEqual[y$46$im, -1.2e-139], N[(N[(x$46$re * y$46$re + N[(y$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] / N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.1e-15], N[(N[(y$46$im * N[(x$46$im / y$46$re), $MachinePrecision] + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\mathbf{if}\;y.im \leq -6.5 \cdot 10^{+42}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq -1.2 \cdot 10^{-139}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.re, y.re, y.im \cdot x.im\right)}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\
\mathbf{elif}\;y.im \leq 1.1 \cdot 10^{-15}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.im, \frac{x.im}{y.re}, x.re\right)}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -6.50000000000000052e42 or 1.09999999999999993e-15 < y.im Initial program 48.4%
Taylor expanded in y.im around inf
/-lowering-/.f64N/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6481.2
Simplified81.2%
associate-*r/N/A
*-commutativeN/A
associate-*r/N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6482.7
Applied egg-rr82.7%
if -6.50000000000000052e42 < y.im < -1.20000000000000007e-139Initial program 78.4%
/-lowering-/.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6478.4
Applied egg-rr78.4%
if -1.20000000000000007e-139 < y.im < 1.09999999999999993e-15Initial program 70.0%
Taylor expanded in y.re around inf
/-lowering-/.f64N/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6490.2
Simplified90.2%
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6490.4
Applied egg-rr90.4%
Final simplification84.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -2.5e+15)
(/ x.im y.im)
(if (<= y.im 1.1e-15)
(/ (fma x.im (/ y.im y.re) x.re) y.re)
(if (<= y.im 6.5e+110)
(/ (fma x.im y.im (* x.re y.re)) (* y.im y.im))
(/ x.im 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+15) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 1.1e-15) {
tmp = fma(x_46_im, (y_46_im / y_46_re), x_46_re) / y_46_re;
} else if (y_46_im <= 6.5e+110) {
tmp = fma(x_46_im, y_46_im, (x_46_re * y_46_re)) / (y_46_im * y_46_im);
} else {
tmp = x_46_im / 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+15) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= 1.1e-15) tmp = Float64(fma(x_46_im, Float64(y_46_im / y_46_re), x_46_re) / y_46_re); elseif (y_46_im <= 6.5e+110) tmp = Float64(fma(x_46_im, y_46_im, Float64(x_46_re * y_46_re)) / Float64(y_46_im * y_46_im)); else tmp = Float64(x_46_im / y_46_im); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -2.5e+15], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 1.1e-15], N[(N[(x$46$im * N[(y$46$im / y$46$re), $MachinePrecision] + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 6.5e+110], N[(N[(x$46$im * y$46$im + N[(x$46$re * y$46$re), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision], N[(x$46$im / y$46$im), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -2.5 \cdot 10^{+15}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq 1.1 \cdot 10^{-15}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 6.5 \cdot 10^{+110}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, y.im, x.re \cdot y.re\right)}{y.im \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -2.5e15 or 6.4999999999999997e110 < y.im Initial program 43.2%
Taylor expanded in y.re around 0
/-lowering-/.f6474.9
Simplified74.9%
if -2.5e15 < y.im < 1.09999999999999993e-15Initial program 71.6%
Taylor expanded in y.re around inf
/-lowering-/.f64N/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6482.9
Simplified82.9%
if 1.09999999999999993e-15 < y.im < 6.4999999999999997e110Initial program 80.0%
Taylor expanded in y.im around inf
/-lowering-/.f64N/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6475.7
Simplified75.7%
Taylor expanded in y.im around 0
/-lowering-/.f64N/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6471.6
Simplified71.6%
Final simplification78.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -2.5e+15)
(/ x.im y.im)
(if (<= y.im 3.5e-30)
(/ x.re y.re)
(if (<= y.im 7.5e+112)
(/ (fma x.im y.im (* x.re y.re)) (* y.im y.im))
(/ x.im 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+15) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 3.5e-30) {
tmp = x_46_re / y_46_re;
} else if (y_46_im <= 7.5e+112) {
tmp = fma(x_46_im, y_46_im, (x_46_re * y_46_re)) / (y_46_im * y_46_im);
} else {
tmp = x_46_im / 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+15) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= 3.5e-30) tmp = Float64(x_46_re / y_46_re); elseif (y_46_im <= 7.5e+112) tmp = Float64(fma(x_46_im, y_46_im, Float64(x_46_re * y_46_re)) / Float64(y_46_im * y_46_im)); else tmp = Float64(x_46_im / y_46_im); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -2.5e+15], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 3.5e-30], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 7.5e+112], N[(N[(x$46$im * y$46$im + N[(x$46$re * y$46$re), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision], N[(x$46$im / y$46$im), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -2.5 \cdot 10^{+15}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq 3.5 \cdot 10^{-30}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.im \leq 7.5 \cdot 10^{+112}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, y.im, x.re \cdot y.re\right)}{y.im \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -2.5e15 or 7.5e112 < y.im Initial program 43.2%
Taylor expanded in y.re around 0
/-lowering-/.f6474.9
Simplified74.9%
if -2.5e15 < y.im < 3.5000000000000003e-30Initial program 70.9%
Taylor expanded in y.re around inf
/-lowering-/.f6469.7
Simplified69.7%
if 3.5000000000000003e-30 < y.im < 7.5e112Initial program 82.2%
Taylor expanded in y.im around inf
/-lowering-/.f64N/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6471.3
Simplified71.3%
Taylor expanded in y.im around 0
/-lowering-/.f64N/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6467.6
Simplified67.6%
Final simplification71.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (fma (/ x.re y.im) y.re x.im) y.im)))
(if (<= y.im -75000000000.0)
t_0
(if (<= y.im 1.4e-14) (/ (fma y.im (/ x.im y.re) x.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 = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
double tmp;
if (y_46_im <= -75000000000.0) {
tmp = t_0;
} else if (y_46_im <= 1.4e-14) {
tmp = fma(y_46_im, (x_46_im / y_46_re), x_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(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im) tmp = 0.0 if (y_46_im <= -75000000000.0) tmp = t_0; elseif (y_46_im <= 1.4e-14) tmp = Float64(fma(y_46_im, Float64(x_46_im / y_46_re), x_46_re) / y_46_re); else tmp = t_0; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(x$46$re / y$46$im), $MachinePrecision] * y$46$re + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -75000000000.0], t$95$0, If[LessEqual[y$46$im, 1.4e-14], N[(N[(y$46$im * N[(x$46$im / y$46$re), $MachinePrecision] + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\mathbf{if}\;y.im \leq -75000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 1.4 \cdot 10^{-14}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.im, \frac{x.im}{y.re}, x.re\right)}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -7.5e10 or 1.4e-14 < y.im Initial program 50.0%
Taylor expanded in y.im around inf
/-lowering-/.f64N/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6481.1
Simplified81.1%
associate-*r/N/A
*-commutativeN/A
associate-*r/N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6482.5
Applied egg-rr82.5%
if -7.5e10 < y.im < 1.4e-14Initial program 71.6%
Taylor expanded in y.re around inf
/-lowering-/.f64N/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6482.9
Simplified82.9%
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6483.1
Applied egg-rr83.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -1.6e+72)
(/ (fma y.im (/ x.im y.re) x.re) y.re)
(if (<= y.re 5.7e-11)
(/ (fma x.re (/ y.re y.im) x.im) y.im)
(/ (fma x.im (/ y.im y.re) x.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.6e+72) {
tmp = fma(y_46_im, (x_46_im / y_46_re), x_46_re) / y_46_re;
} else if (y_46_re <= 5.7e-11) {
tmp = fma(x_46_re, (y_46_re / y_46_im), x_46_im) / y_46_im;
} else {
tmp = fma(x_46_im, (y_46_im / y_46_re), x_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.6e+72) tmp = Float64(fma(y_46_im, Float64(x_46_im / y_46_re), x_46_re) / y_46_re); elseif (y_46_re <= 5.7e-11) tmp = Float64(fma(x_46_re, Float64(y_46_re / y_46_im), x_46_im) / y_46_im); else tmp = Float64(fma(x_46_im, Float64(y_46_im / y_46_re), x_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, -1.6e+72], N[(N[(y$46$im * N[(x$46$im / y$46$re), $MachinePrecision] + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 5.7e-11], N[(N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision], N[(N[(x$46$im * N[(y$46$im / y$46$re), $MachinePrecision] + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1.6 \cdot 10^{+72}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.im, \frac{x.im}{y.re}, x.re\right)}{y.re}\\
\mathbf{elif}\;y.re \leq 5.7 \cdot 10^{-11}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.re, \frac{y.re}{y.im}, x.im\right)}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\
\end{array}
\end{array}
if y.re < -1.6000000000000001e72Initial program 54.4%
Taylor expanded in y.re around inf
/-lowering-/.f64N/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6487.5
Simplified87.5%
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6487.8
Applied egg-rr87.8%
if -1.6000000000000001e72 < y.re < 5.6999999999999997e-11Initial program 68.8%
Taylor expanded in y.im around inf
/-lowering-/.f64N/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6482.1
Simplified82.1%
if 5.6999999999999997e-11 < y.re Initial program 45.6%
Taylor expanded in y.re around inf
/-lowering-/.f64N/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6478.4
Simplified78.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (fma x.im (/ y.im y.re) x.re) y.re)))
(if (<= y.re -1.6e+72)
t_0
(if (<= y.re 5.7e-11) (/ (fma x.re (/ y.re y.im) x.im) y.im) t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = fma(x_46_im, (y_46_im / y_46_re), x_46_re) / y_46_re;
double tmp;
if (y_46_re <= -1.6e+72) {
tmp = t_0;
} else if (y_46_re <= 5.7e-11) {
tmp = fma(x_46_re, (y_46_re / y_46_im), x_46_im) / y_46_im;
} else {
tmp = t_0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(fma(x_46_im, Float64(y_46_im / y_46_re), x_46_re) / y_46_re) tmp = 0.0 if (y_46_re <= -1.6e+72) tmp = t_0; elseif (y_46_re <= 5.7e-11) tmp = Float64(fma(x_46_re, Float64(y_46_re / y_46_im), x_46_im) / y_46_im); else tmp = t_0; 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$im / y$46$re), $MachinePrecision] + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -1.6e+72], t$95$0, If[LessEqual[y$46$re, 5.7e-11], N[(N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\
\mathbf{if}\;y.re \leq -1.6 \cdot 10^{+72}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 5.7 \cdot 10^{-11}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.re, \frac{y.re}{y.im}, x.im\right)}{y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.re < -1.6000000000000001e72 or 5.6999999999999997e-11 < y.re Initial program 49.3%
Taylor expanded in y.re around inf
/-lowering-/.f64N/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6482.2
Simplified82.2%
if -1.6000000000000001e72 < y.re < 5.6999999999999997e-11Initial program 68.8%
Taylor expanded in y.im around inf
/-lowering-/.f64N/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6482.1
Simplified82.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.im -2.5e+15) (/ x.im y.im) (if (<= y.im 9.2e-33) (/ x.re y.re) (/ x.im 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+15) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 9.2e-33) {
tmp = x_46_re / y_46_re;
} else {
tmp = x_46_im / 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 <= (-2.5d+15)) then
tmp = x_46im / y_46im
else if (y_46im <= 9.2d-33) then
tmp = x_46re / y_46re
else
tmp = x_46im / 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 <= -2.5e+15) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 9.2e-33) {
tmp = x_46_re / y_46_re;
} else {
tmp = x_46_im / 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+15: tmp = x_46_im / y_46_im elif y_46_im <= 9.2e-33: tmp = x_46_re / y_46_re else: tmp = x_46_im / 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+15) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= 9.2e-33) tmp = Float64(x_46_re / y_46_re); else tmp = Float64(x_46_im / 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+15) tmp = x_46_im / y_46_im; elseif (y_46_im <= 9.2e-33) tmp = x_46_re / y_46_re; else tmp = x_46_im / 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+15], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 9.2e-33], N[(x$46$re / y$46$re), $MachinePrecision], N[(x$46$im / y$46$im), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -2.5 \cdot 10^{+15}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq 9.2 \cdot 10^{-33}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -2.5e15 or 9.19999999999999942e-33 < y.im Initial program 51.1%
Taylor expanded in y.re around 0
/-lowering-/.f6469.6
Simplified69.6%
if -2.5e15 < y.im < 9.19999999999999942e-33Initial program 70.9%
Taylor expanded in y.re around inf
/-lowering-/.f6469.7
Simplified69.7%
(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 60.6%
Taylor expanded in y.re around 0
/-lowering-/.f6445.1
Simplified45.1%
herbie shell --seed 2024194
(FPCore (x.re x.im y.re y.im)
:name "_divideComplex, real part"
:precision binary64
(/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))