
(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 8 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 (/ 1.0 (/ y.im x.re)) y.re x.im) y.im)))
(if (<= y.im -0.0001107)
t_0
(if (<= y.im 9.5e-64)
(/ (fma (/ x.im y.re) y.im x.re) y.re)
(if (<= y.im 1.85e+75)
(/ (+ (* x.im y.im) (* y.re x.re)) (+ (* y.im 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 = fma((1.0 / (y_46_im / x_46_re)), y_46_re, x_46_im) / y_46_im;
double tmp;
if (y_46_im <= -0.0001107) {
tmp = t_0;
} else if (y_46_im <= 9.5e-64) {
tmp = fma((x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re;
} else if (y_46_im <= 1.85e+75) {
tmp = ((x_46_im * y_46_im) + (y_46_re * x_46_re)) / ((y_46_im * 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(fma(Float64(1.0 / Float64(y_46_im / x_46_re)), y_46_re, x_46_im) / y_46_im) tmp = 0.0 if (y_46_im <= -0.0001107) tmp = t_0; elseif (y_46_im <= 9.5e-64) tmp = Float64(fma(Float64(x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re); elseif (y_46_im <= 1.85e+75) tmp = Float64(Float64(Float64(x_46_im * y_46_im) + Float64(y_46_re * x_46_re)) / Float64(Float64(y_46_im * y_46_im) + Float64(y_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[(1.0 / N[(y$46$im / x$46$re), $MachinePrecision]), $MachinePrecision] * y$46$re + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -0.0001107], t$95$0, If[LessEqual[y$46$im, 9.5e-64], N[(N[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 1.85e+75], N[(N[(N[(x$46$im * y$46$im), $MachinePrecision] + N[(y$46$re * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$im * y$46$im), $MachinePrecision] + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(\frac{1}{\frac{y.im}{x.re}}, y.re, x.im\right)}{y.im}\\
\mathbf{if}\;y.im \leq -0.0001107:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 9.5 \cdot 10^{-64}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.re}, y.im, x.re\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 1.85 \cdot 10^{+75}:\\
\;\;\;\;\frac{x.im \cdot y.im + y.re \cdot x.re}{y.im \cdot y.im + y.re \cdot y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -1.10699999999999994e-4 or 1.85000000000000005e75 < y.im Initial program 55.2%
Taylor expanded in y.im around inf
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6486.5
Applied rewrites86.5%
Applied rewrites86.5%
if -1.10699999999999994e-4 < y.im < 9.50000000000000043e-64Initial program 70.1%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6490.9
Applied rewrites90.9%
if 9.50000000000000043e-64 < y.im < 1.85000000000000005e75Initial program 91.3%
Final simplification88.9%
(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 -0.0001107)
t_0
(if (<= y.im 9.5e-64)
(/ (fma (/ x.im y.re) y.im x.re) y.re)
(if (<= y.im 1.85e+75)
(/ (+ (* x.im y.im) (* y.re x.re)) (+ (* y.im 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 = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
double tmp;
if (y_46_im <= -0.0001107) {
tmp = t_0;
} else if (y_46_im <= 9.5e-64) {
tmp = fma((x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re;
} else if (y_46_im <= 1.85e+75) {
tmp = ((x_46_im * y_46_im) + (y_46_re * x_46_re)) / ((y_46_im * 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(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im) tmp = 0.0 if (y_46_im <= -0.0001107) tmp = t_0; elseif (y_46_im <= 9.5e-64) tmp = Float64(fma(Float64(x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re); elseif (y_46_im <= 1.85e+75) tmp = Float64(Float64(Float64(x_46_im * y_46_im) + Float64(y_46_re * x_46_re)) / Float64(Float64(y_46_im * y_46_im) + Float64(y_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, -0.0001107], t$95$0, If[LessEqual[y$46$im, 9.5e-64], N[(N[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 1.85e+75], N[(N[(N[(x$46$im * y$46$im), $MachinePrecision] + N[(y$46$re * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$im * y$46$im), $MachinePrecision] + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $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 -0.0001107:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 9.5 \cdot 10^{-64}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.re}, y.im, x.re\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 1.85 \cdot 10^{+75}:\\
\;\;\;\;\frac{x.im \cdot y.im + y.re \cdot x.re}{y.im \cdot y.im + y.re \cdot y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -1.10699999999999994e-4 or 1.85000000000000005e75 < y.im Initial program 55.2%
Taylor expanded in y.im around inf
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6486.5
Applied rewrites86.5%
if -1.10699999999999994e-4 < y.im < 9.50000000000000043e-64Initial program 70.1%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6490.9
Applied rewrites90.9%
if 9.50000000000000043e-64 < y.im < 1.85000000000000005e75Initial program 91.3%
Final simplification88.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (fma y.im x.im (* y.re x.re))))
(if (<= y.im -0.0001107)
(/ x.im y.im)
(if (<= y.im 2.65e-246)
(/ x.re y.re)
(if (<= y.im 4.3e-45)
(/ t_0 (* y.re y.re))
(if (<= y.im 4.4e+155) (/ t_0 (* 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 t_0 = fma(y_46_im, x_46_im, (y_46_re * x_46_re));
double tmp;
if (y_46_im <= -0.0001107) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 2.65e-246) {
tmp = x_46_re / y_46_re;
} else if (y_46_im <= 4.3e-45) {
tmp = t_0 / (y_46_re * y_46_re);
} else if (y_46_im <= 4.4e+155) {
tmp = t_0 / (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) t_0 = fma(y_46_im, x_46_im, Float64(y_46_re * x_46_re)) tmp = 0.0 if (y_46_im <= -0.0001107) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= 2.65e-246) tmp = Float64(x_46_re / y_46_re); elseif (y_46_im <= 4.3e-45) tmp = Float64(t_0 / Float64(y_46_re * y_46_re)); elseif (y_46_im <= 4.4e+155) tmp = Float64(t_0 / 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_] := Block[{t$95$0 = N[(y$46$im * x$46$im + N[(y$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -0.0001107], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 2.65e-246], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 4.3e-45], N[(t$95$0 / N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 4.4e+155], N[(t$95$0 / N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision], N[(x$46$im / y$46$im), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)\\
\mathbf{if}\;y.im \leq -0.0001107:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq 2.65 \cdot 10^{-246}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.im \leq 4.3 \cdot 10^{-45}:\\
\;\;\;\;\frac{t\_0}{y.re \cdot y.re}\\
\mathbf{elif}\;y.im \leq 4.4 \cdot 10^{+155}:\\
\;\;\;\;\frac{t\_0}{y.im \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -1.10699999999999994e-4 or 4.4000000000000005e155 < y.im Initial program 53.5%
Taylor expanded in y.im around inf
lower-/.f6478.6
Applied rewrites78.6%
if -1.10699999999999994e-4 < y.im < 2.64999999999999988e-246Initial program 64.8%
Taylor expanded in y.im around 0
lower-/.f6472.8
Applied rewrites72.8%
if 2.64999999999999988e-246 < y.im < 4.2999999999999999e-45Initial program 80.8%
Taylor expanded in y.im around inf
*-commutativeN/A
lower-*.f6452.3
Applied rewrites52.3%
Taylor expanded in y.im around inf
unpow2N/A
lower-*.f6424.4
Applied rewrites24.4%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6426.7
Applied rewrites26.7%
Taylor expanded in y.im around 0
unpow2N/A
lower-*.f6473.9
Applied rewrites73.9%
if 4.2999999999999999e-45 < y.im < 4.4000000000000005e155Initial program 79.7%
Taylor expanded in y.re around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f6461.0
Applied rewrites61.0%
Taylor expanded in y.im around 0
Applied rewrites65.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -0.0001107)
(/ x.im y.im)
(if (<= y.im 1.2e-42)
(/ (fma (/ x.im y.re) y.im x.re) y.re)
(if (<= y.im 4.4e+155)
(/ (fma y.im x.im (* y.re x.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 <= -0.0001107) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 1.2e-42) {
tmp = fma((x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re;
} else if (y_46_im <= 4.4e+155) {
tmp = fma(y_46_im, x_46_im, (y_46_re * x_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 <= -0.0001107) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= 1.2e-42) tmp = Float64(fma(Float64(x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re); elseif (y_46_im <= 4.4e+155) tmp = Float64(fma(y_46_im, x_46_im, Float64(y_46_re * x_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, -0.0001107], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 1.2e-42], N[(N[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 4.4e+155], N[(N[(y$46$im * x$46$im + N[(y$46$re * x$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 -0.0001107:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq 1.2 \cdot 10^{-42}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.re}, y.im, x.re\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 4.4 \cdot 10^{+155}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)}{y.im \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -1.10699999999999994e-4 or 4.4000000000000005e155 < y.im Initial program 53.5%
Taylor expanded in y.im around inf
lower-/.f6478.6
Applied rewrites78.6%
if -1.10699999999999994e-4 < y.im < 1.20000000000000001e-42Initial program 71.1%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6490.0
Applied rewrites90.0%
if 1.20000000000000001e-42 < y.im < 4.4000000000000005e155Initial program 79.7%
Taylor expanded in y.re around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f6461.0
Applied rewrites61.0%
Taylor expanded in y.im around 0
Applied rewrites65.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -0.0001107)
(/ x.im y.im)
(if (<= y.im 1.95e-56)
(/ x.re y.re)
(if (<= y.im 4.4e+155)
(/ (fma y.im x.im (* y.re x.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 <= -0.0001107) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 1.95e-56) {
tmp = x_46_re / y_46_re;
} else if (y_46_im <= 4.4e+155) {
tmp = fma(y_46_im, x_46_im, (y_46_re * x_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 <= -0.0001107) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= 1.95e-56) tmp = Float64(x_46_re / y_46_re); elseif (y_46_im <= 4.4e+155) tmp = Float64(fma(y_46_im, x_46_im, Float64(y_46_re * x_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, -0.0001107], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 1.95e-56], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 4.4e+155], N[(N[(y$46$im * x$46$im + N[(y$46$re * x$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 -0.0001107:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq 1.95 \cdot 10^{-56}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.im \leq 4.4 \cdot 10^{+155}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)}{y.im \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -1.10699999999999994e-4 or 4.4000000000000005e155 < y.im Initial program 53.5%
Taylor expanded in y.im around inf
lower-/.f6478.6
Applied rewrites78.6%
if -1.10699999999999994e-4 < y.im < 1.95e-56Initial program 70.9%
Taylor expanded in y.im around 0
lower-/.f6470.0
Applied rewrites70.0%
if 1.95e-56 < y.im < 4.4000000000000005e155Initial program 80.3%
Taylor expanded in y.re around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f6459.6
Applied rewrites59.6%
Taylor expanded in y.im around 0
Applied rewrites64.3%
(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 -0.0001107)
t_0
(if (<= y.im 1.2e-42) (/ (fma (/ x.im y.re) y.im 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 <= -0.0001107) {
tmp = t_0;
} else if (y_46_im <= 1.2e-42) {
tmp = fma((x_46_im / y_46_re), y_46_im, 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 <= -0.0001107) tmp = t_0; elseif (y_46_im <= 1.2e-42) tmp = Float64(fma(Float64(x_46_im / y_46_re), y_46_im, 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, -0.0001107], t$95$0, If[LessEqual[y$46$im, 1.2e-42], N[(N[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im + 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 -0.0001107:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 1.2 \cdot 10^{-42}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.re}, y.im, x.re\right)}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -1.10699999999999994e-4 or 1.20000000000000001e-42 < y.im Initial program 59.9%
Taylor expanded in y.im around inf
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6483.5
Applied rewrites83.5%
if -1.10699999999999994e-4 < y.im < 1.20000000000000001e-42Initial program 71.1%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6490.0
Applied rewrites90.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.im -0.0001107) (/ x.im y.im) (if (<= y.im 2.05e-55) (/ 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 <= -0.0001107) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 2.05e-55) {
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 <= (-0.0001107d0)) then
tmp = x_46im / y_46im
else if (y_46im <= 2.05d-55) 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 <= -0.0001107) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 2.05e-55) {
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 <= -0.0001107: tmp = x_46_im / y_46_im elif y_46_im <= 2.05e-55: 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 <= -0.0001107) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= 2.05e-55) 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 <= -0.0001107) tmp = x_46_im / y_46_im; elseif (y_46_im <= 2.05e-55) 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, -0.0001107], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 2.05e-55], 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 -0.0001107:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq 2.05 \cdot 10^{-55}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -1.10699999999999994e-4 or 2.0499999999999999e-55 < y.im Initial program 60.2%
Taylor expanded in y.im around inf
lower-/.f6468.9
Applied rewrites68.9%
if -1.10699999999999994e-4 < y.im < 2.0499999999999999e-55Initial program 70.9%
Taylor expanded in y.im around 0
lower-/.f6470.0
Applied rewrites70.0%
(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 65.0%
Taylor expanded in y.im around inf
lower-/.f6444.5
Applied rewrites44.5%
herbie shell --seed 2024235
(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))))