
(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 x.im (* y.re x.re)) (fma y.im y.im (* y.re y.re)))))
(if (<= y.im -2.8e+74)
(/ (fma (/ x.re y.im) y.re x.im) y.im)
(if (<= y.im -5e-136)
t_0
(if (<= y.im 4.4e-156)
(/ (fma (/ y.im y.re) x.im x.re) y.re)
(if (<= y.im 1.1e+96) t_0 (/ (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, x_46_im, (y_46_re * x_46_re)) / fma(y_46_im, y_46_im, (y_46_re * y_46_re));
double tmp;
if (y_46_im <= -2.8e+74) {
tmp = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
} else if (y_46_im <= -5e-136) {
tmp = t_0;
} else if (y_46_im <= 4.4e-156) {
tmp = fma((y_46_im / y_46_re), x_46_im, x_46_re) / y_46_re;
} else if (y_46_im <= 1.1e+96) {
tmp = t_0;
} 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 = Float64(fma(y_46_im, x_46_im, Float64(y_46_re * x_46_re)) / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) tmp = 0.0 if (y_46_im <= -2.8e+74) tmp = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im); elseif (y_46_im <= -5e-136) tmp = t_0; elseif (y_46_im <= 4.4e-156) tmp = Float64(fma(Float64(y_46_im / y_46_re), x_46_im, x_46_re) / y_46_re); elseif (y_46_im <= 1.1e+96) tmp = t_0; 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[(N[(y$46$im * x$46$im + N[(y$46$re * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -2.8e+74], 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, -5e-136], t$95$0, If[LessEqual[y$46$im, 4.4e-156], N[(N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 1.1e+96], t$95$0, 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 := \frac{\mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\
\mathbf{if}\;y.im \leq -2.8 \cdot 10^{+74}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\mathbf{elif}\;y.im \leq -5 \cdot 10^{-136}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 4.4 \cdot 10^{-156}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y.im}{y.re}, x.im, x.re\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 1.1 \cdot 10^{+96}:\\
\;\;\;\;t\_0\\
\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 < -2.80000000000000002e74Initial program 40.5%
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-/.f6478.9
Applied rewrites78.9%
if -2.80000000000000002e74 < y.im < -5.0000000000000002e-136 or 4.3999999999999998e-156 < y.im < 1.0999999999999999e96Initial program 83.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6483.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6483.7
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6483.7
Applied rewrites83.7%
if -5.0000000000000002e-136 < y.im < 4.3999999999999998e-156Initial program 71.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6471.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.0
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6471.0
Applied rewrites71.0%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6490.6
Applied rewrites90.6%
if 1.0999999999999999e96 < y.im Initial program 31.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6431.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6431.6
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6431.6
Applied rewrites31.6%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
lower-/.f6431.6
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6431.6
Applied rewrites31.6%
Taylor expanded in y.im around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6486.5
Applied rewrites86.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (fma x.re y.re (* x.im y.im))) (t_1 (/ t_0 (* y.im y.im))))
(if (<= y.im -3.4e+147)
(/ x.im y.im)
(if (<= y.im -5e-86)
t_1
(if (<= y.im -4.5e-163)
(* (/ y.re (fma y.im y.im (* y.re y.re))) x.re)
(if (<= y.im 2.8e-114)
(/ t_0 (* y.re y.re))
(if (<= y.im 2.15e+95) t_1 (/ 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(x_46_re, y_46_re, (x_46_im * y_46_im));
double t_1 = t_0 / (y_46_im * y_46_im);
double tmp;
if (y_46_im <= -3.4e+147) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= -5e-86) {
tmp = t_1;
} else if (y_46_im <= -4.5e-163) {
tmp = (y_46_re / fma(y_46_im, y_46_im, (y_46_re * y_46_re))) * x_46_re;
} else if (y_46_im <= 2.8e-114) {
tmp = t_0 / (y_46_re * y_46_re);
} else if (y_46_im <= 2.15e+95) {
tmp = t_1;
} 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(x_46_re, y_46_re, Float64(x_46_im * y_46_im)) t_1 = Float64(t_0 / Float64(y_46_im * y_46_im)) tmp = 0.0 if (y_46_im <= -3.4e+147) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= -5e-86) tmp = t_1; elseif (y_46_im <= -4.5e-163) tmp = Float64(Float64(y_46_re / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) * x_46_re); elseif (y_46_im <= 2.8e-114) tmp = Float64(t_0 / Float64(y_46_re * y_46_re)); elseif (y_46_im <= 2.15e+95) tmp = t_1; 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[(x$46$re * y$46$re + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -3.4e+147], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, -5e-86], t$95$1, If[LessEqual[y$46$im, -4.5e-163], N[(N[(y$46$re / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision], If[LessEqual[y$46$im, 2.8e-114], N[(t$95$0 / N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 2.15e+95], t$95$1, N[(x$46$im / y$46$im), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(x.re, y.re, x.im \cdot y.im\right)\\
t_1 := \frac{t\_0}{y.im \cdot y.im}\\
\mathbf{if}\;y.im \leq -3.4 \cdot 10^{+147}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq -5 \cdot 10^{-86}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq -4.5 \cdot 10^{-163}:\\
\;\;\;\;\frac{y.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot x.re\\
\mathbf{elif}\;y.im \leq 2.8 \cdot 10^{-114}:\\
\;\;\;\;\frac{t\_0}{y.re \cdot y.re}\\
\mathbf{elif}\;y.im \leq 2.15 \cdot 10^{+95}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -3.4e147 or 2.15e95 < y.im Initial program 27.0%
Taylor expanded in y.re around 0
lower-/.f6466.3
Applied rewrites66.3%
if -3.4e147 < y.im < -4.9999999999999999e-86 or 2.8000000000000001e-114 < y.im < 2.15e95Initial program 80.5%
Taylor expanded in y.re around 0
unpow2N/A
lower-*.f6463.4
Applied rewrites63.4%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6463.4
Applied rewrites63.4%
if -4.9999999999999999e-86 < y.im < -4.4999999999999997e-163Initial program 72.3%
Taylor expanded in x.re around inf
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6465.8
Applied rewrites65.8%
Applied rewrites78.8%
if -4.4999999999999997e-163 < y.im < 2.8000000000000001e-114Initial program 74.7%
Taylor expanded in y.re around 0
unpow2N/A
lower-*.f6421.5
Applied rewrites21.5%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6421.5
Applied rewrites21.5%
Taylor expanded in y.re around inf
unpow2N/A
lower-*.f6472.2
Applied rewrites72.2%
Final simplification67.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (fma x.re y.re (* x.im y.im)) (* y.im y.im))))
(if (<= y.im -3.4e+147)
(/ x.im y.im)
(if (<= y.im -5e-86)
t_0
(if (<= y.im -8.2e-152)
(* (/ y.re (fma y.im y.im (* y.re y.re))) x.re)
(if (<= y.im 2.75e-114)
(/ x.re y.re)
(if (<= y.im 2.15e+95) t_0 (/ 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(x_46_re, y_46_re, (x_46_im * y_46_im)) / (y_46_im * y_46_im);
double tmp;
if (y_46_im <= -3.4e+147) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= -5e-86) {
tmp = t_0;
} else if (y_46_im <= -8.2e-152) {
tmp = (y_46_re / fma(y_46_im, y_46_im, (y_46_re * y_46_re))) * x_46_re;
} else if (y_46_im <= 2.75e-114) {
tmp = x_46_re / y_46_re;
} else if (y_46_im <= 2.15e+95) {
tmp = t_0;
} 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 = Float64(fma(x_46_re, y_46_re, Float64(x_46_im * y_46_im)) / Float64(y_46_im * y_46_im)) tmp = 0.0 if (y_46_im <= -3.4e+147) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= -5e-86) tmp = t_0; elseif (y_46_im <= -8.2e-152) tmp = Float64(Float64(y_46_re / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) * x_46_re); elseif (y_46_im <= 2.75e-114) tmp = Float64(x_46_re / y_46_re); elseif (y_46_im <= 2.15e+95) tmp = t_0; 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[(N[(x$46$re * y$46$re + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -3.4e+147], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, -5e-86], t$95$0, If[LessEqual[y$46$im, -8.2e-152], N[(N[(y$46$re / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision], If[LessEqual[y$46$im, 2.75e-114], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 2.15e+95], t$95$0, N[(x$46$im / y$46$im), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(x.re, y.re, x.im \cdot y.im\right)}{y.im \cdot y.im}\\
\mathbf{if}\;y.im \leq -3.4 \cdot 10^{+147}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq -5 \cdot 10^{-86}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq -8.2 \cdot 10^{-152}:\\
\;\;\;\;\frac{y.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot x.re\\
\mathbf{elif}\;y.im \leq 2.75 \cdot 10^{-114}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.im \leq 2.15 \cdot 10^{+95}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -3.4e147 or 2.15e95 < y.im Initial program 27.0%
Taylor expanded in y.re around 0
lower-/.f6466.3
Applied rewrites66.3%
if -3.4e147 < y.im < -4.9999999999999999e-86 or 2.75000000000000005e-114 < y.im < 2.15e95Initial program 80.5%
Taylor expanded in y.re around 0
unpow2N/A
lower-*.f6463.4
Applied rewrites63.4%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6463.4
Applied rewrites63.4%
if -4.9999999999999999e-86 < y.im < -8.2000000000000002e-152Initial program 72.3%
Taylor expanded in x.re around inf
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6465.8
Applied rewrites65.8%
Applied rewrites78.8%
if -8.2000000000000002e-152 < y.im < 2.75000000000000005e-114Initial program 74.7%
Taylor expanded in y.re around inf
lower-/.f6470.4
Applied rewrites70.4%
Final simplification67.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -3.2e-24)
(/ (fma (/ y.im y.re) x.im x.re) y.re)
(if (<= y.re 98000.0)
(/ (fma x.re (/ y.re y.im) x.im) y.im)
(/ (fma (/ x.im y.re) y.im 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 <= -3.2e-24) {
tmp = fma((y_46_im / y_46_re), x_46_im, x_46_re) / y_46_re;
} else if (y_46_re <= 98000.0) {
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_re), y_46_im, 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 <= -3.2e-24) tmp = Float64(fma(Float64(y_46_im / y_46_re), x_46_im, x_46_re) / y_46_re); elseif (y_46_re <= 98000.0) tmp = Float64(fma(x_46_re, Float64(y_46_re / y_46_im), x_46_im) / y_46_im); else tmp = Float64(fma(Float64(x_46_im / y_46_re), y_46_im, 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, -3.2e-24], N[(N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 98000.0], N[(N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision], N[(N[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -3.2 \cdot 10^{-24}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y.im}{y.re}, x.im, x.re\right)}{y.re}\\
\mathbf{elif}\;y.re \leq 98000:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.re, \frac{y.re}{y.im}, x.im\right)}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.re}, y.im, x.re\right)}{y.re}\\
\end{array}
\end{array}
if y.re < -3.20000000000000012e-24Initial program 51.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6451.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.2
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6451.2
Applied rewrites51.2%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6474.4
Applied rewrites74.4%
if -3.20000000000000012e-24 < y.re < 98000Initial program 73.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6473.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6473.7
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6473.7
Applied rewrites73.7%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
lower-/.f6473.5
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6473.5
Applied rewrites73.5%
Taylor expanded in y.im around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6484.2
Applied rewrites84.2%
if 98000 < y.re Initial program 47.2%
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-/.f6472.6
Applied rewrites72.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (fma (/ x.im y.re) y.im x.re) y.re)))
(if (<= y.re -3.2e-24)
t_0
(if (<= y.re 98000.0) (/ (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_re), y_46_im, x_46_re) / y_46_re;
double tmp;
if (y_46_re <= -3.2e-24) {
tmp = t_0;
} else if (y_46_re <= 98000.0) {
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(Float64(x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re) tmp = 0.0 if (y_46_re <= -3.2e-24) tmp = t_0; elseif (y_46_re <= 98000.0) 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[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -3.2e-24], t$95$0, If[LessEqual[y$46$re, 98000.0], 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(\frac{x.im}{y.re}, y.im, x.re\right)}{y.re}\\
\mathbf{if}\;y.re \leq -3.2 \cdot 10^{-24}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 98000:\\
\;\;\;\;\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 < -3.20000000000000012e-24 or 98000 < y.re Initial program 49.3%
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-/.f6473.5
Applied rewrites73.5%
if -3.20000000000000012e-24 < y.re < 98000Initial program 73.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6473.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6473.7
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6473.7
Applied rewrites73.7%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
lower-/.f6473.5
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6473.5
Applied rewrites73.5%
Taylor expanded in y.im around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6484.2
Applied rewrites84.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (fma x.re (/ y.re y.im) x.im) y.im)))
(if (<= y.im -1.55e-166)
t_0
(if (<= y.im 2.75e-114)
(/ (fma x.re y.re (* x.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_re / y_46_im), x_46_im) / y_46_im;
double tmp;
if (y_46_im <= -1.55e-166) {
tmp = t_0;
} else if (y_46_im <= 2.75e-114) {
tmp = fma(x_46_re, y_46_re, (x_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(x_46_re, Float64(y_46_re / y_46_im), x_46_im) / y_46_im) tmp = 0.0 if (y_46_im <= -1.55e-166) tmp = t_0; elseif (y_46_im <= 2.75e-114) tmp = Float64(fma(x_46_re, y_46_re, Float64(x_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[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -1.55e-166], t$95$0, If[LessEqual[y$46$im, 2.75e-114], N[(N[(x$46$re * y$46$re + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(x.re, \frac{y.re}{y.im}, x.im\right)}{y.im}\\
\mathbf{if}\;y.im \leq -1.55 \cdot 10^{-166}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 2.75 \cdot 10^{-114}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.re, y.re, x.im \cdot y.im\right)}{y.re \cdot y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -1.54999999999999992e-166 or 2.75000000000000005e-114 < y.im Initial program 56.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6456.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6456.8
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6456.8
Applied rewrites56.8%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
lower-/.f6456.7
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6456.7
Applied rewrites56.7%
Taylor expanded in y.im around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6473.0
Applied rewrites73.0%
if -1.54999999999999992e-166 < y.im < 2.75000000000000005e-114Initial program 74.7%
Taylor expanded in y.re around 0
unpow2N/A
lower-*.f6421.5
Applied rewrites21.5%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6421.5
Applied rewrites21.5%
Taylor expanded in y.re around inf
unpow2N/A
lower-*.f6472.2
Applied rewrites72.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -4.2e-26)
(/ 1.0 (/ y.im x.im))
(if (<= y.im -8.2e-152)
(* (/ y.re (fma y.im y.im (* y.re y.re))) x.re)
(if (<= y.im 2.55e+19) (/ 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 <= -4.2e-26) {
tmp = 1.0 / (y_46_im / x_46_im);
} else if (y_46_im <= -8.2e-152) {
tmp = (y_46_re / fma(y_46_im, y_46_im, (y_46_re * y_46_re))) * x_46_re;
} else if (y_46_im <= 2.55e+19) {
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 <= -4.2e-26) tmp = Float64(1.0 / Float64(y_46_im / x_46_im)); elseif (y_46_im <= -8.2e-152) tmp = Float64(Float64(y_46_re / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) * x_46_re); elseif (y_46_im <= 2.55e+19) tmp = Float64(x_46_re / y_46_re); 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, -4.2e-26], N[(1.0 / N[(y$46$im / x$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, -8.2e-152], N[(N[(y$46$re / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision], If[LessEqual[y$46$im, 2.55e+19], 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 -4.2 \cdot 10^{-26}:\\
\;\;\;\;\frac{1}{\frac{y.im}{x.im}}\\
\mathbf{elif}\;y.im \leq -8.2 \cdot 10^{-152}:\\
\;\;\;\;\frac{y.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot x.re\\
\mathbf{elif}\;y.im \leq 2.55 \cdot 10^{+19}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -4.20000000000000016e-26Initial program 53.7%
Taylor expanded in y.re around 0
lower-/.f6459.9
Applied rewrites59.9%
Applied rewrites60.5%
if -4.20000000000000016e-26 < y.im < -8.2000000000000002e-152Initial program 79.5%
Taylor expanded in x.re around inf
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6459.6
Applied rewrites59.6%
Applied rewrites74.2%
if -8.2000000000000002e-152 < y.im < 2.55e19Initial program 75.7%
Taylor expanded in y.re around inf
lower-/.f6462.6
Applied rewrites62.6%
if 2.55e19 < y.im Initial program 43.0%
Taylor expanded in y.re around 0
lower-/.f6461.0
Applied rewrites61.0%
Final simplification62.5%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.re -9e-33) (/ x.re y.re) (if (<= y.re 1.7e-41) (/ x.im y.im) (/ 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 <= -9e-33) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= 1.7e-41) {
tmp = x_46_im / y_46_im;
} else {
tmp = x_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 <= (-9d-33)) then
tmp = x_46re / y_46re
else if (y_46re <= 1.7d-41) then
tmp = x_46im / y_46im
else
tmp = x_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 <= -9e-33) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= 1.7e-41) {
tmp = x_46_im / y_46_im;
} else {
tmp = x_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 <= -9e-33: tmp = x_46_re / y_46_re elif y_46_re <= 1.7e-41: tmp = x_46_im / y_46_im else: tmp = 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 <= -9e-33) tmp = Float64(x_46_re / y_46_re); elseif (y_46_re <= 1.7e-41) tmp = Float64(x_46_im / y_46_im); else tmp = Float64(x_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 <= -9e-33) tmp = x_46_re / y_46_re; elseif (y_46_re <= 1.7e-41) tmp = x_46_im / y_46_im; else tmp = x_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, -9e-33], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 1.7e-41], N[(x$46$im / y$46$im), $MachinePrecision], N[(x$46$re / y$46$re), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -9 \cdot 10^{-33}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.re \leq 1.7 \cdot 10^{-41}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\end{array}
\end{array}
if y.re < -8.99999999999999982e-33 or 1.6999999999999999e-41 < y.re Initial program 52.7%
Taylor expanded in y.re around inf
lower-/.f6457.4
Applied rewrites57.4%
if -8.99999999999999982e-33 < y.re < 1.6999999999999999e-41Initial program 72.8%
Taylor expanded in y.re around 0
lower-/.f6461.7
Applied rewrites61.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 62.1%
Taylor expanded in y.re around 0
lower-/.f6440.3
Applied rewrites40.3%
herbie shell --seed 2024332
(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))))