
(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 10 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.re y.im) (/ x.re y.im) (/ x.im y.im))))
(if (<= y.im -3.2e+35)
t_0
(if (<= y.im 3.8e-112)
(/ (fma (/ y.im y.re) x.im x.re) y.re)
(if (<= y.im 2.1e+79)
(/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.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((y_46_re / y_46_im), (x_46_re / y_46_im), (x_46_im / y_46_im));
double tmp;
if (y_46_im <= -3.2e+35) {
tmp = t_0;
} else if (y_46_im <= 3.8e-112) {
tmp = fma((y_46_im / y_46_re), x_46_im, x_46_re) / y_46_re;
} else if (y_46_im <= 2.1e+79) {
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));
} else {
tmp = t_0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = fma(Float64(y_46_re / y_46_im), Float64(x_46_re / y_46_im), Float64(x_46_im / y_46_im)) tmp = 0.0 if (y_46_im <= -3.2e+35) tmp = t_0; elseif (y_46_im <= 3.8e-112) tmp = Float64(fma(Float64(y_46_im / y_46_re), x_46_im, x_46_re) / y_46_re); elseif (y_46_im <= 2.1e+79) tmp = 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))); 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[(y$46$re / y$46$im), $MachinePrecision] * N[(x$46$re / y$46$im), $MachinePrecision] + N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -3.2e+35], t$95$0, If[LessEqual[y$46$im, 3.8e-112], 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, 2.1e+79], 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], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{y.re}{y.im}, \frac{x.re}{y.im}, \frac{x.im}{y.im}\right)\\
\mathbf{if}\;y.im \leq -3.2 \cdot 10^{+35}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 3.8 \cdot 10^{-112}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y.im}{y.re}, x.im, x.re\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 2.1 \cdot 10^{+79}:\\
\;\;\;\;\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -3.19999999999999983e35 or 2.10000000000000008e79 < y.im Initial program 42.3%
Taylor expanded in y.re around 0
unpow2N/A
associate-/r*N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6485.8
Applied rewrites85.8%
Applied rewrites85.8%
if -3.19999999999999983e35 < y.im < 3.79999999999999995e-112Initial program 62.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-/.f6486.7
Applied rewrites86.7%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f6488.6
Applied rewrites88.6%
if 3.79999999999999995e-112 < y.im < 2.10000000000000008e79Initial program 82.8%
(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 -3.2e+35)
t_0
(if (<= y.im 3.8e-112)
(/ (fma (/ y.im y.re) x.im x.re) y.re)
(if (<= y.im 2.1e+79)
(/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.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_re / y_46_im), y_46_re, x_46_im) / y_46_im;
double tmp;
if (y_46_im <= -3.2e+35) {
tmp = t_0;
} else if (y_46_im <= 3.8e-112) {
tmp = fma((y_46_im / y_46_re), x_46_im, x_46_re) / y_46_re;
} else if (y_46_im <= 2.1e+79) {
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));
} 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 <= -3.2e+35) tmp = t_0; elseif (y_46_im <= 3.8e-112) tmp = Float64(fma(Float64(y_46_im / y_46_re), x_46_im, x_46_re) / y_46_re); elseif (y_46_im <= 2.1e+79) tmp = 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))); 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, -3.2e+35], t$95$0, If[LessEqual[y$46$im, 3.8e-112], 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, 2.1e+79], 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], 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 -3.2 \cdot 10^{+35}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 3.8 \cdot 10^{-112}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y.im}{y.re}, x.im, x.re\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 2.1 \cdot 10^{+79}:\\
\;\;\;\;\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -3.19999999999999983e35 or 2.10000000000000008e79 < y.im Initial program 42.3%
Taylor expanded in y.re around 0
unpow2N/A
associate-/r*N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6485.8
Applied rewrites85.8%
if -3.19999999999999983e35 < y.im < 3.79999999999999995e-112Initial program 62.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-/.f6486.7
Applied rewrites86.7%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f6488.6
Applied rewrites88.6%
if 3.79999999999999995e-112 < y.im < 2.10000000000000008e79Initial program 82.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (fma y.im y.im (* y.re y.re))))
(if (<= y.im -3.2e+35)
(/ x.im y.im)
(if (<= y.im 2.9e-81)
(/ x.re y.re)
(if (<= y.im 6e+54)
(* (/ x.im t_0) y.im)
(if (<= y.im 2.3e+133) (* (/ x.re t_0) 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 t_0 = fma(y_46_im, y_46_im, (y_46_re * y_46_re));
double tmp;
if (y_46_im <= -3.2e+35) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 2.9e-81) {
tmp = x_46_re / y_46_re;
} else if (y_46_im <= 6e+54) {
tmp = (x_46_im / t_0) * y_46_im;
} else if (y_46_im <= 2.3e+133) {
tmp = (x_46_re / t_0) * 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) t_0 = fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re)) tmp = 0.0 if (y_46_im <= -3.2e+35) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= 2.9e-81) tmp = Float64(x_46_re / y_46_re); elseif (y_46_im <= 6e+54) tmp = Float64(Float64(x_46_im / t_0) * y_46_im); elseif (y_46_im <= 2.3e+133) tmp = Float64(Float64(x_46_re / t_0) * 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_] := Block[{t$95$0 = N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -3.2e+35], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 2.9e-81], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 6e+54], N[(N[(x$46$im / t$95$0), $MachinePrecision] * y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 2.3e+133], N[(N[(x$46$re / t$95$0), $MachinePrecision] * y$46$re), $MachinePrecision], N[(x$46$im / 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)\\
\mathbf{if}\;y.im \leq -3.2 \cdot 10^{+35}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq 2.9 \cdot 10^{-81}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.im \leq 6 \cdot 10^{+54}:\\
\;\;\;\;\frac{x.im}{t\_0} \cdot y.im\\
\mathbf{elif}\;y.im \leq 2.3 \cdot 10^{+133}:\\
\;\;\;\;\frac{x.re}{t\_0} \cdot y.re\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -3.19999999999999983e35 or 2.2999999999999999e133 < y.im Initial program 40.6%
Taylor expanded in y.re around 0
lower-/.f6476.6
Applied rewrites76.6%
if -3.19999999999999983e35 < y.im < 2.89999999999999989e-81Initial program 64.3%
Taylor expanded in y.re around inf
lower-/.f6470.9
Applied rewrites70.9%
if 2.89999999999999989e-81 < y.im < 5.9999999999999998e54Initial program 82.0%
Taylor expanded in x.re around 0
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6463.1
Applied rewrites63.1%
if 5.9999999999999998e54 < y.im < 2.2999999999999999e133Initial program 67.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%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -3.2e+35)
(/ x.im y.im)
(if (<= y.im 2.9e-81)
(/ x.re y.re)
(if (<= y.im 3.6e+61)
(* (/ x.im (fma y.im y.im (* y.re y.re))) y.im)
(if (<= y.im 2.3e+133)
(* x.re (/ y.re (fma y.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 <= -3.2e+35) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 2.9e-81) {
tmp = x_46_re / y_46_re;
} else if (y_46_im <= 3.6e+61) {
tmp = (x_46_im / fma(y_46_im, y_46_im, (y_46_re * y_46_re))) * y_46_im;
} else if (y_46_im <= 2.3e+133) {
tmp = x_46_re * (y_46_re / fma(y_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 <= -3.2e+35) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= 2.9e-81) tmp = Float64(x_46_re / y_46_re); elseif (y_46_im <= 3.6e+61) tmp = Float64(Float64(x_46_im / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) * y_46_im); elseif (y_46_im <= 2.3e+133) tmp = Float64(x_46_re * Float64(y_46_re / fma(y_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, -3.2e+35], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 2.9e-81], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 3.6e+61], N[(N[(x$46$im / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 2.3e+133], N[(x$46$re * N[(y$46$re / N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$im / y$46$im), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -3.2 \cdot 10^{+35}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq 2.9 \cdot 10^{-81}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.im \leq 3.6 \cdot 10^{+61}:\\
\;\;\;\;\frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot y.im\\
\mathbf{elif}\;y.im \leq 2.3 \cdot 10^{+133}:\\
\;\;\;\;x.re \cdot \frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -3.19999999999999983e35 or 2.2999999999999999e133 < y.im Initial program 40.6%
Taylor expanded in y.re around 0
lower-/.f6476.6
Applied rewrites76.6%
if -3.19999999999999983e35 < y.im < 2.89999999999999989e-81Initial program 64.3%
Taylor expanded in y.re around inf
lower-/.f6470.9
Applied rewrites70.9%
if 2.89999999999999989e-81 < y.im < 3.6000000000000001e61Initial program 79.5%
Taylor expanded in x.re around 0
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6461.2
Applied rewrites61.2%
if 3.6000000000000001e61 < y.im < 2.2999999999999999e133Initial program 73.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-*.f6464.6
Applied rewrites64.6%
Applied rewrites64.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -3.2e+35)
(/ x.im y.im)
(if (<= y.im 210000.0)
(/ (fma (/ x.im y.re) y.im x.re) y.re)
(if (<= y.im 3.55e+148)
(/ (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 <= -3.2e+35) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 210000.0) {
tmp = fma((x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re;
} else if (y_46_im <= 3.55e+148) {
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 <= -3.2e+35) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= 210000.0) tmp = Float64(fma(Float64(x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re); elseif (y_46_im <= 3.55e+148) 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, -3.2e+35], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 210000.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$im, 3.55e+148], 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 -3.2 \cdot 10^{+35}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq 210000:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.re}, y.im, x.re\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 3.55 \cdot 10^{+148}:\\
\;\;\;\;\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 < -3.19999999999999983e35 or 3.5500000000000003e148 < y.im Initial program 41.0%
Taylor expanded in y.re around 0
lower-/.f6477.5
Applied rewrites77.5%
if -3.19999999999999983e35 < y.im < 2.1e5Initial program 66.5%
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-/.f6482.5
Applied rewrites82.5%
if 2.1e5 < y.im < 3.5500000000000003e148Initial program 72.8%
Taylor expanded in y.re around inf
unpow2N/A
lower-*.f6419.0
Applied rewrites19.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6419.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6419.0
Applied rewrites19.0%
Taylor expanded in y.re around 0
unpow2N/A
lower-*.f6457.9
Applied rewrites57.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -3.2e+35)
(/ x.im y.im)
(if (<= y.im 1.16e-70)
(/ x.re y.re)
(if (<= y.im 3.55e+148)
(/ (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 <= -3.2e+35) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 1.16e-70) {
tmp = x_46_re / y_46_re;
} else if (y_46_im <= 3.55e+148) {
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 <= -3.2e+35) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= 1.16e-70) tmp = Float64(x_46_re / y_46_re); elseif (y_46_im <= 3.55e+148) 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, -3.2e+35], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 1.16e-70], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 3.55e+148], 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 -3.2 \cdot 10^{+35}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq 1.16 \cdot 10^{-70}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.im \leq 3.55 \cdot 10^{+148}:\\
\;\;\;\;\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 < -3.19999999999999983e35 or 3.5500000000000003e148 < y.im Initial program 41.0%
Taylor expanded in y.re around 0
lower-/.f6477.5
Applied rewrites77.5%
if -3.19999999999999983e35 < y.im < 1.1599999999999999e-70Initial program 64.6%
Taylor expanded in y.re around inf
lower-/.f6471.1
Applied rewrites71.1%
if 1.1599999999999999e-70 < y.im < 3.5500000000000003e148Initial program 75.6%
Taylor expanded in y.re around inf
unpow2N/A
lower-*.f6428.9
Applied rewrites28.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6428.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6428.9
Applied rewrites28.9%
Taylor expanded in y.re around 0
unpow2N/A
lower-*.f6450.7
Applied rewrites50.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -3.2e+35) (not (<= y.im 210000.0))) (/ (fma (/ x.re y.im) y.re x.im) y.im) (/ (fma (/ y.im y.re) x.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_im <= -3.2e+35) || !(y_46_im <= 210000.0)) {
tmp = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
} else {
tmp = fma((y_46_im / y_46_re), x_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_im <= -3.2e+35) || !(y_46_im <= 210000.0)) tmp = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im); else tmp = Float64(fma(Float64(y_46_im / y_46_re), x_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[Or[LessEqual[y$46$im, -3.2e+35], N[Not[LessEqual[y$46$im, 210000.0]], $MachinePrecision]], N[(N[(N[(x$46$re / y$46$im), $MachinePrecision] * y$46$re + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision], N[(N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -3.2 \cdot 10^{+35} \lor \neg \left(y.im \leq 210000\right):\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y.im}{y.re}, x.im, x.re\right)}{y.re}\\
\end{array}
\end{array}
if y.im < -3.19999999999999983e35 or 2.1e5 < y.im Initial program 48.0%
Taylor expanded in y.re around 0
unpow2N/A
associate-/r*N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6483.0
Applied rewrites83.0%
if -3.19999999999999983e35 < y.im < 2.1e5Initial program 66.5%
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-/.f6482.5
Applied rewrites82.5%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f6484.0
Applied rewrites84.0%
Final simplification83.6%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -3.2e+35) (not (<= y.im 210000.0))) (/ (fma (/ x.re y.im) y.re 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_im <= -3.2e+35) || !(y_46_im <= 210000.0)) {
tmp = fma((x_46_re / y_46_im), y_46_re, 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_im <= -3.2e+35) || !(y_46_im <= 210000.0)) tmp = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, 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[Or[LessEqual[y$46$im, -3.2e+35], N[Not[LessEqual[y$46$im, 210000.0]], $MachinePrecision]], N[(N[(N[(x$46$re / y$46$im), $MachinePrecision] * y$46$re + 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.im \leq -3.2 \cdot 10^{+35} \lor \neg \left(y.im \leq 210000\right):\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, 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.im < -3.19999999999999983e35 or 2.1e5 < y.im Initial program 48.0%
Taylor expanded in y.re around 0
unpow2N/A
associate-/r*N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6483.0
Applied rewrites83.0%
if -3.19999999999999983e35 < y.im < 2.1e5Initial program 66.5%
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-/.f6482.5
Applied rewrites82.5%
Final simplification82.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -3.2e+35) (not (<= y.im 3.9e-69))) (/ 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_im <= -3.2e+35) || !(y_46_im <= 3.9e-69)) {
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_46im <= (-3.2d+35)) .or. (.not. (y_46im <= 3.9d-69))) 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_im <= -3.2e+35) || !(y_46_im <= 3.9e-69)) {
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_im <= -3.2e+35) or not (y_46_im <= 3.9e-69): 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_im <= -3.2e+35) || !(y_46_im <= 3.9e-69)) 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_im <= -3.2e+35) || ~((y_46_im <= 3.9e-69))) 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[Or[LessEqual[y$46$im, -3.2e+35], N[Not[LessEqual[y$46$im, 3.9e-69]], $MachinePrecision]], 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.im \leq -3.2 \cdot 10^{+35} \lor \neg \left(y.im \leq 3.9 \cdot 10^{-69}\right):\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\end{array}
\end{array}
if y.im < -3.19999999999999983e35 or 3.89999999999999981e-69 < y.im Initial program 52.3%
Taylor expanded in y.re around 0
lower-/.f6464.2
Applied rewrites64.2%
if -3.19999999999999983e35 < y.im < 3.89999999999999981e-69Initial program 64.6%
Taylor expanded in y.re around inf
lower-/.f6471.1
Applied rewrites71.1%
Final simplification67.5%
(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 58.3%
Taylor expanded in y.re around 0
lower-/.f6438.7
Applied rewrites38.7%
herbie shell --seed 2024329
(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))))