
(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 9 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 -4e+104) (not (<= x.im 2e+98))) (* x.im (+ 2.0 (* (+ x.re x.im) (- x.re x.im)))) (- (* 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 <= -4e+104) || !(x_46_im <= 2e+98)) {
tmp = x_46_im * (2.0 + ((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))) - 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 <= (-4d+104)) .or. (.not. (x_46im <= 2d+98))) then
tmp = x_46im * (2.0d0 + ((x_46re + x_46im) * (x_46re - x_46im)))
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 <= -4e+104) || !(x_46_im <= 2e+98)) {
tmp = x_46_im * (2.0 + ((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))) - Math.pow(x_46_im, 3.0);
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 if (x_46_im <= -4e+104) or not (x_46_im <= 2e+98): tmp = x_46_im * (2.0 + ((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))) - math.pow(x_46_im, 3.0) return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_im <= -4e+104) || !(x_46_im <= 2e+98)) tmp = Float64(x_46_im * Float64(2.0 + Float64(Float64(x_46_re + x_46_im) * Float64(x_46_re - x_46_im)))); 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 <= -4e+104) || ~((x_46_im <= 2e+98))) tmp = x_46_im * (2.0 + ((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))) - (x_46_im ^ 3.0); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -4e+104], N[Not[LessEqual[x$46$im, 2e+98]], $MachinePrecision]], N[(x$46$im * N[(2.0 + N[(N[(x$46$re + x$46$im), $MachinePrecision] * N[(x$46$re - x$46$im), $MachinePrecision]), $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 -4 \cdot 10^{+104} \lor \neg \left(x.im \leq 2 \cdot 10^{+98}\right):\\
\;\;\;\;x.im \cdot \left(2 + \left(x.re + x.im\right) \cdot \left(x.re - x.im\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 < -4e104 or 2e98 < x.im Initial program 80.5%
*-commutative80.5%
*-commutative80.5%
difference-of-squares87.8%
associate-*l*87.8%
fma-def87.8%
*-commutative87.8%
*-commutative87.8%
*-commutative87.8%
distribute-lft-out87.8%
Simplified87.8%
fma-udef87.8%
*-commutative87.8%
associate-*r*87.8%
difference-of-squares80.5%
distribute-lft-in80.5%
*-commutative80.5%
*-commutative80.5%
+-commutative80.5%
Applied egg-rr86.6%
difference-of-squares100.0%
Applied egg-rr100.0%
*-un-lft-identity100.0%
associate-+l+100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
associate-+r+100.0%
count-2100.0%
*-commutative100.0%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
if -4e104 < x.im < 2e98Initial program 94.4%
+-commutative94.4%
*-commutative94.4%
distribute-lft-out94.4%
associate-*l*94.3%
*-commutative94.3%
distribute-lft-out94.4%
associate-+r-94.4%
distribute-lft-out--94.4%
Simplified94.5%
sub-neg94.5%
associate-*l*94.6%
associate-*l*99.8%
Applied egg-rr99.8%
unsub-neg99.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)
(fma (+ x.re x.im) (* x.im (- x.re x.im)) (* x.re (* x.re (+ x.im x.im))))
(* x.im (+ 2.0 (* (+ 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 = fma((x_46_re + x_46_im), (x_46_im * (x_46_re - x_46_im)), (x_46_re * (x_46_re * (x_46_im + x_46_im))));
} else {
tmp = x_46_im * (2.0 + ((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 = fma(Float64(x_46_re + x_46_im), Float64(x_46_im * Float64(x_46_re - x_46_im)), Float64(x_46_re * Float64(x_46_re * Float64(x_46_im + x_46_im)))); else tmp = Float64(x_46_im * Float64(2.0 + Float64(Float64(x_46_re + x_46_im) * Float64(x_46_re - x_46_im)))); end return 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 + x$46$im), $MachinePrecision] * N[(x$46$im * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision] + N[(x$46$re * N[(x$46$re * N[(x$46$im + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$im * N[(2.0 + N[(N[(x$46$re + x$46$im), $MachinePrecision] * N[(x$46$re - x$46$im), $MachinePrecision]), $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:\\
\;\;\;\;\mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), x.re \cdot \left(x.re \cdot \left(x.im + x.im\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \left(2 + \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 95.9%
*-commutative95.9%
*-commutative95.9%
difference-of-squares95.9%
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%
difference-of-squares37.5%
associate-*l*37.5%
fma-def37.5%
*-commutative37.5%
*-commutative37.5%
*-commutative37.5%
distribute-lft-out37.5%
Simplified37.5%
fma-udef37.5%
*-commutative37.5%
associate-*r*37.5%
difference-of-squares0.0%
distribute-lft-in0.0%
*-commutative0.0%
*-commutative0.0%
+-commutative0.0%
Applied egg-rr31.3%
difference-of-squares100.0%
Applied egg-rr100.0%
*-un-lft-identity100.0%
associate-+l+100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
associate-+r+100.0%
count-2100.0%
*-commutative100.0%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Final simplification99.8%
(FPCore (x.re x.im) :precision binary64 (if (or (<= x.im -2.1) (not (<= x.im 2200000.0))) (* x.im (+ 2.0 (* (+ 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 <= -2.1) || !(x_46_im <= 2200000.0)) {
tmp = x_46_im * (2.0 + ((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 <= (-2.1d0)) .or. (.not. (x_46im <= 2200000.0d0))) then
tmp = x_46im * (2.0d0 + ((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 <= -2.1) || !(x_46_im <= 2200000.0)) {
tmp = x_46_im * (2.0 + ((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 <= -2.1) or not (x_46_im <= 2200000.0): tmp = x_46_im * (2.0 + ((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 <= -2.1) || !(x_46_im <= 2200000.0)) tmp = Float64(x_46_im * Float64(2.0 + Float64(Float64(x_46_re + x_46_im) * Float64(x_46_re - x_46_im)))); else tmp = Float64(x_46_re * Float64(Float64(x_46_re * 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 <= -2.1) || ~((x_46_im <= 2200000.0))) tmp = x_46_im * (2.0 + ((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, -2.1], N[Not[LessEqual[x$46$im, 2200000.0]], $MachinePrecision]], N[(x$46$im * N[(2.0 + N[(N[(x$46$re + x$46$im), $MachinePrecision] * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$re * N[(N[(x$46$re * x$46$im), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -2.1 \lor \neg \left(x.im \leq 2200000\right):\\
\;\;\;\;x.im \cdot \left(2 + \left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(\left(x.re \cdot x.im\right) \cdot 3\right)\\
\end{array}
\end{array}
if x.im < -2.10000000000000009 or 2.2e6 < x.im Initial program 86.6%
*-commutative86.6%
*-commutative86.6%
difference-of-squares91.6%
associate-*l*91.6%
fma-def91.6%
*-commutative91.6%
*-commutative91.6%
*-commutative91.6%
distribute-lft-out91.6%
Simplified91.6%
fma-udef91.6%
*-commutative91.6%
associate-*r*91.6%
difference-of-squares86.6%
distribute-lft-in86.6%
*-commutative86.6%
*-commutative86.6%
+-commutative86.6%
Applied egg-rr88.6%
difference-of-squares97.8%
Applied egg-rr97.8%
*-un-lft-identity97.8%
associate-+l+97.8%
Applied egg-rr97.8%
*-lft-identity97.8%
associate-+r+97.8%
count-297.8%
*-commutative97.8%
distribute-lft-out97.8%
+-commutative97.8%
Simplified97.8%
if -2.10000000000000009 < x.im < 2.2e6Initial program 92.9%
difference-of-squares20.5%
Applied egg-rr92.9%
Taylor expanded in x.re around 0 92.9%
Taylor expanded in x.re around inf 76.1%
distribute-rgt-in76.0%
associate-*r*76.0%
distribute-rgt1-in76.0%
metadata-eval76.0%
unpow276.0%
Simplified76.0%
associate-*r*76.1%
associate-*r*82.8%
*-commutative82.8%
associate-*r*82.7%
*-commutative82.7%
expm1-log1p-u66.6%
expm1-udef45.5%
*-commutative45.5%
associate-*l*41.2%
*-commutative41.2%
Applied egg-rr41.2%
Simplified82.7%
Final simplification89.8%
(FPCore (x.re x.im) :precision binary64 (if (<= x.re 2.2e+152) (* x.im (- (* (* x.re x.re) 3.0) (* x.im x.im))) (* x.re (* x.im (* x.re 3.0)))))
double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_re <= 2.2e+152) {
tmp = x_46_im * (((x_46_re * x_46_re) * 3.0) - (x_46_im * x_46_im));
} 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_46re <= 2.2d+152) then
tmp = x_46im * (((x_46re * x_46re) * 3.0d0) - (x_46im * x_46im))
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_re <= 2.2e+152) {
tmp = x_46_im * (((x_46_re * x_46_re) * 3.0) - (x_46_im * x_46_im));
} 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_re <= 2.2e+152: tmp = x_46_im * (((x_46_re * x_46_re) * 3.0) - (x_46_im * x_46_im)) 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_re <= 2.2e+152) tmp = Float64(x_46_im * Float64(Float64(Float64(x_46_re * x_46_re) * 3.0) - Float64(x_46_im * x_46_im))); else tmp = Float64(x_46_re * Float64(x_46_im * Float64(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_re <= 2.2e+152) tmp = x_46_im * (((x_46_re * x_46_re) * 3.0) - (x_46_im * x_46_im)); 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[LessEqual[x$46$re, 2.2e+152], N[(x$46$im * N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] * 3.0), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$re * N[(x$46$im * N[(x$46$re * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq 2.2 \cdot 10^{+152}:\\
\;\;\;\;x.im \cdot \left(\left(x.re \cdot x.re\right) \cdot 3 - x.im \cdot x.im\right)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(x.im \cdot \left(x.re \cdot 3\right)\right)\\
\end{array}
\end{array}
if x.re < 2.1999999999999998e152Initial program 94.1%
difference-of-squares53.8%
Applied egg-rr95.0%
Taylor expanded in x.re around 0 95.0%
Taylor expanded in x.im around 0 94.9%
*-commutative94.9%
associate-*r*94.9%
unpow294.9%
associate-*l*94.9%
Simplified94.9%
+-commutative94.9%
*-commutative94.9%
distribute-lft-out97.2%
difference-of-squares96.3%
Applied egg-rr96.3%
Simplified96.3%
if 2.1999999999999998e152 < x.re Initial program 58.7%
difference-of-squares78.7%
Applied egg-rr72.0%
Taylor expanded in x.re around 0 72.0%
Taylor expanded in x.re around inf 72.0%
unpow272.0%
distribute-rgt1-in72.0%
metadata-eval72.0%
associate-*r*93.2%
*-commutative93.2%
associate-*l*93.2%
*-commutative93.2%
associate-*l*93.3%
*-commutative93.3%
Simplified93.3%
Final simplification96.0%
(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 89.9%
difference-of-squares56.7%
Applied egg-rr92.3%
Taylor expanded in x.re around 0 92.3%
Taylor expanded in x.re around inf 51.7%
distribute-rgt-in51.6%
associate-*r*51.6%
distribute-rgt1-in51.6%
metadata-eval51.6%
unpow251.6%
Simplified51.6%
Final simplification51.6%
(FPCore (x.re x.im) :precision binary64 (* x.im (* (* x.re x.re) 3.0)))
double code(double x_46_re, double x_46_im) {
return x_46_im * ((x_46_re * 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_46im * ((x_46re * x_46re) * 3.0d0)
end function
public static double code(double x_46_re, double x_46_im) {
return x_46_im * ((x_46_re * x_46_re) * 3.0);
}
def code(x_46_re, x_46_im): return x_46_im * ((x_46_re * x_46_re) * 3.0)
function code(x_46_re, x_46_im) return Float64(x_46_im * Float64(Float64(x_46_re * x_46_re) * 3.0)) end
function tmp = code(x_46_re, x_46_im) tmp = x_46_im * ((x_46_re * x_46_re) * 3.0); end
code[x$46$re_, x$46$im_] := N[(x$46$im * N[(N[(x$46$re * x$46$re), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x.im \cdot \left(\left(x.re \cdot x.re\right) \cdot 3\right)
\end{array}
Initial program 89.9%
difference-of-squares56.7%
Applied egg-rr92.3%
Taylor expanded in x.re around 0 92.3%
Taylor expanded in x.re around inf 51.7%
distribute-rgt1-in51.7%
metadata-eval51.7%
*-commutative51.7%
*-commutative51.7%
associate-*r*51.7%
unpow251.7%
Simplified51.7%
Final simplification51.7%
(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(x_46_re * Float64(x_46_im * Float64(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[(x$46$re * N[(x$46$im * N[(x$46$re * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x.re \cdot \left(x.im \cdot \left(x.re \cdot 3\right)\right)
\end{array}
Initial program 89.9%
difference-of-squares56.7%
Applied egg-rr92.3%
Taylor expanded in x.re around 0 92.3%
Taylor expanded in x.re around inf 51.7%
unpow251.7%
distribute-rgt1-in51.7%
metadata-eval51.7%
associate-*r*55.2%
*-commutative55.2%
associate-*l*55.2%
*-commutative55.2%
associate-*l*55.2%
*-commutative55.2%
Simplified55.2%
Final simplification55.2%
(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(Float64(x_46_re * 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[(N[(x$46$re * x$46$im), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x.re \cdot \left(\left(x.re \cdot x.im\right) \cdot 3\right)
\end{array}
Initial program 89.9%
difference-of-squares56.7%
Applied egg-rr92.3%
Taylor expanded in x.re around 0 92.3%
Taylor expanded in x.re around inf 51.7%
distribute-rgt-in51.6%
associate-*r*51.6%
distribute-rgt1-in51.6%
metadata-eval51.6%
unpow251.6%
Simplified51.6%
associate-*r*51.7%
associate-*r*55.2%
*-commutative55.2%
associate-*r*55.2%
*-commutative55.2%
expm1-log1p-u40.7%
expm1-udef29.5%
*-commutative29.5%
associate-*l*27.3%
*-commutative27.3%
Applied egg-rr27.3%
Simplified55.2%
Final simplification55.2%
(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 89.9%
*-commutative89.9%
*-commutative89.9%
difference-of-squares92.3%
associate-*l*95.8%
fma-def95.9%
*-commutative95.9%
*-commutative95.9%
*-commutative95.9%
distribute-lft-out95.9%
Simplified95.9%
Taylor expanded in x.re around 0 57.8%
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 2023275
(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)))