
(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 6 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 (if (or (<= x.im -5e+102) (not (<= x.im 1e+99))) (* x.im (* (- x.re x.im) (+ x.im x.re))) (- (* (* x.re (* x.im x.re)) 3.0) (pow x.im 3.0))))
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -5e+102) || !(x_46_im <= 1e+99)) {
tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re));
} else {
tmp = ((x_46_re * (x_46_im * x_46_re)) * 3.0) - pow(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 <= (-5d+102)) .or. (.not. (x_46im <= 1d+99))) then
tmp = x_46im * ((x_46re - x_46im) * (x_46im + x_46re))
else
tmp = ((x_46re * (x_46im * x_46re)) * 3.0d0) - (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 <= -5e+102) || !(x_46_im <= 1e+99)) {
tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re));
} else {
tmp = ((x_46_re * (x_46_im * x_46_re)) * 3.0) - Math.pow(x_46_im, 3.0);
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 if (x_46_im <= -5e+102) or not (x_46_im <= 1e+99): tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re)) else: tmp = ((x_46_re * (x_46_im * x_46_re)) * 3.0) - math.pow(x_46_im, 3.0) return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_im <= -5e+102) || !(x_46_im <= 1e+99)) tmp = Float64(x_46_im * Float64(Float64(x_46_re - x_46_im) * Float64(x_46_im + x_46_re))); else tmp = Float64(Float64(Float64(x_46_re * Float64(x_46_im * x_46_re)) * 3.0) - (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 <= -5e+102) || ~((x_46_im <= 1e+99))) tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re)); else tmp = ((x_46_re * (x_46_im * x_46_re)) * 3.0) - (x_46_im ^ 3.0); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -5e+102], N[Not[LessEqual[x$46$im, 1e+99]], $MachinePrecision]], N[(x$46$im * N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$im + x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x$46$re * N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * 3.0), $MachinePrecision] - N[Power[x$46$im, 3.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -5 \cdot 10^{+102} \lor \neg \left(x.im \leq 10^{+99}\right):\\
\;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.im + x.re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x.re \cdot \left(x.im \cdot x.re\right)\right) \cdot 3 - {x.im}^{3}\\
\end{array}
\end{array}
if x.im < -5e102 or 9.9999999999999997e98 < x.im Initial program 58.1%
difference-of-squares74.4%
*-commutative74.4%
Applied egg-rr74.4%
expm1-log1p-u57.0%
expm1-udef57.0%
*-commutative57.0%
*-commutative57.0%
count-257.0%
*-commutative57.0%
associate-*r*57.0%
associate-*r*57.0%
*-commutative57.0%
count-257.0%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified100.0%
if -5e102 < x.im < 9.9999999999999997e98Initial program 92.6%
Simplified99.9%
Final simplification99.9%
(FPCore (x.re x.im) :precision binary64 (if (or (<= x.im -5e+102) (not (<= x.im 1e+99))) (* x.im (* (- x.re x.im) (+ x.im x.re))) (- (* x.re (* x.re (* x.im 3.0))) (pow x.im 3.0))))
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -5e+102) || !(x_46_im <= 1e+99)) {
tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re));
} else {
tmp = (x_46_re * (x_46_re * (x_46_im * 3.0))) - pow(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 <= (-5d+102)) .or. (.not. (x_46im <= 1d+99))) then
tmp = x_46im * ((x_46re - x_46im) * (x_46im + x_46re))
else
tmp = (x_46re * (x_46re * (x_46im * 3.0d0))) - (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 <= -5e+102) || !(x_46_im <= 1e+99)) {
tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re));
} else {
tmp = (x_46_re * (x_46_re * (x_46_im * 3.0))) - Math.pow(x_46_im, 3.0);
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 if (x_46_im <= -5e+102) or not (x_46_im <= 1e+99): tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re)) else: tmp = (x_46_re * (x_46_re * (x_46_im * 3.0))) - math.pow(x_46_im, 3.0) return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_im <= -5e+102) || !(x_46_im <= 1e+99)) tmp = Float64(x_46_im * Float64(Float64(x_46_re - x_46_im) * Float64(x_46_im + x_46_re))); else tmp = Float64(Float64(x_46_re * Float64(x_46_re * Float64(x_46_im * 3.0))) - (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 <= -5e+102) || ~((x_46_im <= 1e+99))) tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re)); else tmp = (x_46_re * (x_46_re * (x_46_im * 3.0))) - (x_46_im ^ 3.0); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -5e+102], N[Not[LessEqual[x$46$im, 1e+99]], $MachinePrecision]], N[(x$46$im * N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$im + x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$re * N[(x$46$re * N[(x$46$im * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[x$46$im, 3.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -5 \cdot 10^{+102} \lor \neg \left(x.im \leq 10^{+99}\right):\\
\;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.im + x.re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(x.im \cdot 3\right)\right) - {x.im}^{3}\\
\end{array}
\end{array}
if x.im < -5e102 or 9.9999999999999997e98 < x.im Initial program 58.1%
difference-of-squares74.4%
*-commutative74.4%
Applied egg-rr74.4%
expm1-log1p-u57.0%
expm1-udef57.0%
*-commutative57.0%
*-commutative57.0%
count-257.0%
*-commutative57.0%
associate-*r*57.0%
associate-*r*57.0%
*-commutative57.0%
count-257.0%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified100.0%
if -5e102 < x.im < 9.9999999999999997e98Initial program 92.6%
Simplified99.8%
Final simplification99.9%
(FPCore (x.re x.im)
:precision binary64
(let* ((t_0 (* x.im (* (- x.re x.im) (+ x.im x.re)))))
(if (<=
(+
(* x.im (- (* x.re x.re) (* x.im x.im)))
(* x.re (+ (* x.im x.re) (* x.im x.re))))
INFINITY)
(+ t_0 (* x.re (* (* x.im x.re) 2.0)))
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_im + x_46_re));
double tmp;
if (((x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_im * x_46_re) + (x_46_im * x_46_re)))) <= ((double) INFINITY)) {
tmp = t_0 + (x_46_re * ((x_46_im * x_46_re) * 2.0));
} else {
tmp = t_0;
}
return tmp;
}
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_im + x_46_re));
double tmp;
if (((x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_im * x_46_re) + (x_46_im * x_46_re)))) <= Double.POSITIVE_INFINITY) {
tmp = t_0 + (x_46_re * ((x_46_im * x_46_re) * 2.0));
} 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_im + x_46_re)) tmp = 0 if ((x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_im * x_46_re) + (x_46_im * x_46_re)))) <= math.inf: tmp = t_0 + (x_46_re * ((x_46_im * x_46_re) * 2.0)) 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_im + x_46_re))) 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_im * x_46_re) + Float64(x_46_im * x_46_re)))) <= Inf) tmp = Float64(t_0 + Float64(x_46_re * Float64(Float64(x_46_im * x_46_re) * 2.0))); 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_im + x_46_re)); tmp = 0.0; if (((x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_im * x_46_re) + (x_46_im * x_46_re)))) <= Inf) tmp = t_0 + (x_46_re * ((x_46_im * x_46_re) * 2.0)); 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$im + x$46$re), $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] + N[(x$46$re * N[(N[(x$46$im * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$0 + N[(x$46$re * N[(N[(x$46$im * x$46$re), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.im + x.re\right)\right)\\
\mathbf{if}\;x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) + x.re \cdot \left(x.im \cdot x.re + x.im \cdot x.re\right) \leq \infty:\\
\;\;\;\;t_0 + x.re \cdot \left(\left(x.im \cdot x.re\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\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 94.3%
difference-of-squares94.3%
*-commutative94.3%
Applied egg-rr94.3%
*-commutative94.3%
*-un-lft-identity94.3%
*-un-lft-identity94.3%
distribute-rgt-out94.3%
metadata-eval94.3%
Applied egg-rr94.3%
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%
difference-of-squares38.9%
*-commutative38.9%
Applied egg-rr38.9%
expm1-log1p-u27.8%
expm1-udef27.8%
*-commutative27.8%
*-commutative27.8%
count-227.8%
*-commutative27.8%
associate-*r*27.8%
associate-*r*27.8%
*-commutative27.8%
count-227.8%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified100.0%
Final simplification95.1%
(FPCore (x.re x.im) :precision binary64 (if (or (<= x.im -1.1e-66) (not (<= x.im 9.6e-67))) (* x.im (* (- x.re x.im) (+ x.im x.re))) (* (* x.re (* x.im x.re)) 3.0)))
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -1.1e-66) || !(x_46_im <= 9.6e-67)) {
tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re));
} else {
tmp = (x_46_re * (x_46_im * x_46_re)) * 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 <= (-1.1d-66)) .or. (.not. (x_46im <= 9.6d-67))) then
tmp = x_46im * ((x_46re - x_46im) * (x_46im + x_46re))
else
tmp = (x_46re * (x_46im * x_46re)) * 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 <= -1.1e-66) || !(x_46_im <= 9.6e-67)) {
tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re));
} else {
tmp = (x_46_re * (x_46_im * x_46_re)) * 3.0;
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 if (x_46_im <= -1.1e-66) or not (x_46_im <= 9.6e-67): tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re)) else: tmp = (x_46_re * (x_46_im * x_46_re)) * 3.0 return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_im <= -1.1e-66) || !(x_46_im <= 9.6e-67)) tmp = Float64(x_46_im * Float64(Float64(x_46_re - x_46_im) * Float64(x_46_im + x_46_re))); else tmp = Float64(Float64(x_46_re * Float64(x_46_im * x_46_re)) * 3.0); end return tmp end
function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if ((x_46_im <= -1.1e-66) || ~((x_46_im <= 9.6e-67))) tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re)); else tmp = (x_46_re * (x_46_im * x_46_re)) * 3.0; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -1.1e-66], N[Not[LessEqual[x$46$im, 9.6e-67]], $MachinePrecision]], N[(x$46$im * N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$im + x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$re * N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * 3.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -1.1 \cdot 10^{-66} \lor \neg \left(x.im \leq 9.6 \cdot 10^{-67}\right):\\
\;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.im + x.re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x.re \cdot \left(x.im \cdot x.re\right)\right) \cdot 3\\
\end{array}
\end{array}
if x.im < -1.1000000000000001e-66 or 9.6e-67 < x.im Initial program 77.9%
difference-of-squares86.4%
*-commutative86.4%
Applied egg-rr86.4%
expm1-log1p-u63.5%
expm1-udef63.0%
*-commutative63.0%
*-commutative63.0%
count-263.0%
*-commutative63.0%
associate-*r*63.0%
associate-*r*63.0%
*-commutative63.0%
count-263.0%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified90.3%
if -1.1000000000000001e-66 < x.im < 9.6e-67Initial program 86.6%
Simplified99.7%
Taylor expanded in x.re around inf 81.8%
*-commutative81.8%
rem-cube-cbrt81.4%
*-commutative81.4%
Applied egg-rr81.4%
rem-cube-cbrt81.8%
unpow281.8%
associate-*r*95.1%
*-commutative95.1%
Applied egg-rr95.1%
Final simplification92.1%
(FPCore (x.re x.im) :precision binary64 (* (* x.re (* x.im x.re)) 3.0))
double code(double x_46_re, double x_46_im) {
return (x_46_re * (x_46_im * x_46_re)) * 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_46im * x_46re)) * 3.0d0
end function
public static double code(double x_46_re, double x_46_im) {
return (x_46_re * (x_46_im * x_46_re)) * 3.0;
}
def code(x_46_re, x_46_im): return (x_46_re * (x_46_im * x_46_re)) * 3.0
function code(x_46_re, x_46_im) return Float64(Float64(x_46_re * Float64(x_46_im * x_46_re)) * 3.0) end
function tmp = code(x_46_re, x_46_im) tmp = (x_46_re * (x_46_im * x_46_re)) * 3.0; end
code[x$46$re_, x$46$im_] := N[(N[(x$46$re * N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * 3.0), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot \left(x.im \cdot x.re\right)\right) \cdot 3
\end{array}
Initial program 81.0%
Simplified83.8%
Taylor expanded in x.re around inf 51.5%
*-commutative51.5%
rem-cube-cbrt51.3%
*-commutative51.3%
Applied egg-rr51.3%
rem-cube-cbrt51.5%
unpow251.5%
associate-*r*56.3%
*-commutative56.3%
Applied egg-rr56.3%
Final simplification56.3%
(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 81.0%
difference-of-squares86.5%
*-commutative86.5%
Applied egg-rr86.5%
Taylor expanded in x.re around inf 51.6%
Simplified2.7%
Final simplification2.7%
(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 2023320
(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)))