
(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 10 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 (fma y.im y.im (* y.re y.re)))
(t_1 (/ (fma x.im (/ y.re y.im) (- x.re)) y.im)))
(if (<= y.im -4.2e+126)
t_1
(if (<= y.im -2.32e-73)
(/ (- (* x.im y.re) (* y.im x.re)) (fma y.re y.re (* y.im y.im)))
(if (<= y.im 2e-121)
(/ (fma (* y.im (- x.re)) (/ 1.0 y.re) x.im) y.re)
(if (<= y.im 5e+146)
(fma (- x.re) (/ y.im t_0) (/ (* x.im y.re) 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 = fma(y_46_im, y_46_im, (y_46_re * y_46_re));
double t_1 = fma(x_46_im, (y_46_re / y_46_im), -x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -4.2e+126) {
tmp = t_1;
} else if (y_46_im <= -2.32e-73) {
tmp = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / fma(y_46_re, y_46_re, (y_46_im * y_46_im));
} else if (y_46_im <= 2e-121) {
tmp = fma((y_46_im * -x_46_re), (1.0 / y_46_re), x_46_im) / y_46_re;
} else if (y_46_im <= 5e+146) {
tmp = fma(-x_46_re, (y_46_im / t_0), ((x_46_im * y_46_re) / t_0));
} else {
tmp = t_1;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re)) t_1 = Float64(fma(x_46_im, Float64(y_46_re / y_46_im), Float64(-x_46_re)) / y_46_im) tmp = 0.0 if (y_46_im <= -4.2e+126) tmp = t_1; elseif (y_46_im <= -2.32e-73) tmp = Float64(Float64(Float64(x_46_im * y_46_re) - Float64(y_46_im * x_46_re)) / fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im))); elseif (y_46_im <= 2e-121) tmp = Float64(fma(Float64(y_46_im * Float64(-x_46_re)), Float64(1.0 / y_46_re), x_46_im) / y_46_re); elseif (y_46_im <= 5e+146) tmp = fma(Float64(-x_46_re), Float64(y_46_im / t_0), Float64(Float64(x_46_im * y_46_re) / 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[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision] + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -4.2e+126], t$95$1, If[LessEqual[y$46$im, -2.32e-73], N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 2e-121], N[(N[(N[(y$46$im * (-x$46$re)), $MachinePrecision] * N[(1.0 / y$46$re), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 5e+146], N[((-x$46$re) * N[(y$46$im / t$95$0), $MachinePrecision] + N[(N[(x$46$im * y$46$re), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)\\
t_1 := \frac{\mathsf{fma}\left(x.im, \frac{y.re}{y.im}, -x.re\right)}{y.im}\\
\mathbf{if}\;y.im \leq -4.2 \cdot 10^{+126}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq -2.32 \cdot 10^{-73}:\\
\;\;\;\;\frac{x.im \cdot y.re - y.im \cdot x.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\
\mathbf{elif}\;y.im \leq 2 \cdot 10^{-121}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.im \cdot \left(-x.re\right), \frac{1}{y.re}, x.im\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 5 \cdot 10^{+146}:\\
\;\;\;\;\mathsf{fma}\left(-x.re, \frac{y.im}{t\_0}, \frac{x.im \cdot y.re}{t\_0}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.im < -4.1999999999999998e126 or 4.9999999999999999e146 < y.im Initial program 32.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
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6492.2
Applied rewrites92.2%
Applied rewrites92.2%
if -4.1999999999999998e126 < y.im < -2.32e-73Initial program 90.4%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6490.4
Applied rewrites90.4%
if -2.32e-73 < y.im < 2e-121Initial program 69.7%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6469.7
Applied rewrites69.7%
Taylor expanded in y.re around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6493.2
Applied rewrites93.2%
Applied rewrites95.2%
if 2e-121 < y.im < 4.9999999999999999e146Initial program 74.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f6482.3
Applied rewrites82.3%
Final simplification91.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (- (* x.im y.re) (* y.im x.re)) (fma y.re y.re (* y.im y.im))))
(t_1 (/ (fma x.im (/ y.re y.im) (- x.re)) y.im)))
(if (<= y.im -4.2e+126)
t_1
(if (<= y.im -2.32e-73)
t_0
(if (<= y.im 2e-121)
(/ (fma (* y.im (- x.re)) (/ 1.0 y.re) x.im) y.re)
(if (<= y.im 3.8e+38) 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 = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / fma(y_46_re, y_46_re, (y_46_im * y_46_im));
double t_1 = fma(x_46_im, (y_46_re / y_46_im), -x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -4.2e+126) {
tmp = t_1;
} else if (y_46_im <= -2.32e-73) {
tmp = t_0;
} else if (y_46_im <= 2e-121) {
tmp = fma((y_46_im * -x_46_re), (1.0 / y_46_re), x_46_im) / y_46_re;
} else if (y_46_im <= 3.8e+38) {
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(x_46_im * y_46_re) - Float64(y_46_im * x_46_re)) / fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im))) t_1 = Float64(fma(x_46_im, Float64(y_46_re / y_46_im), Float64(-x_46_re)) / y_46_im) tmp = 0.0 if (y_46_im <= -4.2e+126) tmp = t_1; elseif (y_46_im <= -2.32e-73) tmp = t_0; elseif (y_46_im <= 2e-121) tmp = Float64(fma(Float64(y_46_im * Float64(-x_46_re)), Float64(1.0 / y_46_re), x_46_im) / y_46_re); elseif (y_46_im <= 3.8e+38) 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[(x$46$im * y$46$re), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision] + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -4.2e+126], t$95$1, If[LessEqual[y$46$im, -2.32e-73], t$95$0, If[LessEqual[y$46$im, 2e-121], N[(N[(N[(y$46$im * (-x$46$re)), $MachinePrecision] * N[(1.0 / y$46$re), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 3.8e+38], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x.im \cdot y.re - y.im \cdot x.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\
t_1 := \frac{\mathsf{fma}\left(x.im, \frac{y.re}{y.im}, -x.re\right)}{y.im}\\
\mathbf{if}\;y.im \leq -4.2 \cdot 10^{+126}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq -2.32 \cdot 10^{-73}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 2 \cdot 10^{-121}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.im \cdot \left(-x.re\right), \frac{1}{y.re}, x.im\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 3.8 \cdot 10^{+38}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.im < -4.1999999999999998e126 or 3.7999999999999998e38 < y.im Initial program 41.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
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6488.8
Applied rewrites88.8%
Applied rewrites88.8%
if -4.1999999999999998e126 < y.im < -2.32e-73 or 2e-121 < y.im < 3.7999999999999998e38Initial program 85.8%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6485.9
Applied rewrites85.9%
if -2.32e-73 < y.im < 2e-121Initial program 69.7%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6469.7
Applied rewrites69.7%
Taylor expanded in y.re around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6493.2
Applied rewrites93.2%
Applied rewrites95.2%
Final simplification90.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -65000000000.0)
(/ (fma y.re (/ x.im y.im) (- x.re)) y.im)
(if (<= y.im 3.1e-116)
(/ (fma (* y.im (- x.re)) (/ 1.0 y.re) x.im) y.re)
(/ (fma x.im (/ y.re y.im) (- x.re)) 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 <= -65000000000.0) {
tmp = fma(y_46_re, (x_46_im / y_46_im), -x_46_re) / y_46_im;
} else if (y_46_im <= 3.1e-116) {
tmp = fma((y_46_im * -x_46_re), (1.0 / y_46_re), x_46_im) / y_46_re;
} else {
tmp = fma(x_46_im, (y_46_re / y_46_im), -x_46_re) / 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 <= -65000000000.0) tmp = Float64(fma(y_46_re, Float64(x_46_im / y_46_im), Float64(-x_46_re)) / y_46_im); elseif (y_46_im <= 3.1e-116) tmp = Float64(fma(Float64(y_46_im * Float64(-x_46_re)), Float64(1.0 / y_46_re), x_46_im) / y_46_re); else tmp = Float64(fma(x_46_im, Float64(y_46_re / y_46_im), Float64(-x_46_re)) / 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, -65000000000.0], N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision] + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 3.1e-116], N[(N[(N[(y$46$im * (-x$46$re)), $MachinePrecision] * N[(1.0 / y$46$re), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$re), $MachinePrecision], N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision] + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -65000000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, -x.re\right)}{y.im}\\
\mathbf{elif}\;y.im \leq 3.1 \cdot 10^{-116}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.im \cdot \left(-x.re\right), \frac{1}{y.re}, x.im\right)}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.re}{y.im}, -x.re\right)}{y.im}\\
\end{array}
\end{array}
if y.im < -6.5e10Initial program 57.6%
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
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6481.7
Applied rewrites81.7%
if -6.5e10 < y.im < 3.10000000000000018e-116Initial program 72.8%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6472.8
Applied rewrites72.8%
Taylor expanded in y.re around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6488.4
Applied rewrites88.4%
Applied rewrites90.1%
if 3.10000000000000018e-116 < y.im Initial program 56.7%
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
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6480.3
Applied rewrites80.3%
Applied rewrites81.3%
Final simplification85.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -65000000000.0)
(/ (fma y.re (/ x.im y.im) (- x.re)) y.im)
(if (<= y.im 3.1e-116)
(/ (- x.im (/ (* y.im x.re) y.re)) y.re)
(/ (fma x.im (/ y.re y.im) (- x.re)) 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 <= -65000000000.0) {
tmp = fma(y_46_re, (x_46_im / y_46_im), -x_46_re) / y_46_im;
} else if (y_46_im <= 3.1e-116) {
tmp = (x_46_im - ((y_46_im * x_46_re) / y_46_re)) / y_46_re;
} else {
tmp = fma(x_46_im, (y_46_re / y_46_im), -x_46_re) / 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 <= -65000000000.0) tmp = Float64(fma(y_46_re, Float64(x_46_im / y_46_im), Float64(-x_46_re)) / y_46_im); elseif (y_46_im <= 3.1e-116) tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im * x_46_re) / y_46_re)) / y_46_re); else tmp = Float64(fma(x_46_im, Float64(y_46_re / y_46_im), Float64(-x_46_re)) / 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, -65000000000.0], N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision] + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 3.1e-116], N[(N[(x$46$im - N[(N[(y$46$im * x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision] + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -65000000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, -x.re\right)}{y.im}\\
\mathbf{elif}\;y.im \leq 3.1 \cdot 10^{-116}:\\
\;\;\;\;\frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.re}{y.im}, -x.re\right)}{y.im}\\
\end{array}
\end{array}
if y.im < -6.5e10Initial program 57.6%
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
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6481.7
Applied rewrites81.7%
if -6.5e10 < y.im < 3.10000000000000018e-116Initial program 72.8%
Taylor expanded in y.re around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6490.1
Applied rewrites90.1%
if 3.10000000000000018e-116 < y.im Initial program 56.7%
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
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6480.3
Applied rewrites80.3%
Applied rewrites81.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (fma x.im (/ y.re y.im) (- x.re)) y.im)))
(if (<= y.im -65000000000.0)
t_0
(if (<= y.im 3.1e-116) (/ (- x.im (/ (* y.im x.re) 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_re / y_46_im), -x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -65000000000.0) {
tmp = t_0;
} else if (y_46_im <= 3.1e-116) {
tmp = (x_46_im - ((y_46_im * x_46_re) / 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_im, Float64(y_46_re / y_46_im), Float64(-x_46_re)) / y_46_im) tmp = 0.0 if (y_46_im <= -65000000000.0) tmp = t_0; elseif (y_46_im <= 3.1e-116) tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im * x_46_re) / 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$im * N[(y$46$re / y$46$im), $MachinePrecision] + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -65000000000.0], t$95$0, If[LessEqual[y$46$im, 3.1e-116], N[(N[(x$46$im - N[(N[(y$46$im * x$46$re), $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(x.im, \frac{y.re}{y.im}, -x.re\right)}{y.im}\\
\mathbf{if}\;y.im \leq -65000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 3.1 \cdot 10^{-116}:\\
\;\;\;\;\frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -6.5e10 or 3.10000000000000018e-116 < y.im Initial program 57.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
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6480.8
Applied rewrites80.8%
Applied rewrites81.5%
if -6.5e10 < y.im < 3.10000000000000018e-116Initial program 72.8%
Taylor expanded in y.re around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6490.1
Applied rewrites90.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ x.re (- y.im))))
(if (<= y.im -65000000000.0)
t_0
(if (<= y.im 8.5e+34) (/ (- x.im (/ (* y.im x.re) 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 = x_46_re / -y_46_im;
double tmp;
if (y_46_im <= -65000000000.0) {
tmp = t_0;
} else if (y_46_im <= 8.5e+34) {
tmp = (x_46_im - ((y_46_im * x_46_re) / y_46_re)) / 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 <= (-65000000000.0d0)) then
tmp = t_0
else if (y_46im <= 8.5d+34) then
tmp = (x_46im - ((y_46im * x_46re) / y_46re)) / 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 <= -65000000000.0) {
tmp = t_0;
} else if (y_46_im <= 8.5e+34) {
tmp = (x_46_im - ((y_46_im * x_46_re) / y_46_re)) / 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 <= -65000000000.0: tmp = t_0 elif y_46_im <= 8.5e+34: tmp = (x_46_im - ((y_46_im * x_46_re) / 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(x_46_re / Float64(-y_46_im)) tmp = 0.0 if (y_46_im <= -65000000000.0) tmp = t_0; elseif (y_46_im <= 8.5e+34) tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im * x_46_re) / y_46_re)) / 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 <= -65000000000.0) tmp = t_0; elseif (y_46_im <= 8.5e+34) tmp = (x_46_im - ((y_46_im * x_46_re) / y_46_re)) / 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, -65000000000.0], t$95$0, If[LessEqual[y$46$im, 8.5e+34], N[(N[(x$46$im - N[(N[(y$46$im * x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / 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 -65000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 8.5 \cdot 10^{+34}:\\
\;\;\;\;\frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -6.5e10 or 8.5000000000000003e34 < y.im Initial program 51.7%
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.f6480.7
Applied rewrites80.7%
if -6.5e10 < y.im < 8.5000000000000003e34Initial program 74.0%
Taylor expanded in y.re around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6482.6
Applied rewrites82.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ x.re (- y.im))))
(if (<= y.im -65000000000.0)
t_0
(if (<= y.im 8.5e+34) (/ (- 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 = x_46_re / -y_46_im;
double tmp;
if (y_46_im <= -65000000000.0) {
tmp = t_0;
} else if (y_46_im <= 8.5e+34) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / 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 <= (-65000000000.0d0)) then
tmp = t_0
else if (y_46im <= 8.5d+34) then
tmp = (x_46im - (x_46re * (y_46im / y_46re))) / 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 <= -65000000000.0) {
tmp = t_0;
} else if (y_46_im <= 8.5e+34) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / 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 <= -65000000000.0: tmp = t_0 elif y_46_im <= 8.5e+34: 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(x_46_re / Float64(-y_46_im)) tmp = 0.0 if (y_46_im <= -65000000000.0) tmp = t_0; elseif (y_46_im <= 8.5e+34) tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / 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 <= -65000000000.0) tmp = t_0; elseif (y_46_im <= 8.5e+34) tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / 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, -65000000000.0], t$95$0, If[LessEqual[y$46$im, 8.5e+34], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 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 -65000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 8.5 \cdot 10^{+34}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -6.5e10 or 8.5000000000000003e34 < y.im Initial program 51.7%
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.f6480.7
Applied rewrites80.7%
if -6.5e10 < y.im < 8.5000000000000003e34Initial program 74.0%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6474.0
Applied rewrites74.0%
Taylor expanded in y.re around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6481.3
Applied rewrites81.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ x.re (- y.im))))
(if (<= y.im -3.5e+129)
t_0
(if (<= y.im -7.8e-69)
(* x.re (/ (- y.im) (fma y.im y.im (* y.re y.re))))
(if (<= y.im 2.55e-110) (/ 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 <= -3.5e+129) {
tmp = t_0;
} else if (y_46_im <= -7.8e-69) {
tmp = x_46_re * (-y_46_im / fma(y_46_im, y_46_im, (y_46_re * y_46_re)));
} else if (y_46_im <= 2.55e-110) {
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(x_46_re / Float64(-y_46_im)) tmp = 0.0 if (y_46_im <= -3.5e+129) tmp = t_0; elseif (y_46_im <= -7.8e-69) tmp = Float64(x_46_re * Float64(Float64(-y_46_im) / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re)))); elseif (y_46_im <= 2.55e-110) 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, -3.5e+129], t$95$0, If[LessEqual[y$46$im, -7.8e-69], N[(x$46$re * N[((-y$46$im) / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 2.55e-110], 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 -3.5 \cdot 10^{+129}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq -7.8 \cdot 10^{-69}:\\
\;\;\;\;x.re \cdot \frac{-y.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\
\mathbf{elif}\;y.im \leq 2.55 \cdot 10^{-110}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -3.4999999999999998e129 or 2.5500000000000001e-110 < y.im Initial program 50.1%
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.f6475.6
Applied rewrites75.6%
if -3.4999999999999998e129 < y.im < -7.79999999999999961e-69Initial program 88.1%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6488.1
Applied rewrites88.1%
Taylor expanded in x.im around 0
mul-1-negN/A
lower-neg.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6469.9
Applied rewrites69.9%
if -7.79999999999999961e-69 < y.im < 2.5500000000000001e-110Initial program 70.3%
Taylor expanded in y.re around inf
lower-/.f6474.2
Applied rewrites74.2%
Final simplification74.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ x.re (- y.im))))
(if (<= y.im -54000000000.0)
t_0
(if (<= y.im 2.55e-110) (/ 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 <= -54000000000.0) {
tmp = t_0;
} else if (y_46_im <= 2.55e-110) {
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 <= (-54000000000.0d0)) then
tmp = t_0
else if (y_46im <= 2.55d-110) 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 <= -54000000000.0) {
tmp = t_0;
} else if (y_46_im <= 2.55e-110) {
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 <= -54000000000.0: tmp = t_0 elif y_46_im <= 2.55e-110: 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(x_46_re / Float64(-y_46_im)) tmp = 0.0 if (y_46_im <= -54000000000.0) tmp = t_0; elseif (y_46_im <= 2.55e-110) 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 <= -54000000000.0) tmp = t_0; elseif (y_46_im <= 2.55e-110) 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, -54000000000.0], t$95$0, If[LessEqual[y$46$im, 2.55e-110], 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 -54000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 2.55 \cdot 10^{-110}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -5.4e10 or 2.5500000000000001e-110 < y.im Initial program 56.7%
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.6
Applied rewrites74.6%
if -5.4e10 < y.im < 2.5500000000000001e-110Initial program 73.0%
Taylor expanded in y.re around inf
lower-/.f6469.5
Applied rewrites69.5%
(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 64.0%
Taylor expanded in y.re around inf
lower-/.f6441.3
Applied rewrites41.3%
herbie shell --seed 2024219
(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))))