
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ (+ (* x.re y.re) (* x.im 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_re * y_46_re) + (x_46_im * 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_46re * y_46re) + (x_46im * 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_re * y_46_re) + (x_46_im * 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_re * y_46_re) + (x_46_im * 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_re * y_46_re) + Float64(x_46_im * 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_re * y_46_re) + (x_46_im * 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$re * y$46$re), $MachinePrecision] + N[(x$46$im * 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.re \cdot y.re + x.im \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.re y.re) (* x.im 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_re * y_46_re) + (x_46_im * 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_46re * y_46re) + (x_46im * 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_re * y_46_re) + (x_46_im * 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_re * y_46_re) + (x_46_im * 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_re * y_46_re) + Float64(x_46_im * 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_re * y_46_re) + (x_46_im * 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$re * y$46$re), $MachinePrecision] + N[(x$46$im * 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.re \cdot y.re + x.im \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.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im)))))
(if (<= y.im -2.35e+88)
(/ (+ x.im (* y.re (/ x.re y.im))) y.im)
(if (<= y.im -6.5e-152)
t_0
(if (<= y.im 2.8e-70)
(/ (+ x.re (/ (* x.im y.im) y.re)) y.re)
(if (<= y.im 5.8e+120)
t_0
(/ (+ 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 t_0 = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
double tmp;
if (y_46_im <= -2.35e+88) {
tmp = (x_46_im + (y_46_re * (x_46_re / y_46_im))) / y_46_im;
} else if (y_46_im <= -6.5e-152) {
tmp = t_0;
} else if (y_46_im <= 2.8e-70) {
tmp = (x_46_re + ((x_46_im * y_46_im) / y_46_re)) / y_46_re;
} else if (y_46_im <= 5.8e+120) {
tmp = t_0;
} else {
tmp = (x_46_im + (y_46_re / (y_46_im / x_46_re))) / y_46_im;
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
real(8) :: tmp
t_0 = ((x_46re * y_46re) + (x_46im * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
if (y_46im <= (-2.35d+88)) then
tmp = (x_46im + (y_46re * (x_46re / y_46im))) / y_46im
else if (y_46im <= (-6.5d-152)) then
tmp = t_0
else if (y_46im <= 2.8d-70) then
tmp = (x_46re + ((x_46im * y_46im) / y_46re)) / y_46re
else if (y_46im <= 5.8d+120) then
tmp = t_0
else
tmp = (x_46im + (y_46re / (y_46im / x_46re))) / y_46im
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
double tmp;
if (y_46_im <= -2.35e+88) {
tmp = (x_46_im + (y_46_re * (x_46_re / y_46_im))) / y_46_im;
} else if (y_46_im <= -6.5e-152) {
tmp = t_0;
} else if (y_46_im <= 2.8e-70) {
tmp = (x_46_re + ((x_46_im * y_46_im) / y_46_re)) / y_46_re;
} else if (y_46_im <= 5.8e+120) {
tmp = t_0;
} else {
tmp = (x_46_im + (y_46_re / (y_46_im / x_46_re))) / y_46_im;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)) tmp = 0 if y_46_im <= -2.35e+88: tmp = (x_46_im + (y_46_re * (x_46_re / y_46_im))) / y_46_im elif y_46_im <= -6.5e-152: tmp = t_0 elif y_46_im <= 2.8e-70: tmp = (x_46_re + ((x_46_im * y_46_im) / y_46_re)) / y_46_re elif y_46_im <= 5.8e+120: tmp = t_0 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) t_0 = Float64(Float64(Float64(x_46_re * y_46_re) + Float64(x_46_im * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))) tmp = 0.0 if (y_46_im <= -2.35e+88) tmp = Float64(Float64(x_46_im + Float64(y_46_re * Float64(x_46_re / y_46_im))) / y_46_im); elseif (y_46_im <= -6.5e-152) tmp = t_0; elseif (y_46_im <= 2.8e-70) tmp = Float64(Float64(x_46_re + Float64(Float64(x_46_im * y_46_im) / y_46_re)) / y_46_re); elseif (y_46_im <= 5.8e+120) tmp = t_0; else tmp = Float64(Float64(x_46_im + Float64(y_46_re / Float64(y_46_im / x_46_re))) / y_46_im); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); tmp = 0.0; if (y_46_im <= -2.35e+88) tmp = (x_46_im + (y_46_re * (x_46_re / y_46_im))) / y_46_im; elseif (y_46_im <= -6.5e-152) tmp = t_0; elseif (y_46_im <= 2.8e-70) tmp = (x_46_re + ((x_46_im * y_46_im) / y_46_re)) / y_46_re; elseif (y_46_im <= 5.8e+120) tmp = t_0; else tmp = (x_46_im + (y_46_re / (y_46_im / x_46_re))) / y_46_im; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(x$46$re * y$46$re), $MachinePrecision] + N[(x$46$im * 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, -2.35e+88], N[(N[(x$46$im + N[(y$46$re * N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, -6.5e-152], t$95$0, If[LessEqual[y$46$im, 2.8e-70], N[(N[(x$46$re + N[(N[(x$46$im * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 5.8e+120], t$95$0, N[(N[(x$46$im + N[(y$46$re / N[(y$46$im / x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{if}\;y.im \leq -2.35 \cdot 10^{+88}:\\
\;\;\;\;\frac{x.im + y.re \cdot \frac{x.re}{y.im}}{y.im}\\
\mathbf{elif}\;y.im \leq -6.5 \cdot 10^{-152}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 2.8 \cdot 10^{-70}:\\
\;\;\;\;\frac{x.re + \frac{x.im \cdot y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 5.8 \cdot 10^{+120}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im + \frac{y.re}{\frac{y.im}{x.re}}}{y.im}\\
\end{array}
\end{array}
if y.im < -2.35000000000000004e88Initial program 28.5%
Taylor expanded in y.im around inf 79.4%
associate-/l*85.4%
Simplified85.4%
clear-num85.5%
un-div-inv85.5%
Applied egg-rr85.5%
associate-/r/85.5%
Simplified85.5%
if -2.35000000000000004e88 < y.im < -6.5000000000000001e-152 or 2.7999999999999999e-70 < y.im < 5.8000000000000003e120Initial program 85.3%
if -6.5000000000000001e-152 < y.im < 2.7999999999999999e-70Initial program 71.6%
Taylor expanded in y.re around inf 90.7%
*-commutative90.7%
Simplified90.7%
if 5.8000000000000003e120 < y.im Initial program 27.5%
Taylor expanded in y.im around inf 80.0%
associate-/l*95.0%
Simplified95.0%
clear-num94.9%
un-div-inv94.9%
Applied egg-rr94.9%
associate-/r/95.0%
Simplified95.0%
*-commutative95.0%
clear-num95.0%
un-div-inv95.0%
Applied egg-rr95.0%
Final simplification88.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<=
(/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im)))
5e+268)
(*
(/ 1.0 (hypot y.re y.im))
(/ (fma x.re y.re (* x.im y.im)) (hypot y.re y.im)))
(/ (+ x.im (* x.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) {
double tmp;
if ((((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))) <= 5e+268) {
tmp = (1.0 / hypot(y_46_re, y_46_im)) * (fma(x_46_re, y_46_re, (x_46_im * y_46_im)) / hypot(y_46_re, y_46_im));
} else {
tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / 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_re * y_46_re) + Float64(x_46_im * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))) <= 5e+268) tmp = Float64(Float64(1.0 / hypot(y_46_re, y_46_im)) * Float64(fma(x_46_re, y_46_re, Float64(x_46_im * y_46_im)) / hypot(y_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_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$re * y$46$re), $MachinePrecision] + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+268], N[(N[(1.0 / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(x$46$re * y$46$re + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im + N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \leq 5 \cdot 10^{+268}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\mathsf{fma}\left(x.re, y.re, x.im \cdot y.im\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im + x.re \cdot \frac{y.re}{y.im}}{y.im}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 x.re y.re) (*.f64 x.im y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) < 5.0000000000000002e268Initial program 79.9%
*-un-lft-identity79.9%
add-sqr-sqrt79.9%
times-frac79.8%
hypot-define79.8%
fma-define79.8%
hypot-define95.0%
Applied egg-rr95.0%
if 5.0000000000000002e268 < (/.f64 (+.f64 (*.f64 x.re y.re) (*.f64 x.im y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) Initial program 20.3%
Taylor expanded in y.im around inf 58.0%
associate-/l*69.8%
Simplified69.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -0.00018)
(/ x.im y.im)
(if (<= y.im 9.2e+49)
(/ x.re y.re)
(if (<= y.im 8.2e+88) (* (/ y.re y.im) (/ x.re y.im)) (/ x.im 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 <= -0.00018) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 9.2e+49) {
tmp = x_46_re / y_46_re;
} else if (y_46_im <= 8.2e+88) {
tmp = (y_46_re / y_46_im) * (x_46_re / y_46_im);
} else {
tmp = x_46_im / 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 <= (-0.00018d0)) then
tmp = x_46im / y_46im
else if (y_46im <= 9.2d+49) then
tmp = x_46re / y_46re
else if (y_46im <= 8.2d+88) then
tmp = (y_46re / y_46im) * (x_46re / y_46im)
else
tmp = x_46im / 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 <= -0.00018) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 9.2e+49) {
tmp = x_46_re / y_46_re;
} else if (y_46_im <= 8.2e+88) {
tmp = (y_46_re / y_46_im) * (x_46_re / y_46_im);
} else {
tmp = x_46_im / 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 <= -0.00018: tmp = x_46_im / y_46_im elif y_46_im <= 9.2e+49: tmp = x_46_re / y_46_re elif y_46_im <= 8.2e+88: tmp = (y_46_re / y_46_im) * (x_46_re / y_46_im) else: tmp = x_46_im / 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 <= -0.00018) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= 9.2e+49) tmp = Float64(x_46_re / y_46_re); elseif (y_46_im <= 8.2e+88) tmp = Float64(Float64(y_46_re / y_46_im) * Float64(x_46_re / y_46_im)); else tmp = Float64(x_46_im / 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 <= -0.00018) tmp = x_46_im / y_46_im; elseif (y_46_im <= 9.2e+49) tmp = x_46_re / y_46_re; elseif (y_46_im <= 8.2e+88) tmp = (y_46_re / y_46_im) * (x_46_re / y_46_im); else tmp = x_46_im / 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, -0.00018], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 9.2e+49], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 8.2e+88], N[(N[(y$46$re / y$46$im), $MachinePrecision] * N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision], N[(x$46$im / y$46$im), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -0.00018:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq 9.2 \cdot 10^{+49}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.im \leq 8.2 \cdot 10^{+88}:\\
\;\;\;\;\frac{y.re}{y.im} \cdot \frac{x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -1.80000000000000011e-4 or 8.20000000000000055e88 < y.im Initial program 39.0%
Taylor expanded in y.re around 0 71.3%
if -1.80000000000000011e-4 < y.im < 9.20000000000000008e49Initial program 77.8%
Taylor expanded in y.re around inf 63.2%
if 9.20000000000000008e49 < y.im < 8.20000000000000055e88Initial program 91.0%
Taylor expanded in x.re around inf 59.6%
*-commutative59.6%
Simplified59.6%
add-sqr-sqrt59.6%
hypot-undefine59.6%
hypot-undefine59.6%
times-frac67.9%
Applied egg-rr67.9%
Taylor expanded in y.re around 0 59.9%
Taylor expanded in y.re around 0 59.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -2.75e-41) (not (<= y.im 6.2e-12))) (/ (+ x.im (* x.re (/ y.re y.im))) y.im) (/ (+ x.re (/ (* x.im 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.75e-41) || !(y_46_im <= 6.2e-12)) {
tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im;
} else {
tmp = (x_46_re + ((x_46_im * 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.75d-41)) .or. (.not. (y_46im <= 6.2d-12))) then
tmp = (x_46im + (x_46re * (y_46re / y_46im))) / y_46im
else
tmp = (x_46re + ((x_46im * 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.75e-41) || !(y_46_im <= 6.2e-12)) {
tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im;
} else {
tmp = (x_46_re + ((x_46_im * 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.75e-41) or not (y_46_im <= 6.2e-12): tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im else: tmp = (x_46_re + ((x_46_im * 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.75e-41) || !(y_46_im <= 6.2e-12)) tmp = Float64(Float64(x_46_im + Float64(x_46_re * Float64(y_46_re / y_46_im))) / y_46_im); else tmp = Float64(Float64(x_46_re + Float64(Float64(x_46_im * 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.75e-41) || ~((y_46_im <= 6.2e-12))) tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im; else tmp = (x_46_re + ((x_46_im * 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.75e-41], N[Not[LessEqual[y$46$im, 6.2e-12]], $MachinePrecision]], N[(N[(x$46$im + N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], N[(N[(x$46$re + N[(N[(x$46$im * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -2.75 \cdot 10^{-41} \lor \neg \left(y.im \leq 6.2 \cdot 10^{-12}\right):\\
\;\;\;\;\frac{x.im + x.re \cdot \frac{y.re}{y.im}}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re + \frac{x.im \cdot y.im}{y.re}}{y.re}\\
\end{array}
\end{array}
if y.im < -2.75000000000000011e-41 or 6.2000000000000002e-12 < y.im Initial program 50.8%
Taylor expanded in y.im around inf 72.4%
associate-/l*78.6%
Simplified78.6%
if -2.75000000000000011e-41 < y.im < 6.2000000000000002e-12Initial program 77.6%
Taylor expanded in y.re around inf 84.8%
*-commutative84.8%
Simplified84.8%
Final simplification81.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -1.05e-42) (not (<= y.im 6.2e-12))) (/ (+ x.im (* x.re (/ y.re y.im))) y.im) (/ (+ x.re (* x.im (/ 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 <= -1.05e-42) || !(y_46_im <= 6.2e-12)) {
tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im;
} else {
tmp = (x_46_re + (x_46_im * (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 <= (-1.05d-42)) .or. (.not. (y_46im <= 6.2d-12))) then
tmp = (x_46im + (x_46re * (y_46re / y_46im))) / y_46im
else
tmp = (x_46re + (x_46im * (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 <= -1.05e-42) || !(y_46_im <= 6.2e-12)) {
tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im;
} else {
tmp = (x_46_re + (x_46_im * (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 <= -1.05e-42) or not (y_46_im <= 6.2e-12): tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im else: tmp = (x_46_re + (x_46_im * (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 <= -1.05e-42) || !(y_46_im <= 6.2e-12)) tmp = Float64(Float64(x_46_im + Float64(x_46_re * Float64(y_46_re / y_46_im))) / y_46_im); else tmp = Float64(Float64(x_46_re + Float64(x_46_im * 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 <= -1.05e-42) || ~((y_46_im <= 6.2e-12))) tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im; else tmp = (x_46_re + (x_46_im * (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, -1.05e-42], N[Not[LessEqual[y$46$im, 6.2e-12]], $MachinePrecision]], N[(N[(x$46$im + N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], N[(N[(x$46$re + N[(x$46$im * 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 -1.05 \cdot 10^{-42} \lor \neg \left(y.im \leq 6.2 \cdot 10^{-12}\right):\\
\;\;\;\;\frac{x.im + x.re \cdot \frac{y.re}{y.im}}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re + x.im \cdot \frac{y.im}{y.re}}{y.re}\\
\end{array}
\end{array}
if y.im < -1.05000000000000003e-42 or 6.2000000000000002e-12 < y.im Initial program 50.8%
Taylor expanded in y.im around inf 72.4%
associate-/l*78.6%
Simplified78.6%
if -1.05000000000000003e-42 < y.im < 6.2000000000000002e-12Initial program 77.6%
Taylor expanded in y.re around inf 84.8%
*-commutative84.8%
Simplified84.8%
Taylor expanded in y.im around 0 84.8%
associate-*r/84.1%
Simplified84.1%
Final simplification81.4%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -7.5e+19) (not (<= y.re 2.6e+95))) (/ x.re y.re) (/ (+ x.im (* x.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) {
double tmp;
if ((y_46_re <= -7.5e+19) || !(y_46_re <= 2.6e+95)) {
tmp = x_46_re / y_46_re;
} else {
tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im;
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if ((y_46re <= (-7.5d+19)) .or. (.not. (y_46re <= 2.6d+95))) then
tmp = x_46re / y_46re
else
tmp = (x_46im + (x_46re * (y_46re / y_46im))) / y_46im
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_re <= -7.5e+19) || !(y_46_re <= 2.6e+95)) {
tmp = x_46_re / y_46_re;
} else {
tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (y_46_re <= -7.5e+19) or not (y_46_re <= 2.6e+95): tmp = x_46_re / y_46_re else: tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_re <= -7.5e+19) || !(y_46_re <= 2.6e+95)) tmp = Float64(x_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_im); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if ((y_46_re <= -7.5e+19) || ~((y_46_re <= 2.6e+95))) tmp = x_46_re / y_46_re; else tmp = (x_46_im + (x_46_re * (y_46_re / y_46_im))) / y_46_im; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$re, -7.5e+19], N[Not[LessEqual[y$46$re, 2.6e+95]], $MachinePrecision]], N[(x$46$re / y$46$re), $MachinePrecision], N[(N[(x$46$im + N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -7.5 \cdot 10^{+19} \lor \neg \left(y.re \leq 2.6 \cdot 10^{+95}\right):\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im + x.re \cdot \frac{y.re}{y.im}}{y.im}\\
\end{array}
\end{array}
if y.re < -7.5e19 or 2.5999999999999999e95 < y.re Initial program 58.2%
Taylor expanded in y.re around inf 69.7%
if -7.5e19 < y.re < 2.5999999999999999e95Initial program 68.8%
Taylor expanded in y.im around inf 74.9%
associate-/l*78.6%
Simplified78.6%
Final simplification74.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -3e-10) (not (<= y.im 8e+38))) (/ x.im y.im) (/ 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 <= -3e-10) || !(y_46_im <= 8e+38)) {
tmp = x_46_im / y_46_im;
} else {
tmp = 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 <= (-3d-10)) .or. (.not. (y_46im <= 8d+38))) then
tmp = x_46im / y_46im
else
tmp = 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 <= -3e-10) || !(y_46_im <= 8e+38)) {
tmp = x_46_im / y_46_im;
} else {
tmp = 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 <= -3e-10) or not (y_46_im <= 8e+38): tmp = x_46_im / y_46_im else: tmp = 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 <= -3e-10) || !(y_46_im <= 8e+38)) tmp = Float64(x_46_im / y_46_im); else tmp = Float64(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 <= -3e-10) || ~((y_46_im <= 8e+38))) tmp = x_46_im / y_46_im; else tmp = 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, -3e-10], N[Not[LessEqual[y$46$im, 8e+38]], $MachinePrecision]], N[(x$46$im / y$46$im), $MachinePrecision], N[(x$46$re / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -3 \cdot 10^{-10} \lor \neg \left(y.im \leq 8 \cdot 10^{+38}\right):\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\end{array}
\end{array}
if y.im < -3e-10 or 7.99999999999999982e38 < y.im Initial program 46.1%
Taylor expanded in y.re around 0 64.6%
if -3e-10 < y.im < 7.99999999999999982e38Initial program 77.8%
Taylor expanded in y.re around inf 64.1%
Final simplification64.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 64.3%
Taylor expanded in y.re around 0 38.9%
herbie shell --seed 2024137
(FPCore (x.re x.im y.re y.im)
:name "_divideComplex, real part"
:precision binary64
(/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))