
(FPCore (x.re x.im) :precision binary64 (- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))
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_re) - (((x_46_re * x_46_im) + (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_46re) - (x_46im * x_46im)) * x_46re) - (((x_46re * x_46im) + (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_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im);
}
def code(x_46_re, x_46_im): return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im)
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_re) - Float64(Float64(Float64(x_46_re * x_46_im) + Float64(x_46_im * 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 * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im); 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$re), $MachinePrecision] - N[(N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im
\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.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))
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_re) - (((x_46_re * x_46_im) + (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_46re) - (x_46im * x_46im)) * x_46re) - (((x_46re * x_46im) + (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_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im);
}
def code(x_46_re, x_46_im): return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im)
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_re) - Float64(Float64(Float64(x_46_re * x_46_im) + Float64(x_46_im * 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 * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im); 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$re), $MachinePrecision] - N[(N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im
\end{array}
(FPCore (x.re x.im)
:precision binary64
(if (<=
(-
(* x.re (- (* x.re x.re) (* x.im x.im)))
(* x.im (+ (* x.re x.im) (* x.re x.im))))
INFINITY)
(fma (* x.im (* x.re -3.0)) x.im (pow x.re 3.0))
(* x.re (* x.re x.re))))
double code(double x_46_re, double x_46_im) {
double tmp;
if (((x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)))) <= ((double) INFINITY)) {
tmp = fma((x_46_im * (x_46_re * -3.0)), x_46_im, pow(x_46_re, 3.0));
} else {
tmp = x_46_re * (x_46_re * x_46_re);
}
return tmp;
}
function code(x_46_re, x_46_im) tmp = 0.0 if (Float64(Float64(x_46_re * Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im))) - Float64(x_46_im * Float64(Float64(x_46_re * x_46_im) + Float64(x_46_re * x_46_im)))) <= Inf) tmp = fma(Float64(x_46_im * Float64(x_46_re * -3.0)), x_46_im, (x_46_re ^ 3.0)); else tmp = Float64(x_46_re * Float64(x_46_re * x_46_re)); end return tmp end
code[x$46$re_, x$46$im_] := If[LessEqual[N[(N[(x$46$re * N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $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]), $MachinePrecision], Infinity], N[(N[(x$46$im * N[(x$46$re * -3.0), $MachinePrecision]), $MachinePrecision] * x$46$im + N[Power[x$46$re, 3.0], $MachinePrecision]), $MachinePrecision], N[(x$46$re * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) - x.im \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right) \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(x.im \cdot \left(x.re \cdot -3\right), x.im, {x.re}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im)) < +inf.0Initial program 93.6%
*-commutative93.6%
distribute-lft-out93.6%
associate-*l*93.5%
*-commutative93.5%
distribute-rgt-out--93.5%
associate--l-93.5%
associate--l-93.5%
sub-neg93.5%
associate--l+93.5%
fma-udef93.5%
neg-mul-193.5%
count-293.5%
associate-*l*93.5%
distribute-rgt-out--93.5%
associate-*r*93.5%
metadata-eval93.5%
Simplified93.5%
fma-udef93.5%
Applied egg-rr93.5%
+-commutative93.5%
distribute-lft-in92.2%
associate-*r*92.1%
*-commutative92.1%
associate-*r*92.2%
associate-*r*98.3%
fma-def98.3%
cube-unmult98.4%
Applied egg-rr98.4%
if +inf.0 < (-.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im)) Initial program 0.0%
*-commutative0.0%
distribute-lft-out0.0%
associate-*l*0.0%
*-commutative0.0%
distribute-rgt-out--40.6%
associate--l-40.6%
associate--l-40.6%
sub-neg40.6%
associate--l+40.6%
fma-udef62.5%
neg-mul-162.5%
count-262.5%
associate-*l*62.5%
distribute-rgt-out--62.5%
associate-*r*62.5%
metadata-eval62.5%
Simplified62.5%
Taylor expanded in x.re around inf 78.1%
unpow278.1%
Simplified78.1%
Final simplification95.9%
(FPCore (x.re x.im) :precision binary64 (if (<= x.im 1.5e+142) (* x.re (fma x.re x.re (* x.im (* x.im -3.0)))) (* -3.0 (* x.im (* x.re x.im)))))
double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= 1.5e+142) {
tmp = x_46_re * fma(x_46_re, x_46_re, (x_46_im * (x_46_im * -3.0)));
} else {
tmp = -3.0 * (x_46_im * (x_46_re * x_46_im));
}
return tmp;
}
function code(x_46_re, x_46_im) tmp = 0.0 if (x_46_im <= 1.5e+142) tmp = Float64(x_46_re * fma(x_46_re, x_46_re, Float64(x_46_im * Float64(x_46_im * -3.0)))); else tmp = Float64(-3.0 * Float64(x_46_im * Float64(x_46_re * x_46_im))); end return tmp end
code[x$46$re_, x$46$im_] := If[LessEqual[x$46$im, 1.5e+142], N[(x$46$re * N[(x$46$re * x$46$re + N[(x$46$im * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-3.0 * N[(x$46$im * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 1.5 \cdot 10^{+142}:\\
\;\;\;\;x.re \cdot \mathsf{fma}\left(x.re, x.re, x.im \cdot \left(x.im \cdot -3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-3 \cdot \left(x.im \cdot \left(x.re \cdot x.im\right)\right)\\
\end{array}
\end{array}
if x.im < 1.49999999999999987e142Initial program 87.4%
*-commutative87.4%
distribute-lft-out87.4%
associate-*l*87.3%
*-commutative87.3%
distribute-rgt-out--93.1%
associate--l-93.1%
associate--l-93.1%
sub-neg93.1%
associate--l+93.1%
fma-udef94.5%
neg-mul-194.5%
count-294.5%
associate-*l*94.5%
distribute-rgt-out--94.5%
associate-*r*94.6%
metadata-eval94.6%
Simplified94.6%
if 1.49999999999999987e142 < x.im Initial program 48.5%
*-commutative48.5%
distribute-lft-out48.5%
associate-*l*48.5%
*-commutative48.5%
distribute-rgt-out--48.5%
associate--l-48.5%
associate--l-48.5%
sub-neg48.5%
associate--l+48.5%
fma-udef59.6%
neg-mul-159.6%
count-259.6%
associate-*l*59.6%
distribute-rgt-out--59.6%
associate-*r*59.6%
metadata-eval59.6%
Simplified59.6%
fma-udef48.5%
Applied egg-rr48.5%
Taylor expanded in x.re around 0 59.6%
unpow259.6%
associate-*r*77.6%
*-commutative77.6%
Simplified77.6%
Final simplification92.2%
(FPCore (x.re x.im) :precision binary64 (if (<= x.im 1.5e+142) (* x.re (+ (* x.re x.re) (* x.im (* x.im -3.0)))) (* -3.0 (* x.im (* x.re x.im)))))
double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= 1.5e+142) {
tmp = x_46_re * ((x_46_re * x_46_re) + (x_46_im * (x_46_im * -3.0)));
} else {
tmp = -3.0 * (x_46_im * (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 <= 1.5d+142) then
tmp = x_46re * ((x_46re * x_46re) + (x_46im * (x_46im * (-3.0d0))))
else
tmp = (-3.0d0) * (x_46im * (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 <= 1.5e+142) {
tmp = x_46_re * ((x_46_re * x_46_re) + (x_46_im * (x_46_im * -3.0)));
} else {
tmp = -3.0 * (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 <= 1.5e+142: tmp = x_46_re * ((x_46_re * x_46_re) + (x_46_im * (x_46_im * -3.0))) else: tmp = -3.0 * (x_46_im * (x_46_re * x_46_im)) return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if (x_46_im <= 1.5e+142) tmp = Float64(x_46_re * Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * Float64(x_46_im * -3.0)))); else tmp = Float64(-3.0 * Float64(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 <= 1.5e+142) tmp = x_46_re * ((x_46_re * x_46_re) + (x_46_im * (x_46_im * -3.0))); else tmp = -3.0 * (x_46_im * (x_46_re * x_46_im)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := If[LessEqual[x$46$im, 1.5e+142], N[(x$46$re * N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-3.0 * N[(x$46$im * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 1.5 \cdot 10^{+142}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.re + x.im \cdot \left(x.im \cdot -3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-3 \cdot \left(x.im \cdot \left(x.re \cdot x.im\right)\right)\\
\end{array}
\end{array}
if x.im < 1.49999999999999987e142Initial program 87.4%
*-commutative87.4%
distribute-lft-out87.4%
associate-*l*87.3%
*-commutative87.3%
distribute-rgt-out--93.1%
associate--l-93.1%
associate--l-93.1%
sub-neg93.1%
associate--l+93.1%
fma-udef94.5%
neg-mul-194.5%
count-294.5%
associate-*l*94.5%
distribute-rgt-out--94.5%
associate-*r*94.6%
metadata-eval94.6%
Simplified94.6%
fma-udef93.2%
Applied egg-rr93.2%
if 1.49999999999999987e142 < x.im Initial program 48.5%
*-commutative48.5%
distribute-lft-out48.5%
associate-*l*48.5%
*-commutative48.5%
distribute-rgt-out--48.5%
associate--l-48.5%
associate--l-48.5%
sub-neg48.5%
associate--l+48.5%
fma-udef59.6%
neg-mul-159.6%
count-259.6%
associate-*l*59.6%
distribute-rgt-out--59.6%
associate-*r*59.6%
metadata-eval59.6%
Simplified59.6%
fma-udef48.5%
Applied egg-rr48.5%
Taylor expanded in x.re around 0 59.6%
unpow259.6%
associate-*r*77.6%
*-commutative77.6%
Simplified77.6%
Final simplification91.0%
(FPCore (x.re x.im) :precision binary64 (if (<= x.im 15.5) (* x.re (* x.re x.re)) (* -3.0 (* x.re (* x.im x.im)))))
double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= 15.5) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = -3.0 * (x_46_re * (x_46_im * 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 <= 15.5d0) then
tmp = x_46re * (x_46re * x_46re)
else
tmp = (-3.0d0) * (x_46re * (x_46im * 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 <= 15.5) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = -3.0 * (x_46_re * (x_46_im * x_46_im));
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 if x_46_im <= 15.5: tmp = x_46_re * (x_46_re * x_46_re) else: tmp = -3.0 * (x_46_re * (x_46_im * x_46_im)) return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if (x_46_im <= 15.5) tmp = Float64(x_46_re * Float64(x_46_re * x_46_re)); else tmp = Float64(-3.0 * Float64(x_46_re * Float64(x_46_im * x_46_im))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if (x_46_im <= 15.5) tmp = x_46_re * (x_46_re * x_46_re); else tmp = -3.0 * (x_46_re * (x_46_im * x_46_im)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := If[LessEqual[x$46$im, 15.5], N[(x$46$re * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[(-3.0 * N[(x$46$re * N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 15.5:\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\
\mathbf{else}:\\
\;\;\;\;-3 \cdot \left(x.re \cdot \left(x.im \cdot x.im\right)\right)\\
\end{array}
\end{array}
if x.im < 15.5Initial program 88.4%
*-commutative88.4%
distribute-lft-out88.4%
associate-*l*88.3%
*-commutative88.3%
distribute-rgt-out--92.0%
associate--l-92.0%
associate--l-92.0%
sub-neg92.0%
associate--l+92.0%
fma-udef93.6%
neg-mul-193.6%
count-293.6%
associate-*l*93.6%
distribute-rgt-out--93.6%
associate-*r*93.7%
metadata-eval93.7%
Simplified93.7%
Taylor expanded in x.re around inf 68.7%
unpow268.7%
Simplified68.7%
if 15.5 < x.im Initial program 64.3%
*-commutative64.3%
distribute-lft-out64.3%
associate-*l*64.3%
*-commutative64.3%
distribute-rgt-out--72.9%
associate--l-72.9%
associate--l-72.9%
sub-neg72.9%
associate--l+72.9%
fma-udef78.7%
neg-mul-178.7%
count-278.7%
associate-*l*78.7%
distribute-rgt-out--78.7%
associate-*r*78.7%
metadata-eval78.7%
Simplified78.7%
Taylor expanded in x.re around 0 65.7%
unpow265.7%
Simplified65.7%
Final simplification67.9%
(FPCore (x.re x.im) :precision binary64 (if (<= x.im 24.5) (* x.re (* x.re x.re)) (* -3.0 (* x.im (* x.re x.im)))))
double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= 24.5) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = -3.0 * (x_46_im * (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 <= 24.5d0) then
tmp = x_46re * (x_46re * x_46re)
else
tmp = (-3.0d0) * (x_46im * (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 <= 24.5) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = -3.0 * (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 <= 24.5: tmp = x_46_re * (x_46_re * x_46_re) else: tmp = -3.0 * (x_46_im * (x_46_re * x_46_im)) return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if (x_46_im <= 24.5) tmp = Float64(x_46_re * Float64(x_46_re * x_46_re)); else tmp = Float64(-3.0 * Float64(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 <= 24.5) tmp = x_46_re * (x_46_re * x_46_re); else tmp = -3.0 * (x_46_im * (x_46_re * x_46_im)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := If[LessEqual[x$46$im, 24.5], N[(x$46$re * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[(-3.0 * N[(x$46$im * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 24.5:\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\
\mathbf{else}:\\
\;\;\;\;-3 \cdot \left(x.im \cdot \left(x.re \cdot x.im\right)\right)\\
\end{array}
\end{array}
if x.im < 24.5Initial program 88.4%
*-commutative88.4%
distribute-lft-out88.4%
associate-*l*88.3%
*-commutative88.3%
distribute-rgt-out--92.0%
associate--l-92.0%
associate--l-92.0%
sub-neg92.0%
associate--l+92.0%
fma-udef93.6%
neg-mul-193.6%
count-293.6%
associate-*l*93.6%
distribute-rgt-out--93.6%
associate-*r*93.7%
metadata-eval93.7%
Simplified93.7%
Taylor expanded in x.re around inf 68.7%
unpow268.7%
Simplified68.7%
if 24.5 < x.im Initial program 64.3%
*-commutative64.3%
distribute-lft-out64.3%
associate-*l*64.3%
*-commutative64.3%
distribute-rgt-out--72.9%
associate--l-72.9%
associate--l-72.9%
sub-neg72.9%
associate--l+72.9%
fma-udef78.7%
neg-mul-178.7%
count-278.7%
associate-*l*78.7%
distribute-rgt-out--78.7%
associate-*r*78.7%
metadata-eval78.7%
Simplified78.7%
fma-udef72.9%
Applied egg-rr72.9%
Taylor expanded in x.re around 0 65.7%
unpow265.7%
associate-*r*75.1%
*-commutative75.1%
Simplified75.1%
Final simplification70.4%
(FPCore (x.re x.im) :precision binary64 (* x.re (* x.re x.re)))
double code(double x_46_re, double x_46_im) {
return x_46_re * (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_46re)
end function
public static double code(double x_46_re, double x_46_im) {
return x_46_re * (x_46_re * x_46_re);
}
def code(x_46_re, x_46_im): return x_46_re * (x_46_re * x_46_re)
function code(x_46_re, x_46_im) return Float64(x_46_re * Float64(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_re); end
code[x$46$re_, x$46$im_] := N[(x$46$re * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x.re \cdot \left(x.re \cdot x.re\right)
\end{array}
Initial program 81.9%
*-commutative81.9%
distribute-lft-out81.9%
associate-*l*81.8%
*-commutative81.8%
distribute-rgt-out--86.9%
associate--l-86.9%
associate--l-86.9%
sub-neg86.9%
associate--l+86.9%
fma-udef89.6%
neg-mul-189.6%
count-289.6%
associate-*l*89.6%
distribute-rgt-out--89.6%
associate-*r*89.6%
metadata-eval89.6%
Simplified89.6%
Taylor expanded in x.re around inf 57.2%
unpow257.2%
Simplified57.2%
Final simplification57.2%
(FPCore (x.re x.im) :precision binary64 (+ (* (* x.re x.re) (- x.re x.im)) (* (* x.re x.im) (- x.re (* 3.0 x.im)))))
double code(double x_46_re, double x_46_im) {
return ((x_46_re * x_46_re) * (x_46_re - x_46_im)) + ((x_46_re * x_46_im) * (x_46_re - (3.0 * 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_46re - x_46im)) + ((x_46re * x_46im) * (x_46re - (3.0d0 * 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_re - x_46_im)) + ((x_46_re * x_46_im) * (x_46_re - (3.0 * x_46_im)));
}
def code(x_46_re, x_46_im): return ((x_46_re * x_46_re) * (x_46_re - x_46_im)) + ((x_46_re * x_46_im) * (x_46_re - (3.0 * x_46_im)))
function code(x_46_re, x_46_im) return Float64(Float64(Float64(x_46_re * x_46_re) * Float64(x_46_re - x_46_im)) + Float64(Float64(x_46_re * x_46_im) * Float64(x_46_re - Float64(3.0 * x_46_im)))) end
function tmp = code(x_46_re, x_46_im) tmp = ((x_46_re * x_46_re) * (x_46_re - x_46_im)) + ((x_46_re * x_46_im) * (x_46_re - (3.0 * x_46_im))); end
code[x$46$re_, x$46$im_] := N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision] + N[(N[(x$46$re * x$46$im), $MachinePrecision] * N[(x$46$re - N[(3.0 * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.re\right) \cdot \left(x.re - x.im\right) + \left(x.re \cdot x.im\right) \cdot \left(x.re - 3 \cdot x.im\right)
\end{array}
herbie shell --seed 2023227
(FPCore (x.re x.im)
:name "math.cube on complex, real part"
:precision binary64
:herbie-target
(+ (* (* x.re x.re) (- x.re x.im)) (* (* x.re x.im) (- x.re (* 3.0 x.im))))
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))