
(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 (<= y.re -3.2e+90)
(/ (- x.im (* (/ y.im y.re) x.re)) y.re)
(if (<= y.re 1.5e-122)
(/ (- (* x.im (/ y.re y.im)) x.re) y.im)
(if (<= y.re 7.5e+83)
(/ (fma x.im y.re (* y.im (- x.re))) (fma y.im y.im (* y.re y.re)))
(/ (- x.im (/ x.re (/ y.re y.im))) y.re)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -3.2e+90) {
tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re;
} else if (y_46_re <= 1.5e-122) {
tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
} else if (y_46_re <= 7.5e+83) {
tmp = fma(x_46_im, y_46_re, (y_46_im * -x_46_re)) / fma(y_46_im, y_46_im, (y_46_re * y_46_re));
} else {
tmp = (x_46_im - (x_46_re / (y_46_re / y_46_im))) / y_46_re;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -3.2e+90) tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im / y_46_re) * x_46_re)) / y_46_re); elseif (y_46_re <= 1.5e-122) tmp = Float64(Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im); elseif (y_46_re <= 7.5e+83) tmp = Float64(fma(x_46_im, y_46_re, Float64(y_46_im * Float64(-x_46_re))) / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))); else tmp = Float64(Float64(x_46_im - Float64(x_46_re / Float64(y_46_re / y_46_im))) / y_46_re); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -3.2e+90], N[(N[(x$46$im - N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 1.5e-122], 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$re, 7.5e+83], N[(N[(x$46$im * y$46$re + N[(y$46$im * (-x$46$re)), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im - N[(x$46$re / N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -3.2 \cdot 10^{+90}:\\
\;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\
\mathbf{elif}\;y.re \leq 1.5 \cdot 10^{-122}:\\
\;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\
\mathbf{elif}\;y.re \leq 7.5 \cdot 10^{+83}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, y.re, y.im \cdot \left(-x.re\right)\right)}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - \frac{x.re}{\frac{y.re}{y.im}}}{y.re}\\
\end{array}
\end{array}
if y.re < -3.19999999999999998e90Initial program 39.4%
fmm-def39.4%
distribute-rgt-neg-out39.4%
+-commutative39.4%
fma-define39.4%
Simplified39.4%
Taylor expanded in y.re around inf 87.6%
mul-1-neg87.6%
unsub-neg87.6%
*-commutative87.6%
Simplified87.6%
*-commutative87.6%
associate-*r/90.2%
*-commutative90.2%
Applied egg-rr90.2%
if -3.19999999999999998e90 < y.re < 1.50000000000000002e-122Initial program 69.5%
fmm-def69.5%
distribute-rgt-neg-out69.5%
+-commutative69.5%
fma-define69.5%
Simplified69.5%
Taylor expanded in y.im around inf 80.7%
+-commutative80.7%
mul-1-neg80.7%
unsub-neg80.7%
associate-*r/81.6%
Applied egg-rr81.6%
if 1.50000000000000002e-122 < y.re < 7.49999999999999989e83Initial program 81.4%
fmm-def81.5%
distribute-rgt-neg-out81.5%
+-commutative81.5%
fma-define81.5%
Simplified81.5%
if 7.49999999999999989e83 < y.re Initial program 34.0%
fmm-def34.0%
distribute-rgt-neg-out34.0%
+-commutative34.0%
fma-define34.0%
Simplified34.0%
Taylor expanded in y.re around inf 72.7%
mul-1-neg72.7%
unsub-neg72.7%
*-commutative72.7%
Simplified72.7%
Taylor expanded in x.im around 0 61.8%
+-commutative61.8%
mul-1-neg61.8%
unpow261.8%
associate-/l/72.7%
sub-neg72.7%
div-sub72.7%
associate-*l/78.2%
associate-/r/78.2%
Simplified78.2%
Final simplification82.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -2.4e+90)
(/ (- x.im (* (/ y.im y.re) x.re)) y.re)
(if (<= y.re 2.3e-121)
(/ (- (* x.im (/ y.re y.im)) x.re) y.im)
(if (<= y.re 5.7e+83)
(/ (- (* y.re x.im) (* y.im x.re)) (+ (* y.re y.re) (* y.im y.im)))
(/ (- x.im (/ x.re (/ y.re y.im))) y.re)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -2.4e+90) {
tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re;
} else if (y_46_re <= 2.3e-121) {
tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
} else if (y_46_re <= 5.7e+83) {
tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else {
tmp = (x_46_im - (x_46_re / (y_46_re / y_46_im))) / y_46_re;
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46re <= (-2.4d+90)) then
tmp = (x_46im - ((y_46im / y_46re) * x_46re)) / y_46re
else if (y_46re <= 2.3d-121) then
tmp = ((x_46im * (y_46re / y_46im)) - x_46re) / y_46im
else if (y_46re <= 5.7d+83) then
tmp = ((y_46re * x_46im) - (y_46im * x_46re)) / ((y_46re * y_46re) + (y_46im * y_46im))
else
tmp = (x_46im - (x_46re / (y_46re / y_46im))) / y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -2.4e+90) {
tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re;
} else if (y_46_re <= 2.3e-121) {
tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
} else if (y_46_re <= 5.7e+83) {
tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else {
tmp = (x_46_im - (x_46_re / (y_46_re / y_46_im))) / y_46_re;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_re <= -2.4e+90: tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re elif y_46_re <= 2.3e-121: tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im elif y_46_re <= 5.7e+83: tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)) else: tmp = (x_46_im - (x_46_re / (y_46_re / y_46_im))) / y_46_re return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -2.4e+90) tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im / y_46_re) * x_46_re)) / y_46_re); elseif (y_46_re <= 2.3e-121) tmp = Float64(Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im); elseif (y_46_re <= 5.7e+83) tmp = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))); else tmp = Float64(Float64(x_46_im - Float64(x_46_re / Float64(y_46_re / y_46_im))) / y_46_re); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_re <= -2.4e+90) tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re; elseif (y_46_re <= 2.3e-121) tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im; elseif (y_46_re <= 5.7e+83) tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); else tmp = (x_46_im - (x_46_re / (y_46_re / y_46_im))) / y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -2.4e+90], N[(N[(x$46$im - N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 2.3e-121], 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$re, 5.7e+83], 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], N[(N[(x$46$im - N[(x$46$re / N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -2.4 \cdot 10^{+90}:\\
\;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\
\mathbf{elif}\;y.re \leq 2.3 \cdot 10^{-121}:\\
\;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\
\mathbf{elif}\;y.re \leq 5.7 \cdot 10^{+83}:\\
\;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - \frac{x.re}{\frac{y.re}{y.im}}}{y.re}\\
\end{array}
\end{array}
if y.re < -2.4000000000000001e90Initial program 39.4%
fmm-def39.4%
distribute-rgt-neg-out39.4%
+-commutative39.4%
fma-define39.4%
Simplified39.4%
Taylor expanded in y.re around inf 87.6%
mul-1-neg87.6%
unsub-neg87.6%
*-commutative87.6%
Simplified87.6%
*-commutative87.6%
associate-*r/90.2%
*-commutative90.2%
Applied egg-rr90.2%
if -2.4000000000000001e90 < y.re < 2.30000000000000012e-121Initial program 69.5%
fmm-def69.5%
distribute-rgt-neg-out69.5%
+-commutative69.5%
fma-define69.5%
Simplified69.5%
Taylor expanded in y.im around inf 80.7%
+-commutative80.7%
mul-1-neg80.7%
unsub-neg80.7%
associate-*r/81.6%
Applied egg-rr81.6%
if 2.30000000000000012e-121 < y.re < 5.69999999999999949e83Initial program 81.4%
if 5.69999999999999949e83 < y.re Initial program 34.0%
fmm-def34.0%
distribute-rgt-neg-out34.0%
+-commutative34.0%
fma-define34.0%
Simplified34.0%
Taylor expanded in y.re around inf 72.7%
mul-1-neg72.7%
unsub-neg72.7%
*-commutative72.7%
Simplified72.7%
Taylor expanded in x.im around 0 61.8%
+-commutative61.8%
mul-1-neg61.8%
unpow261.8%
associate-/l/72.7%
sub-neg72.7%
div-sub72.7%
associate-*l/78.2%
associate-/r/78.2%
Simplified78.2%
Final simplification82.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -5e+39) (not (<= y.im 3.9e+15))) (/ (- x.re) y.im) (/ (- x.im (/ x.re (/ y.re y.im))) y.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -5e+39) || !(y_46_im <= 3.9e+15)) {
tmp = -x_46_re / y_46_im;
} else {
tmp = (x_46_im - (x_46_re / (y_46_re / y_46_im))) / y_46_re;
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if ((y_46im <= (-5d+39)) .or. (.not. (y_46im <= 3.9d+15))) then
tmp = -x_46re / y_46im
else
tmp = (x_46im - (x_46re / (y_46re / y_46im))) / y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -5e+39) || !(y_46_im <= 3.9e+15)) {
tmp = -x_46_re / y_46_im;
} else {
tmp = (x_46_im - (x_46_re / (y_46_re / y_46_im))) / y_46_re;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (y_46_im <= -5e+39) or not (y_46_im <= 3.9e+15): tmp = -x_46_re / y_46_im else: tmp = (x_46_im - (x_46_re / (y_46_re / y_46_im))) / y_46_re return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_im <= -5e+39) || !(y_46_im <= 3.9e+15)) tmp = Float64(Float64(-x_46_re) / y_46_im); else tmp = Float64(Float64(x_46_im - Float64(x_46_re / Float64(y_46_re / y_46_im))) / y_46_re); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if ((y_46_im <= -5e+39) || ~((y_46_im <= 3.9e+15))) tmp = -x_46_re / y_46_im; else tmp = (x_46_im - (x_46_re / (y_46_re / y_46_im))) / y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -5e+39], N[Not[LessEqual[y$46$im, 3.9e+15]], $MachinePrecision]], N[((-x$46$re) / y$46$im), $MachinePrecision], N[(N[(x$46$im - N[(x$46$re / N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -5 \cdot 10^{+39} \lor \neg \left(y.im \leq 3.9 \cdot 10^{+15}\right):\\
\;\;\;\;\frac{-x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - \frac{x.re}{\frac{y.re}{y.im}}}{y.re}\\
\end{array}
\end{array}
if y.im < -5.00000000000000015e39 or 3.9e15 < y.im Initial program 46.9%
fmm-def46.9%
distribute-rgt-neg-out46.9%
+-commutative46.9%
fma-define46.9%
Simplified46.9%
Taylor expanded in y.re around 0 71.4%
associate-*r/71.4%
neg-mul-171.4%
Simplified71.4%
if -5.00000000000000015e39 < y.im < 3.9e15Initial program 71.9%
fmm-def71.9%
distribute-rgt-neg-out71.9%
+-commutative71.9%
fma-define71.9%
Simplified71.9%
Taylor expanded in y.re around inf 77.3%
mul-1-neg77.3%
unsub-neg77.3%
*-commutative77.3%
Simplified77.3%
Taylor expanded in x.im around 0 70.9%
+-commutative70.9%
mul-1-neg70.9%
unpow270.9%
associate-/l/77.2%
sub-neg77.2%
div-sub77.3%
associate-*l/75.2%
associate-/r/77.3%
Simplified77.3%
Final simplification74.5%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -7.8e+39) (not (<= y.im 2.15e+15))) (/ (- x.re) y.im) (/ (- x.im (* (/ y.im y.re) x.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.8e+39) || !(y_46_im <= 2.15e+15)) {
tmp = -x_46_re / y_46_im;
} else {
tmp = (x_46_im - ((y_46_im / y_46_re) * x_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.8d+39)) .or. (.not. (y_46im <= 2.15d+15))) then
tmp = -x_46re / y_46im
else
tmp = (x_46im - ((y_46im / y_46re) * x_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.8e+39) || !(y_46_im <= 2.15e+15)) {
tmp = -x_46_re / y_46_im;
} else {
tmp = (x_46_im - ((y_46_im / y_46_re) * x_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.8e+39) or not (y_46_im <= 2.15e+15): tmp = -x_46_re / y_46_im else: tmp = (x_46_im - ((y_46_im / y_46_re) * x_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.8e+39) || !(y_46_im <= 2.15e+15)) tmp = Float64(Float64(-x_46_re) / y_46_im); else tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im / y_46_re) * x_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.8e+39) || ~((y_46_im <= 2.15e+15))) tmp = -x_46_re / y_46_im; else tmp = (x_46_im - ((y_46_im / y_46_re) * x_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.8e+39], N[Not[LessEqual[y$46$im, 2.15e+15]], $MachinePrecision]], N[((-x$46$re) / y$46$im), $MachinePrecision], N[(N[(x$46$im - N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -7.8 \cdot 10^{+39} \lor \neg \left(y.im \leq 2.15 \cdot 10^{+15}\right):\\
\;\;\;\;\frac{-x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\
\end{array}
\end{array}
if y.im < -7.8000000000000002e39 or 2.15e15 < y.im Initial program 46.9%
fmm-def46.9%
distribute-rgt-neg-out46.9%
+-commutative46.9%
fma-define46.9%
Simplified46.9%
Taylor expanded in y.re around 0 71.4%
associate-*r/71.4%
neg-mul-171.4%
Simplified71.4%
if -7.8000000000000002e39 < y.im < 2.15e15Initial program 71.9%
fmm-def71.9%
distribute-rgt-neg-out71.9%
+-commutative71.9%
fma-define71.9%
Simplified71.9%
Taylor expanded in y.re around inf 77.3%
mul-1-neg77.3%
unsub-neg77.3%
*-commutative77.3%
Simplified77.3%
*-commutative77.3%
associate-*r/77.3%
*-commutative77.3%
Applied egg-rr77.3%
Final simplification74.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -3.4e+90)
(/ (- x.im (* (/ y.im y.re) x.re)) y.re)
(if (<= y.re 5e+65)
(/ (- (* x.im (/ y.re y.im)) x.re) y.im)
(/ (- x.im (/ x.re (/ y.re y.im))) y.re))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -3.4e+90) {
tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re;
} else if (y_46_re <= 5e+65) {
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_re / y_46_im))) / y_46_re;
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46re <= (-3.4d+90)) then
tmp = (x_46im - ((y_46im / y_46re) * x_46re)) / y_46re
else if (y_46re <= 5d+65) then
tmp = ((x_46im * (y_46re / y_46im)) - x_46re) / y_46im
else
tmp = (x_46im - (x_46re / (y_46re / y_46im))) / y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -3.4e+90) {
tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re;
} else if (y_46_re <= 5e+65) {
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_re / y_46_im))) / y_46_re;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_re <= -3.4e+90: tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re elif y_46_re <= 5e+65: 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_re / y_46_im))) / y_46_re return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -3.4e+90) tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im / y_46_re) * x_46_re)) / y_46_re); elseif (y_46_re <= 5e+65) 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_re / y_46_im))) / y_46_re); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_re <= -3.4e+90) tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re; elseif (y_46_re <= 5e+65) 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_re / y_46_im))) / y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -3.4e+90], N[(N[(x$46$im - N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 5e+65], 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$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -3.4 \cdot 10^{+90}:\\
\;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\
\mathbf{elif}\;y.re \leq 5 \cdot 10^{+65}:\\
\;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im - \frac{x.re}{\frac{y.re}{y.im}}}{y.re}\\
\end{array}
\end{array}
if y.re < -3.40000000000000018e90Initial program 39.4%
fmm-def39.4%
distribute-rgt-neg-out39.4%
+-commutative39.4%
fma-define39.4%
Simplified39.4%
Taylor expanded in y.re around inf 87.6%
mul-1-neg87.6%
unsub-neg87.6%
*-commutative87.6%
Simplified87.6%
*-commutative87.6%
associate-*r/90.2%
*-commutative90.2%
Applied egg-rr90.2%
if -3.40000000000000018e90 < y.re < 4.99999999999999973e65Initial program 72.0%
fmm-def72.0%
distribute-rgt-neg-out72.0%
+-commutative72.0%
fma-define72.0%
Simplified72.0%
Taylor expanded in y.im around inf 77.0%
+-commutative77.0%
mul-1-neg77.0%
unsub-neg77.0%
associate-*r/78.4%
Applied egg-rr78.4%
if 4.99999999999999973e65 < y.re Initial program 37.3%
fmm-def37.3%
distribute-rgt-neg-out37.3%
+-commutative37.3%
fma-define37.3%
Simplified37.3%
Taylor expanded in y.re around inf 72.9%
mul-1-neg72.9%
unsub-neg72.9%
*-commutative72.9%
Simplified72.9%
Taylor expanded in x.im around 0 62.8%
+-commutative62.8%
mul-1-neg62.8%
unpow262.8%
associate-/l/72.9%
sub-neg72.9%
div-sub72.9%
associate-*l/78.0%
associate-/r/78.0%
Simplified78.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -3.8e+36) (not (<= y.im 2.15e+15))) (/ (- 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 <= -3.8e+36) || !(y_46_im <= 2.15e+15)) {
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 <= (-3.8d+36)) .or. (.not. (y_46im <= 2.15d+15))) 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 <= -3.8e+36) || !(y_46_im <= 2.15e+15)) {
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 <= -3.8e+36) or not (y_46_im <= 2.15e+15): 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 <= -3.8e+36) || !(y_46_im <= 2.15e+15)) 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 <= -3.8e+36) || ~((y_46_im <= 2.15e+15))) 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, -3.8e+36], N[Not[LessEqual[y$46$im, 2.15e+15]], $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 -3.8 \cdot 10^{+36} \lor \neg \left(y.im \leq 2.15 \cdot 10^{+15}\right):\\
\;\;\;\;\frac{-x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.im < -3.80000000000000025e36 or 2.15e15 < y.im Initial program 47.7%
fmm-def47.7%
distribute-rgt-neg-out47.7%
+-commutative47.7%
fma-define47.7%
Simplified47.7%
Taylor expanded in y.re around 0 70.3%
associate-*r/70.3%
neg-mul-170.3%
Simplified70.3%
if -3.80000000000000025e36 < y.im < 2.15e15Initial program 71.5%
fmm-def71.5%
distribute-rgt-neg-out71.5%
+-commutative71.5%
fma-define71.5%
Simplified71.5%
Taylor expanded in y.re around inf 59.9%
Final simplification65.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.im 7.2e+200) (/ x.im y.re) (/ 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+200) {
tmp = x_46_im / y_46_re;
} else {
tmp = 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+200) then
tmp = x_46im / y_46re
else
tmp = 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+200) {
tmp = x_46_im / y_46_re;
} else {
tmp = 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+200: tmp = x_46_im / y_46_re else: tmp = 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+200) tmp = Float64(x_46_im / y_46_re); else tmp = 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+200) tmp = x_46_im / y_46_re; else tmp = 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+200], N[(x$46$im / y$46$re), $MachinePrecision], N[(x$46$re / y$46$im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq 7.2 \cdot 10^{+200}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.im}\\
\end{array}
\end{array}
if y.im < 7.1999999999999995e200Initial program 64.1%
fmm-def64.1%
distribute-rgt-neg-out64.1%
+-commutative64.1%
fma-define64.1%
Simplified64.1%
Taylor expanded in y.re around inf 43.0%
if 7.1999999999999995e200 < y.im Initial program 24.8%
fmm-def24.8%
distribute-rgt-neg-out24.8%
+-commutative24.8%
fma-define24.8%
Simplified24.8%
Taylor expanded in y.re around 0 89.6%
associate-*r/89.6%
neg-mul-189.6%
Simplified89.6%
add-sqr-sqrt55.7%
sqrt-unprod57.2%
sqr-neg57.2%
sqrt-unprod12.1%
add-sqr-sqrt25.4%
div-inv25.4%
Applied egg-rr25.4%
associate-*r/25.4%
*-rgt-identity25.4%
Simplified25.4%
(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 60.0%
fmm-def60.0%
distribute-rgt-neg-out60.0%
+-commutative60.0%
fma-define60.0%
Simplified60.0%
Taylor expanded in y.re around inf 38.9%
herbie shell --seed 2024157
(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))))