
(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 6.2e+151) (* x.re (+ (* x.re x.re) (* x.im (* x.im -3.0)))) (* x.im (* x.im (* x.re -3.0)))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= 6.2e+151) {
tmp = x_46_re * ((x_46_re * x_46_re) + (x_46_im * (x_46_im * -3.0)));
} else {
tmp = x_46_im * (x_46_im * (x_46_re * -3.0));
}
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 <= 6.2d+151) then
tmp = x_46re * ((x_46re * x_46re) + (x_46im * (x_46im * (-3.0d0))))
else
tmp = x_46im * (x_46im * (x_46re * (-3.0d0)))
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 <= 6.2e+151) {
tmp = x_46_re * ((x_46_re * x_46_re) + (x_46_im * (x_46_im * -3.0)));
} else {
tmp = x_46_im * (x_46_im * (x_46_re * -3.0));
}
return tmp;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): tmp = 0 if x_46_im <= 6.2e+151: tmp = x_46_re * ((x_46_re * x_46_re) + (x_46_im * (x_46_im * -3.0))) else: tmp = x_46_im * (x_46_im * (x_46_re * -3.0)) return tmp
x.im = abs(x.im) function code(x_46_re, x_46_im) tmp = 0.0 if (x_46_im <= 6.2e+151) 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(x_46_im * Float64(x_46_im * Float64(x_46_re * -3.0))); 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 <= 6.2e+151) tmp = x_46_re * ((x_46_re * x_46_re) + (x_46_im * (x_46_im * -3.0))); else tmp = x_46_im * (x_46_im * (x_46_re * -3.0)); 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, 6.2e+151], 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[(x$46$im * N[(x$46$im * N[(x$46$re * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 6.2 \cdot 10^{+151}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.re + x.im \cdot \left(x.im \cdot -3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \left(x.im \cdot \left(x.re \cdot -3\right)\right)\\
\end{array}
\end{array}
if x.im < 6.2000000000000004e151Initial program 89.6%
*-commutative89.6%
distribute-lft-out89.6%
associate-*l*89.6%
*-commutative89.6%
distribute-rgt-out--95.4%
associate--l-95.4%
associate--l-95.4%
sub-neg95.4%
associate--l+95.4%
fma-udef95.9%
neg-mul-195.9%
count-295.9%
associate-*l*95.9%
distribute-rgt-out--95.9%
associate-*r*95.9%
metadata-eval95.9%
Simplified95.9%
fma-udef95.4%
Applied egg-rr95.4%
if 6.2000000000000004e151 < x.im Initial program 43.5%
*-commutative43.5%
distribute-lft-out43.5%
associate-*l*43.5%
*-commutative43.5%
distribute-rgt-out--43.5%
associate--l-43.5%
associate--l-43.5%
sub-neg43.5%
associate--l+43.5%
fma-udef60.1%
neg-mul-160.1%
count-260.1%
associate-*l*60.1%
distribute-rgt-out--60.1%
associate-*r*60.1%
metadata-eval60.1%
Simplified60.1%
Taylor expanded in x.re around 0 60.1%
associate-*r*60.1%
unpow260.1%
Simplified60.1%
add-sqr-sqrt34.5%
pow234.5%
*-commutative34.5%
sqrt-prod34.5%
sqrt-prod44.1%
add-sqr-sqrt44.4%
*-commutative44.4%
Applied egg-rr44.4%
unpow244.4%
*-commutative44.4%
*-commutative44.4%
swap-sqr34.5%
add-sqr-sqrt60.1%
associate-*r*80.5%
associate-*r*80.3%
*-commutative80.3%
associate-*r*80.5%
associate-*r*80.5%
Applied egg-rr80.5%
Final simplification93.3%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (<= x.im 1.4e+23) (* 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 <= 1.4e+23) {
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 <= 1.4d+23) 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 <= 1.4e+23) {
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 <= 1.4e+23: 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 <= 1.4e+23) 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 <= 1.4e+23) 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, 1.4e+23], 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 1.4 \cdot 10^{+23}:\\
\;\;\;\;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 < 1.4e23Initial program 92.3%
*-commutative92.3%
distribute-lft-out92.3%
associate-*l*92.3%
*-commutative92.3%
distribute-rgt-out--94.8%
associate--l-94.8%
associate--l-94.8%
sub-neg94.8%
associate--l+94.8%
fma-udef95.4%
neg-mul-195.4%
count-295.4%
associate-*l*95.4%
distribute-rgt-out--95.4%
associate-*r*95.3%
metadata-eval95.3%
Simplified95.3%
Taylor expanded in x.re around inf 66.4%
unpow266.4%
Simplified66.4%
if 1.4e23 < x.im Initial program 55.0%
*-commutative55.0%
distribute-lft-out55.0%
associate-*l*55.0%
*-commutative55.0%
distribute-rgt-out--67.5%
associate--l-67.5%
associate--l-67.5%
sub-neg67.5%
associate--l+67.5%
fma-udef77.1%
neg-mul-177.1%
count-277.1%
associate-*l*77.1%
distribute-rgt-out--77.1%
associate-*r*77.0%
metadata-eval77.0%
Simplified77.0%
fma-udef67.5%
Applied egg-rr67.5%
Taylor expanded in x.re around 0 61.2%
unpow261.2%
Simplified61.2%
Final simplification65.1%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (<= x.im 1.36e+23) (* x.re (* x.re x.re)) (* x.im (* x.re (* x.im -3.0)))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= 1.36e+23) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = x_46_im * (x_46_re * (x_46_im * -3.0));
}
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 <= 1.36d+23) then
tmp = x_46re * (x_46re * x_46re)
else
tmp = x_46im * (x_46re * (x_46im * (-3.0d0)))
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 <= 1.36e+23) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = x_46_im * (x_46_re * (x_46_im * -3.0));
}
return tmp;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): tmp = 0 if x_46_im <= 1.36e+23: tmp = x_46_re * (x_46_re * x_46_re) else: tmp = x_46_im * (x_46_re * (x_46_im * -3.0)) return tmp
x.im = abs(x.im) function code(x_46_re, x_46_im) tmp = 0.0 if (x_46_im <= 1.36e+23) tmp = Float64(x_46_re * Float64(x_46_re * x_46_re)); else tmp = Float64(x_46_im * Float64(x_46_re * Float64(x_46_im * -3.0))); 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 <= 1.36e+23) tmp = x_46_re * (x_46_re * x_46_re); else tmp = x_46_im * (x_46_re * (x_46_im * -3.0)); 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, 1.36e+23], N[(x$46$re * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[(x$46$im * N[(x$46$re * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 1.36 \cdot 10^{+23}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \left(x.re \cdot \left(x.im \cdot -3\right)\right)\\
\end{array}
\end{array}
if x.im < 1.36e23Initial program 92.3%
*-commutative92.3%
distribute-lft-out92.3%
associate-*l*92.3%
*-commutative92.3%
distribute-rgt-out--94.8%
associate--l-94.8%
associate--l-94.8%
sub-neg94.8%
associate--l+94.8%
fma-udef95.4%
neg-mul-195.4%
count-295.4%
associate-*l*95.4%
distribute-rgt-out--95.4%
associate-*r*95.3%
metadata-eval95.3%
Simplified95.3%
Taylor expanded in x.re around inf 66.4%
unpow266.4%
Simplified66.4%
if 1.36e23 < x.im Initial program 55.0%
*-commutative55.0%
distribute-lft-out55.0%
associate-*l*55.0%
*-commutative55.0%
distribute-rgt-out--67.5%
associate--l-67.5%
associate--l-67.5%
sub-neg67.5%
associate--l+67.5%
fma-udef77.1%
neg-mul-177.1%
count-277.1%
associate-*l*77.1%
distribute-rgt-out--77.1%
associate-*r*77.0%
metadata-eval77.0%
Simplified77.0%
fma-udef67.5%
Applied egg-rr67.5%
Taylor expanded in x.re around 0 61.2%
unpow261.2%
*-commutative61.2%
associate-*r*72.8%
*-commutative72.8%
associate-*r*72.7%
associate-*l*72.8%
*-commutative72.8%
Simplified72.8%
Final simplification68.0%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (<= x.im 2.8e+23) (* x.re (* x.re x.re)) (* -3.0 (* x.im (* 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 <= 2.8e+23) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = -3.0 * (x_46_im * (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 <= 2.8d+23) then
tmp = x_46re * (x_46re * x_46re)
else
tmp = (-3.0d0) * (x_46im * (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 <= 2.8e+23) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = -3.0 * (x_46_im * (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 <= 2.8e+23: tmp = x_46_re * (x_46_re * x_46_re) else: tmp = -3.0 * (x_46_im * (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 <= 2.8e+23) tmp = Float64(x_46_re * Float64(x_46_re * x_46_re)); else tmp = Float64(-3.0 * Float64(x_46_im * 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 <= 2.8e+23) tmp = x_46_re * (x_46_re * x_46_re); else tmp = -3.0 * (x_46_im * (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, 2.8e+23], N[(x$46$re * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[(-3.0 * N[(x$46$im * N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 2.8 \cdot 10^{+23}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\
\mathbf{else}:\\
\;\;\;\;-3 \cdot \left(x.im \cdot \left(x.im \cdot x.re\right)\right)\\
\end{array}
\end{array}
if x.im < 2.8e23Initial program 92.3%
*-commutative92.3%
distribute-lft-out92.3%
associate-*l*92.3%
*-commutative92.3%
distribute-rgt-out--94.8%
associate--l-94.8%
associate--l-94.8%
sub-neg94.8%
associate--l+94.8%
fma-udef95.4%
neg-mul-195.4%
count-295.4%
associate-*l*95.4%
distribute-rgt-out--95.4%
associate-*r*95.3%
metadata-eval95.3%
Simplified95.3%
Taylor expanded in x.re around inf 66.4%
unpow266.4%
Simplified66.4%
if 2.8e23 < x.im Initial program 55.0%
*-commutative55.0%
distribute-lft-out55.0%
associate-*l*55.0%
*-commutative55.0%
distribute-rgt-out--67.5%
associate--l-67.5%
associate--l-67.5%
sub-neg67.5%
associate--l+67.5%
fma-udef77.1%
neg-mul-177.1%
count-277.1%
associate-*l*77.1%
distribute-rgt-out--77.1%
associate-*r*77.0%
metadata-eval77.0%
Simplified77.0%
Taylor expanded in x.re around 0 61.2%
associate-*r*61.1%
unpow261.1%
Simplified61.1%
add-sqr-sqrt37.0%
pow237.0%
*-commutative37.0%
sqrt-prod36.9%
sqrt-prod42.4%
add-sqr-sqrt42.6%
*-commutative42.6%
Applied egg-rr42.6%
unpow242.6%
*-commutative42.6%
*-commutative42.6%
swap-sqr36.9%
add-sqr-sqrt61.1%
associate-*r*72.7%
associate-*r*72.8%
*-commutative72.8%
associate-*r*72.7%
*-commutative72.7%
associate-*r*72.8%
Applied egg-rr72.8%
Final simplification68.0%
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.1%
*-commutative83.1%
distribute-lft-out83.1%
associate-*l*83.1%
*-commutative83.1%
distribute-rgt-out--88.1%
associate--l-88.1%
associate--l-88.1%
sub-neg88.1%
associate--l+88.1%
fma-udef90.9%
neg-mul-190.9%
count-290.9%
associate-*l*90.9%
distribute-rgt-out--90.9%
associate-*r*90.8%
metadata-eval90.8%
Simplified90.8%
Taylor expanded in x.re around inf 57.0%
unpow257.0%
Simplified57.0%
Final simplification57.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 2023257
(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)))