
(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 8 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
(/ 1.0 (hypot y.re y.im))
(* y.re (/ x.im (hypot y.re y.im)))
(/ (* y.im (- x.re)) (pow (hypot y.re y.im) 2.0))))
(t_1 (/ (- (* x.im (/ y.re y.im)) x.re) y.im)))
(if (<= y.im -9e+150)
t_1
(if (<= y.im -3.5e-114)
t_0
(if (<= y.im 4.8e-179)
(/ (- x.im (/ (* y.im x.re) y.re)) y.re)
(if (<= y.im 1.85e+131) 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((1.0 / hypot(y_46_re, y_46_im)), (y_46_re * (x_46_im / hypot(y_46_re, y_46_im))), ((y_46_im * -x_46_re) / pow(hypot(y_46_re, y_46_im), 2.0)));
double t_1 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -9e+150) {
tmp = t_1;
} else if (y_46_im <= -3.5e-114) {
tmp = t_0;
} else if (y_46_im <= 4.8e-179) {
tmp = (x_46_im - ((y_46_im * x_46_re) / y_46_re)) / y_46_re;
} else if (y_46_im <= 1.85e+131) {
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 = fma(Float64(1.0 / hypot(y_46_re, y_46_im)), Float64(y_46_re * Float64(x_46_im / hypot(y_46_re, y_46_im))), Float64(Float64(y_46_im * Float64(-x_46_re)) / (hypot(y_46_re, y_46_im) ^ 2.0))) t_1 = Float64(Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im) tmp = 0.0 if (y_46_im <= -9e+150) tmp = t_1; elseif (y_46_im <= -3.5e-114) tmp = t_0; elseif (y_46_im <= 4.8e-179) tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im * x_46_re) / y_46_re)) / y_46_re); elseif (y_46_im <= 1.85e+131) 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[(1.0 / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(y$46$re * N[(x$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(y$46$im * (-x$46$re)), $MachinePrecision] / N[Power[N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -9e+150], t$95$1, If[LessEqual[y$46$im, -3.5e-114], t$95$0, If[LessEqual[y$46$im, 4.8e-179], N[(N[(x$46$im - N[(N[(y$46$im * x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 1.85e+131], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{y.im \cdot \left(-x.re\right)}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)\\
t_1 := \frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\
\mathbf{if}\;y.im \leq -9 \cdot 10^{+150}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq -3.5 \cdot 10^{-114}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 4.8 \cdot 10^{-179}:\\
\;\;\;\;\frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 1.85 \cdot 10^{+131}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.im < -9.00000000000000001e150 or 1.84999999999999998e131 < y.im Initial program 27.5%
fmm-def27.5%
distribute-rgt-neg-out27.5%
+-commutative27.5%
fma-define27.5%
Simplified27.5%
distribute-rgt-neg-out27.5%
fmm-def27.5%
fma-undefine27.5%
+-commutative27.5%
div-sub27.5%
*-un-lft-identity27.5%
add-sqr-sqrt27.5%
times-frac27.5%
fmm-def27.5%
hypot-define27.5%
hypot-define31.5%
associate-/l*35.7%
add-sqr-sqrt35.7%
Applied egg-rr35.7%
*-commutative35.7%
associate-/l*43.8%
associate-*r/38.2%
distribute-frac-neg38.2%
*-commutative38.2%
distribute-rgt-neg-in38.2%
Simplified38.2%
Taylor expanded in y.im around inf 83.4%
+-commutative83.4%
mul-1-neg83.4%
sub-neg83.4%
associate-/l*89.1%
Simplified89.1%
if -9.00000000000000001e150 < y.im < -3.5e-114 or 4.8000000000000001e-179 < y.im < 1.84999999999999998e131Initial program 69.9%
fmm-def69.9%
distribute-rgt-neg-out69.9%
+-commutative69.9%
fma-define69.9%
Simplified69.9%
distribute-rgt-neg-out69.9%
fmm-def69.9%
fma-undefine69.9%
+-commutative69.9%
div-sub69.9%
*-un-lft-identity69.9%
add-sqr-sqrt69.9%
times-frac69.8%
fmm-def69.8%
hypot-define69.8%
hypot-define77.3%
associate-/l*82.0%
add-sqr-sqrt82.0%
Applied egg-rr82.0%
*-commutative82.0%
associate-/l*95.3%
associate-*r/88.7%
distribute-frac-neg88.7%
*-commutative88.7%
distribute-rgt-neg-in88.7%
Simplified88.7%
if -3.5e-114 < y.im < 4.8000000000000001e-179Initial program 58.5%
fmm-def58.5%
distribute-rgt-neg-out58.5%
+-commutative58.5%
fma-define58.5%
Simplified58.5%
Taylor expanded in y.re around inf 93.4%
associate-*r/93.4%
neg-mul-193.4%
distribute-rgt-neg-in93.4%
Simplified93.4%
Final simplification90.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(/ (- (* x.im y.re) (* y.im x.re)) (+ (* y.re y.re) (* y.im y.im))))
(t_1 (/ (- (* x.im (/ y.re y.im)) x.re) y.im)))
(if (<= y.im -2.3e+80)
t_1
(if (<= y.im -1.45e-54)
t_0
(if (<= y.im 7e-125)
(/ (- x.im (/ (* y.im x.re) y.re)) y.re)
(if (<= y.im 5.5e+83) 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)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
double t_1 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -2.3e+80) {
tmp = t_1;
} else if (y_46_im <= -1.45e-54) {
tmp = t_0;
} else if (y_46_im <= 7e-125) {
tmp = (x_46_im - ((y_46_im * x_46_re) / y_46_re)) / y_46_re;
} else if (y_46_im <= 5.5e+83) {
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 = ((x_46im * y_46re) - (y_46im * x_46re)) / ((y_46re * y_46re) + (y_46im * y_46im))
t_1 = ((x_46im * (y_46re / y_46im)) - x_46re) / y_46im
if (y_46im <= (-2.3d+80)) then
tmp = t_1
else if (y_46im <= (-1.45d-54)) then
tmp = t_0
else if (y_46im <= 7d-125) then
tmp = (x_46im - ((y_46im * x_46re) / y_46re)) / y_46re
else if (y_46im <= 5.5d+83) 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 = ((x_46_im * y_46_re) - (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_re / y_46_im)) - x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -2.3e+80) {
tmp = t_1;
} else if (y_46_im <= -1.45e-54) {
tmp = t_0;
} else if (y_46_im <= 7e-125) {
tmp = (x_46_im - ((y_46_im * x_46_re) / y_46_re)) / y_46_re;
} else if (y_46_im <= 5.5e+83) {
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 = ((x_46_im * y_46_re) - (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_re / y_46_im)) - x_46_re) / y_46_im tmp = 0 if y_46_im <= -2.3e+80: tmp = t_1 elif y_46_im <= -1.45e-54: tmp = t_0 elif y_46_im <= 7e-125: tmp = (x_46_im - ((y_46_im * x_46_re) / y_46_re)) / y_46_re elif y_46_im <= 5.5e+83: 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)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))) t_1 = Float64(Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im) tmp = 0.0 if (y_46_im <= -2.3e+80) tmp = t_1; elseif (y_46_im <= -1.45e-54) tmp = t_0; elseif (y_46_im <= 7e-125) tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im * x_46_re) / y_46_re)) / y_46_re); elseif (y_46_im <= 5.5e+83) 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 = ((x_46_im * y_46_re) - (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_re / y_46_im)) - x_46_re) / y_46_im; tmp = 0.0; if (y_46_im <= -2.3e+80) tmp = t_1; elseif (y_46_im <= -1.45e-54) tmp = t_0; elseif (y_46_im <= 7e-125) tmp = (x_46_im - ((y_46_im * x_46_re) / y_46_re)) / y_46_re; elseif (y_46_im <= 5.5e+83) 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[(x$46$im * y$46$re), $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[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -2.3e+80], t$95$1, If[LessEqual[y$46$im, -1.45e-54], t$95$0, If[LessEqual[y$46$im, 7e-125], N[(N[(x$46$im - N[(N[(y$46$im * x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 5.5e+83], 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}{y.re \cdot y.re + y.im \cdot y.im}\\
t_1 := \frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\
\mathbf{if}\;y.im \leq -2.3 \cdot 10^{+80}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq -1.45 \cdot 10^{-54}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 7 \cdot 10^{-125}:\\
\;\;\;\;\frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 5.5 \cdot 10^{+83}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.im < -2.30000000000000004e80 or 5.4999999999999996e83 < y.im Initial program 35.6%
fmm-def35.7%
distribute-rgt-neg-out35.7%
+-commutative35.7%
fma-define35.7%
Simplified35.7%
distribute-rgt-neg-out35.7%
fmm-def35.6%
fma-undefine35.6%
+-commutative35.6%
div-sub35.6%
*-un-lft-identity35.6%
add-sqr-sqrt35.6%
times-frac35.6%
fmm-def35.6%
hypot-define35.6%
hypot-define41.5%
associate-/l*46.6%
add-sqr-sqrt46.6%
Applied egg-rr46.6%
*-commutative46.6%
associate-/l*57.5%
associate-*r/50.4%
distribute-frac-neg50.4%
*-commutative50.4%
distribute-rgt-neg-in50.4%
Simplified50.4%
Taylor expanded in y.im around inf 78.1%
+-commutative78.1%
mul-1-neg78.1%
sub-neg78.1%
associate-/l*83.3%
Simplified83.3%
if -2.30000000000000004e80 < y.im < -1.45000000000000007e-54 or 6.99999999999999995e-125 < y.im < 5.4999999999999996e83Initial program 78.2%
if -1.45000000000000007e-54 < y.im < 6.99999999999999995e-125Initial program 58.5%
fmm-def58.5%
distribute-rgt-neg-out58.5%
+-commutative58.5%
fma-define58.5%
Simplified58.5%
Taylor expanded in y.re around inf 90.8%
associate-*r/90.8%
neg-mul-190.8%
distribute-rgt-neg-in90.8%
Simplified90.8%
Final simplification85.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -7.5e+27) (not (<= y.re 1.58e+44))) (/ (- 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 <= -7.5e+27) || !(y_46_re <= 1.58e+44)) {
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 <= (-7.5d+27)) .or. (.not. (y_46re <= 1.58d+44))) 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 <= -7.5e+27) || !(y_46_re <= 1.58e+44)) {
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 <= -7.5e+27) or not (y_46_re <= 1.58e+44): 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 <= -7.5e+27) || !(y_46_re <= 1.58e+44)) 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(Float64(x_46_im * 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 <= -7.5e+27) || ~((y_46_re <= 1.58e+44))) 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, -7.5e+27], N[Not[LessEqual[y$46$re, 1.58e+44]], $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[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -7.5 \cdot 10^{+27} \lor \neg \left(y.re \leq 1.58 \cdot 10^{+44}\right):\\
\;\;\;\;\frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}\\
\end{array}
\end{array}
if y.re < -7.5000000000000002e27 or 1.57999999999999993e44 < y.re Initial program 39.2%
fmm-def39.2%
distribute-rgt-neg-out39.2%
+-commutative39.2%
fma-define39.2%
Simplified39.2%
Taylor expanded in y.re around inf 73.9%
mul-1-neg73.9%
unsub-neg73.9%
*-commutative73.9%
associate-/l*79.9%
Simplified79.9%
if -7.5000000000000002e27 < y.re < 1.57999999999999993e44Initial program 65.3%
fmm-def65.4%
distribute-rgt-neg-out65.4%
+-commutative65.4%
fma-define65.4%
Simplified65.4%
distribute-rgt-neg-out65.4%
fmm-def65.3%
fma-undefine65.3%
+-commutative65.3%
div-sub60.2%
*-un-lft-identity60.2%
add-sqr-sqrt60.2%
times-frac60.3%
fmm-def60.3%
hypot-define60.3%
hypot-define61.8%
associate-/l*68.0%
add-sqr-sqrt68.0%
Applied egg-rr68.0%
*-commutative68.0%
associate-/l*70.7%
associate-*r/63.8%
distribute-frac-neg63.8%
*-commutative63.8%
distribute-rgt-neg-in63.8%
Simplified63.8%
Taylor expanded in y.im around inf 81.7%
+-commutative81.7%
mul-1-neg81.7%
sub-neg81.7%
associate-/l*81.5%
Simplified81.5%
Taylor expanded in x.im around 0 81.7%
Final simplification80.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -9.6e+27) (not (<= y.re 1.25e+44))) (/ (- 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 <= -9.6e+27) || !(y_46_re <= 1.25e+44)) {
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 <= (-9.6d+27)) .or. (.not. (y_46re <= 1.25d+44))) 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 <= -9.6e+27) || !(y_46_re <= 1.25e+44)) {
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 <= -9.6e+27) or not (y_46_re <= 1.25e+44): 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 <= -9.6e+27) || !(y_46_re <= 1.25e+44)) 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 <= -9.6e+27) || ~((y_46_re <= 1.25e+44))) 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, -9.6e+27], N[Not[LessEqual[y$46$re, 1.25e+44]], $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 -9.6 \cdot 10^{+27} \lor \neg \left(y.re \leq 1.25 \cdot 10^{+44}\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 < -9.59999999999999991e27 or 1.2499999999999999e44 < y.re Initial program 39.2%
fmm-def39.2%
distribute-rgt-neg-out39.2%
+-commutative39.2%
fma-define39.2%
Simplified39.2%
Taylor expanded in y.re around inf 73.9%
mul-1-neg73.9%
unsub-neg73.9%
*-commutative73.9%
associate-/l*79.9%
Simplified79.9%
if -9.59999999999999991e27 < y.re < 1.2499999999999999e44Initial program 65.3%
fmm-def65.4%
distribute-rgt-neg-out65.4%
+-commutative65.4%
fma-define65.4%
Simplified65.4%
distribute-rgt-neg-out65.4%
fmm-def65.3%
fma-undefine65.3%
+-commutative65.3%
div-sub60.2%
*-un-lft-identity60.2%
add-sqr-sqrt60.2%
times-frac60.3%
fmm-def60.3%
hypot-define60.3%
hypot-define61.8%
associate-/l*68.0%
add-sqr-sqrt68.0%
Applied egg-rr68.0%
*-commutative68.0%
associate-/l*70.7%
associate-*r/63.8%
distribute-frac-neg63.8%
*-commutative63.8%
distribute-rgt-neg-in63.8%
Simplified63.8%
Taylor expanded in y.im around inf 81.7%
+-commutative81.7%
mul-1-neg81.7%
sub-neg81.7%
associate-/l*81.5%
Simplified81.5%
Final simplification80.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -3.15e+50) (not (<= y.im 2.05e+75))) (/ 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 <= -3.15e+50) || !(y_46_im <= 2.05e+75)) {
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 <= (-3.15d+50)) .or. (.not. (y_46im <= 2.05d+75))) 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 <= -3.15e+50) || !(y_46_im <= 2.05e+75)) {
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 <= -3.15e+50) or not (y_46_im <= 2.05e+75): 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 <= -3.15e+50) || !(y_46_im <= 2.05e+75)) 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 <= -3.15e+50) || ~((y_46_im <= 2.05e+75))) 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, -3.15e+50], N[Not[LessEqual[y$46$im, 2.05e+75]], $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 -3.15 \cdot 10^{+50} \lor \neg \left(y.im \leq 2.05 \cdot 10^{+75}\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 < -3.14999999999999993e50 or 2.0499999999999999e75 < y.im Initial program 41.5%
fmm-def41.5%
distribute-rgt-neg-out41.5%
+-commutative41.5%
fma-define41.5%
Simplified41.5%
Taylor expanded in y.re around 0 71.2%
associate-*r/71.2%
neg-mul-171.2%
Simplified71.2%
if -3.14999999999999993e50 < y.im < 2.0499999999999999e75Initial program 63.7%
fmm-def63.7%
distribute-rgt-neg-out63.7%
+-commutative63.7%
fma-define63.7%
Simplified63.7%
Taylor expanded in y.re around inf 77.1%
mul-1-neg77.1%
unsub-neg77.1%
*-commutative77.1%
associate-/l*76.8%
Simplified76.8%
Final simplification74.4%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -1.4e+50) (not (<= y.im 1.25e-116))) (/ 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.4e+50) || !(y_46_im <= 1.25e-116)) {
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.4d+50)) .or. (.not. (y_46im <= 1.25d-116))) 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.4e+50) || !(y_46_im <= 1.25e-116)) {
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.4e+50) or not (y_46_im <= 1.25e-116): 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.4e+50) || !(y_46_im <= 1.25e-116)) 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.4e+50) || ~((y_46_im <= 1.25e-116))) 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.4e+50], N[Not[LessEqual[y$46$im, 1.25e-116]], $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.4 \cdot 10^{+50} \lor \neg \left(y.im \leq 1.25 \cdot 10^{-116}\right):\\
\;\;\;\;\frac{x.re}{-y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.im < -1.3999999999999999e50 or 1.2500000000000001e-116 < y.im Initial program 48.2%
fmm-def48.3%
distribute-rgt-neg-out48.3%
+-commutative48.3%
fma-define48.3%
Simplified48.3%
Taylor expanded in y.re around 0 64.4%
associate-*r/64.4%
neg-mul-164.4%
Simplified64.4%
if -1.3999999999999999e50 < y.im < 1.2500000000000001e-116Initial program 61.5%
fmm-def61.5%
distribute-rgt-neg-out61.5%
+-commutative61.5%
fma-define61.5%
Simplified61.5%
Taylor expanded in y.re around inf 70.2%
Final simplification67.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -1.26e+138) (not (<= y.im 3.6e+188))) (/ 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.26e+138) || !(y_46_im <= 3.6e+188)) {
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.26d+138)) .or. (.not. (y_46im <= 3.6d+188))) 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.26e+138) || !(y_46_im <= 3.6e+188)) {
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.26e+138) or not (y_46_im <= 3.6e+188): 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.26e+138) || !(y_46_im <= 3.6e+188)) 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 <= -1.26e+138) || ~((y_46_im <= 3.6e+188))) 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.26e+138], N[Not[LessEqual[y$46$im, 3.6e+188]], $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.26 \cdot 10^{+138} \lor \neg \left(y.im \leq 3.6 \cdot 10^{+188}\right):\\
\;\;\;\;\frac{x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.im < -1.25999999999999994e138 or 3.60000000000000021e188 < y.im Initial program 28.3%
fmm-def28.3%
distribute-rgt-neg-out28.3%
+-commutative28.3%
fma-define28.3%
Simplified28.3%
Taylor expanded in y.re around 0 80.4%
associate-*r/80.4%
neg-mul-180.4%
Simplified80.4%
div-inv80.1%
add-sqr-sqrt47.8%
sqrt-unprod42.6%
sqr-neg42.6%
sqrt-unprod13.1%
add-sqr-sqrt28.7%
Applied egg-rr28.7%
associate-*r/28.7%
*-rgt-identity28.7%
Simplified28.7%
if -1.25999999999999994e138 < y.im < 3.60000000000000021e188Initial program 62.7%
fmm-def62.7%
distribute-rgt-neg-out62.7%
+-commutative62.7%
fma-define62.7%
Simplified62.7%
Taylor expanded in y.re around inf 51.8%
Final simplification46.1%
(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 54.2%
fmm-def54.2%
distribute-rgt-neg-out54.2%
+-commutative54.2%
fma-define54.2%
Simplified54.2%
Taylor expanded in y.re around inf 42.6%
herbie shell --seed 2024165
(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))))