
(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 (/ (- x.im (* y.im (/ x.re y.re))) y.re)))
(if (<= y.re -2.7e+65)
t_0
(if (<= y.re -2.4e-75)
(/ (fma x.im y.re (* y.im (- x.re))) (fma y.im y.im (* y.re y.re)))
(if (<= y.re 3.9e-156)
(/ (- (* y.re (/ x.im y.im)) x.re) y.im)
(if (<= y.re 4.6e+67)
(/ (- (* y.re x.im) (* y.im x.re)) (+ (* 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 = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
double tmp;
if (y_46_re <= -2.7e+65) {
tmp = t_0;
} else if (y_46_re <= -2.4e-75) {
tmp = fma(x_46_im, y_46_re, (y_46_im * -x_46_re)) / fma(y_46_im, y_46_im, (y_46_re * y_46_re));
} else if (y_46_re <= 3.9e-156) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
} else if (y_46_re <= 4.6e+67) {
tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((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(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.7e+65) tmp = t_0; elseif (y_46_re <= -2.4e-75) tmp = Float64(fma(x_46_im, y_46_re, Float64(y_46_im * Float64(-x_46_re))) / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))); elseif (y_46_re <= 3.9e-156) tmp = Float64(Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re) / y_46_im); elseif (y_46_re <= 4.6e+67) tmp = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))); else tmp = t_0; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(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.7e+65], t$95$0, If[LessEqual[y$46$re, -2.4e-75], N[(N[(x$46$im * y$46$re + N[(y$46$im * (-x$46$re)), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 3.9e-156], N[(N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 4.6e+67], N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re}\\
\mathbf{if}\;y.re \leq -2.7 \cdot 10^{+65}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq -2.4 \cdot 10^{-75}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, y.re, y.im \cdot \left(-x.re\right)\right)}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\
\mathbf{elif}\;y.re \leq 3.9 \cdot 10^{-156}:\\
\;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\
\mathbf{elif}\;y.re \leq 4.6 \cdot 10^{+67}:\\
\;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.re < -2.70000000000000019e65 or 4.5999999999999997e67 < y.re Initial program 40.8%
fmm-def40.8%
distribute-rgt-neg-out40.8%
+-commutative40.8%
fma-define40.8%
Simplified40.8%
Taylor expanded in y.re around inf 73.8%
mul-1-neg73.8%
unsub-neg73.8%
*-commutative73.8%
associate-/l*81.7%
Simplified81.7%
if -2.70000000000000019e65 < y.re < -2.40000000000000019e-75Initial program 88.6%
fmm-def88.8%
distribute-rgt-neg-out88.8%
+-commutative88.8%
fma-define88.8%
Simplified88.8%
if -2.40000000000000019e-75 < y.re < 3.9000000000000001e-156Initial program 58.0%
fmm-def58.0%
distribute-rgt-neg-out58.0%
+-commutative58.0%
fma-define58.0%
Simplified58.0%
Taylor expanded in y.im around inf 88.9%
+-commutative88.9%
mul-1-neg88.9%
unsub-neg88.9%
associate-/l*89.6%
Applied egg-rr89.6%
Taylor expanded in x.im around 0 88.9%
*-commutative88.9%
associate-*r/90.3%
Simplified90.3%
if 3.9000000000000001e-156 < y.re < 4.5999999999999997e67Initial program 80.0%
Final simplification84.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(/ (- (* y.re x.im) (* y.im x.re)) (+ (* y.re y.re) (* y.im y.im))))
(t_1 (/ (- x.im (* y.im (/ x.re y.re))) y.re)))
(if (<= y.re -3.6e+62)
t_1
(if (<= y.re -4.2e-75)
t_0
(if (<= y.re 2.3e-154)
(/ (- (* y.re (/ x.im y.im)) x.re) y.im)
(if (<= y.re 1.4e+68) 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) - (y_46_im * x_46_re)) / ((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 <= -3.6e+62) {
tmp = t_1;
} else if (y_46_re <= -4.2e-75) {
tmp = t_0;
} else if (y_46_re <= 2.3e-154) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
} else if (y_46_re <= 1.4e+68) {
tmp = t_0;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = ((y_46re * x_46im) - (y_46im * x_46re)) / ((y_46re * y_46re) + (y_46im * y_46im))
t_1 = (x_46im - (y_46im * (x_46re / y_46re))) / y_46re
if (y_46re <= (-3.6d+62)) then
tmp = t_1
else if (y_46re <= (-4.2d-75)) then
tmp = t_0
else if (y_46re <= 2.3d-154) then
tmp = ((y_46re * (x_46im / y_46im)) - x_46re) / y_46im
else if (y_46re <= 1.4d+68) then
tmp = t_0
else
tmp = t_1
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 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((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 <= -3.6e+62) {
tmp = t_1;
} else if (y_46_re <= -4.2e-75) {
tmp = t_0;
} else if (y_46_re <= 2.3e-154) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
} else if (y_46_re <= 1.4e+68) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)) t_1 = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re tmp = 0 if y_46_re <= -3.6e+62: tmp = t_1 elif y_46_re <= -4.2e-75: tmp = t_0 elif y_46_re <= 2.3e-154: tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im elif y_46_re <= 1.4e+68: 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(y_46_im * x_46_re)) / Float64(Float64(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 <= -3.6e+62) tmp = t_1; elseif (y_46_re <= -4.2e-75) tmp = t_0; elseif (y_46_re <= 2.3e-154) tmp = Float64(Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re) / y_46_im); elseif (y_46_re <= 1.4e+68) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); t_1 = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re; tmp = 0.0; if (y_46_re <= -3.6e+62) tmp = t_1; elseif (y_46_re <= -4.2e-75) tmp = t_0; elseif (y_46_re <= 2.3e-154) tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im; elseif (y_46_re <= 1.4e+68) tmp = t_0; else tmp = t_1; end tmp_2 = 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[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + 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, -3.6e+62], t$95$1, If[LessEqual[y$46$re, -4.2e-75], t$95$0, If[LessEqual[y$46$re, 2.3e-154], N[(N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 1.4e+68], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\
t_1 := \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re}\\
\mathbf{if}\;y.re \leq -3.6 \cdot 10^{+62}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.re \leq -4.2 \cdot 10^{-75}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 2.3 \cdot 10^{-154}:\\
\;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\
\mathbf{elif}\;y.re \leq 1.4 \cdot 10^{+68}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.re < -3.6e62 or 1.4e68 < y.re Initial program 40.8%
fmm-def40.8%
distribute-rgt-neg-out40.8%
+-commutative40.8%
fma-define40.8%
Simplified40.8%
Taylor expanded in y.re around inf 73.8%
mul-1-neg73.8%
unsub-neg73.8%
*-commutative73.8%
associate-/l*81.7%
Simplified81.7%
if -3.6e62 < y.re < -4.2000000000000002e-75 or 2.3e-154 < y.re < 1.4e68Initial program 83.5%
if -4.2000000000000002e-75 < y.re < 2.3e-154Initial program 58.0%
fmm-def58.0%
distribute-rgt-neg-out58.0%
+-commutative58.0%
fma-define58.0%
Simplified58.0%
Taylor expanded in y.im around inf 88.9%
+-commutative88.9%
mul-1-neg88.9%
unsub-neg88.9%
associate-/l*89.6%
Applied egg-rr89.6%
Taylor expanded in x.im around 0 88.9%
*-commutative88.9%
associate-*r/90.3%
Simplified90.3%
Final simplification84.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -5e-8) (not (<= y.re 1.4e-30))) (/ (- x.im (* y.im (/ x.re y.re))) y.re) (/ (- (* y.re (/ x.im 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_re <= -5e-8) || !(y_46_re <= 1.4e-30)) {
tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
} else {
tmp = ((y_46_re * (x_46_im / y_46_im)) - 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_46re <= (-5d-8)) .or. (.not. (y_46re <= 1.4d-30))) then
tmp = (x_46im - (y_46im * (x_46re / y_46re))) / y_46re
else
tmp = ((y_46re * (x_46im / y_46im)) - 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_re <= -5e-8) || !(y_46_re <= 1.4e-30)) {
tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
} else {
tmp = ((y_46_re * (x_46_im / y_46_im)) - 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_re <= -5e-8) or not (y_46_re <= 1.4e-30): tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re else: tmp = ((y_46_re * (x_46_im / 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_re <= -5e-8) || !(y_46_re <= 1.4e-30)) tmp = Float64(Float64(x_46_im - Float64(y_46_im * Float64(x_46_re / y_46_re))) / y_46_re); else tmp = Float64(Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - 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_re <= -5e-8) || ~((y_46_re <= 1.4e-30))) tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re; else tmp = ((y_46_re * (x_46_im / y_46_im)) - 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[Or[LessEqual[y$46$re, -5e-8], N[Not[LessEqual[y$46$re, 1.4e-30]], $MachinePrecision]], N[(N[(x$46$im - N[(y$46$im * N[(x$46$re / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], N[(N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -5 \cdot 10^{-8} \lor \neg \left(y.re \leq 1.4 \cdot 10^{-30}\right):\\
\;\;\;\;\frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\
\end{array}
\end{array}
if y.re < -4.9999999999999998e-8 or 1.39999999999999994e-30 < y.re Initial program 49.4%
fmm-def49.4%
distribute-rgt-neg-out49.4%
+-commutative49.4%
fma-define49.4%
Simplified49.4%
Taylor expanded in y.re around inf 70.5%
mul-1-neg70.5%
unsub-neg70.5%
*-commutative70.5%
associate-/l*76.7%
Simplified76.7%
if -4.9999999999999998e-8 < y.re < 1.39999999999999994e-30Initial program 67.0%
fmm-def67.0%
distribute-rgt-neg-out67.0%
+-commutative67.0%
fma-define67.0%
Simplified67.0%
Taylor expanded in y.im around inf 84.5%
+-commutative84.5%
mul-1-neg84.5%
unsub-neg84.5%
associate-/l*84.4%
Applied egg-rr84.4%
Taylor expanded in x.im around 0 84.5%
*-commutative84.5%
associate-*r/85.5%
Simplified85.5%
Final simplification80.5%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -6.2e-8) (not (<= y.re 5.9e-30))) (/ (- x.im (* y.im (/ x.re y.re))) y.re) (/ (- (* 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_re <= -6.2e-8) || !(y_46_re <= 5.9e-30)) {
tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
} else {
tmp = ((x_46_im * (y_46_re / y_46_im)) - 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_46re <= (-6.2d-8)) .or. (.not. (y_46re <= 5.9d-30))) then
tmp = (x_46im - (y_46im * (x_46re / y_46re))) / y_46re
else
tmp = ((x_46im * (y_46re / y_46im)) - 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_re <= -6.2e-8) || !(y_46_re <= 5.9e-30)) {
tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
} else {
tmp = ((x_46_im * (y_46_re / y_46_im)) - 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_re <= -6.2e-8) or not (y_46_re <= 5.9e-30): tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re else: tmp = ((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_re <= -6.2e-8) || !(y_46_re <= 5.9e-30)) tmp = Float64(Float64(x_46_im - Float64(y_46_im * Float64(x_46_re / y_46_re))) / y_46_re); else tmp = Float64(Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - 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_re <= -6.2e-8) || ~((y_46_re <= 5.9e-30))) tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re; else tmp = ((x_46_im * (y_46_re / y_46_im)) - 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[Or[LessEqual[y$46$re, -6.2e-8], N[Not[LessEqual[y$46$re, 5.9e-30]], $MachinePrecision]], N[(N[(x$46$im - N[(y$46$im * N[(x$46$re / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], N[(N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -6.2 \cdot 10^{-8} \lor \neg \left(y.re \leq 5.9 \cdot 10^{-30}\right):\\
\;\;\;\;\frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\
\end{array}
\end{array}
if y.re < -6.2e-8 or 5.89999999999999979e-30 < y.re Initial program 49.4%
fmm-def49.4%
distribute-rgt-neg-out49.4%
+-commutative49.4%
fma-define49.4%
Simplified49.4%
Taylor expanded in y.re around inf 70.5%
mul-1-neg70.5%
unsub-neg70.5%
*-commutative70.5%
associate-/l*76.7%
Simplified76.7%
if -6.2e-8 < y.re < 5.89999999999999979e-30Initial program 67.0%
fmm-def67.0%
distribute-rgt-neg-out67.0%
+-commutative67.0%
fma-define67.0%
Simplified67.0%
Taylor expanded in y.im around inf 84.5%
+-commutative84.5%
mul-1-neg84.5%
unsub-neg84.5%
associate-/l*84.4%
Applied egg-rr84.4%
Final simplification80.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -1.55e+131) (not (<= y.im 2.4e+87))) (/ x.re (- y.im)) (/ (- x.im (/ x.re (/ y.re y.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.55e+131) || !(y_46_im <= 2.4e+87)) {
tmp = x_46_re / -y_46_im;
} else {
tmp = (x_46_im - (x_46_re / (y_46_re / y_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.55d+131)) .or. (.not. (y_46im <= 2.4d+87))) then
tmp = x_46re / -y_46im
else
tmp = (x_46im - (x_46re / (y_46re / y_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.55e+131) || !(y_46_im <= 2.4e+87)) {
tmp = x_46_re / -y_46_im;
} else {
tmp = (x_46_im - (x_46_re / (y_46_re / y_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.55e+131) or not (y_46_im <= 2.4e+87): tmp = x_46_re / -y_46_im else: tmp = (x_46_im - (x_46_re / (y_46_re / y_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.55e+131) || !(y_46_im <= 2.4e+87)) tmp = Float64(x_46_re / Float64(-y_46_im)); else tmp = Float64(Float64(x_46_im - Float64(x_46_re / Float64(y_46_re / y_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.55e+131) || ~((y_46_im <= 2.4e+87))) tmp = x_46_re / -y_46_im; else tmp = (x_46_im - (x_46_re / (y_46_re / y_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.55e+131], N[Not[LessEqual[y$46$im, 2.4e+87]], $MachinePrecision]], N[(x$46$re / (-y$46$im)), $MachinePrecision], N[(N[(x$46$im - N[(x$46$re / N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -1.55 \cdot 10^{+131} \lor \neg \left(y.im \leq 2.4 \cdot 10^{+87}\right):\\
\;\;\;\;\frac{x.re}{-y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - \frac{x.re}{\frac{y.re}{y.im}}}{y.re}\\
\end{array}
\end{array}
if y.im < -1.55000000000000008e131 or 2.39999999999999981e87 < y.im Initial program 37.0%
fmm-def37.0%
distribute-rgt-neg-out37.0%
+-commutative37.0%
fma-define37.0%
Simplified37.0%
Taylor expanded in y.re around 0 78.4%
associate-*r/78.4%
neg-mul-178.4%
Simplified78.4%
if -1.55000000000000008e131 < y.im < 2.39999999999999981e87Initial program 67.8%
fmm-def67.8%
distribute-rgt-neg-out67.8%
+-commutative67.8%
fma-define67.8%
Simplified67.8%
Taylor expanded in y.re around inf 73.0%
mul-1-neg73.0%
unsub-neg73.0%
*-commutative73.0%
associate-/l*72.9%
Simplified72.9%
*-commutative72.9%
associate-*l/73.0%
associate-*r/74.5%
clear-num74.5%
un-div-inv74.5%
Applied egg-rr74.5%
Final simplification75.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -2.2e+132) (not (<= y.im 5.5e+87))) (/ 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 <= -2.2e+132) || !(y_46_im <= 5.5e+87)) {
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 <= (-2.2d+132)) .or. (.not. (y_46im <= 5.5d+87))) 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 <= -2.2e+132) || !(y_46_im <= 5.5e+87)) {
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 <= -2.2e+132) or not (y_46_im <= 5.5e+87): 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 <= -2.2e+132) || !(y_46_im <= 5.5e+87)) tmp = Float64(x_46_re / Float64(-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 <= -2.2e+132) || ~((y_46_im <= 5.5e+87))) 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, -2.2e+132], N[Not[LessEqual[y$46$im, 5.5e+87]], $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 -2.2 \cdot 10^{+132} \lor \neg \left(y.im \leq 5.5 \cdot 10^{+87}\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 < -2.19999999999999989e132 or 5.50000000000000022e87 < y.im Initial program 37.0%
fmm-def37.0%
distribute-rgt-neg-out37.0%
+-commutative37.0%
fma-define37.0%
Simplified37.0%
Taylor expanded in y.re around 0 78.4%
associate-*r/78.4%
neg-mul-178.4%
Simplified78.4%
if -2.19999999999999989e132 < y.im < 5.50000000000000022e87Initial program 67.8%
fmm-def67.8%
distribute-rgt-neg-out67.8%
+-commutative67.8%
fma-define67.8%
Simplified67.8%
Taylor expanded in y.re around inf 73.0%
mul-1-neg73.0%
unsub-neg73.0%
*-commutative73.0%
associate-/l*72.9%
Simplified72.9%
Final simplification74.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -1.02e-41) (not (<= y.im 4.2e+87))) (/ 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.02e-41) || !(y_46_im <= 4.2e+87)) {
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.02d-41)) .or. (.not. (y_46im <= 4.2d+87))) 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.02e-41) || !(y_46_im <= 4.2e+87)) {
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.02e-41) or not (y_46_im <= 4.2e+87): 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.02e-41) || !(y_46_im <= 4.2e+87)) tmp = Float64(x_46_re / Float64(-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.02e-41) || ~((y_46_im <= 4.2e+87))) 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.02e-41], N[Not[LessEqual[y$46$im, 4.2e+87]], $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.02 \cdot 10^{-41} \lor \neg \left(y.im \leq 4.2 \cdot 10^{+87}\right):\\
\;\;\;\;\frac{x.re}{-y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.im < -1.02e-41 or 4.2e87 < y.im Initial program 45.4%
fmm-def45.4%
distribute-rgt-neg-out45.4%
+-commutative45.4%
fma-define45.4%
Simplified45.4%
Taylor expanded in y.re around 0 68.3%
associate-*r/68.3%
neg-mul-168.3%
Simplified68.3%
if -1.02e-41 < y.im < 4.2e87Initial program 68.4%
fmm-def68.4%
distribute-rgt-neg-out68.4%
+-commutative68.4%
fma-define68.4%
Simplified68.4%
Taylor expanded in y.re around inf 65.9%
Final simplification67.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.im -3e+133) (/ 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 <= -3e+133) {
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 <= (-3d+133)) 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 <= -3e+133) {
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 <= -3e+133: 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 <= -3e+133) tmp = 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 <= -3e+133) 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[LessEqual[y$46$im, -3e+133], 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 -3 \cdot 10^{+133}:\\
\;\;\;\;\frac{x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.im < -3.00000000000000007e133Initial program 39.3%
fmm-def39.3%
distribute-rgt-neg-out39.3%
+-commutative39.3%
fma-define39.3%
Simplified39.3%
Taylor expanded in y.re around 0 81.7%
associate-*r/81.7%
neg-mul-181.7%
Simplified81.7%
div-inv81.6%
add-sqr-sqrt40.4%
sqrt-unprod47.4%
sqr-neg47.4%
sqrt-unprod12.0%
add-sqr-sqrt35.0%
Applied egg-rr35.0%
associate-*r/35.0%
*-rgt-identity35.0%
Simplified35.0%
if -3.00000000000000007e133 < y.im Initial program 60.2%
fmm-def60.2%
distribute-rgt-neg-out60.2%
+-commutative60.2%
fma-define60.2%
Simplified60.2%
Taylor expanded in y.re around inf 49.9%
(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 57.0%
fmm-def57.0%
distribute-rgt-neg-out57.0%
+-commutative57.0%
fma-define57.0%
Simplified57.0%
Taylor expanded in y.re around inf 44.8%
herbie shell --seed 2024188
(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))))