
(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 12 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 (<=
(+
(* x.im (- (* x.re x.re) (* x.im x.im)))
(* x.re (+ (* x.re x.im) (* x.re x.im))))
INFINITY)
(- (* x.re (* x.re (* x.im 3.0))) (pow 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 * ((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 = (x_46_re * (x_46_re * (x_46_im * 3.0))) - pow(x_46_im, 3.0);
} else {
tmp = -pow(x_46_im, 3.0);
}
return tmp;
}
public static 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.POSITIVE_INFINITY) {
tmp = (x_46_re * (x_46_re * (x_46_im * 3.0))) - Math.pow(x_46_im, 3.0);
} else {
tmp = -Math.pow(x_46_im, 3.0);
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 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)))) <= math.inf: tmp = (x_46_re * (x_46_re * (x_46_im * 3.0))) - math.pow(x_46_im, 3.0) else: tmp = -math.pow(x_46_im, 3.0) 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 = Float64(Float64(x_46_re * Float64(x_46_re * Float64(x_46_im * 3.0))) - (x_46_im ^ 3.0)); else tmp = 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 * ((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)))) <= Inf) tmp = (x_46_re * (x_46_re * (x_46_im * 3.0))) - (x_46_im ^ 3.0); else tmp = -(x_46_im ^ 3.0); end tmp_2 = 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 * N[(x$46$re * N[(x$46$im * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[x$46$im, 3.0], $MachinePrecision]), $MachinePrecision], (-N[Power[x$46$im, 3.0], $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:\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(x.im \cdot 3\right)\right) - {x.im}^{3}\\
\mathbf{else}:\\
\;\;\;\;-{x.im}^{3}\\
\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.7%
+-commutative93.7%
*-commutative93.7%
sub-neg93.7%
distribute-lft-in91.5%
associate-+r+91.5%
distribute-rgt-neg-out91.5%
unsub-neg91.5%
associate-*r*97.6%
distribute-rgt-out97.6%
*-commutative97.6%
count-297.6%
distribute-lft1-in97.6%
metadata-eval97.6%
*-commutative97.6%
*-commutative97.6%
associate-*r*97.6%
cube-unmult97.7%
Simplified97.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%
*-commutative0.0%
*-commutative0.0%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+42.3%
distribute-lft-in42.3%
Applied egg-rr42.3%
*-commutative42.3%
distribute-rgt-out42.3%
distribute-lft-out53.8%
Applied egg-rr53.8%
Taylor expanded in x.im around inf 73.1%
mul-1-neg73.1%
Simplified73.1%
Final simplification95.2%
(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)
(- (* x.re (* (* x.re x.im) 3.0)) (pow 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 * ((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 = (x_46_re * ((x_46_re * x_46_im) * 3.0)) - pow(x_46_im, 3.0);
} else {
tmp = -pow(x_46_im, 3.0);
}
return tmp;
}
public static 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.POSITIVE_INFINITY) {
tmp = (x_46_re * ((x_46_re * x_46_im) * 3.0)) - Math.pow(x_46_im, 3.0);
} else {
tmp = -Math.pow(x_46_im, 3.0);
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 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)))) <= math.inf: tmp = (x_46_re * ((x_46_re * x_46_im) * 3.0)) - math.pow(x_46_im, 3.0) else: tmp = -math.pow(x_46_im, 3.0) 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 = Float64(Float64(x_46_re * Float64(Float64(x_46_re * x_46_im) * 3.0)) - (x_46_im ^ 3.0)); else tmp = 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 * ((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)))) <= Inf) tmp = (x_46_re * ((x_46_re * x_46_im) * 3.0)) - (x_46_im ^ 3.0); else tmp = -(x_46_im ^ 3.0); end tmp_2 = 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 * N[(N[(x$46$re * x$46$im), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision] - N[Power[x$46$im, 3.0], $MachinePrecision]), $MachinePrecision], (-N[Power[x$46$im, 3.0], $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:\\
\;\;\;\;x.re \cdot \left(\left(x.re \cdot x.im\right) \cdot 3\right) - {x.im}^{3}\\
\mathbf{else}:\\
\;\;\;\;-{x.im}^{3}\\
\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.7%
+-commutative93.7%
*-commutative93.7%
sub-neg93.7%
distribute-lft-in91.5%
associate-+r+91.5%
distribute-rgt-neg-out91.5%
unsub-neg91.5%
associate-*r*97.6%
distribute-rgt-out97.6%
*-commutative97.6%
count-297.6%
distribute-lft1-in97.6%
metadata-eval97.6%
*-commutative97.6%
*-commutative97.6%
associate-*r*97.6%
cube-unmult97.7%
Simplified97.7%
Taylor expanded in x.re around 0 97.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%
*-commutative0.0%
*-commutative0.0%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+42.3%
distribute-lft-in42.3%
Applied egg-rr42.3%
*-commutative42.3%
distribute-rgt-out42.3%
distribute-lft-out53.8%
Applied egg-rr53.8%
Taylor expanded in x.im around inf 73.1%
mul-1-neg73.1%
Simplified73.1%
Final simplification95.2%
(FPCore (x.re x.im)
:precision binary64
(if (<= x.re 7e+93)
(+
(* x.im (- (* x.re x.re) (* x.im x.im)))
(* x.re (+ (* 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_re <= 7e+93) {
tmp = (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)));
} 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_46re <= 7d+93) then
tmp = (x_46im * ((x_46re * x_46re) - (x_46im * x_46im))) + (x_46re * ((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_re <= 7e+93) {
tmp = (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)));
} 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_re <= 7e+93: tmp = (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))) 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_re <= 7e+93) tmp = 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)))); else tmp = Float64(x_46_re * Float64(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_re <= 7e+93) tmp = (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))); 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[LessEqual[x$46$re, 7e+93], 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], N[(x$46$re * N[(x$46$re * N[(x$46$im * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq 7 \cdot 10^{+93}:\\
\;\;\;\;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)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(x.im \cdot 3\right)\right)\\
\end{array}
\end{array}
if x.re < 6.99999999999999996e93Initial program 88.6%
if 6.99999999999999996e93 < x.re Initial program 57.9%
Taylor expanded in x.im around 0 65.9%
distribute-lft1-in65.9%
metadata-eval65.9%
*-commutative65.9%
pow265.9%
Applied egg-rr65.9%
add-log-exp43.0%
*-un-lft-identity43.0%
log-prod43.0%
metadata-eval43.0%
add-log-exp65.9%
associate-*l*66.1%
associate-*l*80.9%
*-commutative80.9%
Applied egg-rr80.9%
Final simplification87.5%
(FPCore (x.re x.im) :precision binary64 (if (or (<= x.im -1.9e-56) (not (<= x.im 9.5e-68))) (* x.im (+ (- (* x.re x.re) (* x.im x.im)) (+ x.re x.re))) (* 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-56) || !(x_46_im <= 9.5e-68)) {
tmp = x_46_im * (((x_46_re * x_46_re) - (x_46_im * x_46_im)) + (x_46_re + x_46_re));
} 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-56)) .or. (.not. (x_46im <= 9.5d-68))) then
tmp = x_46im * (((x_46re * x_46re) - (x_46im * x_46im)) + (x_46re + x_46re))
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-56) || !(x_46_im <= 9.5e-68)) {
tmp = x_46_im * (((x_46_re * x_46_re) - (x_46_im * x_46_im)) + (x_46_re + x_46_re));
} 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-56) or not (x_46_im <= 9.5e-68): tmp = x_46_im * (((x_46_re * x_46_re) - (x_46_im * x_46_im)) + (x_46_re + x_46_re)) 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-56) || !(x_46_im <= 9.5e-68)) tmp = Float64(x_46_im * Float64(Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im)) + Float64(x_46_re + x_46_re))); else tmp = Float64(x_46_re * Float64(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-56) || ~((x_46_im <= 9.5e-68))) tmp = x_46_im * (((x_46_re * x_46_re) - (x_46_im * x_46_im)) + (x_46_re + x_46_re)); 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-56], N[Not[LessEqual[x$46$im, 9.5e-68]], $MachinePrecision]], N[(x$46$im * N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] + N[(x$46$re + x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$re * N[(x$46$re * N[(x$46$im * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -1.9 \cdot 10^{-56} \lor \neg \left(x.im \leq 9.5 \cdot 10^{-68}\right):\\
\;\;\;\;x.im \cdot \left(\left(x.re \cdot x.re - x.im \cdot x.im\right) + \left(x.re + x.re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(x.im \cdot 3\right)\right)\\
\end{array}
\end{array}
if x.im < -1.9000000000000001e-56 or 9.4999999999999997e-68 < x.im Initial program 83.7%
*-commutative83.7%
*-commutative83.7%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+81.1%
distribute-lft-in81.1%
Applied egg-rr81.1%
*-commutative81.1%
distribute-rgt-out81.1%
distribute-lft-out84.8%
Applied egg-rr84.8%
if -1.9000000000000001e-56 < x.im < 9.4999999999999997e-68Initial program 85.0%
Taylor expanded in x.im around 0 79.7%
distribute-lft1-in79.7%
metadata-eval79.7%
*-commutative79.7%
pow279.7%
Applied egg-rr79.7%
add-log-exp42.7%
*-un-lft-identity42.7%
log-prod42.7%
metadata-eval42.7%
add-log-exp79.7%
associate-*l*79.7%
associate-*l*94.4%
*-commutative94.4%
Applied egg-rr94.4%
Final simplification88.4%
(FPCore (x.re x.im) :precision binary64 (if (or (<= x.im -4.3e+186) (not (<= x.im 1e+152))) (* x.re (* x.re (- x.im))) (* 3.0 (* (* x.re x.re) x.im))))
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -4.3e+186) || !(x_46_im <= 1e+152)) {
tmp = x_46_re * (x_46_re * -x_46_im);
} else {
tmp = 3.0 * ((x_46_re * 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 <= (-4.3d+186)) .or. (.not. (x_46im <= 1d+152))) then
tmp = x_46re * (x_46re * -x_46im)
else
tmp = 3.0d0 * ((x_46re * 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 <= -4.3e+186) || !(x_46_im <= 1e+152)) {
tmp = x_46_re * (x_46_re * -x_46_im);
} else {
tmp = 3.0 * ((x_46_re * x_46_re) * x_46_im);
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 if (x_46_im <= -4.3e+186) or not (x_46_im <= 1e+152): tmp = x_46_re * (x_46_re * -x_46_im) else: tmp = 3.0 * ((x_46_re * x_46_re) * x_46_im) return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_im <= -4.3e+186) || !(x_46_im <= 1e+152)) tmp = Float64(x_46_re * Float64(x_46_re * Float64(-x_46_im))); else tmp = Float64(3.0 * Float64(Float64(x_46_re * 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 <= -4.3e+186) || ~((x_46_im <= 1e+152))) tmp = x_46_re * (x_46_re * -x_46_im); else tmp = 3.0 * ((x_46_re * x_46_re) * x_46_im); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -4.3e+186], N[Not[LessEqual[x$46$im, 1e+152]], $MachinePrecision]], N[(x$46$re * N[(x$46$re * (-x$46$im)), $MachinePrecision]), $MachinePrecision], N[(3.0 * N[(N[(x$46$re * x$46$re), $MachinePrecision] * x$46$im), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -4.3 \cdot 10^{+186} \lor \neg \left(x.im \leq 10^{+152}\right):\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(-x.im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;3 \cdot \left(\left(x.re \cdot x.re\right) \cdot x.im\right)\\
\end{array}
\end{array}
if x.im < -4.3e186 or 1e152 < x.im Initial program 65.0%
Taylor expanded in x.im around 0 7.2%
Taylor expanded in x.re around 0 7.2%
Simplified30.8%
Taylor expanded in x.re around 0 30.8%
mul-1-neg30.8%
distribute-rgt-neg-in30.8%
unpow230.8%
associate-*l*30.9%
Simplified30.9%
if -4.3e186 < x.im < 1e152Initial program 90.1%
Taylor expanded in x.re around inf 58.6%
Taylor expanded in x.im around 0 58.5%
unpow258.5%
Simplified58.5%
Final simplification52.1%
(FPCore (x.re x.im) :precision binary64 (if (or (<= x.im -7.8e+186) (not (<= x.im 2.3e+147))) (* x.re (* 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 <= -7.8e+186) || !(x_46_im <= 2.3e+147)) {
tmp = x_46_re * (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 <= (-7.8d+186)) .or. (.not. (x_46im <= 2.3d+147))) then
tmp = x_46re * (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 <= -7.8e+186) || !(x_46_im <= 2.3e+147)) {
tmp = x_46_re * (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 <= -7.8e+186) or not (x_46_im <= 2.3e+147): tmp = x_46_re * (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 <= -7.8e+186) || !(x_46_im <= 2.3e+147)) tmp = Float64(x_46_re * Float64(x_46_re * Float64(-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 <= -7.8e+186) || ~((x_46_im <= 2.3e+147))) tmp = x_46_re * (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, -7.8e+186], N[Not[LessEqual[x$46$im, 2.3e+147]], $MachinePrecision]], N[(x$46$re * N[(x$46$re * (-x$46$im)), $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 -7.8 \cdot 10^{+186} \lor \neg \left(x.im \leq 2.3 \cdot 10^{+147}\right):\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(-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 < -7.8000000000000002e186 or 2.2999999999999999e147 < x.im Initial program 65.0%
Taylor expanded in x.im around 0 7.2%
Taylor expanded in x.re around 0 7.2%
Simplified30.8%
Taylor expanded in x.re around 0 30.8%
mul-1-neg30.8%
distribute-rgt-neg-in30.8%
unpow230.8%
associate-*l*30.9%
Simplified30.9%
if -7.8000000000000002e186 < x.im < 2.2999999999999999e147Initial program 90.1%
Taylor expanded in x.re around inf 58.6%
Taylor expanded in x.im around 0 58.5%
unpow258.5%
associate-*l*65.7%
associate-*r*65.6%
*-commutative65.6%
associate-*l*65.7%
Simplified65.7%
Final simplification57.5%
(FPCore (x.re x.im) :precision binary64 (if (or (<= x.im -3.2e+187) (not (<= x.im 1e+152))) (* x.re (* 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 <= -3.2e+187) || !(x_46_im <= 1e+152)) {
tmp = x_46_re * (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 <= (-3.2d+187)) .or. (.not. (x_46im <= 1d+152))) then
tmp = x_46re * (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 <= -3.2e+187) || !(x_46_im <= 1e+152)) {
tmp = x_46_re * (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 <= -3.2e+187) or not (x_46_im <= 1e+152): tmp = x_46_re * (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 <= -3.2e+187) || !(x_46_im <= 1e+152)) tmp = Float64(x_46_re * Float64(x_46_re * Float64(-x_46_im))); else tmp = Float64(x_46_re * Float64(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 <= -3.2e+187) || ~((x_46_im <= 1e+152))) tmp = x_46_re * (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, -3.2e+187], N[Not[LessEqual[x$46$im, 1e+152]], $MachinePrecision]], N[(x$46$re * N[(x$46$re * (-x$46$im)), $MachinePrecision]), $MachinePrecision], N[(x$46$re * N[(x$46$re * N[(x$46$im * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -3.2 \cdot 10^{+187} \lor \neg \left(x.im \leq 10^{+152}\right):\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(-x.im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(x.im \cdot 3\right)\right)\\
\end{array}
\end{array}
if x.im < -3.19999999999999993e187 or 1e152 < x.im Initial program 65.0%
Taylor expanded in x.im around 0 7.2%
Taylor expanded in x.re around 0 7.2%
Simplified30.8%
Taylor expanded in x.re around 0 30.8%
mul-1-neg30.8%
distribute-rgt-neg-in30.8%
unpow230.8%
associate-*l*30.9%
Simplified30.9%
if -3.19999999999999993e187 < x.im < 1e152Initial program 90.1%
Taylor expanded in x.im around 0 58.5%
distribute-lft1-in58.5%
metadata-eval58.5%
*-commutative58.5%
pow258.5%
Applied egg-rr58.5%
add-log-exp34.9%
*-un-lft-identity34.9%
log-prod34.9%
metadata-eval34.9%
add-log-exp58.5%
associate-*l*58.6%
associate-*l*65.7%
*-commutative65.7%
Applied egg-rr65.7%
Final simplification57.5%
(FPCore (x.re x.im) :precision binary64 (if (or (<= x.im -1.65e+186) (not (<= x.im 9.2e+151))) (* x.re (* x.re (- x.im))) (* x.re (* x.re x.im))))
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -1.65e+186) || !(x_46_im <= 9.2e+151)) {
tmp = x_46_re * (x_46_re * -x_46_im);
} else {
tmp = x_46_re * (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.65d+186)) .or. (.not. (x_46im <= 9.2d+151))) then
tmp = x_46re * (x_46re * -x_46im)
else
tmp = x_46re * (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.65e+186) || !(x_46_im <= 9.2e+151)) {
tmp = x_46_re * (x_46_re * -x_46_im);
} else {
tmp = x_46_re * (x_46_re * x_46_im);
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 if (x_46_im <= -1.65e+186) or not (x_46_im <= 9.2e+151): tmp = x_46_re * (x_46_re * -x_46_im) else: tmp = x_46_re * (x_46_re * x_46_im) return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_im <= -1.65e+186) || !(x_46_im <= 9.2e+151)) tmp = Float64(x_46_re * Float64(x_46_re * Float64(-x_46_im))); else tmp = Float64(x_46_re * 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.65e+186) || ~((x_46_im <= 9.2e+151))) tmp = x_46_re * (x_46_re * -x_46_im); else tmp = x_46_re * (x_46_re * x_46_im); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -1.65e+186], N[Not[LessEqual[x$46$im, 9.2e+151]], $MachinePrecision]], N[(x$46$re * N[(x$46$re * (-x$46$im)), $MachinePrecision]), $MachinePrecision], N[(x$46$re * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -1.65 \cdot 10^{+186} \lor \neg \left(x.im \leq 9.2 \cdot 10^{+151}\right):\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(-x.im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.im\right)\\
\end{array}
\end{array}
if x.im < -1.65000000000000012e186 or 9.2000000000000003e151 < x.im Initial program 65.0%
Taylor expanded in x.im around 0 7.2%
Taylor expanded in x.re around 0 7.2%
Simplified30.8%
Taylor expanded in x.re around 0 30.8%
mul-1-neg30.8%
distribute-rgt-neg-in30.8%
unpow230.8%
associate-*l*30.9%
Simplified30.9%
if -1.65000000000000012e186 < x.im < 9.2000000000000003e151Initial program 90.1%
*-commutative90.1%
*-commutative90.1%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+63.6%
distribute-lft-in63.6%
Applied egg-rr63.6%
*-commutative63.6%
distribute-rgt-out63.6%
distribute-lft-out65.1%
Applied egg-rr65.1%
Taylor expanded in x.re around inf 37.7%
unpow237.7%
associate-*l*38.6%
Simplified38.6%
Final simplification36.8%
(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 84.2%
*-commutative84.2%
*-commutative84.2%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+67.4%
distribute-lft-in67.4%
Applied egg-rr67.4%
*-commutative67.4%
distribute-rgt-out67.4%
distribute-lft-out69.8%
Applied egg-rr69.8%
Taylor expanded in x.re around inf 30.6%
unpow230.6%
associate-*l*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 84.2%
+-commutative84.2%
*-commutative84.2%
sub-neg84.2%
distribute-lft-in82.2%
associate-+r+82.2%
distribute-rgt-neg-out82.2%
unsub-neg82.2%
associate-*r*87.6%
distribute-rgt-out87.7%
*-commutative87.7%
count-287.7%
distribute-lft1-in87.7%
metadata-eval87.7%
*-commutative87.7%
*-commutative87.7%
associate-*r*87.7%
cube-unmult87.8%
Simplified87.8%
associate-*r*87.8%
associate-*l*87.7%
flip--24.4%
div-inv24.2%
swap-sqr24.2%
pow224.2%
metadata-eval24.2%
pow-prod-up24.1%
metadata-eval24.1%
associate-*l*24.1%
associate-*r*24.1%
fma-def24.1%
Applied egg-rr24.1%
Simplified2.7%
Final simplification2.7%
(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 84.2%
Taylor expanded in x.re around 0 60.8%
Simplified2.7%
Final simplification2.7%
(FPCore (x.re x.im) :precision binary64 0.0)
double code(double x_46_re, double x_46_im) {
return 0.0;
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = 0.0d0
end function
public static double code(double x_46_re, double x_46_im) {
return 0.0;
}
def code(x_46_re, x_46_im): return 0.0
function code(x_46_re, x_46_im) return 0.0 end
function tmp = code(x_46_re, x_46_im) tmp = 0.0; end
code[x$46$re_, x$46$im_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 84.2%
*-commutative84.2%
*-commutative84.2%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+67.4%
distribute-lft-in67.4%
Applied egg-rr67.4%
*-commutative67.4%
distribute-rgt-out67.4%
distribute-lft-out69.8%
Applied egg-rr69.8%
Applied egg-rr14.1%
+-inverses14.1%
Simplified14.1%
Final simplification14.1%
(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 2023240
(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)))