
(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 5 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}
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (<= x.im 7.8e+153) (* x.re (+ (* x.re x.re) (* x.im (* x.im -3.0)))) (* (* x.im -3.0) (* x.im x.re))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= 7.8e+153) {
tmp = x_46_re * ((x_46_re * x_46_re) + (x_46_im * (x_46_im * -3.0)));
} else {
tmp = (x_46_im * -3.0) * (x_46_im * x_46_re);
}
return tmp;
}
NOTE: x.im should be positive before calling this function
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 <= 7.8d+153) then
tmp = x_46re * ((x_46re * x_46re) + (x_46im * (x_46im * (-3.0d0))))
else
tmp = (x_46im * (-3.0d0)) * (x_46im * x_46re)
end if
code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= 7.8e+153) {
tmp = x_46_re * ((x_46_re * x_46_re) + (x_46_im * (x_46_im * -3.0)));
} else {
tmp = (x_46_im * -3.0) * (x_46_im * x_46_re);
}
return tmp;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): tmp = 0 if x_46_im <= 7.8e+153: tmp = x_46_re * ((x_46_re * x_46_re) + (x_46_im * (x_46_im * -3.0))) else: tmp = (x_46_im * -3.0) * (x_46_im * x_46_re) return tmp
x.im = abs(x.im) function code(x_46_re, x_46_im) tmp = 0.0 if (x_46_im <= 7.8e+153) 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(Float64(x_46_im * -3.0) * Float64(x_46_im * x_46_re)); end return tmp end
x.im = abs(x.im) function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if (x_46_im <= 7.8e+153) tmp = x_46_re * ((x_46_re * x_46_re) + (x_46_im * (x_46_im * -3.0))); else tmp = (x_46_im * -3.0) * (x_46_im * x_46_re); end tmp_2 = tmp; end
NOTE: x.im should be positive before calling this function code[x$46$re_, x$46$im_] := If[LessEqual[x$46$im, 7.8e+153], 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[(N[(x$46$im * -3.0), $MachinePrecision] * N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 7.8 \cdot 10^{+153}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.re + x.im \cdot \left(x.im \cdot -3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x.im \cdot -3\right) \cdot \left(x.im \cdot x.re\right)\\
\end{array}
\end{array}
if x.im < 7.79999999999999966e153Initial program 86.1%
*-commutative86.1%
distribute-lft-out86.1%
associate-*l*86.1%
*-commutative86.1%
distribute-rgt-out--93.1%
associate--l-93.1%
associate--l-93.1%
sub-neg93.1%
associate--l+93.1%
fma-udef94.4%
neg-mul-194.4%
count-294.4%
associate-*l*94.4%
distribute-rgt-out--94.4%
associate-*r*94.4%
metadata-eval94.4%
Simplified94.4%
fma-udef93.1%
Applied egg-rr93.1%
if 7.79999999999999966e153 < x.im Initial program 57.1%
*-commutative57.1%
distribute-lft-out57.1%
associate-*l*57.1%
*-commutative57.1%
distribute-rgt-out--57.1%
associate--l-57.1%
associate--l-57.1%
sub-neg57.1%
associate--l+57.1%
fma-udef64.5%
neg-mul-164.5%
count-264.5%
associate-*l*64.5%
distribute-rgt-out--64.5%
associate-*r*64.5%
metadata-eval64.5%
Simplified64.5%
fma-udef57.1%
Applied egg-rr57.1%
Taylor expanded in x.re around 0 64.5%
unpow264.5%
Simplified64.5%
add-sqr-sqrt30.1%
pow230.1%
associate-*r*30.1%
sqrt-prod30.1%
*-commutative30.1%
sqrt-prod36.9%
add-sqr-sqrt37.0%
Applied egg-rr37.0%
unpow237.0%
swap-sqr30.1%
add-sqr-sqrt64.5%
*-commutative64.5%
associate-*l*85.1%
*-commutative85.1%
associate-*r*85.1%
associate-*l*85.1%
Applied egg-rr85.1%
Final simplification92.2%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (<= x.im 4.7e+70) (* x.re (* x.re x.re)) (* -3.0 (* x.re (* x.im x.im)))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= 4.7e+70) {
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;
}
NOTE: x.im should be positive before calling this function
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.7d+70) then
tmp = x_46re * (x_46re * x_46re)
else
tmp = (-3.0d0) * (x_46re * (x_46im * x_46im))
end if
code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= 4.7e+70) {
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;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): tmp = 0 if x_46_im <= 4.7e+70: 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
x.im = abs(x.im) function code(x_46_re, x_46_im) tmp = 0.0 if (x_46_im <= 4.7e+70) 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
x.im = abs(x.im) function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if (x_46_im <= 4.7e+70) 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
NOTE: x.im should be positive before calling this function code[x$46$re_, x$46$im_] := If[LessEqual[x$46$im, 4.7e+70], 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}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 4.7 \cdot 10^{+70}:\\
\;\;\;\;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 < 4.6999999999999998e70Initial program 87.5%
*-commutative87.5%
distribute-lft-out87.5%
associate-*l*87.6%
*-commutative87.6%
distribute-rgt-out--92.4%
associate--l-92.4%
associate--l-92.4%
sub-neg92.4%
associate--l+92.4%
fma-udef93.8%
neg-mul-193.8%
count-293.8%
associate-*l*93.8%
distribute-rgt-out--93.8%
associate-*r*93.8%
metadata-eval93.8%
Simplified93.8%
Taylor expanded in x.re around inf 70.4%
unpow270.4%
Simplified70.4%
if 4.6999999999999998e70 < x.im Initial program 63.9%
*-commutative63.9%
distribute-lft-out63.9%
associate-*l*63.9%
*-commutative63.9%
distribute-rgt-out--76.2%
associate--l-76.2%
associate--l-76.2%
sub-neg76.2%
associate--l+76.2%
fma-udef80.2%
neg-mul-180.2%
count-280.2%
associate-*l*80.2%
distribute-rgt-out--80.2%
associate-*r*80.3%
metadata-eval80.3%
Simplified80.3%
fma-udef76.2%
Applied egg-rr76.2%
Taylor expanded in x.re around 0 67.9%
unpow267.9%
Simplified67.9%
Final simplification69.9%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (<= x.im 5.1e+70) (* x.re (* x.re x.re)) (* (* x.im -3.0) (* x.im x.re))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= 5.1e+70) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = (x_46_im * -3.0) * (x_46_im * x_46_re);
}
return tmp;
}
NOTE: x.im should be positive before calling this function
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 <= 5.1d+70) then
tmp = x_46re * (x_46re * x_46re)
else
tmp = (x_46im * (-3.0d0)) * (x_46im * x_46re)
end if
code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= 5.1e+70) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = (x_46_im * -3.0) * (x_46_im * x_46_re);
}
return tmp;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): tmp = 0 if x_46_im <= 5.1e+70: tmp = x_46_re * (x_46_re * x_46_re) else: tmp = (x_46_im * -3.0) * (x_46_im * x_46_re) return tmp
x.im = abs(x.im) function code(x_46_re, x_46_im) tmp = 0.0 if (x_46_im <= 5.1e+70) tmp = Float64(x_46_re * Float64(x_46_re * x_46_re)); else tmp = Float64(Float64(x_46_im * -3.0) * Float64(x_46_im * x_46_re)); end return tmp end
x.im = abs(x.im) function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if (x_46_im <= 5.1e+70) tmp = x_46_re * (x_46_re * x_46_re); else tmp = (x_46_im * -3.0) * (x_46_im * x_46_re); end tmp_2 = tmp; end
NOTE: x.im should be positive before calling this function code[x$46$re_, x$46$im_] := If[LessEqual[x$46$im, 5.1e+70], N[(x$46$re * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im * -3.0), $MachinePrecision] * N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 5.1 \cdot 10^{+70}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x.im \cdot -3\right) \cdot \left(x.im \cdot x.re\right)\\
\end{array}
\end{array}
if x.im < 5.10000000000000014e70Initial program 87.5%
*-commutative87.5%
distribute-lft-out87.5%
associate-*l*87.6%
*-commutative87.6%
distribute-rgt-out--92.4%
associate--l-92.4%
associate--l-92.4%
sub-neg92.4%
associate--l+92.4%
fma-udef93.8%
neg-mul-193.8%
count-293.8%
associate-*l*93.8%
distribute-rgt-out--93.8%
associate-*r*93.8%
metadata-eval93.8%
Simplified93.8%
Taylor expanded in x.re around inf 70.4%
unpow270.4%
Simplified70.4%
if 5.10000000000000014e70 < x.im Initial program 63.9%
*-commutative63.9%
distribute-lft-out63.9%
associate-*l*63.9%
*-commutative63.9%
distribute-rgt-out--76.2%
associate--l-76.2%
associate--l-76.2%
sub-neg76.2%
associate--l+76.2%
fma-udef80.2%
neg-mul-180.2%
count-280.2%
associate-*l*80.2%
distribute-rgt-out--80.2%
associate-*r*80.3%
metadata-eval80.3%
Simplified80.3%
fma-udef76.2%
Applied egg-rr76.2%
Taylor expanded in x.re around 0 67.9%
unpow267.9%
Simplified67.9%
add-sqr-sqrt40.9%
pow240.9%
associate-*r*40.9%
sqrt-prod40.9%
*-commutative40.9%
sqrt-prod44.5%
add-sqr-sqrt44.7%
Applied egg-rr44.7%
unpow244.7%
swap-sqr40.8%
add-sqr-sqrt68.0%
*-commutative68.0%
associate-*l*79.4%
*-commutative79.4%
associate-*r*79.4%
associate-*l*79.5%
Applied egg-rr79.5%
Final simplification72.1%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (<= x.im 8.2e+184) (* x.re (* x.re x.re)) (* x.re (* x.im (- x.im)))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= 8.2e+184) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = x_46_re * (x_46_im * -x_46_im);
}
return tmp;
}
NOTE: x.im should be positive before calling this function
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 <= 8.2d+184) then
tmp = x_46re * (x_46re * x_46re)
else
tmp = x_46re * (x_46im * -x_46im)
end if
code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= 8.2e+184) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = x_46_re * (x_46_im * -x_46_im);
}
return tmp;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): tmp = 0 if x_46_im <= 8.2e+184: tmp = x_46_re * (x_46_re * x_46_re) else: tmp = x_46_re * (x_46_im * -x_46_im) return tmp
x.im = abs(x.im) function code(x_46_re, x_46_im) tmp = 0.0 if (x_46_im <= 8.2e+184) tmp = Float64(x_46_re * Float64(x_46_re * x_46_re)); else tmp = Float64(x_46_re * Float64(x_46_im * Float64(-x_46_im))); end return tmp end
x.im = abs(x.im) function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if (x_46_im <= 8.2e+184) tmp = x_46_re * (x_46_re * x_46_re); else tmp = x_46_re * (x_46_im * -x_46_im); end tmp_2 = tmp; end
NOTE: x.im should be positive before calling this function code[x$46$re_, x$46$im_] := If[LessEqual[x$46$im, 8.2e+184], N[(x$46$re * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[(x$46$re * N[(x$46$im * (-x$46$im)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 8.2 \cdot 10^{+184}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(x.im \cdot \left(-x.im\right)\right)\\
\end{array}
\end{array}
if x.im < 8.1999999999999993e184Initial program 85.1%
*-commutative85.1%
distribute-lft-out85.1%
associate-*l*85.1%
*-commutative85.1%
distribute-rgt-out--92.0%
associate--l-92.0%
associate--l-92.0%
sub-neg92.0%
associate--l+92.0%
fma-udef93.2%
neg-mul-193.2%
count-293.2%
associate-*l*93.2%
distribute-rgt-out--93.2%
associate-*r*93.3%
metadata-eval93.3%
Simplified93.3%
Taylor expanded in x.re around inf 65.8%
unpow265.8%
Simplified65.8%
if 8.1999999999999993e184 < x.im Initial program 60.6%
*-commutative60.6%
fma-neg60.6%
distribute-lft-neg-in60.6%
*-commutative60.6%
*-commutative60.6%
count-260.6%
distribute-lft-neg-in60.6%
metadata-eval60.6%
*-commutative60.6%
Simplified60.6%
Taylor expanded in x.re around 0 69.7%
mul-1-neg69.7%
unpow269.7%
distribute-rgt-neg-out69.7%
Simplified69.7%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
sqr-neg0.0%
sqrt-prod0.0%
add-sqr-sqrt0.0%
fma-def0.0%
*-commutative0.0%
associate-*l*0.0%
Applied egg-rr0.0%
associate-*r*4.0%
associate-*r*4.0%
*-commutative4.0%
distribute-lft-out72.2%
*-commutative72.2%
distribute-rgt1-in72.2%
metadata-eval72.2%
neg-mul-172.2%
distribute-rgt-neg-in72.2%
associate-*r*69.7%
Simplified69.7%
Final simplification66.2%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (* x.re (* x.re x.re)))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
return x_46_re * (x_46_re * x_46_re);
}
NOTE: x.im should be positive before calling this function
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
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
return x_46_re * (x_46_re * x_46_re);
}
x.im = abs(x.im) def code(x_46_re, x_46_im): return x_46_re * (x_46_re * x_46_re)
x.im = abs(x.im) function code(x_46_re, x_46_im) return Float64(x_46_re * Float64(x_46_re * x_46_re)) end
x.im = abs(x.im) function tmp = code(x_46_re, x_46_im) tmp = x_46_re * (x_46_re * x_46_re); end
NOTE: x.im should be positive before calling this function code[x$46$re_, x$46$im_] := N[(x$46$re * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x.im = |x.im|\\
\\
x.re \cdot \left(x.re \cdot x.re\right)
\end{array}
Initial program 83.0%
*-commutative83.0%
distribute-lft-out83.0%
associate-*l*83.0%
*-commutative83.0%
distribute-rgt-out--89.3%
associate--l-89.3%
associate--l-89.3%
sub-neg89.3%
associate--l+89.3%
fma-udef91.2%
neg-mul-191.2%
count-291.2%
associate-*l*91.2%
distribute-rgt-out--91.2%
associate-*r*91.2%
metadata-eval91.2%
Simplified91.2%
Taylor expanded in x.re around inf 61.0%
unpow261.0%
Simplified61.0%
Final simplification61.0%
(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 2023201
(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)))