
(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
(/ (- (* y.re x.im) (* y.im x.re)) (+ (* y.re y.re) (* y.im y.im)))))
(if (<= y.im -4.4e+112)
(- (/ y.re (/ y.im (/ x.im y.im))) (/ x.re y.im))
(if (<= y.im -2.15e-156)
t_0
(if (<= y.im 1.95e-115)
(- (/ x.im y.re) (/ (/ (* y.im x.re) y.re) y.re))
(if (<= y.im 9.6e+17)
t_0
(- (* (/ x.im y.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 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 tmp;
if (y_46_im <= -4.4e+112) {
tmp = (y_46_re / (y_46_im / (x_46_im / y_46_im))) - (x_46_re / y_46_im);
} else if (y_46_im <= -2.15e-156) {
tmp = t_0;
} else if (y_46_im <= 1.95e-115) {
tmp = (x_46_im / y_46_re) - (((y_46_im * x_46_re) / y_46_re) / y_46_re);
} else if (y_46_im <= 9.6e+17) {
tmp = t_0;
} else {
tmp = ((x_46_im / y_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) :: t_0
real(8) :: tmp
t_0 = ((y_46re * x_46im) - (y_46im * x_46re)) / ((y_46re * y_46re) + (y_46im * y_46im))
if (y_46im <= (-4.4d+112)) then
tmp = (y_46re / (y_46im / (x_46im / y_46im))) - (x_46re / y_46im)
else if (y_46im <= (-2.15d-156)) then
tmp = t_0
else if (y_46im <= 1.95d-115) then
tmp = (x_46im / y_46re) - (((y_46im * x_46re) / y_46re) / y_46re)
else if (y_46im <= 9.6d+17) then
tmp = t_0
else
tmp = ((x_46im / y_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 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 tmp;
if (y_46_im <= -4.4e+112) {
tmp = (y_46_re / (y_46_im / (x_46_im / y_46_im))) - (x_46_re / y_46_im);
} else if (y_46_im <= -2.15e-156) {
tmp = t_0;
} else if (y_46_im <= 1.95e-115) {
tmp = (x_46_im / y_46_re) - (((y_46_im * x_46_re) / y_46_re) / y_46_re);
} else if (y_46_im <= 9.6e+17) {
tmp = t_0;
} else {
tmp = ((x_46_im / y_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): 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)) tmp = 0 if y_46_im <= -4.4e+112: tmp = (y_46_re / (y_46_im / (x_46_im / y_46_im))) - (x_46_re / y_46_im) elif y_46_im <= -2.15e-156: tmp = t_0 elif y_46_im <= 1.95e-115: tmp = (x_46_im / y_46_re) - (((y_46_im * x_46_re) / y_46_re) / y_46_re) elif y_46_im <= 9.6e+17: tmp = t_0 else: tmp = ((x_46_im / y_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) 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))) tmp = 0.0 if (y_46_im <= -4.4e+112) tmp = Float64(Float64(y_46_re / Float64(y_46_im / Float64(x_46_im / y_46_im))) - Float64(x_46_re / y_46_im)); elseif (y_46_im <= -2.15e-156) tmp = t_0; elseif (y_46_im <= 1.95e-115) tmp = Float64(Float64(x_46_im / y_46_re) - Float64(Float64(Float64(y_46_im * x_46_re) / y_46_re) / y_46_re)); elseif (y_46_im <= 9.6e+17) tmp = t_0; else tmp = Float64(Float64(Float64(x_46_im / y_46_im) * Float64(y_46_re / y_46_im)) - 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) 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)); tmp = 0.0; if (y_46_im <= -4.4e+112) tmp = (y_46_re / (y_46_im / (x_46_im / y_46_im))) - (x_46_re / y_46_im); elseif (y_46_im <= -2.15e-156) tmp = t_0; elseif (y_46_im <= 1.95e-115) tmp = (x_46_im / y_46_re) - (((y_46_im * x_46_re) / y_46_re) / y_46_re); elseif (y_46_im <= 9.6e+17) tmp = t_0; else tmp = ((x_46_im / y_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_] := 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]}, If[LessEqual[y$46$im, -4.4e+112], N[(N[(y$46$re / N[(y$46$im / N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, -2.15e-156], t$95$0, If[LessEqual[y$46$im, 1.95e-115], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(N[(N[(y$46$im * x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 9.6e+17], t$95$0, N[(N[(N[(x$46$im / y$46$im), $MachinePrecision] * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]]]]]]
\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}\\
\mathbf{if}\;y.im \leq -4.4 \cdot 10^{+112}:\\
\;\;\;\;\frac{y.re}{\frac{y.im}{\frac{x.im}{y.im}}} - \frac{x.re}{y.im}\\
\mathbf{elif}\;y.im \leq -2.15 \cdot 10^{-156}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y.im \leq 1.95 \cdot 10^{-115}:\\
\;\;\;\;\frac{x.im}{y.re} - \frac{\frac{y.im \cdot x.re}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 9.6 \cdot 10^{+17}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im} \cdot \frac{y.re}{y.im} - \frac{x.re}{y.im}\\
\end{array}
\end{array}
if y.im < -4.3999999999999999e112Initial program 39.8%
Taylor expanded in y.re around 0 74.6%
+-commutative74.6%
mul-1-neg74.6%
unsub-neg74.6%
*-commutative74.6%
associate-/l*80.0%
Simplified80.0%
pow280.0%
*-un-lft-identity80.0%
times-frac88.9%
Applied egg-rr88.9%
/-rgt-identity88.9%
clear-num88.8%
un-div-inv89.0%
Applied egg-rr89.0%
if -4.3999999999999999e112 < y.im < -2.14999999999999989e-156 or 1.9499999999999999e-115 < y.im < 9.6e17Initial program 84.4%
if -2.14999999999999989e-156 < y.im < 1.9499999999999999e-115Initial program 59.0%
Taylor expanded in y.re around inf 77.5%
+-commutative77.5%
mul-1-neg77.5%
unsub-neg77.5%
associate-/l*78.6%
associate-/r/71.9%
Simplified71.9%
pow271.9%
associate-*l/77.5%
associate-/r*93.3%
Applied egg-rr93.3%
if 9.6e17 < y.im Initial program 42.6%
Taylor expanded in y.re around 0 75.8%
+-commutative75.8%
mul-1-neg75.8%
unsub-neg75.8%
*-commutative75.8%
associate-/l*79.8%
Simplified79.8%
pow279.8%
*-un-lft-identity79.8%
times-frac83.8%
Applied egg-rr83.8%
/-rgt-identity83.8%
associate-/r*86.2%
div-inv86.2%
clear-num86.2%
Applied egg-rr86.2%
Final simplification87.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -6.8e-29)
(/ (- (* y.re (/ x.im y.im)) x.re) y.im)
(if (<= y.im 1.3e-14)
(/ x.im y.re)
(- (* (/ x.im y.im) (/ y.re y.im)) (/ x.re y.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_im <= -6.8e-29) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
} else if (y_46_im <= 1.3e-14) {
tmp = x_46_im / y_46_re;
} else {
tmp = ((x_46_im / y_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_46im <= (-6.8d-29)) then
tmp = ((y_46re * (x_46im / y_46im)) - x_46re) / y_46im
else if (y_46im <= 1.3d-14) then
tmp = x_46im / y_46re
else
tmp = ((x_46im / y_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_im <= -6.8e-29) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
} else if (y_46_im <= 1.3e-14) {
tmp = x_46_im / y_46_re;
} else {
tmp = ((x_46_im / y_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_im <= -6.8e-29: tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im elif y_46_im <= 1.3e-14: tmp = x_46_im / y_46_re else: tmp = ((x_46_im / y_46_im) * (y_46_re / y_46_im)) - (x_46_re / y_46_im) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_im <= -6.8e-29) tmp = Float64(Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re) / y_46_im); elseif (y_46_im <= 1.3e-14) tmp = Float64(x_46_im / y_46_re); else tmp = Float64(Float64(Float64(x_46_im / y_46_im) * Float64(y_46_re / y_46_im)) - 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 <= -6.8e-29) tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im; elseif (y_46_im <= 1.3e-14) tmp = x_46_im / y_46_re; else tmp = ((x_46_im / y_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[LessEqual[y$46$im, -6.8e-29], 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$im, 1.3e-14], N[(x$46$im / y$46$re), $MachinePrecision], N[(N[(N[(x$46$im / y$46$im), $MachinePrecision] * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -6.8 \cdot 10^{-29}:\\
\;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\
\mathbf{elif}\;y.im \leq 1.3 \cdot 10^{-14}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im} \cdot \frac{y.re}{y.im} - \frac{x.re}{y.im}\\
\end{array}
\end{array}
if y.im < -6.79999999999999945e-29Initial program 62.5%
Taylor expanded in y.re around 0 73.9%
+-commutative73.9%
mul-1-neg73.9%
unsub-neg73.9%
*-commutative73.9%
associate-/l*77.1%
Simplified77.1%
pow277.1%
*-un-lft-identity77.1%
times-frac82.4%
Applied egg-rr82.4%
/-rgt-identity82.4%
*-un-lft-identity82.4%
times-frac82.4%
Applied egg-rr82.4%
associate-*l/82.4%
*-un-lft-identity82.4%
sub-div82.4%
div-inv82.4%
clear-num82.4%
Applied egg-rr82.4%
if -6.79999999999999945e-29 < y.im < 1.29999999999999998e-14Initial program 68.0%
Taylor expanded in y.re around inf 69.3%
if 1.29999999999999998e-14 < y.im Initial program 45.8%
Taylor expanded in y.re around 0 75.2%
+-commutative75.2%
mul-1-neg75.2%
unsub-neg75.2%
*-commutative75.2%
associate-/l*78.9%
Simplified78.9%
pow278.9%
*-un-lft-identity78.9%
times-frac82.6%
Applied egg-rr82.6%
/-rgt-identity82.6%
associate-/r*84.8%
div-inv84.8%
clear-num84.8%
Applied egg-rr84.8%
Final simplification77.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -2.4e-25)
(/ (- (* y.re (/ x.im y.im)) x.re) y.im)
(if (<= y.im 8e-13)
(- (/ x.im y.re) (/ (/ (* y.im x.re) y.re) y.re))
(- (* (/ x.im y.im) (/ y.re y.im)) (/ x.re y.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_im <= -2.4e-25) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
} else if (y_46_im <= 8e-13) {
tmp = (x_46_im / y_46_re) - (((y_46_im * x_46_re) / y_46_re) / y_46_re);
} else {
tmp = ((x_46_im / y_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_46im <= (-2.4d-25)) then
tmp = ((y_46re * (x_46im / y_46im)) - x_46re) / y_46im
else if (y_46im <= 8d-13) then
tmp = (x_46im / y_46re) - (((y_46im * x_46re) / y_46re) / y_46re)
else
tmp = ((x_46im / y_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_im <= -2.4e-25) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
} else if (y_46_im <= 8e-13) {
tmp = (x_46_im / y_46_re) - (((y_46_im * x_46_re) / y_46_re) / y_46_re);
} else {
tmp = ((x_46_im / y_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_im <= -2.4e-25: tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im elif y_46_im <= 8e-13: tmp = (x_46_im / y_46_re) - (((y_46_im * x_46_re) / y_46_re) / y_46_re) else: tmp = ((x_46_im / y_46_im) * (y_46_re / y_46_im)) - (x_46_re / y_46_im) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_im <= -2.4e-25) tmp = Float64(Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re) / y_46_im); elseif (y_46_im <= 8e-13) tmp = Float64(Float64(x_46_im / y_46_re) - Float64(Float64(Float64(y_46_im * x_46_re) / y_46_re) / y_46_re)); else tmp = Float64(Float64(Float64(x_46_im / y_46_im) * Float64(y_46_re / y_46_im)) - 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 <= -2.4e-25) tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im; elseif (y_46_im <= 8e-13) tmp = (x_46_im / y_46_re) - (((y_46_im * x_46_re) / y_46_re) / y_46_re); else tmp = ((x_46_im / y_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[LessEqual[y$46$im, -2.4e-25], 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$im, 8e-13], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(N[(N[(y$46$im * x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x$46$im / y$46$im), $MachinePrecision] * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -2.4 \cdot 10^{-25}:\\
\;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\
\mathbf{elif}\;y.im \leq 8 \cdot 10^{-13}:\\
\;\;\;\;\frac{x.im}{y.re} - \frac{\frac{y.im \cdot x.re}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im} \cdot \frac{y.re}{y.im} - \frac{x.re}{y.im}\\
\end{array}
\end{array}
if y.im < -2.40000000000000009e-25Initial program 62.5%
Taylor expanded in y.re around 0 73.9%
+-commutative73.9%
mul-1-neg73.9%
unsub-neg73.9%
*-commutative73.9%
associate-/l*77.1%
Simplified77.1%
pow277.1%
*-un-lft-identity77.1%
times-frac82.4%
Applied egg-rr82.4%
/-rgt-identity82.4%
*-un-lft-identity82.4%
times-frac82.4%
Applied egg-rr82.4%
associate-*l/82.4%
*-un-lft-identity82.4%
sub-div82.4%
div-inv82.4%
clear-num82.4%
Applied egg-rr82.4%
if -2.40000000000000009e-25 < y.im < 8.0000000000000002e-13Initial program 68.0%
Taylor expanded in y.re around inf 73.3%
+-commutative73.3%
mul-1-neg73.3%
unsub-neg73.3%
associate-/l*73.9%
associate-/r/70.2%
Simplified70.2%
pow270.2%
associate-*l/73.3%
associate-/r*82.1%
Applied egg-rr82.1%
if 8.0000000000000002e-13 < y.im Initial program 45.8%
Taylor expanded in y.re around 0 75.2%
+-commutative75.2%
mul-1-neg75.2%
unsub-neg75.2%
*-commutative75.2%
associate-/l*78.9%
Simplified78.9%
pow278.9%
*-un-lft-identity78.9%
times-frac82.6%
Applied egg-rr82.6%
/-rgt-identity82.6%
associate-/r*84.8%
div-inv84.8%
clear-num84.8%
Applied egg-rr84.8%
Final simplification83.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -7.2e-23)
(- (/ y.re (/ y.im (/ x.im y.im))) (/ x.re y.im))
(if (<= y.im 9.6e-15)
(- (/ x.im y.re) (/ (/ (* y.im x.re) y.re) y.re))
(- (* (/ x.im y.im) (/ y.re y.im)) (/ x.re y.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_im <= -7.2e-23) {
tmp = (y_46_re / (y_46_im / (x_46_im / y_46_im))) - (x_46_re / y_46_im);
} else if (y_46_im <= 9.6e-15) {
tmp = (x_46_im / y_46_re) - (((y_46_im * x_46_re) / y_46_re) / y_46_re);
} else {
tmp = ((x_46_im / y_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_46im <= (-7.2d-23)) then
tmp = (y_46re / (y_46im / (x_46im / y_46im))) - (x_46re / y_46im)
else if (y_46im <= 9.6d-15) then
tmp = (x_46im / y_46re) - (((y_46im * x_46re) / y_46re) / y_46re)
else
tmp = ((x_46im / y_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_im <= -7.2e-23) {
tmp = (y_46_re / (y_46_im / (x_46_im / y_46_im))) - (x_46_re / y_46_im);
} else if (y_46_im <= 9.6e-15) {
tmp = (x_46_im / y_46_re) - (((y_46_im * x_46_re) / y_46_re) / y_46_re);
} else {
tmp = ((x_46_im / y_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_im <= -7.2e-23: tmp = (y_46_re / (y_46_im / (x_46_im / y_46_im))) - (x_46_re / y_46_im) elif y_46_im <= 9.6e-15: tmp = (x_46_im / y_46_re) - (((y_46_im * x_46_re) / y_46_re) / y_46_re) else: tmp = ((x_46_im / y_46_im) * (y_46_re / y_46_im)) - (x_46_re / y_46_im) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_im <= -7.2e-23) tmp = Float64(Float64(y_46_re / Float64(y_46_im / Float64(x_46_im / y_46_im))) - Float64(x_46_re / y_46_im)); elseif (y_46_im <= 9.6e-15) tmp = Float64(Float64(x_46_im / y_46_re) - Float64(Float64(Float64(y_46_im * x_46_re) / y_46_re) / y_46_re)); else tmp = Float64(Float64(Float64(x_46_im / y_46_im) * Float64(y_46_re / y_46_im)) - 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 <= -7.2e-23) tmp = (y_46_re / (y_46_im / (x_46_im / y_46_im))) - (x_46_re / y_46_im); elseif (y_46_im <= 9.6e-15) tmp = (x_46_im / y_46_re) - (((y_46_im * x_46_re) / y_46_re) / y_46_re); else tmp = ((x_46_im / y_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[LessEqual[y$46$im, -7.2e-23], N[(N[(y$46$re / N[(y$46$im / N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 9.6e-15], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(N[(N[(y$46$im * x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x$46$im / y$46$im), $MachinePrecision] * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -7.2 \cdot 10^{-23}:\\
\;\;\;\;\frac{y.re}{\frac{y.im}{\frac{x.im}{y.im}}} - \frac{x.re}{y.im}\\
\mathbf{elif}\;y.im \leq 9.6 \cdot 10^{-15}:\\
\;\;\;\;\frac{x.im}{y.re} - \frac{\frac{y.im \cdot x.re}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im} \cdot \frac{y.re}{y.im} - \frac{x.re}{y.im}\\
\end{array}
\end{array}
if y.im < -7.1999999999999996e-23Initial program 62.5%
Taylor expanded in y.re around 0 73.9%
+-commutative73.9%
mul-1-neg73.9%
unsub-neg73.9%
*-commutative73.9%
associate-/l*77.1%
Simplified77.1%
pow277.1%
*-un-lft-identity77.1%
times-frac82.4%
Applied egg-rr82.4%
/-rgt-identity82.4%
clear-num82.4%
un-div-inv82.4%
Applied egg-rr82.4%
if -7.1999999999999996e-23 < y.im < 9.5999999999999998e-15Initial program 68.0%
Taylor expanded in y.re around inf 73.3%
+-commutative73.3%
mul-1-neg73.3%
unsub-neg73.3%
associate-/l*73.9%
associate-/r/70.2%
Simplified70.2%
pow270.2%
associate-*l/73.3%
associate-/r*82.1%
Applied egg-rr82.1%
if 9.5999999999999998e-15 < y.im Initial program 45.8%
Taylor expanded in y.re around 0 75.2%
+-commutative75.2%
mul-1-neg75.2%
unsub-neg75.2%
*-commutative75.2%
associate-/l*78.9%
Simplified78.9%
pow278.9%
*-un-lft-identity78.9%
times-frac82.6%
Applied egg-rr82.6%
/-rgt-identity82.6%
associate-/r*84.8%
div-inv84.8%
clear-num84.8%
Applied egg-rr84.8%
Final simplification83.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -2.05e-25) (not (<= y.im 1.15e-12))) (/ (- (* y.re (/ x.im y.im)) 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 <= -2.05e-25) || !(y_46_im <= 1.15e-12)) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - 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 <= (-2.05d-25)) .or. (.not. (y_46im <= 1.15d-12))) then
tmp = ((y_46re * (x_46im / y_46im)) - 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 <= -2.05e-25) || !(y_46_im <= 1.15e-12)) {
tmp = ((y_46_re * (x_46_im / y_46_im)) - 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 <= -2.05e-25) or not (y_46_im <= 1.15e-12): tmp = ((y_46_re * (x_46_im / y_46_im)) - 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 <= -2.05e-25) || !(y_46_im <= 1.15e-12)) tmp = Float64(Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - 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 <= -2.05e-25) || ~((y_46_im <= 1.15e-12))) tmp = ((y_46_re * (x_46_im / y_46_im)) - 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, -2.05e-25], N[Not[LessEqual[y$46$im, 1.15e-12]], $MachinePrecision]], N[(N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], N[(x$46$im / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -2.05 \cdot 10^{-25} \lor \neg \left(y.im \leq 1.15 \cdot 10^{-12}\right):\\
\;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.im < -2.04999999999999994e-25 or 1.14999999999999995e-12 < y.im Initial program 53.4%
Taylor expanded in y.re around 0 74.6%
+-commutative74.6%
mul-1-neg74.6%
unsub-neg74.6%
*-commutative74.6%
associate-/l*78.1%
Simplified78.1%
pow278.1%
*-un-lft-identity78.1%
times-frac82.5%
Applied egg-rr82.5%
/-rgt-identity82.5%
*-un-lft-identity82.5%
times-frac83.7%
Applied egg-rr83.7%
associate-*l/83.7%
*-un-lft-identity83.7%
sub-div83.7%
div-inv83.7%
clear-num83.7%
Applied egg-rr83.7%
if -2.04999999999999994e-25 < y.im < 1.14999999999999995e-12Initial program 68.0%
Taylor expanded in y.re around inf 69.3%
Final simplification77.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -9e-26) (not (<= y.im 5.5e-14))) (/ (- 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 <= -9e-26) || !(y_46_im <= 5.5e-14)) {
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 <= (-9d-26)) .or. (.not. (y_46im <= 5.5d-14))) 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 <= -9e-26) || !(y_46_im <= 5.5e-14)) {
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 <= -9e-26) or not (y_46_im <= 5.5e-14): 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 <= -9e-26) || !(y_46_im <= 5.5e-14)) 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 <= -9e-26) || ~((y_46_im <= 5.5e-14))) 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, -9e-26], N[Not[LessEqual[y$46$im, 5.5e-14]], $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 -9 \cdot 10^{-26} \lor \neg \left(y.im \leq 5.5 \cdot 10^{-14}\right):\\
\;\;\;\;\frac{-x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.im < -8.9999999999999998e-26 or 5.49999999999999991e-14 < y.im Initial program 53.4%
Taylor expanded in y.re around 0 71.1%
associate-*r/71.1%
neg-mul-171.1%
Simplified71.1%
if -8.9999999999999998e-26 < y.im < 5.49999999999999991e-14Initial program 68.0%
Taylor expanded in y.re around inf 69.3%
Final simplification70.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ x.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_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_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_im;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return x_46_im / y_46_im
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(x_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_im; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(x$46$im / y$46$im), $MachinePrecision]
\begin{array}{l}
\\
\frac{x.im}{y.im}
\end{array}
Initial program 59.9%
*-un-lft-identity59.9%
fma-def59.9%
add-sqr-sqrt59.9%
times-frac59.9%
fma-def59.9%
hypot-def59.9%
cancel-sign-sub-inv59.9%
add-sqr-sqrt27.1%
sqrt-unprod41.2%
sqr-neg41.2%
sqrt-unprod18.4%
add-sqr-sqrt36.7%
fma-def36.7%
fma-def36.7%
hypot-def44.7%
Applied egg-rr44.7%
Taylor expanded in y.im around -inf 32.7%
neg-mul-132.7%
+-commutative32.7%
unsub-neg32.7%
mul-1-neg32.7%
associate-/l*33.5%
distribute-neg-frac33.5%
Simplified33.5%
Taylor expanded in y.re around -inf 9.3%
Final simplification9.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.9%
Taylor expanded in y.re around inf 40.7%
Final simplification40.7%
herbie shell --seed 2024017
(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))))