
(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 7 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) (+ x.re x.im))))
(t_1 (+ t_0 (* x.re (* (* x.re x.im) 2.0)))))
(if (<= x.im -1.66e+162)
t_0
(if (<= x.im -1.28e-76)
t_1
(if (<= x.im 4.6e-100)
(* 3.0 (* x.re (* x.re x.im)))
(if (<= x.im 5e+40) t_1 t_0))))))
double code(double x_46_re, double x_46_im) {
double t_0 = x_46_im * ((x_46_re - x_46_im) * (x_46_re + x_46_im));
double t_1 = t_0 + (x_46_re * ((x_46_re * x_46_im) * 2.0));
double tmp;
if (x_46_im <= -1.66e+162) {
tmp = t_0;
} else if (x_46_im <= -1.28e-76) {
tmp = t_1;
} else if (x_46_im <= 4.6e-100) {
tmp = 3.0 * (x_46_re * (x_46_re * x_46_im));
} else if (x_46_im <= 5e+40) {
tmp = t_1;
} else {
tmp = t_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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x_46im * ((x_46re - x_46im) * (x_46re + x_46im))
t_1 = t_0 + (x_46re * ((x_46re * x_46im) * 2.0d0))
if (x_46im <= (-1.66d+162)) then
tmp = t_0
else if (x_46im <= (-1.28d-76)) then
tmp = t_1
else if (x_46im <= 4.6d-100) then
tmp = 3.0d0 * (x_46re * (x_46re * x_46im))
else if (x_46im <= 5d+40) then
tmp = t_1
else
tmp = t_0
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_im) * (x_46_re + x_46_im));
double t_1 = t_0 + (x_46_re * ((x_46_re * x_46_im) * 2.0));
double tmp;
if (x_46_im <= -1.66e+162) {
tmp = t_0;
} else if (x_46_im <= -1.28e-76) {
tmp = t_1;
} else if (x_46_im <= 4.6e-100) {
tmp = 3.0 * (x_46_re * (x_46_re * x_46_im));
} else if (x_46_im <= 5e+40) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x_46_re, x_46_im): t_0 = x_46_im * ((x_46_re - x_46_im) * (x_46_re + x_46_im)) t_1 = t_0 + (x_46_re * ((x_46_re * x_46_im) * 2.0)) tmp = 0 if x_46_im <= -1.66e+162: tmp = t_0 elif x_46_im <= -1.28e-76: tmp = t_1 elif x_46_im <= 4.6e-100: tmp = 3.0 * (x_46_re * (x_46_re * x_46_im)) elif x_46_im <= 5e+40: tmp = t_1 else: tmp = t_0 return tmp
function code(x_46_re, x_46_im) t_0 = Float64(x_46_im * Float64(Float64(x_46_re - x_46_im) * Float64(x_46_re + x_46_im))) t_1 = Float64(t_0 + Float64(x_46_re * Float64(Float64(x_46_re * x_46_im) * 2.0))) tmp = 0.0 if (x_46_im <= -1.66e+162) tmp = t_0; elseif (x_46_im <= -1.28e-76) tmp = t_1; elseif (x_46_im <= 4.6e-100) tmp = Float64(3.0 * Float64(x_46_re * Float64(x_46_re * x_46_im))); elseif (x_46_im <= 5e+40) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x_46_re, x_46_im) t_0 = x_46_im * ((x_46_re - x_46_im) * (x_46_re + x_46_im)); t_1 = t_0 + (x_46_re * ((x_46_re * x_46_im) * 2.0)); tmp = 0.0; if (x_46_im <= -1.66e+162) tmp = t_0; elseif (x_46_im <= -1.28e-76) tmp = t_1; elseif (x_46_im <= 4.6e-100) tmp = 3.0 * (x_46_re * (x_46_re * x_46_im)); elseif (x_46_im <= 5e+40) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(x$46$im * N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + N[(x$46$re * N[(N[(x$46$re * x$46$im), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$im, -1.66e+162], t$95$0, If[LessEqual[x$46$im, -1.28e-76], t$95$1, If[LessEqual[x$46$im, 4.6e-100], N[(3.0 * N[(x$46$re * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 5e+40], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right)\\
t_1 := t_0 + x.re \cdot \left(\left(x.re \cdot x.im\right) \cdot 2\right)\\
\mathbf{if}\;x.im \leq -1.66 \cdot 10^{+162}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x.im \leq -1.28 \cdot 10^{-76}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x.im \leq 4.6 \cdot 10^{-100}:\\
\;\;\;\;3 \cdot \left(x.re \cdot \left(x.re \cdot x.im\right)\right)\\
\mathbf{elif}\;x.im \leq 5 \cdot 10^{+40}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x.im < -1.66000000000000003e162 or 5.00000000000000003e40 < x.im Initial program 69.4%
expm1-log1p-u57.6%
expm1-udef57.6%
*-commutative57.6%
*-commutative57.6%
count-257.6%
*-commutative57.6%
associate-*r*57.6%
associate-*r*57.6%
*-commutative57.6%
count-257.6%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified85.9%
difference-of-squares100.0%
*-commutative100.0%
Applied egg-rr100.0%
if -1.66000000000000003e162 < x.im < -1.28e-76 or 4.59999999999999989e-100 < x.im < 5.00000000000000003e40Initial program 97.1%
difference-of-squares83.4%
*-commutative83.4%
Applied egg-rr99.7%
*-un-lft-identity99.7%
*-commutative99.7%
*-un-lft-identity99.7%
distribute-rgt-out99.7%
*-commutative99.7%
metadata-eval99.7%
Applied egg-rr99.7%
if -1.28e-76 < x.im < 4.59999999999999989e-100Initial program 83.2%
Taylor expanded in x.re around inf 83.1%
Simplified83.2%
add-sqr-sqrt66.7%
pow266.7%
*-commutative66.7%
sqrt-prod40.3%
unpow240.3%
sqrt-prod26.1%
add-sqr-sqrt48.2%
Applied egg-rr48.2%
unpow248.2%
*-commutative48.2%
associate-*r*48.2%
associate-*r*48.2%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x.re x.im)
:precision binary64
(if (<=
(+
(* x.im (- (* x.re x.re) (* x.im x.im)))
(* x.re (+ (* x.re x.im) (* x.re x.im))))
INFINITY)
(- (* x.re (* (* x.re x.im) 3.0)) (pow x.im 3.0))
(* x.im (* (- x.re x.im) (+ x.re x.im)))))
double code(double x_46_re, double 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 = (x_46_re * ((x_46_re * x_46_im) * 3.0)) - pow(x_46_im, 3.0);
} else {
tmp = 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 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.POSITIVE_INFINITY) {
tmp = (x_46_re * ((x_46_re * x_46_im) * 3.0)) - Math.pow(x_46_im, 3.0);
} else {
tmp = 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): tmp = 0 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)))) <= math.inf: tmp = (x_46_re * ((x_46_re * x_46_im) * 3.0)) - math.pow(x_46_im, 3.0) else: tmp = 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) 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 = Float64(Float64(x_46_re * Float64(Float64(x_46_re * x_46_im) * 3.0)) - (x_46_im ^ 3.0)); else tmp = Float64(x_46_im * Float64(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) tmp = 0.0; 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)))) <= Inf) tmp = (x_46_re * ((x_46_re * x_46_im) * 3.0)) - (x_46_im ^ 3.0); else tmp = 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_] := 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 * N[(N[(x$46$re * x$46$im), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision] - N[Power[x$46$im, 3.0], $MachinePrecision]), $MachinePrecision], N[(x$46$im * N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\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:\\
\;\;\;\;x.re \cdot \left(\left(x.re \cdot x.im\right) \cdot 3\right) - {x.im}^{3}\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\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 92.9%
Simplified98.5%
Taylor expanded in x.re around 0 98.6%
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%
expm1-log1p-u0.0%
expm1-udef0.0%
*-commutative0.0%
*-commutative0.0%
count-20.0%
*-commutative0.0%
associate-*r*0.0%
associate-*r*0.0%
*-commutative0.0%
count-20.0%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified50.0%
difference-of-squares100.0%
*-commutative100.0%
Applied egg-rr100.0%
Final simplification98.7%
(FPCore (x.re x.im) :precision binary64 (if (or (<= x.im -4.2e-76) (not (<= x.im 6.5e-82))) (* x.im (* (- x.re x.im) (+ x.re x.im))) (* 3.0 (* x.re (* x.re x.im)))))
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -4.2e-76) || !(x_46_im <= 6.5e-82)) {
tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_re + x_46_im));
} else {
tmp = 3.0 * (x_46_re * (x_46_re * x_46_im));
}
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 <= (-4.2d-76)) .or. (.not. (x_46im <= 6.5d-82))) then
tmp = x_46im * ((x_46re - x_46im) * (x_46re + x_46im))
else
tmp = 3.0d0 * (x_46re * (x_46re * x_46im))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -4.2e-76) || !(x_46_im <= 6.5e-82)) {
tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_re + x_46_im));
} else {
tmp = 3.0 * (x_46_re * (x_46_re * x_46_im));
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 if (x_46_im <= -4.2e-76) or not (x_46_im <= 6.5e-82): tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_re + x_46_im)) else: tmp = 3.0 * (x_46_re * (x_46_re * x_46_im)) return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_im <= -4.2e-76) || !(x_46_im <= 6.5e-82)) tmp = Float64(x_46_im * Float64(Float64(x_46_re - x_46_im) * Float64(x_46_re + x_46_im))); else tmp = Float64(3.0 * Float64(x_46_re * Float64(x_46_re * x_46_im))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if ((x_46_im <= -4.2e-76) || ~((x_46_im <= 6.5e-82))) tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_re + x_46_im)); else tmp = 3.0 * (x_46_re * (x_46_re * x_46_im)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -4.2e-76], N[Not[LessEqual[x$46$im, 6.5e-82]], $MachinePrecision]], N[(x$46$im * N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 * N[(x$46$re * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -4.2 \cdot 10^{-76} \lor \neg \left(x.im \leq 6.5 \cdot 10^{-82}\right):\\
\;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;3 \cdot \left(x.re \cdot \left(x.re \cdot x.im\right)\right)\\
\end{array}
\end{array}
if x.im < -4.19999999999999985e-76 or 6.4999999999999997e-82 < x.im Initial program 81.9%
expm1-log1p-u60.6%
expm1-udef59.5%
*-commutative59.5%
*-commutative59.5%
count-259.5%
*-commutative59.5%
associate-*r*59.5%
associate-*r*59.5%
*-commutative59.5%
count-259.5%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified85.6%
difference-of-squares94.5%
*-commutative94.5%
Applied egg-rr94.5%
if -4.19999999999999985e-76 < x.im < 6.4999999999999997e-82Initial program 84.0%
Taylor expanded in x.re around inf 83.9%
Simplified84.0%
add-sqr-sqrt68.3%
pow268.3%
*-commutative68.3%
sqrt-prod43.2%
unpow243.2%
sqrt-prod27.8%
add-sqr-sqrt50.7%
Applied egg-rr50.7%
unpow250.7%
*-commutative50.7%
associate-*r*50.7%
associate-*r*50.7%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
Final simplification96.6%
(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(x_46_re * Float64(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[(x$46$re * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
3 \cdot \left(x.re \cdot \left(x.re \cdot x.im\right)\right)
\end{array}
Initial program 82.7%
Taylor expanded in x.re around inf 49.7%
Simplified49.8%
add-sqr-sqrt35.7%
pow235.7%
*-commutative35.7%
sqrt-prod25.8%
unpow225.8%
sqrt-prod14.5%
add-sqr-sqrt28.7%
Applied egg-rr28.7%
unpow228.7%
*-commutative28.7%
associate-*r*28.7%
associate-*r*28.7%
add-sqr-sqrt55.9%
Applied egg-rr55.9%
Final simplification55.9%
(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 82.7%
Taylor expanded in x.re around inf 49.7%
Taylor expanded in x.im around 0 49.8%
Simplified2.6%
Final simplification2.6%
(FPCore (x.re x.im) :precision binary64 -0.3333333333333333)
double code(double x_46_re, double x_46_im) {
return -0.3333333333333333;
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = -0.3333333333333333d0
end function
public static double code(double x_46_re, double x_46_im) {
return -0.3333333333333333;
}
def code(x_46_re, x_46_im): return -0.3333333333333333
function code(x_46_re, x_46_im) return -0.3333333333333333 end
function tmp = code(x_46_re, x_46_im) tmp = -0.3333333333333333; end
code[x$46$re_, x$46$im_] := -0.3333333333333333
\begin{array}{l}
\\
-0.3333333333333333
\end{array}
Initial program 82.7%
Taylor expanded in x.re around inf 49.7%
Simplified49.8%
associate-*r*49.7%
metadata-eval49.7%
distribute-rgt1-in49.7%
*-commutative49.7%
flip-+38.6%
associate-*r/36.3%
difference-of-squares39.4%
*-un-lft-identity39.4%
distribute-rgt-out39.4%
metadata-eval39.4%
*-un-lft-identity39.4%
distribute-rgt-out--39.4%
metadata-eval39.4%
*-un-lft-identity39.4%
distribute-rgt-out--39.4%
metadata-eval39.4%
Applied egg-rr39.4%
Simplified2.6%
Applied egg-rr2.6%
Final simplification2.6%
(FPCore (x.re x.im) :precision binary64 0.3333333333333333)
double code(double x_46_re, double x_46_im) {
return 0.3333333333333333;
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = 0.3333333333333333d0
end function
public static double code(double x_46_re, double x_46_im) {
return 0.3333333333333333;
}
def code(x_46_re, x_46_im): return 0.3333333333333333
function code(x_46_re, x_46_im) return 0.3333333333333333 end
function tmp = code(x_46_re, x_46_im) tmp = 0.3333333333333333; end
code[x$46$re_, x$46$im_] := 0.3333333333333333
\begin{array}{l}
\\
0.3333333333333333
\end{array}
Initial program 82.7%
Taylor expanded in x.re around inf 49.7%
Simplified49.8%
associate-*r*49.7%
metadata-eval49.7%
distribute-rgt1-in49.7%
*-commutative49.7%
flip-+38.6%
associate-*r/36.3%
difference-of-squares39.4%
*-un-lft-identity39.4%
distribute-rgt-out39.4%
metadata-eval39.4%
*-un-lft-identity39.4%
distribute-rgt-out--39.4%
metadata-eval39.4%
*-un-lft-identity39.4%
distribute-rgt-out--39.4%
metadata-eval39.4%
Applied egg-rr39.4%
Simplified2.6%
Applied egg-rr2.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 2023333
(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)))