
(FPCore (x.re x.im) :precision binary64 (+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re)))
double code(double x_46_re, double x_46_im) {
return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re);
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = (((x_46re * x_46re) - (x_46im * x_46im)) * x_46im) + (((x_46re * x_46im) + (x_46im * x_46re)) * x_46re)
end function
public static double code(double x_46_re, double x_46_im) {
return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re);
}
def code(x_46_re, x_46_im): return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re)
function code(x_46_re, x_46_im) return Float64(Float64(Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im)) * x_46_im) + Float64(Float64(Float64(x_46_re * x_46_im) + Float64(x_46_im * x_46_re)) * x_46_re)) end
function tmp = code(x_46_re, x_46_im) tmp = (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re); end
code[x$46$re_, x$46$im_] := N[(N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision] + N[(N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x.re x.im) :precision binary64 (+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re)))
double code(double x_46_re, double x_46_im) {
return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re);
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = (((x_46re * x_46re) - (x_46im * x_46im)) * x_46im) + (((x_46re * x_46im) + (x_46im * x_46re)) * x_46re)
end function
public static double code(double x_46_re, double x_46_im) {
return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re);
}
def code(x_46_re, x_46_im): return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re)
function code(x_46_re, x_46_im) return Float64(Float64(Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im)) * x_46_im) + Float64(Float64(Float64(x_46_re * x_46_im) + Float64(x_46_im * x_46_re)) * x_46_re)) end
function tmp = code(x_46_re, x_46_im) tmp = (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re); end
code[x$46$re_, x$46$im_] := N[(N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision] + N[(N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re
\end{array}
(FPCore (x.re x.im)
:precision binary64
(let* ((t_0 (* x.im (- x.re x.im))))
(if (<=
(+
(* x.im (- (* x.re x.re) (* x.im x.im)))
(* x.re (+ (* x.re x.im) (* x.re x.im))))
INFINITY)
(fma (+ x.re x.im) t_0 (* x.re (* x.re (+ x.im x.im))))
(+ (+ x.im x.im) (* t_0 (+ x.re x.im))))))
double code(double x_46_re, double x_46_im) {
double t_0 = x_46_im * (x_46_re - x_46_im);
double tmp;
if (((x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_re * x_46_im) + (x_46_re * x_46_im)))) <= ((double) INFINITY)) {
tmp = fma((x_46_re + x_46_im), t_0, (x_46_re * (x_46_re * (x_46_im + x_46_im))));
} else {
tmp = (x_46_im + x_46_im) + (t_0 * (x_46_re + x_46_im));
}
return tmp;
}
function code(x_46_re, x_46_im) t_0 = Float64(x_46_im * Float64(x_46_re - x_46_im)) tmp = 0.0 if (Float64(Float64(x_46_im * Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im))) + Float64(x_46_re * Float64(Float64(x_46_re * x_46_im) + Float64(x_46_re * x_46_im)))) <= Inf) tmp = fma(Float64(x_46_re + x_46_im), t_0, Float64(x_46_re * Float64(x_46_re * Float64(x_46_im + x_46_im)))); else tmp = Float64(Float64(x_46_im + x_46_im) + Float64(t_0 * Float64(x_46_re + x_46_im))); end return tmp end
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(x$46$im * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(x$46$im * N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x$46$re * N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(x$46$re + x$46$im), $MachinePrecision] * t$95$0 + N[(x$46$re * N[(x$46$re * N[(x$46$im + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im + x$46$im), $MachinePrecision] + N[(t$95$0 * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x.im \cdot \left(x.re - x.im\right)\\
\mathbf{if}\;x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) + x.re \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right) \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(x.re + x.im, t_0, x.re \cdot \left(x.re \cdot \left(x.im + x.im\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x.im + x.im\right) + t_0 \cdot \left(x.re + x.im\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.im) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.re)) < +inf.0Initial program 91.6%
*-commutative91.6%
*-commutative91.6%
difference-of-squares91.6%
associate-*l*99.7%
fma-def99.8%
*-commutative99.8%
*-commutative99.8%
*-commutative99.8%
distribute-lft-out99.8%
Simplified99.8%
if +inf.0 < (+.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.im) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.re)) Initial program 0.0%
+-commutative0.0%
*-commutative0.0%
fma-def26.3%
*-commutative26.3%
distribute-lft-out26.3%
*-commutative26.3%
Simplified26.3%
fma-udef0.0%
distribute-lft-in0.0%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+26.3%
distribute-lft-in26.3%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+26.3%
*-commutative26.3%
difference-of-squares100.0%
associate-*r*100.0%
*-commutative100.0%
Applied egg-rr100.0%
Final simplification99.8%
(FPCore (x.re x.im)
:precision binary64
(let* ((t_0 (* x.re (+ (* x.re x.im) (* x.re x.im)))))
(if (<= (+ (* x.im (- (* x.re x.re) (* x.im x.im))) t_0) INFINITY)
(+ t_0 (/ (+ x.re x.im) (/ (/ 1.0 x.im) (- x.re x.im))))
(+ (+ x.im x.im) (* (* x.im (- x.re x.im)) (+ x.re x.im))))))
double code(double x_46_re, double x_46_im) {
double t_0 = x_46_re * ((x_46_re * x_46_im) + (x_46_re * x_46_im));
double tmp;
if (((x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + t_0) <= ((double) INFINITY)) {
tmp = t_0 + ((x_46_re + x_46_im) / ((1.0 / x_46_im) / (x_46_re - x_46_im)));
} else {
tmp = (x_46_im + x_46_im) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im) {
double t_0 = x_46_re * ((x_46_re * x_46_im) + (x_46_re * x_46_im));
double tmp;
if (((x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + t_0) <= Double.POSITIVE_INFINITY) {
tmp = t_0 + ((x_46_re + x_46_im) / ((1.0 / x_46_im) / (x_46_re - x_46_im)));
} else {
tmp = (x_46_im + x_46_im) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im));
}
return tmp;
}
def code(x_46_re, x_46_im): t_0 = x_46_re * ((x_46_re * x_46_im) + (x_46_re * x_46_im)) tmp = 0 if ((x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + t_0) <= math.inf: tmp = t_0 + ((x_46_re + x_46_im) / ((1.0 / x_46_im) / (x_46_re - x_46_im))) else: tmp = (x_46_im + x_46_im) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im)) return tmp
function code(x_46_re, x_46_im) t_0 = Float64(x_46_re * Float64(Float64(x_46_re * x_46_im) + Float64(x_46_re * x_46_im))) tmp = 0.0 if (Float64(Float64(x_46_im * Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im))) + t_0) <= Inf) tmp = Float64(t_0 + Float64(Float64(x_46_re + x_46_im) / Float64(Float64(1.0 / x_46_im) / Float64(x_46_re - x_46_im)))); else tmp = Float64(Float64(x_46_im + x_46_im) + Float64(Float64(x_46_im * Float64(x_46_re - x_46_im)) * Float64(x_46_re + x_46_im))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im) t_0 = x_46_re * ((x_46_re * x_46_im) + (x_46_re * x_46_im)); tmp = 0.0; if (((x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + t_0) <= Inf) tmp = t_0 + ((x_46_re + x_46_im) / ((1.0 / x_46_im) / (x_46_re - x_46_im))); else tmp = (x_46_im + x_46_im) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(x$46$re * N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(x$46$im * N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], Infinity], N[(t$95$0 + N[(N[(x$46$re + x$46$im), $MachinePrecision] / N[(N[(1.0 / x$46$im), $MachinePrecision] / N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im + x$46$im), $MachinePrecision] + N[(N[(x$46$im * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x.re \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\\
\mathbf{if}\;x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) + t_0 \leq \infty:\\
\;\;\;\;t_0 + \frac{x.re + x.im}{\frac{\frac{1}{x.im}}{x.re - x.im}}\\
\mathbf{else}:\\
\;\;\;\;\left(x.im + x.im\right) + \left(x.im \cdot \left(x.re - x.im\right)\right) \cdot \left(x.re + x.im\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.im) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.re)) < +inf.0Initial program 91.6%
difference-of-squares91.6%
associate-*r*99.7%
*-commutative99.7%
flip-+91.6%
associate-*l/83.8%
Applied egg-rr83.8%
expm1-log1p-u58.3%
expm1-udef49.4%
associate-/l*50.7%
Applied egg-rr50.7%
expm1-def62.0%
expm1-log1p91.5%
difference-of-squares91.5%
associate-/l*99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x.re around 0 99.8%
if +inf.0 < (+.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.im) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.re)) Initial program 0.0%
+-commutative0.0%
*-commutative0.0%
fma-def26.3%
*-commutative26.3%
distribute-lft-out26.3%
*-commutative26.3%
Simplified26.3%
fma-udef0.0%
distribute-lft-in0.0%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+26.3%
distribute-lft-in26.3%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+26.3%
*-commutative26.3%
difference-of-squares100.0%
associate-*r*100.0%
*-commutative100.0%
Applied egg-rr100.0%
Final simplification99.8%
(FPCore (x.re x.im)
:precision binary64
(let* ((t_0
(+
(* x.im (- (* x.re x.re) (* x.im x.im)))
(* x.re (+ (* x.re x.im) (* x.re x.im)))))
(t_1 (+ (+ x.im x.im) (* (* x.im (- x.re x.im)) (+ x.re x.im)))))
(if (<= x.im -1e+152)
t_1
(if (<= x.im -4.5e-71)
t_0
(if (<= x.im 1.18e-125)
(* x.re (* x.re (* x.im 3.0)))
(if (<= x.im 1e+82) t_0 t_1))))))
double code(double x_46_re, double x_46_im) {
double t_0 = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_re * x_46_im) + (x_46_re * x_46_im)));
double t_1 = (x_46_im + x_46_im) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im));
double tmp;
if (x_46_im <= -1e+152) {
tmp = t_1;
} else if (x_46_im <= -4.5e-71) {
tmp = t_0;
} else if (x_46_im <= 1.18e-125) {
tmp = x_46_re * (x_46_re * (x_46_im * 3.0));
} else if (x_46_im <= 1e+82) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (x_46im * ((x_46re * x_46re) - (x_46im * x_46im))) + (x_46re * ((x_46re * x_46im) + (x_46re * x_46im)))
t_1 = (x_46im + x_46im) + ((x_46im * (x_46re - x_46im)) * (x_46re + x_46im))
if (x_46im <= (-1d+152)) then
tmp = t_1
else if (x_46im <= (-4.5d-71)) then
tmp = t_0
else if (x_46im <= 1.18d-125) then
tmp = x_46re * (x_46re * (x_46im * 3.0d0))
else if (x_46im <= 1d+82) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
double t_0 = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_re * x_46_im) + (x_46_re * x_46_im)));
double t_1 = (x_46_im + x_46_im) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im));
double tmp;
if (x_46_im <= -1e+152) {
tmp = t_1;
} else if (x_46_im <= -4.5e-71) {
tmp = t_0;
} else if (x_46_im <= 1.18e-125) {
tmp = x_46_re * (x_46_re * (x_46_im * 3.0));
} else if (x_46_im <= 1e+82) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x_46_re, x_46_im): t_0 = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_re * x_46_im) + (x_46_re * x_46_im))) t_1 = (x_46_im + x_46_im) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im)) tmp = 0 if x_46_im <= -1e+152: tmp = t_1 elif x_46_im <= -4.5e-71: tmp = t_0 elif x_46_im <= 1.18e-125: tmp = x_46_re * (x_46_re * (x_46_im * 3.0)) elif x_46_im <= 1e+82: tmp = t_0 else: tmp = t_1 return tmp
function code(x_46_re, x_46_im) t_0 = Float64(Float64(x_46_im * Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im))) + Float64(x_46_re * Float64(Float64(x_46_re * x_46_im) + Float64(x_46_re * x_46_im)))) t_1 = Float64(Float64(x_46_im + x_46_im) + Float64(Float64(x_46_im * Float64(x_46_re - x_46_im)) * Float64(x_46_re + x_46_im))) tmp = 0.0 if (x_46_im <= -1e+152) tmp = t_1; elseif (x_46_im <= -4.5e-71) tmp = t_0; elseif (x_46_im <= 1.18e-125) tmp = Float64(x_46_re * Float64(x_46_re * Float64(x_46_im * 3.0))); elseif (x_46_im <= 1e+82) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x_46_re, x_46_im) t_0 = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_re * x_46_im) + (x_46_re * x_46_im))); t_1 = (x_46_im + x_46_im) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im)); tmp = 0.0; if (x_46_im <= -1e+152) tmp = t_1; elseif (x_46_im <= -4.5e-71) tmp = t_0; elseif (x_46_im <= 1.18e-125) tmp = x_46_re * (x_46_re * (x_46_im * 3.0)); elseif (x_46_im <= 1e+82) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(N[(x$46$im * N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x$46$re * N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x$46$im + x$46$im), $MachinePrecision] + N[(N[(x$46$im * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$im, -1e+152], t$95$1, If[LessEqual[x$46$im, -4.5e-71], t$95$0, If[LessEqual[x$46$im, 1.18e-125], N[(x$46$re * N[(x$46$re * N[(x$46$im * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 1e+82], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) + x.re \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\\
t_1 := \left(x.im + x.im\right) + \left(x.im \cdot \left(x.re - x.im\right)\right) \cdot \left(x.re + x.im\right)\\
\mathbf{if}\;x.im \leq -1 \cdot 10^{+152}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x.im \leq -4.5 \cdot 10^{-71}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x.im \leq 1.18 \cdot 10^{-125}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(x.im \cdot 3\right)\right)\\
\mathbf{elif}\;x.im \leq 10^{+82}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x.im < -1e152 or 9.9999999999999996e81 < x.im Initial program 73.6%
+-commutative73.6%
*-commutative73.6%
fma-def80.5%
*-commutative80.5%
distribute-lft-out80.5%
*-commutative80.5%
Simplified80.5%
fma-udef73.6%
distribute-lft-in73.6%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+72.2%
distribute-lft-in72.2%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+80.5%
*-commutative80.5%
difference-of-squares100.0%
associate-*r*100.0%
*-commutative100.0%
Applied egg-rr100.0%
if -1e152 < x.im < -4.5000000000000002e-71 or 1.17999999999999994e-125 < x.im < 9.9999999999999996e81Initial program 99.7%
if -4.5000000000000002e-71 < x.im < 1.17999999999999994e-125Initial program 79.4%
difference-of-squares79.4%
associate-*r*99.6%
*-commutative99.6%
flip-+79.3%
associate-*l/74.7%
Applied egg-rr74.7%
expm1-log1p-u62.2%
expm1-udef49.6%
associate-/l*49.6%
Applied egg-rr49.6%
expm1-def64.9%
expm1-log1p79.4%
difference-of-squares79.4%
associate-/l*99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x.im around 0 77.6%
distribute-lft1-in77.6%
metadata-eval77.6%
associate-*r*77.5%
*-commutative77.5%
metadata-eval77.5%
distribute-rgt1-in77.5%
unpow277.5%
associate-*r*97.8%
distribute-rgt1-in97.8%
metadata-eval97.8%
*-commutative97.8%
Simplified97.8%
Final simplification99.1%
(FPCore (x.re x.im)
:precision binary64
(let* ((t_0 (* x.re (+ (* x.re x.im) (* x.re x.im))))
(t_1 (+ (* x.im (- (* x.re x.re) (* x.im x.im))) t_0))
(t_2 (+ (+ x.im x.im) (* (* x.im (- x.re x.im)) (+ x.re x.im)))))
(if (<= x.im -8.5e+151)
t_2
(if (<= x.im -4.5e-71)
t_1
(if (<= x.im 1e-125)
(+ t_0 (/ (+ x.re x.im) (/ (/ 1.0 x.im) x.re)))
(if (<= x.im 1e+81) t_1 t_2))))))
double code(double x_46_re, double x_46_im) {
double t_0 = x_46_re * ((x_46_re * x_46_im) + (x_46_re * x_46_im));
double t_1 = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + t_0;
double t_2 = (x_46_im + x_46_im) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im));
double tmp;
if (x_46_im <= -8.5e+151) {
tmp = t_2;
} else if (x_46_im <= -4.5e-71) {
tmp = t_1;
} else if (x_46_im <= 1e-125) {
tmp = t_0 + ((x_46_re + x_46_im) / ((1.0 / x_46_im) / x_46_re));
} else if (x_46_im <= 1e+81) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = x_46re * ((x_46re * x_46im) + (x_46re * x_46im))
t_1 = (x_46im * ((x_46re * x_46re) - (x_46im * x_46im))) + t_0
t_2 = (x_46im + x_46im) + ((x_46im * (x_46re - x_46im)) * (x_46re + x_46im))
if (x_46im <= (-8.5d+151)) then
tmp = t_2
else if (x_46im <= (-4.5d-71)) then
tmp = t_1
else if (x_46im <= 1d-125) then
tmp = t_0 + ((x_46re + x_46im) / ((1.0d0 / x_46im) / x_46re))
else if (x_46im <= 1d+81) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
double t_0 = x_46_re * ((x_46_re * x_46_im) + (x_46_re * x_46_im));
double t_1 = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + t_0;
double t_2 = (x_46_im + x_46_im) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im));
double tmp;
if (x_46_im <= -8.5e+151) {
tmp = t_2;
} else if (x_46_im <= -4.5e-71) {
tmp = t_1;
} else if (x_46_im <= 1e-125) {
tmp = t_0 + ((x_46_re + x_46_im) / ((1.0 / x_46_im) / x_46_re));
} else if (x_46_im <= 1e+81) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x_46_re, x_46_im): t_0 = x_46_re * ((x_46_re * x_46_im) + (x_46_re * x_46_im)) t_1 = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + t_0 t_2 = (x_46_im + x_46_im) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im)) tmp = 0 if x_46_im <= -8.5e+151: tmp = t_2 elif x_46_im <= -4.5e-71: tmp = t_1 elif x_46_im <= 1e-125: tmp = t_0 + ((x_46_re + x_46_im) / ((1.0 / x_46_im) / x_46_re)) elif x_46_im <= 1e+81: tmp = t_1 else: tmp = t_2 return tmp
function code(x_46_re, x_46_im) t_0 = Float64(x_46_re * Float64(Float64(x_46_re * x_46_im) + Float64(x_46_re * x_46_im))) t_1 = Float64(Float64(x_46_im * Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im))) + t_0) t_2 = Float64(Float64(x_46_im + x_46_im) + Float64(Float64(x_46_im * Float64(x_46_re - x_46_im)) * Float64(x_46_re + x_46_im))) tmp = 0.0 if (x_46_im <= -8.5e+151) tmp = t_2; elseif (x_46_im <= -4.5e-71) tmp = t_1; elseif (x_46_im <= 1e-125) tmp = Float64(t_0 + Float64(Float64(x_46_re + x_46_im) / Float64(Float64(1.0 / x_46_im) / x_46_re))); elseif (x_46_im <= 1e+81) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x_46_re, x_46_im) t_0 = x_46_re * ((x_46_re * x_46_im) + (x_46_re * x_46_im)); t_1 = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + t_0; t_2 = (x_46_im + x_46_im) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im)); tmp = 0.0; if (x_46_im <= -8.5e+151) tmp = t_2; elseif (x_46_im <= -4.5e-71) tmp = t_1; elseif (x_46_im <= 1e-125) tmp = t_0 + ((x_46_re + x_46_im) / ((1.0 / x_46_im) / x_46_re)); elseif (x_46_im <= 1e+81) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(x$46$re * N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x$46$im * N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x$46$im + x$46$im), $MachinePrecision] + N[(N[(x$46$im * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$im, -8.5e+151], t$95$2, If[LessEqual[x$46$im, -4.5e-71], t$95$1, If[LessEqual[x$46$im, 1e-125], N[(t$95$0 + N[(N[(x$46$re + x$46$im), $MachinePrecision] / N[(N[(1.0 / x$46$im), $MachinePrecision] / x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 1e+81], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x.re \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\\
t_1 := x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) + t_0\\
t_2 := \left(x.im + x.im\right) + \left(x.im \cdot \left(x.re - x.im\right)\right) \cdot \left(x.re + x.im\right)\\
\mathbf{if}\;x.im \leq -8.5 \cdot 10^{+151}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x.im \leq -4.5 \cdot 10^{-71}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x.im \leq 10^{-125}:\\
\;\;\;\;t_0 + \frac{x.re + x.im}{\frac{\frac{1}{x.im}}{x.re}}\\
\mathbf{elif}\;x.im \leq 10^{+81}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if x.im < -8.50000000000000051e151 or 9.99999999999999921e80 < x.im Initial program 73.6%
+-commutative73.6%
*-commutative73.6%
fma-def80.5%
*-commutative80.5%
distribute-lft-out80.5%
*-commutative80.5%
Simplified80.5%
fma-udef73.6%
distribute-lft-in73.6%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+72.2%
distribute-lft-in72.2%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+80.5%
*-commutative80.5%
difference-of-squares100.0%
associate-*r*100.0%
*-commutative100.0%
Applied egg-rr100.0%
if -8.50000000000000051e151 < x.im < -4.5000000000000002e-71 or 1.00000000000000001e-125 < x.im < 9.99999999999999921e80Initial program 99.7%
if -4.5000000000000002e-71 < x.im < 1.00000000000000001e-125Initial program 79.4%
difference-of-squares79.4%
associate-*r*99.6%
*-commutative99.6%
flip-+79.3%
associate-*l/74.7%
Applied egg-rr74.7%
expm1-log1p-u62.2%
expm1-udef49.6%
associate-/l*49.6%
Applied egg-rr49.6%
expm1-def64.9%
expm1-log1p79.4%
difference-of-squares79.4%
associate-/l*99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x.re around inf 97.8%
associate-/r*97.9%
Simplified97.9%
Final simplification99.1%
(FPCore (x.re x.im) :precision binary64 (if (or (<= x.im -370.0) (not (<= x.im 420.0))) (+ (* x.im (- (* x.re x.re) (* x.im x.im))) (+ x.im x.im)) (* x.re (* x.re (* x.im 3.0)))))
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -370.0) || !(x_46_im <= 420.0)) {
tmp = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_im + x_46_im);
} else {
tmp = x_46_re * (x_46_re * (x_46_im * 3.0));
}
return tmp;
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8) :: tmp
if ((x_46im <= (-370.0d0)) .or. (.not. (x_46im <= 420.0d0))) then
tmp = (x_46im * ((x_46re * x_46re) - (x_46im * x_46im))) + (x_46im + x_46im)
else
tmp = x_46re * (x_46re * (x_46im * 3.0d0))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -370.0) || !(x_46_im <= 420.0)) {
tmp = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_im + x_46_im);
} else {
tmp = x_46_re * (x_46_re * (x_46_im * 3.0));
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 if (x_46_im <= -370.0) or not (x_46_im <= 420.0): tmp = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_im + x_46_im) else: tmp = x_46_re * (x_46_re * (x_46_im * 3.0)) return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_im <= -370.0) || !(x_46_im <= 420.0)) tmp = Float64(Float64(x_46_im * Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im))) + Float64(x_46_im + x_46_im)); else tmp = Float64(x_46_re * Float64(x_46_re * Float64(x_46_im * 3.0))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if ((x_46_im <= -370.0) || ~((x_46_im <= 420.0))) tmp = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_im + x_46_im); else tmp = x_46_re * (x_46_re * (x_46_im * 3.0)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -370.0], N[Not[LessEqual[x$46$im, 420.0]], $MachinePrecision]], N[(N[(x$46$im * N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x$46$im + x$46$im), $MachinePrecision]), $MachinePrecision], N[(x$46$re * N[(x$46$re * N[(x$46$im * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -370 \lor \neg \left(x.im \leq 420\right):\\
\;\;\;\;x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) + \left(x.im + x.im\right)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(x.im \cdot 3\right)\right)\\
\end{array}
\end{array}
if x.im < -370 or 420 < x.im Initial program 84.0%
*-commutative84.0%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+77.0%
*-commutative77.0%
distribute-lft-in77.0%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+85.4%
Applied egg-rr85.4%
if -370 < x.im < 420Initial program 85.5%
difference-of-squares85.5%
associate-*r*99.6%
*-commutative99.6%
flip-+85.5%
associate-*l/78.6%
Applied egg-rr78.6%
expm1-log1p-u65.1%
expm1-udef49.6%
associate-/l*49.6%
Applied egg-rr49.6%
expm1-def69.2%
expm1-log1p85.4%
difference-of-squares85.4%
associate-/l*99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x.im around 0 75.8%
distribute-lft1-in75.8%
metadata-eval75.8%
associate-*r*75.8%
*-commutative75.8%
metadata-eval75.8%
distribute-rgt1-in75.8%
unpow275.8%
associate-*r*90.0%
distribute-rgt1-in90.0%
metadata-eval90.0%
*-commutative90.0%
Simplified90.0%
Final simplification87.9%
(FPCore (x.re x.im) :precision binary64 (if (or (<= x.im -185.0) (not (<= x.im 900.0))) (+ (+ x.im x.im) (* (* x.im (- x.re x.im)) (+ x.re x.im))) (* x.re (* x.re (* x.im 3.0)))))
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -185.0) || !(x_46_im <= 900.0)) {
tmp = (x_46_im + x_46_im) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im));
} else {
tmp = x_46_re * (x_46_re * (x_46_im * 3.0));
}
return tmp;
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8) :: tmp
if ((x_46im <= (-185.0d0)) .or. (.not. (x_46im <= 900.0d0))) then
tmp = (x_46im + x_46im) + ((x_46im * (x_46re - x_46im)) * (x_46re + x_46im))
else
tmp = x_46re * (x_46re * (x_46im * 3.0d0))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -185.0) || !(x_46_im <= 900.0)) {
tmp = (x_46_im + x_46_im) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im));
} else {
tmp = x_46_re * (x_46_re * (x_46_im * 3.0));
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 if (x_46_im <= -185.0) or not (x_46_im <= 900.0): tmp = (x_46_im + x_46_im) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im)) else: tmp = x_46_re * (x_46_re * (x_46_im * 3.0)) return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_im <= -185.0) || !(x_46_im <= 900.0)) tmp = Float64(Float64(x_46_im + x_46_im) + Float64(Float64(x_46_im * Float64(x_46_re - x_46_im)) * Float64(x_46_re + x_46_im))); else tmp = Float64(x_46_re * Float64(x_46_re * Float64(x_46_im * 3.0))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if ((x_46_im <= -185.0) || ~((x_46_im <= 900.0))) tmp = (x_46_im + x_46_im) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im)); else tmp = x_46_re * (x_46_re * (x_46_im * 3.0)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -185.0], N[Not[LessEqual[x$46$im, 900.0]], $MachinePrecision]], N[(N[(x$46$im + x$46$im), $MachinePrecision] + N[(N[(x$46$im * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$re * N[(x$46$re * N[(x$46$im * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -185 \lor \neg \left(x.im \leq 900\right):\\
\;\;\;\;\left(x.im + x.im\right) + \left(x.im \cdot \left(x.re - x.im\right)\right) \cdot \left(x.re + x.im\right)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(x.im \cdot 3\right)\right)\\
\end{array}
\end{array}
if x.im < -185 or 900 < x.im Initial program 84.0%
+-commutative84.0%
*-commutative84.0%
fma-def88.2%
*-commutative88.2%
distribute-lft-out88.2%
*-commutative88.2%
Simplified88.2%
fma-udef84.0%
distribute-lft-in84.0%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+77.0%
distribute-lft-in77.0%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+85.4%
*-commutative85.4%
difference-of-squares97.1%
associate-*r*97.1%
*-commutative97.1%
Applied egg-rr97.1%
if -185 < x.im < 900Initial program 85.5%
difference-of-squares85.5%
associate-*r*99.6%
*-commutative99.6%
flip-+85.5%
associate-*l/78.6%
Applied egg-rr78.6%
expm1-log1p-u65.1%
expm1-udef49.6%
associate-/l*49.6%
Applied egg-rr49.6%
expm1-def69.2%
expm1-log1p85.4%
difference-of-squares85.4%
associate-/l*99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x.im around 0 75.8%
distribute-lft1-in75.8%
metadata-eval75.8%
associate-*r*75.8%
*-commutative75.8%
metadata-eval75.8%
distribute-rgt1-in75.8%
unpow275.8%
associate-*r*90.0%
distribute-rgt1-in90.0%
metadata-eval90.0%
*-commutative90.0%
Simplified90.0%
Final simplification93.3%
(FPCore (x.re x.im) :precision binary64 (* 3.0 (* (* x.re x.re) x.im)))
double code(double x_46_re, double x_46_im) {
return 3.0 * ((x_46_re * x_46_re) * x_46_im);
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = 3.0d0 * ((x_46re * x_46re) * x_46im)
end function
public static double code(double x_46_re, double x_46_im) {
return 3.0 * ((x_46_re * x_46_re) * x_46_im);
}
def code(x_46_re, x_46_im): return 3.0 * ((x_46_re * x_46_re) * x_46_im)
function code(x_46_re, x_46_im) return Float64(3.0 * Float64(Float64(x_46_re * x_46_re) * x_46_im)) end
function tmp = code(x_46_re, x_46_im) tmp = 3.0 * ((x_46_re * x_46_re) * x_46_im); end
code[x$46$re_, x$46$im_] := N[(3.0 * N[(N[(x$46$re * x$46$re), $MachinePrecision] * x$46$im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
3 \cdot \left(\left(x.re \cdot x.re\right) \cdot x.im\right)
\end{array}
Initial program 84.8%
+-commutative84.8%
*-commutative84.8%
distribute-lft-out84.8%
associate-*l*84.8%
*-commutative84.8%
distribute-lft-out86.8%
associate-+r-86.8%
distribute-lft-out--79.7%
Simplified79.8%
sub-neg79.8%
associate-*l*79.8%
associate-*l*87.4%
Applied egg-rr87.4%
Taylor expanded in x.re around 0 87.4%
Taylor expanded in x.re around inf 52.3%
unpow252.3%
Simplified52.3%
Final simplification52.3%
(FPCore (x.re x.im) :precision binary64 (* x.re (* x.re (* x.im 3.0))))
double code(double x_46_re, double x_46_im) {
return x_46_re * (x_46_re * (x_46_im * 3.0));
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = x_46re * (x_46re * (x_46im * 3.0d0))
end function
public static double code(double x_46_re, double x_46_im) {
return x_46_re * (x_46_re * (x_46_im * 3.0));
}
def code(x_46_re, x_46_im): return x_46_re * (x_46_re * (x_46_im * 3.0))
function code(x_46_re, x_46_im) return Float64(x_46_re * Float64(x_46_re * Float64(x_46_im * 3.0))) end
function tmp = code(x_46_re, x_46_im) tmp = x_46_re * (x_46_re * (x_46_im * 3.0)); end
code[x$46$re_, x$46$im_] := N[(x$46$re * N[(x$46$re * N[(x$46$im * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x.re \cdot \left(x.re \cdot \left(x.im \cdot 3\right)\right)
\end{array}
Initial program 84.8%
difference-of-squares85.6%
associate-*r*93.1%
*-commutative93.1%
flip-+84.8%
associate-*l/77.5%
Applied egg-rr77.5%
expm1-log1p-u53.9%
expm1-udef45.7%
associate-/l*47.0%
Applied egg-rr47.0%
expm1-def57.4%
expm1-log1p84.7%
difference-of-squares85.5%
associate-/l*93.1%
+-commutative93.1%
Simplified93.1%
Taylor expanded in x.im around 0 52.3%
distribute-lft1-in52.3%
metadata-eval52.3%
associate-*r*52.3%
*-commutative52.3%
metadata-eval52.3%
distribute-rgt1-in52.3%
unpow252.3%
associate-*r*59.9%
distribute-rgt1-in59.9%
metadata-eval59.9%
*-commutative59.9%
Simplified59.9%
Final simplification59.9%
(FPCore (x.re x.im) :precision binary64 (* (* x.re x.re) x.im))
double code(double x_46_re, double x_46_im) {
return (x_46_re * x_46_re) * x_46_im;
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = (x_46re * x_46re) * x_46im
end function
public static double code(double x_46_re, double x_46_im) {
return (x_46_re * x_46_re) * x_46_im;
}
def code(x_46_re, x_46_im): return (x_46_re * x_46_re) * x_46_im
function code(x_46_re, x_46_im) return Float64(Float64(x_46_re * x_46_re) * x_46_im) end
function tmp = code(x_46_re, x_46_im) tmp = (x_46_re * x_46_re) * x_46_im; end
code[x$46$re_, x$46$im_] := N[(N[(x$46$re * x$46$re), $MachinePrecision] * x$46$im), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.re\right) \cdot x.im
\end{array}
Initial program 84.8%
*-commutative84.8%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+64.3%
*-commutative64.3%
distribute-lft-in64.3%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+53.1%
Applied egg-rr53.1%
Taylor expanded in x.re around inf 39.3%
unpow239.3%
Simplified39.3%
Final simplification39.3%
(FPCore (x.re x.im) :precision binary64 -3.25)
double code(double x_46_re, double x_46_im) {
return -3.25;
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = -3.25d0
end function
public static double code(double x_46_re, double x_46_im) {
return -3.25;
}
def code(x_46_re, x_46_im): return -3.25
function code(x_46_re, x_46_im) return -3.25 end
function tmp = code(x_46_re, x_46_im) tmp = -3.25; end
code[x$46$re_, x$46$im_] := -3.25
\begin{array}{l}
\\
-3.25
\end{array}
Initial program 84.8%
+-commutative84.8%
*-commutative84.8%
distribute-lft-out84.8%
associate-*l*84.8%
*-commutative84.8%
distribute-lft-out86.8%
associate-+r-86.8%
distribute-lft-out--79.7%
Simplified79.8%
flip3--12.3%
frac-2neg12.3%
*-commutative12.3%
unpow-prod-down12.2%
metadata-eval12.2%
associate-*l*12.2%
pow-pow12.2%
metadata-eval12.2%
Applied egg-rr8.7%
Simplified2.6%
Final simplification2.6%
(FPCore (x.re x.im) :precision binary64 -3.0)
double code(double x_46_re, double x_46_im) {
return -3.0;
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = -3.0d0
end function
public static double code(double x_46_re, double x_46_im) {
return -3.0;
}
def code(x_46_re, x_46_im): return -3.0
function code(x_46_re, x_46_im) return -3.0 end
function tmp = code(x_46_re, x_46_im) tmp = -3.0; end
code[x$46$re_, x$46$im_] := -3.0
\begin{array}{l}
\\
-3
\end{array}
Initial program 84.8%
Taylor expanded in x.re around 0 68.0%
Simplified24.3%
*-commutative24.3%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+7.8%
*-commutative7.8%
distribute-rgt-in7.8%
*-commutative7.8%
flip-+0.0%
clear-num0.0%
*-commutative0.0%
+-inverses0.0%
+-inverses0.0%
*-commutative0.0%
*-commutative0.0%
+-inverses0.0%
+-inverses0.0%
flip-+3.0%
Applied egg-rr3.0%
Taylor expanded in x.im around inf 2.6%
Final simplification2.6%
(FPCore (x.re x.im) :precision binary64 3.25)
double code(double x_46_re, double x_46_im) {
return 3.25;
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = 3.25d0
end function
public static double code(double x_46_re, double x_46_im) {
return 3.25;
}
def code(x_46_re, x_46_im): return 3.25
function code(x_46_re, x_46_im) return 3.25 end
function tmp = code(x_46_re, x_46_im) tmp = 3.25; end
code[x$46$re_, x$46$im_] := 3.25
\begin{array}{l}
\\
3.25
\end{array}
Initial program 84.8%
+-commutative84.8%
*-commutative84.8%
distribute-lft-out84.8%
associate-*l*84.8%
*-commutative84.8%
distribute-lft-out86.8%
associate-+r-86.8%
distribute-lft-out--79.7%
Simplified79.8%
flip3--12.3%
div-inv12.2%
*-commutative12.2%
unpow-prod-down12.2%
metadata-eval12.2%
associate-*l*12.2%
pow-pow12.2%
metadata-eval12.2%
associate-+r+12.2%
Applied egg-rr8.7%
Simplified2.8%
Final simplification2.8%
(FPCore (x.re x.im) :precision binary64 (+ (* (* x.re x.im) (* 2.0 x.re)) (* (* x.im (- x.re x.im)) (+ x.re x.im))))
double code(double x_46_re, double x_46_im) {
return ((x_46_re * x_46_im) * (2.0 * x_46_re)) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im));
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = ((x_46re * x_46im) * (2.0d0 * x_46re)) + ((x_46im * (x_46re - x_46im)) * (x_46re + x_46im))
end function
public static double code(double x_46_re, double x_46_im) {
return ((x_46_re * x_46_im) * (2.0 * x_46_re)) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im));
}
def code(x_46_re, x_46_im): return ((x_46_re * x_46_im) * (2.0 * x_46_re)) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im))
function code(x_46_re, x_46_im) return Float64(Float64(Float64(x_46_re * x_46_im) * Float64(2.0 * x_46_re)) + Float64(Float64(x_46_im * Float64(x_46_re - x_46_im)) * Float64(x_46_re + x_46_im))) end
function tmp = code(x_46_re, x_46_im) tmp = ((x_46_re * x_46_im) * (2.0 * x_46_re)) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im)); end
code[x$46$re_, x$46$im_] := N[(N[(N[(x$46$re * x$46$im), $MachinePrecision] * N[(2.0 * x$46$re), $MachinePrecision]), $MachinePrecision] + N[(N[(x$46$im * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.im\right) \cdot \left(2 \cdot x.re\right) + \left(x.im \cdot \left(x.re - x.im\right)\right) \cdot \left(x.re + x.im\right)
\end{array}
herbie shell --seed 2023283
(FPCore (x.re x.im)
:name "math.cube on complex, imaginary part"
:precision binary64
:herbie-target
(+ (* (* x.re x.im) (* 2.0 x.re)) (* (* x.im (- x.re x.im)) (+ x.re x.im)))
(+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re)))