
(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 8 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 -2.8e+122) (not (<= x.im 2e+84))) (* x.im (* (- x.re x.im) (+ x.re x.im))) (- (* 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 <= -2.8e+122) || !(x_46_im <= 2e+84)) {
tmp = x_46_im * ((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))) - 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 <= (-2.8d+122)) .or. (.not. (x_46im <= 2d+84))) then
tmp = x_46im * ((x_46re - x_46im) * (x_46re + x_46im))
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 <= -2.8e+122) || !(x_46_im <= 2e+84)) {
tmp = x_46_im * ((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))) - Math.pow(x_46_im, 3.0);
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 if (x_46_im <= -2.8e+122) or not (x_46_im <= 2e+84): tmp = x_46_im * ((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))) - math.pow(x_46_im, 3.0) return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_im <= -2.8e+122) || !(x_46_im <= 2e+84)) tmp = Float64(x_46_im * Float64(Float64(x_46_re - x_46_im) * Float64(x_46_re + x_46_im))); 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 <= -2.8e+122) || ~((x_46_im <= 2e+84))) tmp = x_46_im * ((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))) - (x_46_im ^ 3.0); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -2.8e+122], N[Not[LessEqual[x$46$im, 2e+84]], $MachinePrecision]], N[(x$46$im * N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$re + x$46$im), $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 -2.8 \cdot 10^{+122} \lor \neg \left(x.im \leq 2 \cdot 10^{+84}\right):\\
\;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\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 < -2.8e122 or 2.00000000000000012e84 < x.im Initial program 56.2%
difference-of-squares70.8%
*-commutative70.8%
Applied egg-rr70.8%
expm1-log1p-u44.9%
expm1-udef44.9%
*-commutative44.9%
*-commutative44.9%
*-un-lft-identity44.9%
*-un-lft-identity44.9%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified98.9%
if -2.8e122 < x.im < 2.00000000000000012e84Initial program 88.0%
+-commutative88.0%
*-commutative88.0%
distribute-lft-out88.0%
associate-*l*87.9%
*-commutative87.9%
distribute-rgt-out87.9%
associate-+r-87.9%
distribute-lft-out--87.9%
Simplified99.7%
Final simplification99.4%
(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))
(* x.im (* (- x.re x.im) (+ x.re x.im)))))
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 = x_46_im * ((x_46_re - x_46_im) * (x_46_re + x_46_im));
}
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 = 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): 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 = 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) 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(Float64(x_46_re * Float64(x_46_re * x_46_im)) * 3.0) - (x_46_im ^ 3.0)); else tmp = Float64(x_46_im * Float64(Float64(x_46_re - x_46_im) * 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 * ((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 * ((x_46_re - x_46_im) * (x_46_re + x_46_im)); 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[(N[(x$46$re * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision] * 3.0), $MachinePrecision] - N[Power[x$46$im, 3.0], $MachinePrecision]), $MachinePrecision], N[(x$46$im * N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $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:\\
\;\;\;\;\left(x.re \cdot \left(x.re \cdot x.im\right)\right) \cdot 3 - {x.im}^{3}\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \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)) < +inf.0Initial program 90.7%
+-commutative90.7%
*-commutative90.7%
distribute-lft-out90.7%
associate-*l*90.7%
*-commutative90.7%
distribute-rgt-out90.7%
associate-+r-90.7%
distribute-lft-out--88.8%
Simplified98.0%
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%
difference-of-squares33.3%
*-commutative33.3%
Applied egg-rr33.3%
expm1-log1p-u10.3%
expm1-udef10.3%
*-commutative10.3%
*-commutative10.3%
*-un-lft-identity10.3%
*-un-lft-identity10.3%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified97.4%
Final simplification97.9%
(FPCore (x.re x.im)
:precision binary64
(let* ((t_0
(+
(* x.im (- (* x.re x.re) (* x.im x.im)))
(* x.re (+ (* x.re x.im) (* x.re x.im))))))
(if (<= t_0 1e+235) t_0 (* 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_re * x_46_im) + (x_46_re * x_46_im)));
double tmp;
if (t_0 <= 1e+235) {
tmp = t_0;
} else {
tmp = 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_46re * x_46im) + (x_46re * x_46im)))
if (t_0 <= 1d+235) then
tmp = t_0
else
tmp = 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_re * x_46_im) + (x_46_re * x_46_im)));
double tmp;
if (t_0 <= 1e+235) {
tmp = t_0;
} else {
tmp = 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_re * x_46_im) + (x_46_re * x_46_im))) tmp = 0 if t_0 <= 1e+235: tmp = t_0 else: tmp = 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_re * x_46_im) + Float64(x_46_re * x_46_im)))) tmp = 0.0 if (t_0 <= 1e+235) tmp = t_0; else tmp = Float64(x_46_im * Float64(Float64(x_46_re - 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_re * x_46_im) + (x_46_re * x_46_im))); tmp = 0.0; if (t_0 <= 1e+235) tmp = t_0; else tmp = 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$re * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e+235], t$95$0, N[(x$46$im * N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$re + x$46$im), $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.re \cdot x.im + x.re \cdot x.im\right)\\
\mathbf{if}\;t_0 \leq 10^{+235}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \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.0000000000000001e235Initial program 93.2%
if 1.0000000000000001e235 < (+.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 44.7%
difference-of-squares59.8%
*-commutative59.8%
Applied egg-rr59.8%
expm1-log1p-u35.4%
expm1-udef35.4%
*-commutative35.4%
*-commutative35.4%
*-un-lft-identity35.4%
*-un-lft-identity35.4%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified88.9%
Final simplification91.8%
(FPCore (x.re x.im)
:precision binary64
(let* ((t_0 (* x.im (* (- x.re x.im) (+ x.re x.im)))))
(if (or (<= x.im -4.6e+166) (not (<= x.im 2e+80)))
t_0
(+ t_0 (* x.re (* (* x.re x.im) 2.0))))))
double code(double x_46_re, double x_46_im) {
double t_0 = x_46_im * ((x_46_re - x_46_im) * (x_46_re + x_46_im));
double tmp;
if ((x_46_im <= -4.6e+166) || !(x_46_im <= 2e+80)) {
tmp = t_0;
} else {
tmp = t_0 + (x_46_re * ((x_46_re * x_46_im) * 2.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) :: t_0
real(8) :: tmp
t_0 = x_46im * ((x_46re - x_46im) * (x_46re + x_46im))
if ((x_46im <= (-4.6d+166)) .or. (.not. (x_46im <= 2d+80))) then
tmp = t_0
else
tmp = t_0 + (x_46re * ((x_46re * x_46im) * 2.0d0))
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_im) * (x_46_re + x_46_im));
double tmp;
if ((x_46_im <= -4.6e+166) || !(x_46_im <= 2e+80)) {
tmp = t_0;
} else {
tmp = t_0 + (x_46_re * ((x_46_re * x_46_im) * 2.0));
}
return tmp;
}
def code(x_46_re, x_46_im): t_0 = x_46_im * ((x_46_re - x_46_im) * (x_46_re + x_46_im)) tmp = 0 if (x_46_im <= -4.6e+166) or not (x_46_im <= 2e+80): tmp = t_0 else: tmp = t_0 + (x_46_re * ((x_46_re * x_46_im) * 2.0)) return tmp
function code(x_46_re, x_46_im) t_0 = Float64(x_46_im * Float64(Float64(x_46_re - x_46_im) * Float64(x_46_re + x_46_im))) tmp = 0.0 if ((x_46_im <= -4.6e+166) || !(x_46_im <= 2e+80)) tmp = t_0; else tmp = Float64(t_0 + Float64(x_46_re * Float64(Float64(x_46_re * x_46_im) * 2.0))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im) t_0 = x_46_im * ((x_46_re - x_46_im) * (x_46_re + x_46_im)); tmp = 0.0; if ((x_46_im <= -4.6e+166) || ~((x_46_im <= 2e+80))) tmp = t_0; else tmp = t_0 + (x_46_re * ((x_46_re * x_46_im) * 2.0)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(x$46$im * N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x$46$im, -4.6e+166], N[Not[LessEqual[x$46$im, 2e+80]], $MachinePrecision]], t$95$0, N[(t$95$0 + N[(x$46$re * N[(N[(x$46$re * x$46$im), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right)\\
\mathbf{if}\;x.im \leq -4.6 \cdot 10^{+166} \lor \neg \left(x.im \leq 2 \cdot 10^{+80}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_0 + x.re \cdot \left(\left(x.re \cdot x.im\right) \cdot 2\right)\\
\end{array}
\end{array}
if x.im < -4.60000000000000015e166 or 2e80 < x.im Initial program 53.1%
difference-of-squares67.1%
*-commutative67.1%
Applied egg-rr67.1%
expm1-log1p-u49.3%
expm1-udef49.3%
*-commutative49.3%
*-commutative49.3%
*-un-lft-identity49.3%
*-un-lft-identity49.3%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified98.7%
if -4.60000000000000015e166 < x.im < 2e80Initial program 87.5%
difference-of-squares88.6%
*-commutative88.6%
Applied egg-rr88.6%
*-commutative88.6%
*-un-lft-identity88.6%
metadata-eval88.6%
distribute-lft-in88.6%
distribute-rgt-out88.6%
metadata-eval88.6%
metadata-eval88.6%
metadata-eval88.6%
Applied egg-rr88.6%
Final simplification91.7%
(FPCore (x.re x.im) :precision binary64 (* x.im (* (+ x.re x.im) (+ x.re x.im))))
double code(double x_46_re, double x_46_im) {
return 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_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_im * ((x_46_re + x_46_im) * (x_46_re + x_46_im));
}
def code(x_46_re, x_46_im): return 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(x_46_im * Float64(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_im * ((x_46_re + x_46_im) * (x_46_re + x_46_im)); end
code[x$46$re_, x$46$im_] := N[(x$46$im * N[(N[(x$46$re + x$46$im), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x.im \cdot \left(\left(x.re + x.im\right) \cdot \left(x.re + x.im\right)\right)
\end{array}
Initial program 76.9%
difference-of-squares82.0%
*-commutative82.0%
Applied egg-rr82.0%
expm1-log1p-u65.5%
expm1-udef58.1%
*-commutative58.1%
*-commutative58.1%
*-un-lft-identity58.1%
*-un-lft-identity58.1%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified79.6%
*-commutative79.6%
distribute-lft-in73.0%
*-commutative73.0%
distribute-lft-in66.7%
*-commutative66.7%
Applied egg-rr66.7%
Simplified73.0%
Applied egg-rr34.5%
Final simplification34.5%
(FPCore (x.re x.im) :precision binary64 (* x.im (* (- x.re x.im) (+ x.re x.im))))
double code(double x_46_re, double x_46_im) {
return 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_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_im * ((x_46_re - x_46_im) * (x_46_re + x_46_im));
}
def code(x_46_re, x_46_im): return 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(x_46_im * Float64(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_im * ((x_46_re - x_46_im) * (x_46_re + x_46_im)); end
code[x$46$re_, x$46$im_] := N[(x$46$im * N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right)
\end{array}
Initial program 76.9%
difference-of-squares82.0%
*-commutative82.0%
Applied egg-rr82.0%
expm1-log1p-u65.5%
expm1-udef58.1%
*-commutative58.1%
*-commutative58.1%
*-un-lft-identity58.1%
*-un-lft-identity58.1%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified79.6%
Final simplification79.6%
(FPCore (x.re x.im) :precision binary64 (- x.re))
double code(double x_46_re, double x_46_im) {
return -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
end function
public static double code(double x_46_re, double x_46_im) {
return -x_46_re;
}
def code(x_46_re, x_46_im): return -x_46_re
function code(x_46_re, x_46_im) return Float64(-x_46_re) end
function tmp = code(x_46_re, x_46_im) tmp = -x_46_re; end
code[x$46$re_, x$46$im_] := (-x$46$re)
\begin{array}{l}
\\
-x.re
\end{array}
Initial program 76.9%
difference-of-squares82.0%
*-commutative82.0%
Applied egg-rr82.0%
*-commutative82.0%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
div-sub0.0%
pow20.0%
+-inverses0.0%
pow20.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified59.9%
Taylor expanded in x.im around 0 3.7%
mul-1-neg3.7%
Simplified3.7%
Final simplification3.7%
(FPCore (x.re x.im) :precision binary64 x.re)
double code(double x_46_re, double x_46_im) {
return 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
end function
public static double code(double x_46_re, double x_46_im) {
return x_46_re;
}
def code(x_46_re, x_46_im): return x_46_re
function code(x_46_re, x_46_im) return x_46_re end
function tmp = code(x_46_re, x_46_im) tmp = x_46_re; end
code[x$46$re_, x$46$im_] := x$46$re
\begin{array}{l}
\\
x.re
\end{array}
Initial program 76.9%
difference-of-squares82.0%
*-commutative82.0%
Applied egg-rr82.0%
*-commutative82.0%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
div-sub0.0%
pow20.0%
+-inverses0.0%
pow20.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified59.9%
associate-*l*60.2%
add-sqr-sqrt31.6%
sqrt-unprod58.9%
swap-sqr58.9%
metadata-eval58.9%
*-un-lft-identity58.9%
unpow258.9%
unpow258.9%
sqrt-prod28.4%
add-sqr-sqrt60.0%
fma-def60.0%
Applied egg-rr42.8%
Taylor expanded in x.im around 0 3.7%
Final simplification3.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 2023305
(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)))