
(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
(if (<=
(/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im)))
4e+289)
(*
(/ 1.0 (hypot y.re y.im))
(/ (fma x.im y.re (* x.re (- y.im))) (hypot y.re y.im)))
(/ (- (* 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 ((((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))) <= 4e+289) {
tmp = (1.0 / hypot(y_46_re, y_46_im)) * (fma(x_46_im, y_46_re, (x_46_re * -y_46_im)) / hypot(y_46_re, y_46_im));
} 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 (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))) <= 4e+289) tmp = Float64(Float64(1.0 / hypot(y_46_re, y_46_im)) * Float64(fma(x_46_im, y_46_re, Float64(x_46_re * Float64(-y_46_im))) / hypot(y_46_re, y_46_im))); 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
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[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], 4e+289], N[(N[(1.0 / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(x$46$im * y$46$re + N[(x$46$re * (-y$46$im)), $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $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}\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \leq 4 \cdot 10^{+289}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\mathsf{fma}\left(x.im, y.re, x.re \cdot \left(-y.im\right)\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 x.im y.re) (*.f64 x.re y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) < 4.0000000000000002e289Initial program 79.0%
*-un-lft-identity79.0%
add-sqr-sqrt79.0%
times-frac78.9%
hypot-define78.9%
fma-neg78.9%
distribute-rgt-neg-in78.9%
hypot-define96.5%
Applied egg-rr96.5%
if 4.0000000000000002e289 < (/.f64 (-.f64 (*.f64 x.im y.re) (*.f64 x.re y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) Initial program 12.7%
Taylor expanded in y.re around 0 44.1%
+-commutative44.1%
mul-1-neg44.1%
unsub-neg44.1%
unpow244.1%
associate-/r*50.4%
div-sub54.9%
associate-/l*65.0%
Simplified65.0%
Final simplification88.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (- (* y.re (/ x.im y.im)) x.re) y.im)))
(if (<= y.im -1.08e+102)
t_0
(if (<= y.im -1.65e-139)
(/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im)))
(if (<= y.im 5.3e+19) (/ (- x.im (/ (* x.re y.im) y.re)) y.re) t_0)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -1.08e+102) {
tmp = t_0;
} else if (y_46_im <= -1.65e-139) {
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));
} else if (y_46_im <= 5.3e+19) {
tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re;
} 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 = ((y_46re * (x_46im / y_46im)) - x_46re) / y_46im
if (y_46im <= (-1.08d+102)) then
tmp = t_0
else if (y_46im <= (-1.65d-139)) then
tmp = ((x_46im * y_46re) - (x_46re * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
else if (y_46im <= 5.3d+19) then
tmp = (x_46im - ((x_46re * y_46im) / y_46re)) / y_46re
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 = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -1.08e+102) {
tmp = t_0;
} else if (y_46_im <= -1.65e-139) {
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));
} else if (y_46_im <= 5.3e+19) {
tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re;
} else {
tmp = t_0;
}
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_im tmp = 0 if y_46_im <= -1.08e+102: tmp = t_0 elif y_46_im <= -1.65e-139: 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)) elif y_46_im <= 5.3e+19: tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re else: tmp = t_0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re) / y_46_im) tmp = 0.0 if (y_46_im <= -1.08e+102) tmp = t_0; elseif (y_46_im <= -1.65e-139) tmp = 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))); elseif (y_46_im <= 5.3e+19) tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re * y_46_im) / y_46_re)) / y_46_re); 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 = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im; tmp = 0.0; if (y_46_im <= -1.08e+102) tmp = t_0; elseif (y_46_im <= -1.65e-139) 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)); elseif (y_46_im <= 5.3e+19) tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re; 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[(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.08e+102], t$95$0, If[LessEqual[y$46$im, -1.65e-139], 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], If[LessEqual[y$46$im, 5.3e+19], N[(N[(x$46$im - N[(N[(x$46$re * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\
\mathbf{if}\;y.im \leq -1.08 \cdot 10^{+102}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq -1.65 \cdot 10^{-139}:\\
\;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{elif}\;y.im \leq 5.3 \cdot 10^{+19}:\\
\;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -1.08000000000000002e102 or 5.3e19 < y.im Initial program 43.5%
Taylor expanded in y.re around 0 78.2%
+-commutative78.2%
mul-1-neg78.2%
unsub-neg78.2%
unpow278.2%
associate-/r*83.3%
div-sub83.3%
associate-/l*88.0%
Simplified88.0%
Taylor expanded in x.im around 0 83.3%
associate-*l/88.0%
*-commutative88.0%
Simplified88.0%
if -1.08000000000000002e102 < y.im < -1.65e-139Initial program 92.0%
if -1.65e-139 < y.im < 5.3e19Initial program 65.2%
Taylor expanded in y.re around inf 85.0%
mul-1-neg85.0%
unsub-neg85.0%
unsub-neg85.0%
distribute-frac-neg85.0%
distribute-rgt-neg-out85.0%
Simplified85.0%
Final simplification87.6%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -4.9e+35) (not (<= y.im 3.4e+72))) (/ 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 <= -4.9e+35) || !(y_46_im <= 3.4e+72)) {
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 <= (-4.9d+35)) .or. (.not. (y_46im <= 3.4d+72))) 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 <= -4.9e+35) || !(y_46_im <= 3.4e+72)) {
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 <= -4.9e+35) or not (y_46_im <= 3.4e+72): 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 <= -4.9e+35) || !(y_46_im <= 3.4e+72)) 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 <= -4.9e+35) || ~((y_46_im <= 3.4e+72))) 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, -4.9e+35], N[Not[LessEqual[y$46$im, 3.4e+72]], $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 -4.9 \cdot 10^{+35} \lor \neg \left(y.im \leq 3.4 \cdot 10^{+72}\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 < -4.90000000000000025e35 or 3.3999999999999998e72 < y.im Initial program 48.4%
Taylor expanded in y.re around 0 72.7%
associate-*r/72.7%
neg-mul-172.7%
Simplified72.7%
if -4.90000000000000025e35 < y.im < 3.3999999999999998e72Initial program 72.1%
Taylor expanded in y.re around inf 72.8%
remove-double-neg72.8%
mul-1-neg72.8%
neg-mul-172.8%
distribute-lft-in72.8%
distribute-lft-in72.8%
mul-1-neg72.8%
unsub-neg72.8%
neg-mul-172.8%
mul-1-neg72.8%
remove-double-neg72.8%
associate-/l*73.5%
Simplified73.5%
Final simplification73.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -120.0) (not (<= y.im 4.4e+18))) (/ (- (* 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 <= -120.0) || !(y_46_im <= 4.4e+18)) {
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 <= (-120.0d0)) .or. (.not. (y_46im <= 4.4d+18))) 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 <= -120.0) || !(y_46_im <= 4.4e+18)) {
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 <= -120.0) or not (y_46_im <= 4.4e+18): 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 <= -120.0) || !(y_46_im <= 4.4e+18)) 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 <= -120.0) || ~((y_46_im <= 4.4e+18))) 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, -120.0], N[Not[LessEqual[y$46$im, 4.4e+18]], $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 -120 \lor \neg \left(y.im \leq 4.4 \cdot 10^{+18}\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 < -120 or 4.4e18 < y.im Initial program 54.2%
Taylor expanded in y.re around 0 75.6%
+-commutative75.6%
mul-1-neg75.6%
unsub-neg75.6%
unpow275.6%
associate-/r*79.6%
div-sub79.6%
associate-/l*83.3%
Simplified83.3%
if -120 < y.im < 4.4e18Initial program 69.8%
Taylor expanded in y.re around inf 80.7%
remove-double-neg80.7%
mul-1-neg80.7%
neg-mul-180.7%
distribute-lft-in80.7%
distribute-lft-in80.7%
mul-1-neg80.7%
unsub-neg80.7%
neg-mul-180.7%
mul-1-neg80.7%
remove-double-neg80.7%
associate-/l*79.9%
Simplified79.9%
Final simplification81.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -0.062) (not (<= y.im 2.2e+19))) (/ (- (* y.re (/ x.im 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 <= -0.062) || !(y_46_im <= 2.2e+19)) {
tmp = ((y_46_re * (x_46_im / 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 <= (-0.062d0)) .or. (.not. (y_46im <= 2.2d+19))) then
tmp = ((y_46re * (x_46im / 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 <= -0.062) || !(y_46_im <= 2.2e+19)) {
tmp = ((y_46_re * (x_46_im / 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 <= -0.062) or not (y_46_im <= 2.2e+19): tmp = ((y_46_re * (x_46_im / 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 <= -0.062) || !(y_46_im <= 2.2e+19)) tmp = Float64(Float64(Float64(y_46_re * Float64(x_46_im / 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 <= -0.062) || ~((y_46_im <= 2.2e+19))) tmp = ((y_46_re * (x_46_im / 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, -0.062], N[Not[LessEqual[y$46$im, 2.2e+19]], $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[(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 -0.062 \lor \neg \left(y.im \leq 2.2 \cdot 10^{+19}\right):\\
\;\;\;\;\frac{y.re \cdot \frac{x.im}{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 < -0.062 or 2.2e19 < y.im Initial program 54.2%
Taylor expanded in y.re around 0 75.6%
+-commutative75.6%
mul-1-neg75.6%
unsub-neg75.6%
unpow275.6%
associate-/r*79.6%
div-sub79.6%
associate-/l*83.3%
Simplified83.3%
Taylor expanded in x.im around 0 79.6%
associate-*l/83.3%
*-commutative83.3%
Simplified83.3%
if -0.062 < y.im < 2.2e19Initial program 69.8%
Taylor expanded in y.re around inf 80.7%
remove-double-neg80.7%
mul-1-neg80.7%
neg-mul-180.7%
distribute-lft-in80.7%
distribute-lft-in80.7%
mul-1-neg80.7%
unsub-neg80.7%
neg-mul-180.7%
mul-1-neg80.7%
remove-double-neg80.7%
associate-/l*79.9%
Simplified79.9%
Final simplification81.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -28.0) (not (<= y.im 7.8e+18))) (/ (- (* y.re (/ x.im 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 <= -28.0) || !(y_46_im <= 7.8e+18)) {
tmp = ((y_46_re * (x_46_im / 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 <= (-28.0d0)) .or. (.not. (y_46im <= 7.8d+18))) then
tmp = ((y_46re * (x_46im / 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 <= -28.0) || !(y_46_im <= 7.8e+18)) {
tmp = ((y_46_re * (x_46_im / 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 <= -28.0) or not (y_46_im <= 7.8e+18): tmp = ((y_46_re * (x_46_im / 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 <= -28.0) || !(y_46_im <= 7.8e+18)) tmp = Float64(Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re) / y_46_im); else tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re * y_46_im) / y_46_re)) / y_46_re); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if ((y_46_im <= -28.0) || ~((y_46_im <= 7.8e+18))) tmp = ((y_46_re * (x_46_im / 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, -28.0], N[Not[LessEqual[y$46$im, 7.8e+18]], $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[(N[(x$46$im - N[(N[(x$46$re * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -28 \lor \neg \left(y.im \leq 7.8 \cdot 10^{+18}\right):\\
\;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\
\end{array}
\end{array}
if y.im < -28 or 7.8e18 < y.im Initial program 54.2%
Taylor expanded in y.re around 0 75.6%
+-commutative75.6%
mul-1-neg75.6%
unsub-neg75.6%
unpow275.6%
associate-/r*79.6%
div-sub79.6%
associate-/l*83.3%
Simplified83.3%
Taylor expanded in x.im around 0 79.6%
associate-*l/83.3%
*-commutative83.3%
Simplified83.3%
if -28 < y.im < 7.8e18Initial program 69.8%
Taylor expanded in y.re around inf 80.7%
mul-1-neg80.7%
unsub-neg80.7%
unsub-neg80.7%
distribute-frac-neg80.7%
distribute-rgt-neg-out80.7%
Simplified80.7%
Final simplification82.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -1.92) (not (<= y.im 9.5e+72))) (/ 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.92) || !(y_46_im <= 9.5e+72)) {
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.92d0)) .or. (.not. (y_46im <= 9.5d+72))) 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.92) || !(y_46_im <= 9.5e+72)) {
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.92) or not (y_46_im <= 9.5e+72): 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.92) || !(y_46_im <= 9.5e+72)) 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.92) || ~((y_46_im <= 9.5e+72))) 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.92], N[Not[LessEqual[y$46$im, 9.5e+72]], $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.92 \lor \neg \left(y.im \leq 9.5 \cdot 10^{+72}\right):\\
\;\;\;\;\frac{x.re}{-y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.im < -1.9199999999999999 or 9.50000000000000054e72 < y.im Initial program 52.9%
Taylor expanded in y.re around 0 69.7%
associate-*r/69.7%
neg-mul-169.7%
Simplified69.7%
if -1.9199999999999999 < y.im < 9.50000000000000054e72Initial program 69.8%
Taylor expanded in y.re around inf 57.9%
Final simplification63.6%
(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 61.6%
Taylor expanded in y.re around inf 38.0%
Final simplification38.0%
herbie shell --seed 2024078
(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))))