
(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)
use fmin_fmax_functions
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]
\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
Herbie found 9 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)
use fmin_fmax_functions
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]
\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (fma y.im y.im (* y.re y.re)))
(t_1 (fma x.im (/ y.im t_0) (* y.re (/ x.re t_0))))
(t_2 (/ (fma y.re (/ x.re y.im) x.im) y.im))
(t_3 (/ (+ x.re (/ (* x.im y.im) y.re)) y.re)))
(if (<= y.im -9.8e+169)
t_2
(if (<= y.im -3.6e+30)
t_1
(if (<= y.im -5e-22)
t_3
(if (<= y.im -2.9e-97)
(/ (fma y.im x.im (* y.re x.re)) t_0)
(if (<= y.im 1.1e-40)
t_3
(if (<= y.im 1.15e+136) t_1 t_2))))))))double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = fma(y_46_im, y_46_im, (y_46_re * y_46_re));
double t_1 = fma(x_46_im, (y_46_im / t_0), (y_46_re * (x_46_re / t_0)));
double t_2 = fma(y_46_re, (x_46_re / y_46_im), x_46_im) / y_46_im;
double t_3 = (x_46_re + ((x_46_im * y_46_im) / y_46_re)) / y_46_re;
double tmp;
if (y_46_im <= -9.8e+169) {
tmp = t_2;
} else if (y_46_im <= -3.6e+30) {
tmp = t_1;
} else if (y_46_im <= -5e-22) {
tmp = t_3;
} else if (y_46_im <= -2.9e-97) {
tmp = fma(y_46_im, x_46_im, (y_46_re * x_46_re)) / t_0;
} else if (y_46_im <= 1.1e-40) {
tmp = t_3;
} else if (y_46_im <= 1.15e+136) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re)) t_1 = fma(x_46_im, Float64(y_46_im / t_0), Float64(y_46_re * Float64(x_46_re / t_0))) t_2 = Float64(fma(y_46_re, Float64(x_46_re / y_46_im), x_46_im) / y_46_im) t_3 = Float64(Float64(x_46_re + Float64(Float64(x_46_im * y_46_im) / y_46_re)) / y_46_re) tmp = 0.0 if (y_46_im <= -9.8e+169) tmp = t_2; elseif (y_46_im <= -3.6e+30) tmp = t_1; elseif (y_46_im <= -5e-22) tmp = t_3; elseif (y_46_im <= -2.9e-97) tmp = Float64(fma(y_46_im, x_46_im, Float64(y_46_re * x_46_re)) / t_0); elseif (y_46_im <= 1.1e-40) tmp = t_3; elseif (y_46_im <= 1.15e+136) tmp = t_1; else tmp = t_2; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x$46$im * N[(y$46$im / t$95$0), $MachinePrecision] + N[(y$46$re * N[(x$46$re / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y$46$re * N[(x$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]}, Block[{t$95$3 = 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, -9.8e+169], t$95$2, If[LessEqual[y$46$im, -3.6e+30], t$95$1, If[LessEqual[y$46$im, -5e-22], t$95$3, If[LessEqual[y$46$im, -2.9e-97], N[(N[(y$46$im * x$46$im + N[(y$46$re * x$46$re), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[y$46$im, 1.1e-40], t$95$3, If[LessEqual[y$46$im, 1.15e+136], t$95$1, t$95$2]]]]]]]]]]
\begin{array}{l}
t_0 := \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)\\
t_1 := \mathsf{fma}\left(x.im, \frac{y.im}{t\_0}, y.re \cdot \frac{x.re}{t\_0}\right)\\
t_2 := \frac{\mathsf{fma}\left(y.re, \frac{x.re}{y.im}, x.im\right)}{y.im}\\
t_3 := \frac{x.re + \frac{x.im \cdot y.im}{y.re}}{y.re}\\
\mathbf{if}\;y.im \leq -9.8 \cdot 10^{+169}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y.im \leq -3.6 \cdot 10^{+30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq -5 \cdot 10^{-22}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;y.im \leq -2.9 \cdot 10^{-97}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)}{t\_0}\\
\mathbf{elif}\;y.im \leq 1.1 \cdot 10^{-40}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;y.im \leq 1.15 \cdot 10^{+136}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if y.im < -9.8000000000000005e169 or 1.15e136 < y.im Initial program 61.8%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.8%
Applied rewrites52.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6454.1%
Applied rewrites54.1%
if -9.8000000000000005e169 < y.im < -3.6000000000000002e30 or 1.1e-40 < y.im < 1.15e136Initial program 61.8%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6461.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6461.9%
Applied rewrites61.9%
if -3.6000000000000002e30 < y.im < -4.9999999999999995e-22 or -2.8999999999999999e-97 < y.im < 1.1e-40Initial program 61.8%
Taylor expanded in y.re around 0
lower-/.f6443.2%
Applied rewrites43.2%
Taylor expanded in y.re around inf
lower-/.f6442.0%
Applied rewrites42.0%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6451.1%
Applied rewrites51.1%
if -4.9999999999999995e-22 < y.im < -2.8999999999999999e-97Initial program 61.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6461.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6461.8%
Applied rewrites61.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (fma y.im y.im (* y.re y.re)))
(t_1 (/ y.re t_0))
(t_2 (/ (fma y.re (/ x.re y.im) x.im) y.im)))
(if (<= y.im -9.8e+169)
t_2
(if (<= y.im -2.9e-97)
(fma x.re t_1 (* x.im (/ y.im t_0)))
(if (<= y.im 2.5e-99)
(/ (+ x.re (/ (* x.im y.im) y.re)) y.re)
(if (<= y.im 1.85e+123)
(fma x.re t_1 (* y.im (/ x.im t_0)))
t_2))))))double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = fma(y_46_im, y_46_im, (y_46_re * y_46_re));
double t_1 = y_46_re / t_0;
double t_2 = fma(y_46_re, (x_46_re / y_46_im), x_46_im) / y_46_im;
double tmp;
if (y_46_im <= -9.8e+169) {
tmp = t_2;
} else if (y_46_im <= -2.9e-97) {
tmp = fma(x_46_re, t_1, (x_46_im * (y_46_im / t_0)));
} else if (y_46_im <= 2.5e-99) {
tmp = (x_46_re + ((x_46_im * y_46_im) / y_46_re)) / y_46_re;
} else if (y_46_im <= 1.85e+123) {
tmp = fma(x_46_re, t_1, (y_46_im * (x_46_im / t_0)));
} else {
tmp = t_2;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re)) t_1 = Float64(y_46_re / t_0) t_2 = Float64(fma(y_46_re, Float64(x_46_re / y_46_im), x_46_im) / y_46_im) tmp = 0.0 if (y_46_im <= -9.8e+169) tmp = t_2; elseif (y_46_im <= -2.9e-97) tmp = fma(x_46_re, t_1, Float64(x_46_im * Float64(y_46_im / t_0))); elseif (y_46_im <= 2.5e-99) tmp = Float64(Float64(x_46_re + Float64(Float64(x_46_im * y_46_im) / y_46_re)) / y_46_re); elseif (y_46_im <= 1.85e+123) tmp = fma(x_46_re, t_1, Float64(y_46_im * Float64(x_46_im / t_0))); else tmp = t_2; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y$46$re / t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y$46$re * N[(x$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -9.8e+169], t$95$2, If[LessEqual[y$46$im, -2.9e-97], N[(x$46$re * t$95$1 + N[(x$46$im * N[(y$46$im / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 2.5e-99], 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, 1.85e+123], N[(x$46$re * t$95$1 + N[(y$46$im * N[(x$46$im / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
t_0 := \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)\\
t_1 := \frac{y.re}{t\_0}\\
t_2 := \frac{\mathsf{fma}\left(y.re, \frac{x.re}{y.im}, x.im\right)}{y.im}\\
\mathbf{if}\;y.im \leq -9.8 \cdot 10^{+169}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y.im \leq -2.9 \cdot 10^{-97}:\\
\;\;\;\;\mathsf{fma}\left(x.re, t\_1, x.im \cdot \frac{y.im}{t\_0}\right)\\
\mathbf{elif}\;y.im \leq 2.5 \cdot 10^{-99}:\\
\;\;\;\;\frac{x.re + \frac{x.im \cdot y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 1.85 \cdot 10^{+123}:\\
\;\;\;\;\mathsf{fma}\left(x.re, t\_1, y.im \cdot \frac{x.im}{t\_0}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if y.im < -9.8000000000000005e169 or 1.85e123 < y.im Initial program 61.8%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.8%
Applied rewrites52.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6454.1%
Applied rewrites54.1%
if -9.8000000000000005e169 < y.im < -2.8999999999999999e-97Initial program 61.8%
lift-/.f64N/A
lift-+.f64N/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6461.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6461.5%
Applied rewrites61.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6465.0%
Applied rewrites65.0%
if -2.8999999999999999e-97 < y.im < 2.4999999999999998e-99Initial program 61.8%
Taylor expanded in y.re around 0
lower-/.f6443.2%
Applied rewrites43.2%
Taylor expanded in y.re around inf
lower-/.f6442.0%
Applied rewrites42.0%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6451.1%
Applied rewrites51.1%
if 2.4999999999999998e-99 < y.im < 1.85e123Initial program 61.8%
lift-/.f64N/A
lift-+.f64N/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6461.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6461.5%
Applied rewrites61.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (fma y.im y.im (* y.re y.re)))
(t_1 (fma x.re (/ y.re t_0) (* x.im (/ y.im t_0))))
(t_2 (/ (fma y.re (/ x.re y.im) x.im) y.im)))
(if (<= y.im -9.8e+169)
t_2
(if (<= y.im -2.9e-97)
t_1
(if (<= y.im 4e-131)
(/ (+ x.re (/ (* x.im y.im) y.re)) y.re)
(if (<= y.im 1.15e+136) t_1 t_2))))))double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = fma(y_46_im, y_46_im, (y_46_re * y_46_re));
double t_1 = fma(x_46_re, (y_46_re / t_0), (x_46_im * (y_46_im / t_0)));
double t_2 = fma(y_46_re, (x_46_re / y_46_im), x_46_im) / y_46_im;
double tmp;
if (y_46_im <= -9.8e+169) {
tmp = t_2;
} else if (y_46_im <= -2.9e-97) {
tmp = t_1;
} else if (y_46_im <= 4e-131) {
tmp = (x_46_re + ((x_46_im * y_46_im) / y_46_re)) / y_46_re;
} else if (y_46_im <= 1.15e+136) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re)) t_1 = fma(x_46_re, Float64(y_46_re / t_0), Float64(x_46_im * Float64(y_46_im / t_0))) t_2 = Float64(fma(y_46_re, Float64(x_46_re / y_46_im), x_46_im) / y_46_im) tmp = 0.0 if (y_46_im <= -9.8e+169) tmp = t_2; elseif (y_46_im <= -2.9e-97) tmp = t_1; elseif (y_46_im <= 4e-131) tmp = Float64(Float64(x_46_re + Float64(Float64(x_46_im * y_46_im) / y_46_re)) / y_46_re); elseif (y_46_im <= 1.15e+136) tmp = t_1; else tmp = t_2; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x$46$re * N[(y$46$re / t$95$0), $MachinePrecision] + N[(x$46$im * N[(y$46$im / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y$46$re * N[(x$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -9.8e+169], t$95$2, If[LessEqual[y$46$im, -2.9e-97], t$95$1, If[LessEqual[y$46$im, 4e-131], 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, 1.15e+136], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
t_0 := \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)\\
t_1 := \mathsf{fma}\left(x.re, \frac{y.re}{t\_0}, x.im \cdot \frac{y.im}{t\_0}\right)\\
t_2 := \frac{\mathsf{fma}\left(y.re, \frac{x.re}{y.im}, x.im\right)}{y.im}\\
\mathbf{if}\;y.im \leq -9.8 \cdot 10^{+169}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y.im \leq -2.9 \cdot 10^{-97}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq 4 \cdot 10^{-131}:\\
\;\;\;\;\frac{x.re + \frac{x.im \cdot y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 1.15 \cdot 10^{+136}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if y.im < -9.8000000000000005e169 or 1.15e136 < y.im Initial program 61.8%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.8%
Applied rewrites52.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6454.1%
Applied rewrites54.1%
if -9.8000000000000005e169 < y.im < -2.8999999999999999e-97 or 3.9999999999999999e-131 < y.im < 1.15e136Initial program 61.8%
lift-/.f64N/A
lift-+.f64N/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6461.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6461.5%
Applied rewrites61.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6465.0%
Applied rewrites65.0%
if -2.8999999999999999e-97 < y.im < 3.9999999999999999e-131Initial program 61.8%
Taylor expanded in y.re around 0
lower-/.f6443.2%
Applied rewrites43.2%
Taylor expanded in y.re around inf
lower-/.f6442.0%
Applied rewrites42.0%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6451.1%
Applied rewrites51.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(/
(fma y.im x.im (* y.re x.re))
(fma y.im y.im (* y.re y.re))))
(t_1 (/ (fma y.re (/ x.re y.im) x.im) y.im)))
(if (<= y.im -6e+86)
t_1
(if (<= y.im -2.9e-97)
t_0
(if (<= y.im 4e-131)
(/ (+ x.re (/ (* x.im y.im) y.re)) y.re)
(if (<= y.im 1.1e+109) t_0 t_1))))))double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = fma(y_46_im, x_46_im, (y_46_re * x_46_re)) / fma(y_46_im, y_46_im, (y_46_re * y_46_re));
double t_1 = fma(y_46_re, (x_46_re / y_46_im), x_46_im) / y_46_im;
double tmp;
if (y_46_im <= -6e+86) {
tmp = t_1;
} else if (y_46_im <= -2.9e-97) {
tmp = t_0;
} else if (y_46_im <= 4e-131) {
tmp = (x_46_re + ((x_46_im * y_46_im) / y_46_re)) / y_46_re;
} else if (y_46_im <= 1.1e+109) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(fma(y_46_im, x_46_im, Float64(y_46_re * x_46_re)) / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) t_1 = Float64(fma(y_46_re, Float64(x_46_re / y_46_im), x_46_im) / y_46_im) tmp = 0.0 if (y_46_im <= -6e+86) tmp = t_1; elseif (y_46_im <= -2.9e-97) tmp = t_0; elseif (y_46_im <= 4e-131) tmp = Float64(Float64(x_46_re + Float64(Float64(x_46_im * y_46_im) / y_46_re)) / y_46_re); elseif (y_46_im <= 1.1e+109) tmp = t_0; else tmp = t_1; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(y$46$im * x$46$im + N[(y$46$re * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y$46$re * N[(x$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -6e+86], t$95$1, If[LessEqual[y$46$im, -2.9e-97], t$95$0, If[LessEqual[y$46$im, 4e-131], 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, 1.1e+109], t$95$0, t$95$1]]]]]]
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\
t_1 := \frac{\mathsf{fma}\left(y.re, \frac{x.re}{y.im}, x.im\right)}{y.im}\\
\mathbf{if}\;y.im \leq -6 \cdot 10^{+86}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq -2.9 \cdot 10^{-97}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 4 \cdot 10^{-131}:\\
\;\;\;\;\frac{x.re + \frac{x.im \cdot y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 1.1 \cdot 10^{+109}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if y.im < -5.9999999999999995e86 or 1.1e109 < y.im Initial program 61.8%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.8%
Applied rewrites52.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6454.1%
Applied rewrites54.1%
if -5.9999999999999995e86 < y.im < -2.8999999999999999e-97 or 3.9999999999999999e-131 < y.im < 1.1e109Initial program 61.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6461.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6461.8%
Applied rewrites61.8%
if -2.8999999999999999e-97 < y.im < 3.9999999999999999e-131Initial program 61.8%
Taylor expanded in y.re around 0
lower-/.f6443.2%
Applied rewrites43.2%
Taylor expanded in y.re around inf
lower-/.f6442.0%
Applied rewrites42.0%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6451.1%
Applied rewrites51.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (fma y.re (/ x.re y.im) x.im) y.im)))
(if (<= y.im -3.6e+30)
t_0
(if (<= y.im 0.045)
(/ (+ x.re (/ (* x.im 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 = fma(y_46_re, (x_46_re / y_46_im), x_46_im) / y_46_im;
double tmp;
if (y_46_im <= -3.6e+30) {
tmp = t_0;
} else if (y_46_im <= 0.045) {
tmp = (x_46_re + ((x_46_im * 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(fma(y_46_re, Float64(x_46_re / y_46_im), x_46_im) / y_46_im) tmp = 0.0 if (y_46_im <= -3.6e+30) tmp = t_0; elseif (y_46_im <= 0.045) tmp = Float64(Float64(x_46_re + Float64(Float64(x_46_im * y_46_im) / y_46_re)) / y_46_re); else tmp = t_0; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(y$46$re * N[(x$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -3.6e+30], t$95$0, If[LessEqual[y$46$im, 0.045], N[(N[(x$46$re + N[(N[(x$46$im * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(y.re, \frac{x.re}{y.im}, x.im\right)}{y.im}\\
\mathbf{if}\;y.im \leq -3.6 \cdot 10^{+30}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 0.045:\\
\;\;\;\;\frac{x.re + \frac{x.im \cdot y.im}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y.im < -3.6000000000000002e30 or 0.044999999999999998 < y.im Initial program 61.8%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.8%
Applied rewrites52.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6454.1%
Applied rewrites54.1%
if -3.6000000000000002e30 < y.im < 0.044999999999999998Initial program 61.8%
Taylor expanded in y.re around 0
lower-/.f6443.2%
Applied rewrites43.2%
Taylor expanded in y.re around inf
lower-/.f6442.0%
Applied rewrites42.0%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6451.1%
Applied rewrites51.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -4e-26)
(/ x.re y.re)
(if (<= y.re 2.4e+69)
(/ (fma (/ y.re y.im) x.re 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_re <= -4e-26) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= 2.4e+69) {
tmp = fma((y_46_re / y_46_im), x_46_re, 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_re <= -4e-26) tmp = Float64(x_46_re / y_46_re); elseif (y_46_re <= 2.4e+69) tmp = Float64(fma(Float64(y_46_re / y_46_im), x_46_re, x_46_im) / y_46_im); else tmp = Float64(x_46_re / 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, -4e-26], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 2.4e+69], N[(N[(N[(y$46$re / y$46$im), $MachinePrecision] * x$46$re + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision], N[(x$46$re / y$46$re), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;y.re \leq -4 \cdot 10^{-26}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.re \leq 2.4 \cdot 10^{+69}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y.re}{y.im}, x.re, x.im\right)}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\end{array}
if y.re < -4.0000000000000002e-26 or 2.4000000000000002e69 < y.re Initial program 61.8%
Taylor expanded in y.re around 0
lower-/.f6443.2%
Applied rewrites43.2%
Taylor expanded in y.re around inf
lower-/.f6442.0%
Applied rewrites42.0%
if -4.0000000000000002e-26 < y.re < 2.4000000000000002e69Initial program 61.8%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.8%
Applied rewrites52.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6454.1%
Applied rewrites54.1%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-fma.f6454.9%
Applied rewrites54.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (let* ((t_0 (/ (fma y.re (/ x.re y.im) x.im) y.im))) (if (<= y.im -3.6e+30) t_0 (if (<= y.im 0.045) (/ x.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 = fma(y_46_re, (x_46_re / y_46_im), x_46_im) / y_46_im;
double tmp;
if (y_46_im <= -3.6e+30) {
tmp = t_0;
} else if (y_46_im <= 0.045) {
tmp = x_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(fma(y_46_re, Float64(x_46_re / y_46_im), x_46_im) / y_46_im) tmp = 0.0 if (y_46_im <= -3.6e+30) tmp = t_0; elseif (y_46_im <= 0.045) tmp = Float64(x_46_re / y_46_re); else tmp = t_0; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(y$46$re * N[(x$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -3.6e+30], t$95$0, If[LessEqual[y$46$im, 0.045], N[(x$46$re / y$46$re), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(y.re, \frac{x.re}{y.im}, x.im\right)}{y.im}\\
\mathbf{if}\;y.im \leq -3.6 \cdot 10^{+30}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 0.045:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y.im < -3.6000000000000002e30 or 0.044999999999999998 < y.im Initial program 61.8%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.8%
Applied rewrites52.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6454.1%
Applied rewrites54.1%
if -3.6000000000000002e30 < y.im < 0.044999999999999998Initial program 61.8%
Taylor expanded in y.re around 0
lower-/.f6443.2%
Applied rewrites43.2%
Taylor expanded in y.re around inf
lower-/.f6442.0%
Applied rewrites42.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.im -3.7e+33) (/ x.im y.im) (if (<= y.im 0.045) (/ x.re y.re) (/ 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 <= -3.7e+33) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 0.045) {
tmp = x_46_re / y_46_re;
} else {
tmp = x_46_im / y_46_im;
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
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.7d+33)) then
tmp = x_46im / y_46im
else if (y_46im <= 0.045d0) then
tmp = x_46re / y_46re
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 <= -3.7e+33) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 0.045) {
tmp = x_46_re / y_46_re;
} 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 <= -3.7e+33: tmp = x_46_im / y_46_im elif y_46_im <= 0.045: tmp = x_46_re / y_46_re 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 <= -3.7e+33) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= 0.045) tmp = Float64(x_46_re / y_46_re); 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 <= -3.7e+33) tmp = x_46_im / y_46_im; elseif (y_46_im <= 0.045) tmp = x_46_re / y_46_re; 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, -3.7e+33], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 0.045], N[(x$46$re / y$46$re), $MachinePrecision], N[(x$46$im / y$46$im), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;y.im \leq -3.7 \cdot 10^{+33}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq 0.045:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
if y.im < -3.6999999999999999e33 or 0.044999999999999998 < y.im Initial program 61.8%
Taylor expanded in y.re around 0
lower-/.f6443.2%
Applied rewrites43.2%
if -3.6999999999999999e33 < y.im < 0.044999999999999998Initial program 61.8%
Taylor expanded in y.re around 0
lower-/.f6443.2%
Applied rewrites43.2%
Taylor expanded in y.re around inf
lower-/.f6442.0%
Applied rewrites42.0%
(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)
use fmin_fmax_functions
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]
\frac{x.im}{y.im}
Initial program 61.8%
Taylor expanded in y.re around 0
lower-/.f6443.2%
Applied rewrites43.2%
herbie shell --seed 2025313 -o setup:search
(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))))