
(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.re y.im)
x.im
(fma (* y.re (/ y.re (* y.im y.im))) x.re (- x.re)))
y.im))
(t_1 (fma y.im y.im (* y.re y.re))))
(if (<= y.im -1.7e+96)
t_0
(if (<= y.im 3.3e-77)
(/ (- x.im (/ (* x.re y.im) y.re)) y.re)
(if (<= y.im 1.65e+131)
(fma (/ y.re t_1) x.im (* (- y.im) (/ x.re 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 = fma((y_46_re / y_46_im), x_46_im, fma((y_46_re * (y_46_re / (y_46_im * y_46_im))), x_46_re, -x_46_re)) / y_46_im;
double t_1 = fma(y_46_im, y_46_im, (y_46_re * y_46_re));
double tmp;
if (y_46_im <= -1.7e+96) {
tmp = t_0;
} else if (y_46_im <= 3.3e-77) {
tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re;
} else if (y_46_im <= 1.65e+131) {
tmp = fma((y_46_re / t_1), x_46_im, (-y_46_im * (x_46_re / 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(fma(Float64(y_46_re / y_46_im), x_46_im, fma(Float64(y_46_re * Float64(y_46_re / Float64(y_46_im * y_46_im))), x_46_re, Float64(-x_46_re))) / y_46_im) t_1 = fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re)) tmp = 0.0 if (y_46_im <= -1.7e+96) tmp = t_0; elseif (y_46_im <= 3.3e-77) tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re * y_46_im) / y_46_re)) / y_46_re); elseif (y_46_im <= 1.65e+131) tmp = fma(Float64(y_46_re / t_1), x_46_im, Float64(Float64(-y_46_im) * Float64(x_46_re / 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[(N[(N[(y$46$re / y$46$im), $MachinePrecision] * x$46$im + N[(N[(y$46$re * N[(y$46$re / N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x$46$re + (-x$46$re)), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision]}, Block[{t$95$1 = N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -1.7e+96], t$95$0, If[LessEqual[y$46$im, 3.3e-77], 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, 1.65e+131], N[(N[(y$46$re / t$95$1), $MachinePrecision] * x$46$im + N[((-y$46$im) * N[(x$46$re / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(\frac{y.re}{y.im}, x.im, \mathsf{fma}\left(y.re \cdot \frac{y.re}{y.im \cdot y.im}, x.re, -x.re\right)\right)}{y.im}\\
t_1 := \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)\\
\mathbf{if}\;y.im \leq -1.7 \cdot 10^{+96}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 3.3 \cdot 10^{-77}:\\
\;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 1.65 \cdot 10^{+131}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y.re}{t\_1}, x.im, \left(-y.im\right) \cdot \frac{x.re}{t\_1}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -1.7e96 or 1.6499999999999999e131 < y.im Initial program 34.9%
Taylor expanded in y.re around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
lower-*.f6412.0
Applied rewrites12.0%
Applied rewrites16.9%
Taylor expanded in y.im around inf
lower-/.f64N/A
Applied rewrites85.1%
if -1.7e96 < y.im < 3.29999999999999991e-77Initial program 70.1%
Taylor expanded in y.re around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
lower-*.f6485.3
Applied rewrites85.3%
if 3.29999999999999991e-77 < y.im < 1.6499999999999999e131Initial program 78.1%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-negN/A
lift-*.f64N/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 rewrites82.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(/
(fma
(/ y.re y.im)
x.im
(fma (* y.re (/ y.re (* y.im y.im))) x.re (- x.re)))
y.im)))
(if (<= y.im -1.7e+96)
t_0
(if (<= y.im 3e-77)
(/ (- x.im (/ (* x.re y.im) y.re)) y.re)
(if (<= y.im 8.5e+130)
(/ (- (* x.im y.re) (* x.re y.im)) (fma 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_im, fma((y_46_re * (y_46_re / (y_46_im * y_46_im))), x_46_re, -x_46_re)) / y_46_im;
double tmp;
if (y_46_im <= -1.7e+96) {
tmp = t_0;
} else if (y_46_im <= 3e-77) {
tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re;
} else if (y_46_im <= 8.5e+130) {
tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / fma(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(y_46_re / y_46_im), x_46_im, fma(Float64(y_46_re * Float64(y_46_re / Float64(y_46_im * y_46_im))), x_46_re, Float64(-x_46_re))) / y_46_im) tmp = 0.0 if (y_46_im <= -1.7e+96) tmp = t_0; elseif (y_46_im <= 3e-77) tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re * y_46_im) / y_46_re)) / y_46_re); elseif (y_46_im <= 8.5e+130) tmp = Float64(Float64(Float64(x_46_im * y_46_re) - Float64(x_46_re * y_46_im)) / fma(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[(y$46$re / y$46$im), $MachinePrecision] * x$46$im + N[(N[(y$46$re * N[(y$46$re / N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x$46$re + (-x$46$re)), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -1.7e+96], t$95$0, If[LessEqual[y$46$im, 3e-77], 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, 8.5e+130], N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(y$46$re * y$46$re + 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{y.re}{y.im}, x.im, \mathsf{fma}\left(y.re \cdot \frac{y.re}{y.im \cdot y.im}, x.re, -x.re\right)\right)}{y.im}\\
\mathbf{if}\;y.im \leq -1.7 \cdot 10^{+96}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 3 \cdot 10^{-77}:\\
\;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 8.5 \cdot 10^{+130}:\\
\;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -1.7e96 or 8.49999999999999965e130 < y.im Initial program 34.9%
Taylor expanded in y.re around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
lower-*.f6412.0
Applied rewrites12.0%
Applied rewrites16.9%
Taylor expanded in y.im around inf
lower-/.f64N/A
Applied rewrites85.1%
if -1.7e96 < y.im < 3.00000000000000016e-77Initial program 70.1%
Taylor expanded in y.re around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
lower-*.f6485.3
Applied rewrites85.3%
if 3.00000000000000016e-77 < y.im < 8.49999999999999965e130Initial program 78.1%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6478.1
Applied rewrites78.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (- (* x.im y.re) (* x.re y.im)) (fma y.re y.re (* y.im y.im))))
(t_1 (/ (- x.im (* y.im (/ x.re y.re))) y.re)))
(if (<= y.re -2.3e+111)
t_1
(if (<= y.re -2.3e-48)
t_0
(if (<= y.re 3.5e-136)
(/ (- (/ (* x.im y.re) y.im) x.re) y.im)
(if (<= y.re 2.45e+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) - (x_46_re * y_46_im)) / fma(y_46_re, y_46_re, (y_46_im * y_46_im));
double t_1 = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
double tmp;
if (y_46_re <= -2.3e+111) {
tmp = t_1;
} else if (y_46_re <= -2.3e-48) {
tmp = t_0;
} else if (y_46_re <= 3.5e-136) {
tmp = (((x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im;
} else if (y_46_re <= 2.45e+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(x_46_re * y_46_im)) / fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im))) t_1 = Float64(Float64(x_46_im - Float64(y_46_im * Float64(x_46_re / y_46_re))) / y_46_re) tmp = 0.0 if (y_46_re <= -2.3e+111) tmp = t_1; elseif (y_46_re <= -2.3e-48) tmp = t_0; elseif (y_46_re <= 3.5e-136) tmp = Float64(Float64(Float64(Float64(x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im); elseif (y_46_re <= 2.45e+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[(x$46$re * y$46$im), $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$im * N[(x$46$re / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -2.3e+111], t$95$1, If[LessEqual[y$46$re, -2.3e-48], t$95$0, If[LessEqual[y$46$re, 3.5e-136], N[(N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 2.45e+38], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x.im \cdot y.re - x.re \cdot y.im}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\
t_1 := \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re}\\
\mathbf{if}\;y.re \leq -2.3 \cdot 10^{+111}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.re \leq -2.3 \cdot 10^{-48}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 3.5 \cdot 10^{-136}:\\
\;\;\;\;\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}\\
\mathbf{elif}\;y.re \leq 2.45 \cdot 10^{+38}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.re < -2.30000000000000002e111 or 2.45000000000000001e38 < y.re Initial program 41.7%
Taylor expanded in y.re around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
lower-*.f6478.3
Applied rewrites78.3%
Applied rewrites83.3%
if -2.30000000000000002e111 < y.re < -2.3000000000000001e-48 or 3.50000000000000029e-136 < y.re < 2.45000000000000001e38Initial program 78.1%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6478.2
Applied rewrites78.2%
if -2.3000000000000001e-48 < y.re < 3.50000000000000029e-136Initial program 66.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
lower--.f64N/A
lower-/.f64N/A
lower-*.f6490.6
Applied rewrites90.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (- x.re) y.im)))
(if (<= y.im -1.7e+96)
t_0
(if (<= y.im 1.15e-76)
(/ x.im y.re)
(if (<= y.im 1.5e+95)
(* (/ x.re (fma y.im y.im (* y.re y.re))) (- 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 = -x_46_re / y_46_im;
double tmp;
if (y_46_im <= -1.7e+96) {
tmp = t_0;
} else if (y_46_im <= 1.15e-76) {
tmp = x_46_im / y_46_re;
} else if (y_46_im <= 1.5e+95) {
tmp = (x_46_re / fma(y_46_im, y_46_im, (y_46_re * y_46_re))) * -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(Float64(-x_46_re) / y_46_im) tmp = 0.0 if (y_46_im <= -1.7e+96) tmp = t_0; elseif (y_46_im <= 1.15e-76) tmp = Float64(x_46_im / y_46_re); elseif (y_46_im <= 1.5e+95) tmp = Float64(Float64(x_46_re / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) * Float64(-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[((-x$46$re) / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -1.7e+96], t$95$0, If[LessEqual[y$46$im, 1.15e-76], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 1.5e+95], N[(N[(x$46$re / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * (-y$46$im)), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x.re}{y.im}\\
\mathbf{if}\;y.im \leq -1.7 \cdot 10^{+96}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 1.15 \cdot 10^{-76}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\mathbf{elif}\;y.im \leq 1.5 \cdot 10^{+95}:\\
\;\;\;\;\frac{x.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot \left(-y.im\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -1.7e96 or 1.49999999999999996e95 < y.im Initial program 37.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.f6474.1
Applied rewrites74.1%
if -1.7e96 < y.im < 1.15000000000000003e-76Initial program 70.1%
Taylor expanded in y.re around inf
lower-/.f6469.1
Applied rewrites69.1%
if 1.15000000000000003e-76 < y.im < 1.49999999999999996e95Initial program 79.5%
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-*.f6463.8
Applied rewrites63.8%
Applied rewrites66.4%
Final simplification70.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (- x.re) y.im)))
(if (<= y.im -1.7e+96)
t_0
(if (<= y.im 4.4e-77)
(/ x.im y.re)
(if (<= y.im 6.6e+95)
(* (- x.re) (/ y.im (fma y.im y.im (* y.re y.re))))
t_0)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = -x_46_re / y_46_im;
double tmp;
if (y_46_im <= -1.7e+96) {
tmp = t_0;
} else if (y_46_im <= 4.4e-77) {
tmp = x_46_im / y_46_re;
} else if (y_46_im <= 6.6e+95) {
tmp = -x_46_re * (y_46_im / fma(y_46_im, y_46_im, (y_46_re * y_46_re)));
} else {
tmp = t_0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(Float64(-x_46_re) / y_46_im) tmp = 0.0 if (y_46_im <= -1.7e+96) tmp = t_0; elseif (y_46_im <= 4.4e-77) tmp = Float64(x_46_im / y_46_re); elseif (y_46_im <= 6.6e+95) tmp = Float64(Float64(-x_46_re) * Float64(y_46_im / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re)))); else tmp = t_0; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[((-x$46$re) / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -1.7e+96], t$95$0, If[LessEqual[y$46$im, 4.4e-77], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 6.6e+95], 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], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x.re}{y.im}\\
\mathbf{if}\;y.im \leq -1.7 \cdot 10^{+96}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 4.4 \cdot 10^{-77}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\mathbf{elif}\;y.im \leq 6.6 \cdot 10^{+95}:\\
\;\;\;\;\left(-x.re\right) \cdot \frac{y.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -1.7e96 or 6.5999999999999997e95 < y.im Initial program 37.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.f6474.1
Applied rewrites74.1%
if -1.7e96 < y.im < 4.40000000000000014e-77Initial program 70.1%
Taylor expanded in y.re around inf
lower-/.f6469.1
Applied rewrites69.1%
if 4.40000000000000014e-77 < y.im < 6.5999999999999997e95Initial program 79.5%
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-*.f6463.8
Applied rewrites63.8%
Final simplification70.2%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -1.7e+96) (not (<= y.im 2.2e+26))) (/ (- x.re) y.im) (/ (- x.im (/ (* x.re y.im) y.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 <= -1.7e+96) || !(y_46_im <= 2.2e+26)) {
tmp = -x_46_re / y_46_im;
} else {
tmp = (x_46_im - ((x_46_re * y_46_im) / y_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 <= (-1.7d+96)) .or. (.not. (y_46im <= 2.2d+26))) then
tmp = -x_46re / y_46im
else
tmp = (x_46im - ((x_46re * y_46im) / y_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 <= -1.7e+96) || !(y_46_im <= 2.2e+26)) {
tmp = -x_46_re / y_46_im;
} else {
tmp = (x_46_im - ((x_46_re * y_46_im) / y_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 <= -1.7e+96) or not (y_46_im <= 2.2e+26): tmp = -x_46_re / y_46_im else: tmp = (x_46_im - ((x_46_re * y_46_im) / y_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 <= -1.7e+96) || !(y_46_im <= 2.2e+26)) tmp = Float64(Float64(-x_46_re) / y_46_im); else tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re * y_46_im) / y_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 <= -1.7e+96) || ~((y_46_im <= 2.2e+26))) tmp = -x_46_re / y_46_im; else tmp = (x_46_im - ((x_46_re * y_46_im) / y_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, -1.7e+96], N[Not[LessEqual[y$46$im, 2.2e+26]], $MachinePrecision]], N[((-x$46$re) / y$46$im), $MachinePrecision], N[(N[(x$46$im - N[(N[(x$46$re * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -1.7 \cdot 10^{+96} \lor \neg \left(y.im \leq 2.2 \cdot 10^{+26}\right):\\
\;\;\;\;\frac{-x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\
\end{array}
\end{array}
if y.im < -1.7e96 or 2.20000000000000007e26 < y.im Initial program 43.0%
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.f6471.0
Applied rewrites71.0%
if -1.7e96 < y.im < 2.20000000000000007e26Initial program 71.7%
Taylor expanded in y.re around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
lower-*.f6482.1
Applied rewrites82.1%
Final simplification77.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -7.6e+100) (not (<= y.im 3.6e+27))) (/ (- x.re) y.im) (/ (- x.im (* y.im (/ x.re y.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 <= -7.6e+100) || !(y_46_im <= 3.6e+27)) {
tmp = -x_46_re / y_46_im;
} else {
tmp = (x_46_im - (y_46_im * (x_46_re / y_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 <= (-7.6d+100)) .or. (.not. (y_46im <= 3.6d+27))) then
tmp = -x_46re / y_46im
else
tmp = (x_46im - (y_46im * (x_46re / y_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 <= -7.6e+100) || !(y_46_im <= 3.6e+27)) {
tmp = -x_46_re / y_46_im;
} else {
tmp = (x_46_im - (y_46_im * (x_46_re / y_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 <= -7.6e+100) or not (y_46_im <= 3.6e+27): tmp = -x_46_re / y_46_im else: tmp = (x_46_im - (y_46_im * (x_46_re / y_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 <= -7.6e+100) || !(y_46_im <= 3.6e+27)) tmp = Float64(Float64(-x_46_re) / y_46_im); else tmp = Float64(Float64(x_46_im - Float64(y_46_im * Float64(x_46_re / y_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 <= -7.6e+100) || ~((y_46_im <= 3.6e+27))) tmp = -x_46_re / y_46_im; else tmp = (x_46_im - (y_46_im * (x_46_re / y_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, -7.6e+100], N[Not[LessEqual[y$46$im, 3.6e+27]], $MachinePrecision]], N[((-x$46$re) / y$46$im), $MachinePrecision], N[(N[(x$46$im - N[(y$46$im * N[(x$46$re / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -7.6 \cdot 10^{+100} \lor \neg \left(y.im \leq 3.6 \cdot 10^{+27}\right):\\
\;\;\;\;\frac{-x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re}\\
\end{array}
\end{array}
if y.im < -7.59999999999999927e100 or 3.59999999999999983e27 < y.im Initial program 43.0%
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.f6471.0
Applied rewrites71.0%
if -7.59999999999999927e100 < y.im < 3.59999999999999983e27Initial program 71.7%
Taylor expanded in y.re around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
lower-*.f6482.1
Applied rewrites82.1%
Applied rewrites79.5%
Final simplification75.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -1.7e+96)
(/ (- (/ (* x.im y.re) y.im) x.re) y.im)
(if (<= y.im 2.2e+26)
(/ (- x.im (/ (* x.re y.im) y.re)) y.re)
(/ (- 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 <= -1.7e+96) {
tmp = (((x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im;
} else if (y_46_im <= 2.2e+26) {
tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re;
} else {
tmp = -x_46_re / y_46_im;
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46im <= (-1.7d+96)) then
tmp = (((x_46im * y_46re) / y_46im) - x_46re) / y_46im
else if (y_46im <= 2.2d+26) then
tmp = (x_46im - ((x_46re * y_46im) / y_46re)) / y_46re
else
tmp = -x_46re / y_46im
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_im <= -1.7e+96) {
tmp = (((x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im;
} else if (y_46_im <= 2.2e+26) {
tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re;
} else {
tmp = -x_46_re / y_46_im;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_im <= -1.7e+96: tmp = (((x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im elif y_46_im <= 2.2e+26: tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re else: tmp = -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 <= -1.7e+96) tmp = Float64(Float64(Float64(Float64(x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im); elseif (y_46_im <= 2.2e+26) tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re * y_46_im) / y_46_re)) / y_46_re); else tmp = Float64(Float64(-x_46_re) / y_46_im); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_im <= -1.7e+96) tmp = (((x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im; elseif (y_46_im <= 2.2e+26) tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re; else tmp = -x_46_re / y_46_im; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -1.7e+96], N[(N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 2.2e+26], N[(N[(x$46$im - N[(N[(x$46$re * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], N[((-x$46$re) / y$46$im), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -1.7 \cdot 10^{+96}:\\
\;\;\;\;\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}\\
\mathbf{elif}\;y.im \leq 2.2 \cdot 10^{+26}:\\
\;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x.re}{y.im}\\
\end{array}
\end{array}
if y.im < -1.7e96Initial program 38.8%
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
lower--.f64N/A
lower-/.f64N/A
lower-*.f6484.5
Applied rewrites84.5%
if -1.7e96 < y.im < 2.20000000000000007e26Initial program 71.7%
Taylor expanded in y.re around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
lower-*.f6482.1
Applied rewrites82.1%
if 2.20000000000000007e26 < y.im Initial program 46.5%
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.3
Applied rewrites67.3%
Final simplification79.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -1.7e+96) (not (<= y.im 2.9))) (/ (- 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_im <= -1.7e+96) || !(y_46_im <= 2.9)) {
tmp = -x_46_re / y_46_im;
} else {
tmp = x_46_im / 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 <= (-1.7d+96)) .or. (.not. (y_46im <= 2.9d0))) then
tmp = -x_46re / y_46im
else
tmp = x_46im / 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 <= -1.7e+96) || !(y_46_im <= 2.9)) {
tmp = -x_46_re / y_46_im;
} else {
tmp = x_46_im / 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 <= -1.7e+96) or not (y_46_im <= 2.9): 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_im <= -1.7e+96) || !(y_46_im <= 2.9)) tmp = Float64(Float64(-x_46_re) / y_46_im); else tmp = Float64(x_46_im / 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 <= -1.7e+96) || ~((y_46_im <= 2.9))) tmp = -x_46_re / y_46_im; else tmp = x_46_im / 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, -1.7e+96], N[Not[LessEqual[y$46$im, 2.9]], $MachinePrecision]], 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.im \leq -1.7 \cdot 10^{+96} \lor \neg \left(y.im \leq 2.9\right):\\
\;\;\;\;\frac{-x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.im < -1.7e96 or 2.89999999999999991 < y.im Initial program 44.5%
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.f6470.1
Applied rewrites70.1%
if -1.7e96 < y.im < 2.89999999999999991Initial program 71.1%
Taylor expanded in y.re around inf
lower-/.f6466.9
Applied rewrites66.9%
Final simplification68.3%
(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 59.3%
Taylor expanded in y.re around inf
lower-/.f6445.0
Applied rewrites45.0%
herbie shell --seed 2024321
(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))))