
(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
(let* ((t_0 (* (- x.re x.im) (* x.im (+ x.re x.im))))
(t_1 (* x.re (+ (* x.re x.im) (* x.re x.im)))))
(if (<= (+ (* x.im (- (* x.re x.re) (* x.im x.im))) t_1) INFINITY)
(+ t_1 t_0)
(+ t_0 (* x.re 0.0)))))
double code(double x_46_re, double x_46_im) {
double t_0 = (x_46_re - x_46_im) * (x_46_im * (x_46_re + x_46_im));
double t_1 = x_46_re * ((x_46_re * x_46_im) + (x_46_re * x_46_im));
double tmp;
if (((x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + t_1) <= ((double) INFINITY)) {
tmp = t_1 + t_0;
} else {
tmp = t_0 + (x_46_re * 0.0);
}
return tmp;
}
public static double code(double x_46_re, double x_46_im) {
double t_0 = (x_46_re - x_46_im) * (x_46_im * (x_46_re + x_46_im));
double t_1 = x_46_re * ((x_46_re * x_46_im) + (x_46_re * x_46_im));
double tmp;
if (((x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + t_1) <= Double.POSITIVE_INFINITY) {
tmp = t_1 + t_0;
} else {
tmp = t_0 + (x_46_re * 0.0);
}
return tmp;
}
def code(x_46_re, x_46_im): t_0 = (x_46_re - x_46_im) * (x_46_im * (x_46_re + x_46_im)) t_1 = x_46_re * ((x_46_re * x_46_im) + (x_46_re * x_46_im)) tmp = 0 if ((x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + t_1) <= math.inf: tmp = t_1 + t_0 else: tmp = t_0 + (x_46_re * 0.0) return tmp
function code(x_46_re, x_46_im) t_0 = Float64(Float64(x_46_re - x_46_im) * Float64(x_46_im * Float64(x_46_re + x_46_im))) t_1 = Float64(x_46_re * Float64(Float64(x_46_re * x_46_im) + Float64(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))) + t_1) <= Inf) tmp = Float64(t_1 + t_0); else tmp = Float64(t_0 + Float64(x_46_re * 0.0)); end return tmp end
function tmp_2 = code(x_46_re, x_46_im) t_0 = (x_46_re - x_46_im) * (x_46_im * (x_46_re + x_46_im)); t_1 = x_46_re * ((x_46_re * x_46_im) + (x_46_re * x_46_im)); tmp = 0.0; if (((x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + t_1) <= Inf) tmp = t_1 + t_0; else tmp = t_0 + (x_46_re * 0.0); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$im * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x$46$re * N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$im), $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] + t$95$1), $MachinePrecision], Infinity], N[(t$95$1 + t$95$0), $MachinePrecision], N[(t$95$0 + N[(x$46$re * 0.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.re + x.im\right)\right)\\
t_1 := x.re \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\\
\mathbf{if}\;x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) + t_1 \leq \infty:\\
\;\;\;\;t_1 + t_0\\
\mathbf{else}:\\
\;\;\;\;t_0 + x.re \cdot 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 93.4%
add-cube-cbrt93.0%
pow393.0%
*-commutative93.0%
difference-of-squares93.0%
associate-*r*99.4%
Applied egg-rr99.4%
unpow399.4%
add-cube-cbrt99.7%
*-commutative99.7%
+-commutative99.7%
Applied egg-rr99.7%
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%
add-cube-cbrt0.0%
pow30.0%
*-commutative0.0%
difference-of-squares28.9%
associate-*r*28.9%
Applied egg-rr28.9%
unpow328.9%
add-cube-cbrt28.9%
*-commutative28.9%
+-commutative28.9%
Applied egg-rr28.9%
*-commutative28.9%
flip-+0.0%
div-sub0.0%
pow20.0%
*-commutative0.0%
*-commutative0.0%
*-commutative0.0%
pow20.0%
*-commutative0.0%
*-commutative0.0%
*-commutative0.0%
Applied egg-rr0.0%
+-inverses100.0%
Simplified100.0%
Final simplification99.8%
(FPCore (x.re x.im)
:precision binary64
(let* ((t_0 (* (- x.re x.im) (* x.im (+ x.re x.im)))))
(if (or (<= x.im -1e+130) (not (<= x.im 1.95e+44)))
(+ t_0 (* x.re 0.0))
(+ t_0 (* x.re (* x.re (+ x.im x.im)))))))
double code(double x_46_re, double x_46_im) {
double t_0 = (x_46_re - x_46_im) * (x_46_im * (x_46_re + x_46_im));
double tmp;
if ((x_46_im <= -1e+130) || !(x_46_im <= 1.95e+44)) {
tmp = t_0 + (x_46_re * 0.0);
} else {
tmp = t_0 + (x_46_re * (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) :: t_0
real(8) :: tmp
t_0 = (x_46re - x_46im) * (x_46im * (x_46re + x_46im))
if ((x_46im <= (-1d+130)) .or. (.not. (x_46im <= 1.95d+44))) then
tmp = t_0 + (x_46re * 0.0d0)
else
tmp = t_0 + (x_46re * (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 t_0 = (x_46_re - x_46_im) * (x_46_im * (x_46_re + x_46_im));
double tmp;
if ((x_46_im <= -1e+130) || !(x_46_im <= 1.95e+44)) {
tmp = t_0 + (x_46_re * 0.0);
} else {
tmp = t_0 + (x_46_re * (x_46_re * (x_46_im + x_46_im)));
}
return tmp;
}
def code(x_46_re, x_46_im): t_0 = (x_46_re - x_46_im) * (x_46_im * (x_46_re + x_46_im)) tmp = 0 if (x_46_im <= -1e+130) or not (x_46_im <= 1.95e+44): tmp = t_0 + (x_46_re * 0.0) else: tmp = t_0 + (x_46_re * (x_46_re * (x_46_im + x_46_im))) return tmp
function code(x_46_re, x_46_im) t_0 = Float64(Float64(x_46_re - x_46_im) * Float64(x_46_im * Float64(x_46_re + x_46_im))) tmp = 0.0 if ((x_46_im <= -1e+130) || !(x_46_im <= 1.95e+44)) tmp = Float64(t_0 + Float64(x_46_re * 0.0)); else tmp = Float64(t_0 + Float64(x_46_re * 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) t_0 = (x_46_re - x_46_im) * (x_46_im * (x_46_re + x_46_im)); tmp = 0.0; if ((x_46_im <= -1e+130) || ~((x_46_im <= 1.95e+44))) tmp = t_0 + (x_46_re * 0.0); else tmp = t_0 + (x_46_re * (x_46_re * (x_46_im + x_46_im))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$im * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x$46$im, -1e+130], N[Not[LessEqual[x$46$im, 1.95e+44]], $MachinePrecision]], N[(t$95$0 + N[(x$46$re * 0.0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(x$46$re * N[(x$46$re * N[(x$46$im + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.re + x.im\right)\right)\\
\mathbf{if}\;x.im \leq -1 \cdot 10^{+130} \lor \neg \left(x.im \leq 1.95 \cdot 10^{+44}\right):\\
\;\;\;\;t_0 + x.re \cdot 0\\
\mathbf{else}:\\
\;\;\;\;t_0 + x.re \cdot \left(x.re \cdot \left(x.im + x.im\right)\right)\\
\end{array}
\end{array}
if x.im < -1.0000000000000001e130 or 1.9500000000000001e44 < x.im Initial program 64.8%
add-cube-cbrt64.7%
pow364.7%
*-commutative64.7%
difference-of-squares74.9%
associate-*r*74.9%
Applied egg-rr74.9%
unpow374.9%
add-cube-cbrt75.0%
*-commutative75.0%
+-commutative75.0%
Applied egg-rr75.0%
*-commutative75.0%
flip-+0.0%
div-sub0.0%
pow20.0%
*-commutative0.0%
*-commutative0.0%
*-commutative0.0%
pow20.0%
*-commutative0.0%
*-commutative0.0%
*-commutative0.0%
Applied egg-rr0.0%
+-inverses100.0%
Simplified100.0%
if -1.0000000000000001e130 < x.im < 1.9500000000000001e44Initial program 90.2%
add-cube-cbrt89.8%
pow389.8%
*-commutative89.8%
difference-of-squares89.8%
associate-*r*99.2%
Applied egg-rr99.2%
unpow399.1%
add-cube-cbrt99.6%
*-commutative99.6%
+-commutative99.6%
Applied egg-rr99.6%
*-commutative99.6%
distribute-lft-out99.6%
Applied egg-rr99.6%
Final simplification99.8%
(FPCore (x.re x.im) :precision binary64 (if (or (<= x.im -1.9e-101) (not (<= x.im 1.4e-29))) (+ (* (- x.re x.im) (* x.im (+ x.re x.im))) (* x.re 0.0)) (* (* x.re x.re) (* x.im 3.0))))
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -1.9e-101) || !(x_46_im <= 1.4e-29)) {
tmp = ((x_46_re - x_46_im) * (x_46_im * (x_46_re + x_46_im))) + (x_46_re * 0.0);
} 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 <= (-1.9d-101)) .or. (.not. (x_46im <= 1.4d-29))) then
tmp = ((x_46re - x_46im) * (x_46im * (x_46re + x_46im))) + (x_46re * 0.0d0)
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 <= -1.9e-101) || !(x_46_im <= 1.4e-29)) {
tmp = ((x_46_re - x_46_im) * (x_46_im * (x_46_re + x_46_im))) + (x_46_re * 0.0);
} 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 <= -1.9e-101) or not (x_46_im <= 1.4e-29): tmp = ((x_46_re - x_46_im) * (x_46_im * (x_46_re + x_46_im))) + (x_46_re * 0.0) 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 <= -1.9e-101) || !(x_46_im <= 1.4e-29)) tmp = Float64(Float64(Float64(x_46_re - x_46_im) * Float64(x_46_im * Float64(x_46_re + x_46_im))) + Float64(x_46_re * 0.0)); else tmp = Float64(Float64(x_46_re * x_46_re) * Float64(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 <= -1.9e-101) || ~((x_46_im <= 1.4e-29))) tmp = ((x_46_re - x_46_im) * (x_46_im * (x_46_re + x_46_im))) + (x_46_re * 0.0); 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, -1.9e-101], N[Not[LessEqual[x$46$im, 1.4e-29]], $MachinePrecision]], N[(N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$im * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x$46$re * 0.0), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$re * x$46$re), $MachinePrecision] * N[(x$46$im * 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -1.9 \cdot 10^{-101} \lor \neg \left(x.im \leq 1.4 \cdot 10^{-29}\right):\\
\;\;\;\;\left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.re + x.im\right)\right) + x.re \cdot 0\\
\mathbf{else}:\\
\;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.im \cdot 3\right)\\
\end{array}
\end{array}
if x.im < -1.90000000000000005e-101 or 1.4000000000000001e-29 < x.im Initial program 75.4%
add-cube-cbrt75.0%
pow375.1%
*-commutative75.1%
difference-of-squares82.0%
associate-*r*82.6%
Applied egg-rr82.6%
unpow382.5%
add-cube-cbrt82.9%
*-commutative82.9%
+-commutative82.9%
Applied egg-rr82.9%
*-commutative82.9%
flip-+0.0%
div-sub0.0%
pow20.0%
*-commutative0.0%
*-commutative0.0%
*-commutative0.0%
pow20.0%
*-commutative0.0%
*-commutative0.0%
*-commutative0.0%
Applied egg-rr0.0%
+-inverses93.8%
Simplified93.8%
if -1.90000000000000005e-101 < x.im < 1.4000000000000001e-29Initial program 86.2%
Taylor expanded in x.re around inf 82.1%
Simplified82.1%
Taylor expanded in x.re around 0 82.2%
unpow282.2%
distribute-rgt1-in82.2%
metadata-eval82.2%
Simplified82.2%
Final simplification89.4%
(FPCore (x.re x.im) :precision binary64 (* 2.0 (* x.re (* x.re x.im))))
double code(double x_46_re, double x_46_im) {
return 2.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 = 2.0d0 * (x_46re * (x_46re * x_46im))
end function
public static double code(double x_46_re, double x_46_im) {
return 2.0 * (x_46_re * (x_46_re * x_46_im));
}
def code(x_46_re, x_46_im): return 2.0 * (x_46_re * (x_46_re * x_46_im))
function code(x_46_re, x_46_im) return Float64(2.0 * Float64(x_46_re * Float64(x_46_re * x_46_im))) end
function tmp = code(x_46_re, x_46_im) tmp = 2.0 * (x_46_re * (x_46_re * x_46_im)); end
code[x$46$re_, x$46$im_] := N[(2.0 * N[(x$46$re * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(x.re \cdot \left(x.re \cdot x.im\right)\right)
\end{array}
Initial program 79.5%
add-cube-cbrt79.2%
pow379.2%
*-commutative79.2%
difference-of-squares83.5%
associate-*r*88.9%
Applied egg-rr88.9%
Taylor expanded in x.im around 0 31.0%
*-commutative31.0%
unpow231.0%
associate-*r*31.8%
Simplified31.8%
Final simplification31.8%
(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 79.5%
Taylor expanded in x.re around inf 48.1%
Simplified48.1%
Taylor expanded in x.im around 0 48.1%
*-commutative48.1%
distribute-lft1-in48.1%
metadata-eval48.1%
unpow248.1%
Simplified48.1%
Final simplification48.1%
(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(Float64(x_46_re * x_46_re) * Float64(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[(N[(x$46$re * x$46$re), $MachinePrecision] * N[(x$46$im * 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.re\right) \cdot \left(x.im \cdot 3\right)
\end{array}
Initial program 79.5%
Taylor expanded in x.re around inf 48.1%
Simplified48.1%
Taylor expanded in x.re around 0 48.1%
unpow248.1%
distribute-rgt1-in48.1%
metadata-eval48.1%
Simplified48.1%
Final simplification48.1%
(FPCore (x.re x.im) :precision binary64 (* (* x.re x.re) x.im))
double code(double x_46_re, double x_46_im) {
return (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 = (x_46re * 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;
}
def code(x_46_re, x_46_im): return (x_46_re * x_46_re) * x_46_im
function code(x_46_re, x_46_im) return Float64(Float64(x_46_re * 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; end
code[x$46$re_, x$46$im_] := N[(N[(x$46$re * x$46$re), $MachinePrecision] * x$46$im), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.re\right) \cdot x.im
\end{array}
Initial program 79.5%
*-commutative79.5%
*-commutative79.5%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+60.0%
distribute-lft-in60.0%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+53.0%
Applied egg-rr53.0%
Taylor expanded in x.re around inf 30.5%
*-commutative30.5%
unpow230.5%
Simplified30.5%
Final simplification30.5%
(FPCore (x.re x.im) :precision binary64 (* x.re (* x.re x.im)))
double code(double x_46_re, double x_46_im) {
return 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 = x_46re * (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);
}
def code(x_46_re, x_46_im): return x_46_re * (x_46_re * x_46_im)
function code(x_46_re, x_46_im) return Float64(x_46_re * Float64(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); end
code[x$46$re_, x$46$im_] := N[(x$46$re * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x.re \cdot \left(x.re \cdot x.im\right)
\end{array}
Initial program 79.5%
*-commutative79.5%
*-commutative79.5%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+60.0%
distribute-lft-in60.0%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+53.0%
Applied egg-rr53.0%
Taylor expanded in x.re around inf 30.5%
*-commutative30.5%
unpow230.5%
associate-*r*31.2%
Simplified31.2%
Final simplification31.2%
(FPCore (x.re x.im) :precision binary64 -10.0)
double code(double x_46_re, double x_46_im) {
return -10.0;
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = -10.0d0
end function
public static double code(double x_46_re, double x_46_im) {
return -10.0;
}
def code(x_46_re, x_46_im): return -10.0
function code(x_46_re, x_46_im) return -10.0 end
function tmp = code(x_46_re, x_46_im) tmp = -10.0; end
code[x$46$re_, x$46$im_] := -10.0
\begin{array}{l}
\\
-10
\end{array}
Initial program 79.5%
+-commutative79.5%
*-commutative79.5%
sub-neg79.5%
distribute-lft-in76.8%
associate-+r+76.8%
distribute-rgt-neg-out76.8%
unsub-neg76.8%
associate-*r*82.2%
distribute-rgt-out82.2%
*-commutative82.2%
count-282.2%
distribute-lft1-in82.2%
metadata-eval82.2%
*-commutative82.2%
*-commutative82.2%
associate-*r*81.8%
cube-unmult81.8%
Simplified81.8%
associate-*r*82.3%
associate-*l*82.2%
flip--19.6%
div-inv18.3%
swap-sqr18.2%
pow218.2%
metadata-eval18.2%
pow-prod-up18.2%
metadata-eval18.2%
associate-*l*18.2%
associate-*r*18.2%
fma-def18.2%
Applied egg-rr18.2%
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 2023196
(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)))