
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = ((x_46im * y_46re) - (x_46re * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(Float64(Float64(x_46_im * y_46_re) - Float64(x_46_re * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = ((x_46im * y_46re) - (x_46re * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(Float64(Float64(x_46_im * y_46_re) - Float64(x_46_re * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\end{array}
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(/ (- (* y.re x.im) (* x.re y.im)) (+ (* y.im y.im) (* y.re y.re))))
(t_1 (fma (/ x.im y.im) y.re (- x.re))))
(if (<= y.im -5e+124)
(/ 1.0 (/ y.im t_1))
(if (<= y.im -2.6e-107)
t_0
(if (<= y.im 3.4e-137)
(/ (- x.im (/ (* x.re y.im) y.re)) y.re)
(if (<= y.im 4.5e+45) t_0 (/ t_1 y.im)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = ((y_46_re * x_46_im) - (x_46_re * y_46_im)) / ((y_46_im * y_46_im) + (y_46_re * y_46_re));
double t_1 = fma((x_46_im / y_46_im), y_46_re, -x_46_re);
double tmp;
if (y_46_im <= -5e+124) {
tmp = 1.0 / (y_46_im / t_1);
} else if (y_46_im <= -2.6e-107) {
tmp = t_0;
} else if (y_46_im <= 3.4e-137) {
tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re;
} else if (y_46_im <= 4.5e+45) {
tmp = t_0;
} else {
tmp = t_1 / y_46_im;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(x_46_re * y_46_im)) / Float64(Float64(y_46_im * y_46_im) + Float64(y_46_re * y_46_re))) t_1 = fma(Float64(x_46_im / y_46_im), y_46_re, Float64(-x_46_re)) tmp = 0.0 if (y_46_im <= -5e+124) tmp = Float64(1.0 / Float64(y_46_im / t_1)); elseif (y_46_im <= -2.6e-107) tmp = t_0; elseif (y_46_im <= 3.4e-137) tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re * y_46_im) / y_46_re)) / y_46_re); elseif (y_46_im <= 4.5e+45) tmp = t_0; else tmp = Float64(t_1 / 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[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$im * y$46$im), $MachinePrecision] + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x$46$im / y$46$im), $MachinePrecision] * y$46$re + (-x$46$re)), $MachinePrecision]}, If[LessEqual[y$46$im, -5e+124], N[(1.0 / N[(y$46$im / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, -2.6e-107], t$95$0, If[LessEqual[y$46$im, 3.4e-137], N[(N[(x$46$im - N[(N[(x$46$re * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 4.5e+45], t$95$0, N[(t$95$1 / y$46$im), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y.re \cdot x.im - x.re \cdot y.im}{y.im \cdot y.im + y.re \cdot y.re}\\
t_1 := \mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)\\
\mathbf{if}\;y.im \leq -5 \cdot 10^{+124}:\\
\;\;\;\;\frac{1}{\frac{y.im}{t\_1}}\\
\mathbf{elif}\;y.im \leq -2.6 \cdot 10^{-107}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 3.4 \cdot 10^{-137}:\\
\;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 4.5 \cdot 10^{+45}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{y.im}\\
\end{array}
\end{array}
if y.im < -4.9999999999999996e124Initial program 21.1%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
Applied rewrites28.4%
Taylor expanded in y.re around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
unpow2N/A
associate-/r*N/A
div-subN/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6485.7
Applied rewrites85.7%
Applied rewrites86.8%
if -4.9999999999999996e124 < y.im < -2.6000000000000001e-107 or 3.40000000000000014e-137 < y.im < 4.4999999999999998e45Initial program 86.6%
if -2.6000000000000001e-107 < y.im < 3.40000000000000014e-137Initial program 73.6%
Taylor expanded in y.re around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
lower-*.f6490.3
Applied rewrites90.3%
if 4.4999999999999998e45 < y.im Initial program 43.9%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
Applied rewrites51.1%
Taylor expanded in y.re around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
unpow2N/A
associate-/r*N/A
div-subN/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6483.7
Applied rewrites83.7%
Final simplification87.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(/ (- (* y.re x.im) (* x.re y.im)) (+ (* y.im y.im) (* y.re y.re))))
(t_1 (/ (fma (/ x.im y.im) y.re (- x.re)) y.im)))
(if (<= y.im -6.4e+122)
t_1
(if (<= y.im -2.6e-107)
t_0
(if (<= y.im 3.4e-137)
(/ (- x.im (/ (* x.re y.im) y.re)) y.re)
(if (<= y.im 4.5e+45) t_0 t_1))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = ((y_46_re * x_46_im) - (x_46_re * y_46_im)) / ((y_46_im * y_46_im) + (y_46_re * y_46_re));
double t_1 = fma((x_46_im / y_46_im), y_46_re, -x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -6.4e+122) {
tmp = t_1;
} else if (y_46_im <= -2.6e-107) {
tmp = t_0;
} else if (y_46_im <= 3.4e-137) {
tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re;
} else if (y_46_im <= 4.5e+45) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(x_46_re * y_46_im)) / Float64(Float64(y_46_im * y_46_im) + Float64(y_46_re * y_46_re))) t_1 = Float64(fma(Float64(x_46_im / y_46_im), y_46_re, Float64(-x_46_re)) / y_46_im) tmp = 0.0 if (y_46_im <= -6.4e+122) tmp = t_1; elseif (y_46_im <= -2.6e-107) tmp = t_0; elseif (y_46_im <= 3.4e-137) tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re * y_46_im) / y_46_re)) / y_46_re); elseif (y_46_im <= 4.5e+45) tmp = t_0; else tmp = t_1; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$im * y$46$im), $MachinePrecision] + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(x$46$im / y$46$im), $MachinePrecision] * y$46$re + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -6.4e+122], t$95$1, If[LessEqual[y$46$im, -2.6e-107], t$95$0, If[LessEqual[y$46$im, 3.4e-137], N[(N[(x$46$im - N[(N[(x$46$re * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 4.5e+45], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y.re \cdot x.im - x.re \cdot y.im}{y.im \cdot y.im + y.re \cdot y.re}\\
t_1 := \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im}\\
\mathbf{if}\;y.im \leq -6.4 \cdot 10^{+122}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq -2.6 \cdot 10^{-107}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 3.4 \cdot 10^{-137}:\\
\;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 4.5 \cdot 10^{+45}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.im < -6.40000000000000024e122 or 4.4999999999999998e45 < y.im Initial program 34.0%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
Applied rewrites41.3%
Taylor expanded in y.re around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
unpow2N/A
associate-/r*N/A
div-subN/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6484.6
Applied rewrites84.6%
if -6.40000000000000024e122 < y.im < -2.6000000000000001e-107 or 3.40000000000000014e-137 < y.im < 4.4999999999999998e45Initial program 86.6%
if -2.6000000000000001e-107 < y.im < 3.40000000000000014e-137Initial program 73.6%
Taylor expanded in y.re around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
lower-*.f6490.3
Applied rewrites90.3%
Final simplification87.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (- x.re) y.im))
(t_1 (/ (- (* y.re x.im) (* x.re y.im)) (* y.im y.im))))
(if (<= y.im -1.1e+72)
t_0
(if (<= y.im -0.009)
t_1
(if (<= y.im -8.6e-106)
(* (/ y.im (fma y.im y.im (* y.re y.re))) (- x.re))
(if (<= y.im 1.8e-41)
(/ x.im y.re)
(if (<= y.im 1.85e+159) t_1 t_0)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = -x_46_re / y_46_im;
double t_1 = ((y_46_re * x_46_im) - (x_46_re * y_46_im)) / (y_46_im * y_46_im);
double tmp;
if (y_46_im <= -1.1e+72) {
tmp = t_0;
} else if (y_46_im <= -0.009) {
tmp = t_1;
} else if (y_46_im <= -8.6e-106) {
tmp = (y_46_im / fma(y_46_im, y_46_im, (y_46_re * y_46_re))) * -x_46_re;
} else if (y_46_im <= 1.8e-41) {
tmp = x_46_im / y_46_re;
} else if (y_46_im <= 1.85e+159) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(Float64(-x_46_re) / y_46_im) t_1 = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(x_46_re * y_46_im)) / Float64(y_46_im * y_46_im)) tmp = 0.0 if (y_46_im <= -1.1e+72) tmp = t_0; elseif (y_46_im <= -0.009) tmp = t_1; elseif (y_46_im <= -8.6e-106) tmp = Float64(Float64(y_46_im / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) * Float64(-x_46_re)); elseif (y_46_im <= 1.8e-41) tmp = Float64(x_46_im / y_46_re); elseif (y_46_im <= 1.85e+159) tmp = t_1; 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[((-x$46$re) / y$46$im), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -1.1e+72], t$95$0, If[LessEqual[y$46$im, -0.009], t$95$1, If[LessEqual[y$46$im, -8.6e-106], N[(N[(y$46$im / 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, 1.8e-41], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 1.85e+159], t$95$1, t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x.re}{y.im}\\
t_1 := \frac{y.re \cdot x.im - x.re \cdot y.im}{y.im \cdot y.im}\\
\mathbf{if}\;y.im \leq -1.1 \cdot 10^{+72}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq -0.009:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq -8.6 \cdot 10^{-106}:\\
\;\;\;\;\frac{y.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot \left(-x.re\right)\\
\mathbf{elif}\;y.im \leq 1.8 \cdot 10^{-41}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\mathbf{elif}\;y.im \leq 1.85 \cdot 10^{+159}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -1.1e72 or 1.85e159 < y.im Initial program 27.4%
Taylor expanded in y.re around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6474.9
Applied rewrites74.9%
if -1.1e72 < y.im < -0.00899999999999999932 or 1.8e-41 < y.im < 1.85e159Initial program 78.3%
Taylor expanded in y.re around 0
unpow2N/A
lower-*.f6466.5
Applied rewrites66.5%
if -0.00899999999999999932 < y.im < -8.6000000000000004e-106Initial program 90.3%
Taylor expanded in x.re around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6472.4
Applied rewrites72.4%
if -8.6000000000000004e-106 < y.im < 1.8e-41Initial program 76.7%
Taylor expanded in y.re around inf
lower-/.f6471.8
Applied rewrites71.8%
Final simplification71.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -3e+133)
(/ x.im y.re)
(if (<= y.re 1.3e-62)
(/ (fma (/ x.im y.im) y.re (- x.re)) y.im)
(if (<= y.re 4.5e+62)
(/ (- (* y.re x.im) (* x.re y.im)) (* y.re y.re))
(/ x.im y.re)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -3e+133) {
tmp = x_46_im / y_46_re;
} else if (y_46_re <= 1.3e-62) {
tmp = fma((x_46_im / y_46_im), y_46_re, -x_46_re) / y_46_im;
} else if (y_46_re <= 4.5e+62) {
tmp = ((y_46_re * x_46_im) - (x_46_re * y_46_im)) / (y_46_re * y_46_re);
} else {
tmp = x_46_im / y_46_re;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -3e+133) tmp = Float64(x_46_im / y_46_re); elseif (y_46_re <= 1.3e-62) tmp = Float64(fma(Float64(x_46_im / y_46_im), y_46_re, Float64(-x_46_re)) / y_46_im); elseif (y_46_re <= 4.5e+62) tmp = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(x_46_re * y_46_im)) / Float64(y_46_re * y_46_re)); else tmp = Float64(x_46_im / 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, -3e+133], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 1.3e-62], N[(N[(N[(x$46$im / y$46$im), $MachinePrecision] * y$46$re + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 4.5e+62], N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision], N[(x$46$im / y$46$re), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -3 \cdot 10^{+133}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\mathbf{elif}\;y.re \leq 1.3 \cdot 10^{-62}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im}\\
\mathbf{elif}\;y.re \leq 4.5 \cdot 10^{+62}:\\
\;\;\;\;\frac{y.re \cdot x.im - x.re \cdot y.im}{y.re \cdot y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.re < -3.00000000000000007e133 or 4.49999999999999999e62 < y.re Initial program 39.5%
Taylor expanded in y.re around inf
lower-/.f6474.9
Applied rewrites74.9%
if -3.00000000000000007e133 < y.re < 1.3e-62Initial program 74.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
Applied rewrites66.2%
Taylor expanded in y.re around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
unpow2N/A
associate-/r*N/A
div-subN/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6480.1
Applied rewrites80.1%
if 1.3e-62 < y.re < 4.49999999999999999e62Initial program 92.4%
Taylor expanded in y.re around inf
unpow2N/A
lower-*.f6482.0
Applied rewrites82.0%
Final simplification78.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (fma (/ x.im y.im) y.re (- x.re)) y.im)))
(if (<= y.im -4.5e-7)
t_0
(if (<= y.im 1.4e-13) (/ (- x.im (/ (* x.re 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_im / y_46_im), y_46_re, -x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -4.5e-7) {
tmp = t_0;
} else if (y_46_im <= 1.4e-13) {
tmp = (x_46_im - ((x_46_re * 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_im / y_46_im), y_46_re, Float64(-x_46_re)) / y_46_im) tmp = 0.0 if (y_46_im <= -4.5e-7) tmp = t_0; elseif (y_46_im <= 1.4e-13) tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re * y_46_im) / 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$im / y$46$im), $MachinePrecision] * y$46$re + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -4.5e-7], t$95$0, If[LessEqual[y$46$im, 1.4e-13], N[(N[(x$46$im - N[(N[(x$46$re * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im}\\
\mathbf{if}\;y.im \leq -4.5 \cdot 10^{-7}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 1.4 \cdot 10^{-13}:\\
\;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -4.4999999999999998e-7 or 1.4000000000000001e-13 < y.im Initial program 49.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
Applied rewrites55.0%
Taylor expanded in y.re around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
unpow2N/A
associate-/r*N/A
div-subN/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6482.2
Applied rewrites82.2%
if -4.4999999999999998e-7 < y.im < 1.4000000000000001e-13Initial program 79.5%
Taylor expanded in y.re around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
lower-*.f6479.1
Applied rewrites79.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (- x.re) y.im)))
(if (<= y.im -4.5e+109)
t_0
(if (<= y.im -8.6e-106)
(* (/ y.im (fma y.im y.im (* y.re y.re))) (- x.re))
(if (<= y.im 4.5e-15) (/ x.im 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 = -x_46_re / y_46_im;
double tmp;
if (y_46_im <= -4.5e+109) {
tmp = t_0;
} else if (y_46_im <= -8.6e-106) {
tmp = (y_46_im / fma(y_46_im, y_46_im, (y_46_re * y_46_re))) * -x_46_re;
} else if (y_46_im <= 4.5e-15) {
tmp = x_46_im / 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(Float64(-x_46_re) / y_46_im) tmp = 0.0 if (y_46_im <= -4.5e+109) tmp = t_0; elseif (y_46_im <= -8.6e-106) tmp = Float64(Float64(y_46_im / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) * Float64(-x_46_re)); elseif (y_46_im <= 4.5e-15) tmp = Float64(x_46_im / 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[((-x$46$re) / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -4.5e+109], t$95$0, If[LessEqual[y$46$im, -8.6e-106], N[(N[(y$46$im / 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, 4.5e-15], N[(x$46$im / y$46$re), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x.re}{y.im}\\
\mathbf{if}\;y.im \leq -4.5 \cdot 10^{+109}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq -8.6 \cdot 10^{-106}:\\
\;\;\;\;\frac{y.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot \left(-x.re\right)\\
\mathbf{elif}\;y.im \leq 4.5 \cdot 10^{-15}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -4.4999999999999996e109 or 4.4999999999999998e-15 < y.im Initial program 42.4%
Taylor expanded in y.re around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6466.3
Applied rewrites66.3%
if -4.4999999999999996e109 < y.im < -8.6000000000000004e-106Initial program 87.9%
Taylor expanded in x.re around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6464.8
Applied rewrites64.8%
if -8.6000000000000004e-106 < y.im < 4.4999999999999998e-15Initial program 77.6%
Taylor expanded in y.re around inf
lower-/.f6469.0
Applied rewrites69.0%
Final simplification67.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -1.1e+133)
(/ x.im y.re)
(if (<= y.re -1.7e-84)
(* (/ y.re (fma y.im y.im (* y.re y.re))) x.im)
(if (<= y.re 5.8e-57) (/ (- x.re) y.im) (/ x.im y.re)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -1.1e+133) {
tmp = x_46_im / y_46_re;
} else if (y_46_re <= -1.7e-84) {
tmp = (y_46_re / fma(y_46_im, y_46_im, (y_46_re * y_46_re))) * x_46_im;
} else if (y_46_re <= 5.8e-57) {
tmp = -x_46_re / y_46_im;
} else {
tmp = x_46_im / y_46_re;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -1.1e+133) tmp = Float64(x_46_im / y_46_re); elseif (y_46_re <= -1.7e-84) tmp = Float64(Float64(y_46_re / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) * x_46_im); elseif (y_46_re <= 5.8e-57) tmp = Float64(Float64(-x_46_re) / y_46_im); else tmp = Float64(x_46_im / 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.1e+133], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -1.7e-84], N[(N[(y$46$re / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision], If[LessEqual[y$46$re, 5.8e-57], N[((-x$46$re) / y$46$im), $MachinePrecision], N[(x$46$im / y$46$re), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1.1 \cdot 10^{+133}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\mathbf{elif}\;y.re \leq -1.7 \cdot 10^{-84}:\\
\;\;\;\;\frac{y.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot x.im\\
\mathbf{elif}\;y.re \leq 5.8 \cdot 10^{-57}:\\
\;\;\;\;\frac{-x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.re < -1.1e133 or 5.8000000000000005e-57 < y.re Initial program 53.3%
Taylor expanded in y.re around inf
lower-/.f6470.1
Applied rewrites70.1%
if -1.1e133 < y.re < -1.7000000000000001e-84Initial program 79.5%
lift-/.f64N/A
frac-2negN/A
div-invN/A
lower-*.f64N/A
lift--.f64N/A
sub-negN/A
distribute-neg-inN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
remove-double-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6479.5
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6479.5
Applied rewrites79.5%
Taylor expanded in x.re around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6454.7
Applied rewrites54.7%
if -1.7000000000000001e-84 < y.re < 5.8000000000000005e-57Initial program 71.9%
Taylor expanded in y.re around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6467.7
Applied rewrites67.7%
Final simplification66.5%
(FPCore (x.re x.im y.re y.im) :precision binary64 (let* ((t_0 (/ (- x.re) y.im))) (if (<= y.im -9e-106) t_0 (if (<= y.im 4.5e-15) (/ x.im 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 = -x_46_re / y_46_im;
double tmp;
if (y_46_im <= -9e-106) {
tmp = t_0;
} else if (y_46_im <= 4.5e-15) {
tmp = x_46_im / y_46_re;
} else {
tmp = t_0;
}
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) :: t_0
real(8) :: tmp
t_0 = -x_46re / y_46im
if (y_46im <= (-9d-106)) then
tmp = t_0
else if (y_46im <= 4.5d-15) then
tmp = x_46im / y_46re
else
tmp = t_0
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 t_0 = -x_46_re / y_46_im;
double tmp;
if (y_46_im <= -9e-106) {
tmp = t_0;
} else if (y_46_im <= 4.5e-15) {
tmp = x_46_im / y_46_re;
} else {
tmp = t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = -x_46_re / y_46_im tmp = 0 if y_46_im <= -9e-106: tmp = t_0 elif y_46_im <= 4.5e-15: tmp = x_46_im / 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(Float64(-x_46_re) / y_46_im) tmp = 0.0 if (y_46_im <= -9e-106) tmp = t_0; elseif (y_46_im <= 4.5e-15) tmp = Float64(x_46_im / y_46_re); else tmp = t_0; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = -x_46_re / y_46_im; tmp = 0.0; if (y_46_im <= -9e-106) tmp = t_0; elseif (y_46_im <= 4.5e-15) tmp = x_46_im / y_46_re; else tmp = t_0; end tmp_2 = 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$im), $MachinePrecision]}, If[LessEqual[y$46$im, -9e-106], t$95$0, If[LessEqual[y$46$im, 4.5e-15], N[(x$46$im / y$46$re), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x.re}{y.im}\\
\mathbf{if}\;y.im \leq -9 \cdot 10^{-106}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 4.5 \cdot 10^{-15}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -8.99999999999999911e-106 or 4.4999999999999998e-15 < y.im Initial program 55.6%
Taylor expanded in y.re around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6461.2
Applied rewrites61.2%
if -8.99999999999999911e-106 < y.im < 4.4999999999999998e-15Initial program 77.6%
Taylor expanded in y.re around inf
lower-/.f6469.0
Applied rewrites69.0%
Final simplification64.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ x.im y.re))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return x_46_im / y_46_re;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = x_46im / y_46re
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return x_46_im / y_46_re;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return x_46_im / y_46_re
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(x_46_im / y_46_re) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = x_46_im / y_46_re; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(x$46$im / y$46$re), $MachinePrecision]
\begin{array}{l}
\\
\frac{x.im}{y.re}
\end{array}
Initial program 65.5%
Taylor expanded in y.re around inf
lower-/.f6441.5
Applied rewrites41.5%
herbie shell --seed 2024331
(FPCore (x.re x.im y.re y.im)
:name "_divideComplex, imaginary part"
:precision binary64
(/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))