
(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 6 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) y.re) x.re) y.im)))
(if (<= y.im -4e-8)
t_0
(if (<= y.im 1.05e-40)
(/ (- x.im (* x.re (/ y.im y.re))) y.re)
(if (<= y.im 4.1e+80)
(/ (- (* x.im y.re) (* 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) * y_46_re) - x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -4e-8) {
tmp = t_0;
} else if (y_46_im <= 1.05e-40) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else if (y_46_im <= 4.1e+80) {
tmp = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
real(8) :: tmp
t_0 = (((x_46im / y_46im) * y_46re) - x_46re) / y_46im
if (y_46im <= (-4d-8)) then
tmp = t_0
else if (y_46im <= 1.05d-40) then
tmp = (x_46im - (x_46re * (y_46im / y_46re))) / y_46re
else if (y_46im <= 4.1d+80) then
tmp = ((x_46im * y_46re) - (y_46im * x_46re)) / ((y_46re * y_46re) + (y_46im * y_46im))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = (((x_46_im / y_46_im) * y_46_re) - x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -4e-8) {
tmp = t_0;
} else if (y_46_im <= 1.05e-40) {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
} else if (y_46_im <= 4.1e+80) {
tmp = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else {
tmp = t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = (((x_46_im / y_46_im) * y_46_re) - x_46_re) / y_46_im tmp = 0 if y_46_im <= -4e-8: tmp = t_0 elif y_46_im <= 1.05e-40: tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re elif y_46_im <= 4.1e+80: tmp = ((x_46_im * y_46_re) - (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(Float64(Float64(x_46_im / y_46_im) * y_46_re) - x_46_re) / y_46_im) tmp = 0.0 if (y_46_im <= -4e-8) tmp = t_0; elseif (y_46_im <= 1.05e-40) tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); elseif (y_46_im <= 4.1e+80) tmp = 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))); else tmp = t_0; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = (((x_46_im / y_46_im) * y_46_re) - x_46_re) / y_46_im; tmp = 0.0; if (y_46_im <= -4e-8) tmp = t_0; elseif (y_46_im <= 1.05e-40) tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re; elseif (y_46_im <= 4.1e+80) tmp = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); else tmp = t_0; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(N[(x$46$im / y$46$im), $MachinePrecision] * y$46$re), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -4e-8], t$95$0, If[LessEqual[y$46$im, 1.05e-40], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 4.1e+80], 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], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{x.im}{y.im} \cdot y.re - x.re}{y.im}\\
\mathbf{if}\;y.im \leq -4 \cdot 10^{-8}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 1.05 \cdot 10^{-40}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 4.1 \cdot 10^{+80}:\\
\;\;\;\;\frac{x.im \cdot y.re - 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.im < -4.0000000000000001e-8 or 4.10000000000000001e80 < y.im Initial program 48.4%
Taylor expanded in y.re around 0 78.4%
+-commutative78.4%
mul-1-neg78.4%
unsub-neg78.4%
unpow278.4%
associate-/r*80.5%
div-sub80.5%
associate-/l*84.5%
Simplified84.5%
clear-num84.5%
un-div-inv84.5%
Applied egg-rr84.5%
associate-/r/85.4%
Applied egg-rr85.4%
if -4.0000000000000001e-8 < y.im < 1.05000000000000009e-40Initial program 72.0%
Taylor expanded in y.re around inf 88.0%
remove-double-neg88.0%
mul-1-neg88.0%
neg-mul-188.0%
distribute-lft-in88.0%
mul-1-neg88.0%
distribute-neg-in88.0%
mul-1-neg88.0%
remove-double-neg88.0%
unsub-neg88.0%
associate-/l*88.1%
Simplified88.1%
if 1.05000000000000009e-40 < y.im < 4.10000000000000001e80Initial program 94.1%
Final simplification87.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -7.5e-9) (not (<= y.im 2.7e+26))) (/ x.re (- y.im)) (/ (- x.im (* x.re (/ y.im y.re))) y.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -7.5e-9) || !(y_46_im <= 2.7e+26)) {
tmp = x_46_re / -y_46_im;
} else {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if ((y_46im <= (-7.5d-9)) .or. (.not. (y_46im <= 2.7d+26))) then
tmp = x_46re / -y_46im
else
tmp = (x_46im - (x_46re * (y_46im / y_46re))) / y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -7.5e-9) || !(y_46_im <= 2.7e+26)) {
tmp = x_46_re / -y_46_im;
} else {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (y_46_im <= -7.5e-9) or not (y_46_im <= 2.7e+26): tmp = x_46_re / -y_46_im else: tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_im <= -7.5e-9) || !(y_46_im <= 2.7e+26)) tmp = Float64(x_46_re / Float64(-y_46_im)); else tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if ((y_46_im <= -7.5e-9) || ~((y_46_im <= 2.7e+26))) tmp = x_46_re / -y_46_im; else tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -7.5e-9], N[Not[LessEqual[y$46$im, 2.7e+26]], $MachinePrecision]], N[(x$46$re / (-y$46$im)), $MachinePrecision], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -7.5 \cdot 10^{-9} \lor \neg \left(y.im \leq 2.7 \cdot 10^{+26}\right):\\
\;\;\;\;\frac{x.re}{-y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\end{array}
\end{array}
if y.im < -7.49999999999999933e-9 or 2.7e26 < y.im Initial program 57.3%
Taylor expanded in y.re around 0 71.5%
associate-*r/71.5%
neg-mul-171.5%
Simplified71.5%
if -7.49999999999999933e-9 < y.im < 2.7e26Initial program 73.8%
Taylor expanded in y.re around inf 85.2%
remove-double-neg85.2%
mul-1-neg85.2%
neg-mul-185.2%
distribute-lft-in85.2%
mul-1-neg85.2%
distribute-neg-in85.2%
mul-1-neg85.2%
remove-double-neg85.2%
unsub-neg85.2%
associate-/l*85.3%
Simplified85.3%
Final simplification78.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -2.6e-8) (not (<= y.im 5.2e+25))) (/ (- (* x.im (/ y.re y.im)) x.re) y.im) (/ (- x.im (* x.re (/ y.im y.re))) y.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -2.6e-8) || !(y_46_im <= 5.2e+25)) {
tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
} else {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if ((y_46im <= (-2.6d-8)) .or. (.not. (y_46im <= 5.2d+25))) then
tmp = ((x_46im * (y_46re / y_46im)) - x_46re) / y_46im
else
tmp = (x_46im - (x_46re * (y_46im / y_46re))) / y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -2.6e-8) || !(y_46_im <= 5.2e+25)) {
tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
} else {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (y_46_im <= -2.6e-8) or not (y_46_im <= 5.2e+25): tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im else: tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_im <= -2.6e-8) || !(y_46_im <= 5.2e+25)) tmp = Float64(Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im); else tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if ((y_46_im <= -2.6e-8) || ~((y_46_im <= 5.2e+25))) tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im; else tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -2.6e-8], N[Not[LessEqual[y$46$im, 5.2e+25]], $MachinePrecision]], N[(N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -2.6 \cdot 10^{-8} \lor \neg \left(y.im \leq 5.2 \cdot 10^{+25}\right):\\
\;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\end{array}
\end{array}
if y.im < -2.6000000000000001e-8 or 5.1999999999999997e25 < y.im Initial program 57.3%
Taylor expanded in y.re around 0 80.6%
+-commutative80.6%
mul-1-neg80.6%
unsub-neg80.6%
unpow280.6%
associate-/r*82.3%
div-sub82.3%
associate-/l*85.6%
Simplified85.6%
if -2.6000000000000001e-8 < y.im < 5.1999999999999997e25Initial program 73.8%
Taylor expanded in y.re around inf 85.2%
remove-double-neg85.2%
mul-1-neg85.2%
neg-mul-185.2%
distribute-lft-in85.2%
mul-1-neg85.2%
distribute-neg-in85.2%
mul-1-neg85.2%
remove-double-neg85.2%
unsub-neg85.2%
associate-/l*85.3%
Simplified85.3%
Final simplification85.4%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -5.6e-8) (not (<= y.im 6.4e+25))) (/ (- (* (/ x.im y.im) y.re) x.re) y.im) (/ (- x.im (* x.re (/ y.im y.re))) y.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -5.6e-8) || !(y_46_im <= 6.4e+25)) {
tmp = (((x_46_im / y_46_im) * y_46_re) - x_46_re) / y_46_im;
} else {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if ((y_46im <= (-5.6d-8)) .or. (.not. (y_46im <= 6.4d+25))) then
tmp = (((x_46im / y_46im) * y_46re) - x_46re) / y_46im
else
tmp = (x_46im - (x_46re * (y_46im / y_46re))) / y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -5.6e-8) || !(y_46_im <= 6.4e+25)) {
tmp = (((x_46_im / y_46_im) * y_46_re) - x_46_re) / y_46_im;
} else {
tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (y_46_im <= -5.6e-8) or not (y_46_im <= 6.4e+25): tmp = (((x_46_im / y_46_im) * y_46_re) - x_46_re) / y_46_im else: tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_im <= -5.6e-8) || !(y_46_im <= 6.4e+25)) tmp = Float64(Float64(Float64(Float64(x_46_im / y_46_im) * y_46_re) - x_46_re) / y_46_im); else tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if ((y_46_im <= -5.6e-8) || ~((y_46_im <= 6.4e+25))) tmp = (((x_46_im / y_46_im) * y_46_re) - x_46_re) / y_46_im; else tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -5.6e-8], N[Not[LessEqual[y$46$im, 6.4e+25]], $MachinePrecision]], N[(N[(N[(N[(x$46$im / y$46$im), $MachinePrecision] * y$46$re), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -5.6 \cdot 10^{-8} \lor \neg \left(y.im \leq 6.4 \cdot 10^{+25}\right):\\
\;\;\;\;\frac{\frac{x.im}{y.im} \cdot y.re - x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\
\end{array}
\end{array}
if y.im < -5.5999999999999999e-8 or 6.3999999999999999e25 < y.im Initial program 57.3%
Taylor expanded in y.re around 0 80.6%
+-commutative80.6%
mul-1-neg80.6%
unsub-neg80.6%
unpow280.6%
associate-/r*82.3%
div-sub82.3%
associate-/l*85.6%
Simplified85.6%
clear-num85.6%
un-div-inv85.6%
Applied egg-rr85.6%
associate-/r/86.4%
Applied egg-rr86.4%
if -5.5999999999999999e-8 < y.im < 6.3999999999999999e25Initial program 73.8%
Taylor expanded in y.re around inf 85.2%
remove-double-neg85.2%
mul-1-neg85.2%
neg-mul-185.2%
distribute-lft-in85.2%
mul-1-neg85.2%
distribute-neg-in85.2%
mul-1-neg85.2%
remove-double-neg85.2%
unsub-neg85.2%
associate-/l*85.3%
Simplified85.3%
Final simplification85.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -6e-8) (not (<= y.im 1.6e+26))) (/ 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 <= -6e-8) || !(y_46_im <= 1.6e+26)) {
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 <= (-6d-8)) .or. (.not. (y_46im <= 1.6d+26))) 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 <= -6e-8) || !(y_46_im <= 1.6e+26)) {
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 <= -6e-8) or not (y_46_im <= 1.6e+26): 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 <= -6e-8) || !(y_46_im <= 1.6e+26)) 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 <= -6e-8) || ~((y_46_im <= 1.6e+26))) 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, -6e-8], N[Not[LessEqual[y$46$im, 1.6e+26]], $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 -6 \cdot 10^{-8} \lor \neg \left(y.im \leq 1.6 \cdot 10^{+26}\right):\\
\;\;\;\;\frac{x.re}{-y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.im < -5.99999999999999946e-8 or 1.60000000000000014e26 < y.im Initial program 57.3%
Taylor expanded in y.re around 0 71.5%
associate-*r/71.5%
neg-mul-171.5%
Simplified71.5%
if -5.99999999999999946e-8 < y.im < 1.60000000000000014e26Initial program 73.8%
Taylor expanded in y.re around inf 67.3%
Final simplification69.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 66.1%
Taylor expanded in y.re around inf 44.4%
Final simplification44.4%
herbie shell --seed 2024112
(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))))