
(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 11 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 (or (<= x.im -8.2e+105) (not (<= x.im 2e+102))) (* x.im (* (- x.re x.im) (+ x.im x.re))) (- (* x.re (* x.re (* 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 <= -8.2e+105) || !(x_46_im <= 2e+102)) {
tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re));
} else {
tmp = (x_46_re * (x_46_re * (x_46_im * 3.0))) - pow(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 <= (-8.2d+105)) .or. (.not. (x_46im <= 2d+102))) then
tmp = x_46im * ((x_46re - x_46im) * (x_46im + x_46re))
else
tmp = (x_46re * (x_46re * (x_46im * 3.0d0))) - (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 <= -8.2e+105) || !(x_46_im <= 2e+102)) {
tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re));
} else {
tmp = (x_46_re * (x_46_re * (x_46_im * 3.0))) - Math.pow(x_46_im, 3.0);
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 if (x_46_im <= -8.2e+105) or not (x_46_im <= 2e+102): tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re)) else: tmp = (x_46_re * (x_46_re * (x_46_im * 3.0))) - math.pow(x_46_im, 3.0) return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_im <= -8.2e+105) || !(x_46_im <= 2e+102)) tmp = Float64(x_46_im * Float64(Float64(x_46_re - x_46_im) * Float64(x_46_im + x_46_re))); else tmp = Float64(Float64(x_46_re * Float64(x_46_re * Float64(x_46_im * 3.0))) - (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 <= -8.2e+105) || ~((x_46_im <= 2e+102))) tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re)); else tmp = (x_46_re * (x_46_re * (x_46_im * 3.0))) - (x_46_im ^ 3.0); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -8.2e+105], N[Not[LessEqual[x$46$im, 2e+102]], $MachinePrecision]], N[(x$46$im * N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$im + x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -8.2 \cdot 10^{+105} \lor \neg \left(x.im \leq 2 \cdot 10^{+102}\right):\\
\;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.im + x.re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(x.im \cdot 3\right)\right) - {x.im}^{3}\\
\end{array}
\end{array}
if x.im < -8.2000000000000005e105 or 1.99999999999999995e102 < x.im Initial program 75.0%
*-commutative75.0%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+78.4%
*-commutative78.4%
distribute-lft-in78.4%
Applied egg-rr78.4%
+-commutative78.4%
add-cube-cbrt78.4%
fma-def78.4%
Applied egg-rr0.0%
Simplified85.2%
difference-of-squares100.0%
*-commutative100.0%
Applied egg-rr100.0%
if -8.2000000000000005e105 < x.im < 1.99999999999999995e102Initial program 95.9%
+-commutative95.9%
*-commutative95.9%
sub-neg95.9%
distribute-lft-in95.8%
associate-+r+95.8%
distribute-rgt-neg-out95.8%
unsub-neg95.8%
associate-*r*99.7%
distribute-rgt-out99.7%
*-commutative99.7%
count-299.7%
distribute-lft1-in99.7%
metadata-eval99.7%
*-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
cube-unmult99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (x.re x.im) :precision binary64 (if (or (<= x.im -8.2e+105) (not (<= x.im 4e+83))) (* x.im (* (- x.re x.im) (+ x.im x.re))) (- (* x.re (* 3.0 (* x.im x.re))) (pow x.im 3.0))))
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -8.2e+105) || !(x_46_im <= 4e+83)) {
tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re));
} else {
tmp = (x_46_re * (3.0 * (x_46_im * x_46_re))) - pow(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 <= (-8.2d+105)) .or. (.not. (x_46im <= 4d+83))) then
tmp = x_46im * ((x_46re - x_46im) * (x_46im + x_46re))
else
tmp = (x_46re * (3.0d0 * (x_46im * 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 <= -8.2e+105) || !(x_46_im <= 4e+83)) {
tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re));
} else {
tmp = (x_46_re * (3.0 * (x_46_im * x_46_re))) - Math.pow(x_46_im, 3.0);
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 if (x_46_im <= -8.2e+105) or not (x_46_im <= 4e+83): tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re)) else: tmp = (x_46_re * (3.0 * (x_46_im * x_46_re))) - math.pow(x_46_im, 3.0) return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_im <= -8.2e+105) || !(x_46_im <= 4e+83)) tmp = Float64(x_46_im * Float64(Float64(x_46_re - x_46_im) * Float64(x_46_im + x_46_re))); else tmp = Float64(Float64(x_46_re * Float64(3.0 * Float64(x_46_im * 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 <= -8.2e+105) || ~((x_46_im <= 4e+83))) tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re)); else tmp = (x_46_re * (3.0 * (x_46_im * 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, -8.2e+105], N[Not[LessEqual[x$46$im, 4e+83]], $MachinePrecision]], N[(x$46$im * N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$im + x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$re * N[(3.0 * N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[x$46$im, 3.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -8.2 \cdot 10^{+105} \lor \neg \left(x.im \leq 4 \cdot 10^{+83}\right):\\
\;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.im + x.re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(3 \cdot \left(x.im \cdot x.re\right)\right) - {x.im}^{3}\\
\end{array}
\end{array}
if x.im < -8.2000000000000005e105 or 4.00000000000000012e83 < x.im Initial program 75.0%
*-commutative75.0%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+78.4%
*-commutative78.4%
distribute-lft-in78.4%
Applied egg-rr78.4%
+-commutative78.4%
add-cube-cbrt78.4%
fma-def78.4%
Applied egg-rr0.0%
Simplified85.2%
difference-of-squares100.0%
*-commutative100.0%
Applied egg-rr100.0%
if -8.2000000000000005e105 < x.im < 4.00000000000000012e83Initial program 95.9%
+-commutative95.9%
*-commutative95.9%
sub-neg95.9%
distribute-lft-in95.8%
associate-+r+95.8%
distribute-rgt-neg-out95.8%
unsub-neg95.8%
associate-*r*99.7%
distribute-rgt-out99.7%
*-commutative99.7%
count-299.7%
distribute-lft1-in99.7%
metadata-eval99.7%
*-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
cube-unmult99.8%
Simplified99.8%
Taylor expanded in x.re around 0 99.8%
Final simplification99.9%
(FPCore (x.re x.im)
:precision binary64
(let* ((t_0
(+
(* x.im (- (* x.re x.re) (* x.im x.im)))
(* x.re (+ (* x.im x.re) (* x.im x.re))))))
(if (<= t_0 1e+246)
t_0
(+ (+ x.im x.im) (* (+ x.im x.re) (* x.im (- x.re x.im)))))))
double code(double x_46_re, double x_46_im) {
double t_0 = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_im * x_46_re) + (x_46_im * x_46_re)));
double tmp;
if (t_0 <= 1e+246) {
tmp = t_0;
} else {
tmp = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * (x_46_re - x_46_im)));
}
return tmp;
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8) :: t_0
real(8) :: tmp
t_0 = (x_46im * ((x_46re * x_46re) - (x_46im * x_46im))) + (x_46re * ((x_46im * x_46re) + (x_46im * x_46re)))
if (t_0 <= 1d+246) then
tmp = t_0
else
tmp = (x_46im + x_46im) + ((x_46im + x_46re) * (x_46im * (x_46re - x_46im)))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
double t_0 = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_im * x_46_re) + (x_46_im * x_46_re)));
double tmp;
if (t_0 <= 1e+246) {
tmp = t_0;
} else {
tmp = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * (x_46_re - x_46_im)));
}
return tmp;
}
def code(x_46_re, x_46_im): t_0 = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_im * x_46_re) + (x_46_im * x_46_re))) tmp = 0 if t_0 <= 1e+246: tmp = t_0 else: tmp = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * (x_46_re - x_46_im))) return tmp
function code(x_46_re, x_46_im) t_0 = 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_im * x_46_re) + Float64(x_46_im * x_46_re)))) tmp = 0.0 if (t_0 <= 1e+246) tmp = t_0; else tmp = Float64(Float64(x_46_im + x_46_im) + Float64(Float64(x_46_im + x_46_re) * Float64(x_46_im * Float64(x_46_re - x_46_im)))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im) t_0 = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_im * x_46_re) + (x_46_im * x_46_re))); tmp = 0.0; if (t_0 <= 1e+246) tmp = t_0; else tmp = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * (x_46_re - x_46_im))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := Block[{t$95$0 = 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$im * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e+246], t$95$0, N[(N[(x$46$im + x$46$im), $MachinePrecision] + N[(N[(x$46$im + x$46$re), $MachinePrecision] * N[(x$46$im * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) + x.re \cdot \left(x.im \cdot x.re + x.im \cdot x.re\right)\\
\mathbf{if}\;t_0 \leq 10^{+246}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left(x.im + x.im\right) + \left(x.im + x.re\right) \cdot \left(x.im \cdot \left(x.re - x.im\right)\right)\\
\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)) < 1.00000000000000007e246Initial program 99.2%
if 1.00000000000000007e246 < (+.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 64.6%
+-commutative64.6%
*-commutative64.6%
fma-def65.9%
*-commutative65.9%
distribute-rgt-out65.9%
*-commutative65.9%
Simplified65.9%
fma-udef64.6%
distribute-lft-in64.6%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+69.7%
distribute-lft-in69.7%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+76.2%
*-commutative76.2%
difference-of-squares92.8%
associate-*l*93.6%
Applied egg-rr93.6%
Final simplification97.5%
(FPCore (x.re x.im) :precision binary64 (if (or (<= x.im -9.5e-66) (not (<= x.im 3.1e-95))) (* x.im (* (- x.re x.im) (+ x.im x.re))) (* x.re (* 3.0 (* x.im x.re)))))
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -9.5e-66) || !(x_46_im <= 3.1e-95)) {
tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re));
} else {
tmp = x_46_re * (3.0 * (x_46_im * x_46_re));
}
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 <= (-9.5d-66)) .or. (.not. (x_46im <= 3.1d-95))) then
tmp = x_46im * ((x_46re - x_46im) * (x_46im + x_46re))
else
tmp = x_46re * (3.0d0 * (x_46im * x_46re))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -9.5e-66) || !(x_46_im <= 3.1e-95)) {
tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re));
} else {
tmp = x_46_re * (3.0 * (x_46_im * x_46_re));
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 if (x_46_im <= -9.5e-66) or not (x_46_im <= 3.1e-95): tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re)) else: tmp = x_46_re * (3.0 * (x_46_im * x_46_re)) return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_im <= -9.5e-66) || !(x_46_im <= 3.1e-95)) tmp = Float64(x_46_im * Float64(Float64(x_46_re - x_46_im) * Float64(x_46_im + x_46_re))); else tmp = Float64(x_46_re * Float64(3.0 * Float64(x_46_im * x_46_re))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if ((x_46_im <= -9.5e-66) || ~((x_46_im <= 3.1e-95))) tmp = x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re)); else tmp = x_46_re * (3.0 * (x_46_im * x_46_re)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -9.5e-66], N[Not[LessEqual[x$46$im, 3.1e-95]], $MachinePrecision]], N[(x$46$im * N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$im + x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$re * N[(3.0 * N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -9.5 \cdot 10^{-66} \lor \neg \left(x.im \leq 3.1 \cdot 10^{-95}\right):\\
\;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.im + x.re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(3 \cdot \left(x.im \cdot x.re\right)\right)\\
\end{array}
\end{array}
if x.im < -9.5000000000000004e-66 or 3.09999999999999992e-95 < x.im Initial program 86.4%
*-commutative86.4%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+76.2%
*-commutative76.2%
distribute-lft-in76.2%
Applied egg-rr76.2%
+-commutative76.2%
add-cube-cbrt76.2%
fma-def76.2%
Applied egg-rr0.0%
Simplified83.2%
difference-of-squares91.1%
*-commutative91.1%
Applied egg-rr91.1%
if -9.5000000000000004e-66 < x.im < 3.09999999999999992e-95Initial program 92.7%
+-commutative92.7%
*-commutative92.7%
sub-neg92.7%
distribute-lft-in92.7%
associate-+r+92.7%
distribute-rgt-neg-out92.7%
unsub-neg92.7%
associate-*r*99.7%
distribute-rgt-out99.8%
*-commutative99.8%
count-299.8%
distribute-lft1-in99.8%
metadata-eval99.8%
*-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
cube-unmult99.8%
Simplified99.8%
Taylor expanded in x.re around 0 99.8%
Taylor expanded in x.re around inf 92.6%
Simplified92.8%
Taylor expanded in x.im around 0 92.6%
Simplified92.6%
Taylor expanded in x.im around 0 92.6%
unpow292.6%
associate-*r*99.7%
*-commutative99.7%
*-commutative99.7%
associate-*r*99.8%
*-commutative99.8%
*-commutative99.8%
Simplified99.8%
Final simplification94.2%
(FPCore (x.re x.im) :precision binary64 (* x.im (* 3.0 (* x.re x.re))))
double code(double x_46_re, double x_46_im) {
return x_46_im * (3.0 * (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_46im * (3.0d0 * (x_46re * x_46re))
end function
public static double code(double x_46_re, double x_46_im) {
return x_46_im * (3.0 * (x_46_re * x_46_re));
}
def code(x_46_re, x_46_im): return x_46_im * (3.0 * (x_46_re * x_46_re))
function code(x_46_re, x_46_im) return Float64(x_46_im * Float64(3.0 * Float64(x_46_re * x_46_re))) end
function tmp = code(x_46_re, x_46_im) tmp = x_46_im * (3.0 * (x_46_re * x_46_re)); end
code[x$46$re_, x$46$im_] := N[(x$46$im * N[(3.0 * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x.im \cdot \left(3 \cdot \left(x.re \cdot x.re\right)\right)
\end{array}
Initial program 88.7%
+-commutative88.7%
*-commutative88.7%
sub-neg88.7%
distribute-lft-in82.4%
associate-+r+82.4%
distribute-rgt-neg-out82.4%
unsub-neg82.4%
associate-*r*84.9%
distribute-rgt-out85.0%
*-commutative85.0%
count-285.0%
distribute-lft1-in85.0%
metadata-eval85.0%
*-commutative85.0%
*-commutative85.0%
associate-*r*85.0%
cube-unmult85.0%
Simplified85.0%
Taylor expanded in x.re around 0 85.0%
Taylor expanded in x.re around inf 56.0%
Simplified56.1%
Taylor expanded in x.im around 0 56.0%
Simplified56.0%
Final simplification56.0%
(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(x_46_re * Float64(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[(x$46$re * N[(x$46$re * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x.im \cdot \left(x.re \cdot \left(x.re \cdot 3\right)\right)
\end{array}
Initial program 88.7%
+-commutative88.7%
*-commutative88.7%
sub-neg88.7%
distribute-lft-in82.4%
associate-+r+82.4%
distribute-rgt-neg-out82.4%
unsub-neg82.4%
associate-*r*84.9%
distribute-rgt-out85.0%
*-commutative85.0%
count-285.0%
distribute-lft1-in85.0%
metadata-eval85.0%
*-commutative85.0%
*-commutative85.0%
associate-*r*85.0%
cube-unmult85.0%
Simplified85.0%
Taylor expanded in x.re around 0 85.0%
Taylor expanded in x.re around inf 56.0%
Simplified56.1%
Final simplification56.1%
(FPCore (x.re x.im) :precision binary64 (* x.re (* 3.0 (* x.im x.re))))
double code(double x_46_re, double x_46_im) {
return x_46_re * (3.0 * (x_46_im * 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 * (3.0d0 * (x_46im * x_46re))
end function
public static double code(double x_46_re, double x_46_im) {
return x_46_re * (3.0 * (x_46_im * x_46_re));
}
def code(x_46_re, x_46_im): return x_46_re * (3.0 * (x_46_im * x_46_re))
function code(x_46_re, x_46_im) return Float64(x_46_re * Float64(3.0 * Float64(x_46_im * x_46_re))) end
function tmp = code(x_46_re, x_46_im) tmp = x_46_re * (3.0 * (x_46_im * x_46_re)); end
code[x$46$re_, x$46$im_] := N[(x$46$re * N[(3.0 * N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x.re \cdot \left(3 \cdot \left(x.im \cdot x.re\right)\right)
\end{array}
Initial program 88.7%
+-commutative88.7%
*-commutative88.7%
sub-neg88.7%
distribute-lft-in82.4%
associate-+r+82.4%
distribute-rgt-neg-out82.4%
unsub-neg82.4%
associate-*r*84.9%
distribute-rgt-out85.0%
*-commutative85.0%
count-285.0%
distribute-lft1-in85.0%
metadata-eval85.0%
*-commutative85.0%
*-commutative85.0%
associate-*r*85.0%
cube-unmult85.0%
Simplified85.0%
Taylor expanded in x.re around 0 85.0%
Taylor expanded in x.re around inf 56.0%
Simplified56.1%
Taylor expanded in x.im around 0 56.0%
Simplified56.0%
Taylor expanded in x.im around 0 56.0%
unpow256.0%
associate-*r*58.5%
*-commutative58.5%
*-commutative58.5%
associate-*r*58.6%
*-commutative58.6%
*-commutative58.6%
Simplified58.6%
Final simplification58.6%
(FPCore (x.re x.im) :precision binary64 (* x.im (* x.re x.re)))
double code(double x_46_re, double x_46_im) {
return 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_46im * (x_46re * x_46re)
end function
public static double code(double x_46_re, double x_46_im) {
return x_46_im * (x_46_re * x_46_re);
}
def code(x_46_re, x_46_im): return x_46_im * (x_46_re * x_46_re)
function code(x_46_re, x_46_im) return Float64(x_46_im * Float64(x_46_re * x_46_re)) end
function tmp = code(x_46_re, x_46_im) tmp = x_46_im * (x_46_re * x_46_re); end
code[x$46$re_, x$46$im_] := N[(x$46$im * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x.im \cdot \left(x.re \cdot x.re\right)
\end{array}
Initial program 88.7%
*-commutative88.7%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+66.8%
*-commutative66.8%
distribute-lft-in66.8%
Applied egg-rr66.8%
Taylor expanded in x.re around inf 39.0%
Simplified39.0%
Final simplification39.0%
(FPCore (x.re x.im) :precision binary64 (* x.re (* x.im x.re)))
double code(double x_46_re, double x_46_im) {
return x_46_re * (x_46_im * 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_46im * x_46re)
end function
public static double code(double x_46_re, double x_46_im) {
return x_46_re * (x_46_im * x_46_re);
}
def code(x_46_re, x_46_im): return x_46_re * (x_46_im * x_46_re)
function code(x_46_re, x_46_im) return Float64(x_46_re * Float64(x_46_im * x_46_re)) end
function tmp = code(x_46_re, x_46_im) tmp = x_46_re * (x_46_im * x_46_re); end
code[x$46$re_, x$46$im_] := N[(x$46$re * N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x.re \cdot \left(x.im \cdot x.re\right)
\end{array}
Initial program 88.7%
*-commutative88.7%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+66.8%
*-commutative66.8%
distribute-lft-in66.8%
Applied egg-rr66.8%
Taylor expanded in x.re around inf 39.0%
Simplified39.0%
Taylor expanded in x.im around 0 39.0%
unpow239.0%
associate-*r*39.3%
Simplified39.3%
Final simplification39.3%
(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 88.7%
Taylor expanded in x.re around 0 56.0%
Simplified2.7%
Final simplification2.7%
(FPCore (x.re x.im) :precision binary64 0.125)
double code(double x_46_re, double x_46_im) {
return 0.125;
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = 0.125d0
end function
public static double code(double x_46_re, double x_46_im) {
return 0.125;
}
def code(x_46_re, x_46_im): return 0.125
function code(x_46_re, x_46_im) return 0.125 end
function tmp = code(x_46_re, x_46_im) tmp = 0.125; end
code[x$46$re_, x$46$im_] := 0.125
\begin{array}{l}
\\
0.125
\end{array}
Initial program 88.7%
+-commutative88.7%
*-commutative88.7%
sub-neg88.7%
distribute-lft-in82.4%
associate-+r+82.4%
distribute-rgt-neg-out82.4%
unsub-neg82.4%
associate-*r*84.9%
distribute-rgt-out85.0%
*-commutative85.0%
count-285.0%
distribute-lft1-in85.0%
metadata-eval85.0%
*-commutative85.0%
*-commutative85.0%
associate-*r*85.0%
cube-unmult85.0%
Simplified85.0%
sub-neg85.0%
flip3-+16.2%
associate-*r*16.2%
unpow-prod-down10.0%
pow210.0%
pow-pow10.0%
metadata-eval10.0%
Applied egg-rr9.9%
Simplified2.9%
Final simplification2.9%
(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 2023189
(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)))