?

Average Accuracy: 88.2% → 99.2%
Time: 12.5s
Precision: binary64
Cost: 3656

?

\[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
\[\begin{array}{l} t_0 := x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right)\\ t_1 := t_0 - x.im \cdot \left(x.im \cdot x.re + x.im \cdot x.re\right)\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;-3 \cdot \left(x.im \cdot \left(x.im \cdot x.re\right)\right)\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{+296}:\\ \;\;\;\;t_0 - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x.im \cdot \left(\left(x.im \cdot x.re\right) \cdot -3\right)\\ \end{array} \]
(FPCore (x.re x.im)
 :precision binary64
 (-
  (* (- (* x.re x.re) (* x.im x.im)) x.re)
  (* (+ (* x.re x.im) (* x.im x.re)) x.im)))
(FPCore (x.re x.im)
 :precision binary64
 (let* ((t_0 (* x.re (- (* x.re x.re) (* x.im x.im))))
        (t_1 (- t_0 (* x.im (+ (* x.im x.re) (* x.im x.re))))))
   (if (<= t_1 (- INFINITY))
     (* -3.0 (* x.im (* x.im x.re)))
     (if (<= t_1 2e+296)
       (- t_0 (* x.im (* x.re (+ x.im x.im))))
       (* x.im (* (* x.im x.re) -3.0))))))
double code(double x_46_re, double x_46_im) {
	return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im);
}
double code(double x_46_re, double x_46_im) {
	double t_0 = x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im));
	double t_1 = t_0 - (x_46_im * ((x_46_im * x_46_re) + (x_46_im * x_46_re)));
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = -3.0 * (x_46_im * (x_46_im * x_46_re));
	} else if (t_1 <= 2e+296) {
		tmp = t_0 - (x_46_im * (x_46_re * (x_46_im + x_46_im)));
	} else {
		tmp = x_46_im * ((x_46_im * x_46_re) * -3.0);
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im) {
	return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im);
}
public static double code(double x_46_re, double x_46_im) {
	double t_0 = x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im));
	double t_1 = t_0 - (x_46_im * ((x_46_im * x_46_re) + (x_46_im * x_46_re)));
	double tmp;
	if (t_1 <= -Double.POSITIVE_INFINITY) {
		tmp = -3.0 * (x_46_im * (x_46_im * x_46_re));
	} else if (t_1 <= 2e+296) {
		tmp = t_0 - (x_46_im * (x_46_re * (x_46_im + x_46_im)));
	} else {
		tmp = x_46_im * ((x_46_im * x_46_re) * -3.0);
	}
	return tmp;
}
def code(x_46_re, x_46_im):
	return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im)
def code(x_46_re, x_46_im):
	t_0 = x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))
	t_1 = t_0 - (x_46_im * ((x_46_im * x_46_re) + (x_46_im * x_46_re)))
	tmp = 0
	if t_1 <= -math.inf:
		tmp = -3.0 * (x_46_im * (x_46_im * x_46_re))
	elif t_1 <= 2e+296:
		tmp = t_0 - (x_46_im * (x_46_re * (x_46_im + x_46_im)))
	else:
		tmp = x_46_im * ((x_46_im * x_46_re) * -3.0)
	return tmp
function code(x_46_re, x_46_im)
	return Float64(Float64(Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im)) * x_46_re) - Float64(Float64(Float64(x_46_re * x_46_im) + Float64(x_46_im * x_46_re)) * x_46_im))
end
function code(x_46_re, x_46_im)
	t_0 = Float64(x_46_re * Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im)))
	t_1 = Float64(t_0 - Float64(x_46_im * Float64(Float64(x_46_im * x_46_re) + Float64(x_46_im * x_46_re))))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(-3.0 * Float64(x_46_im * Float64(x_46_im * x_46_re)));
	elseif (t_1 <= 2e+296)
		tmp = Float64(t_0 - Float64(x_46_im * Float64(x_46_re * Float64(x_46_im + x_46_im))));
	else
		tmp = Float64(x_46_im * Float64(Float64(x_46_im * x_46_re) * -3.0));
	end
	return tmp
end
function tmp = code(x_46_re, x_46_im)
	tmp = (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im);
end
function tmp_2 = code(x_46_re, x_46_im)
	t_0 = x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im));
	t_1 = t_0 - (x_46_im * ((x_46_im * x_46_re) + (x_46_im * x_46_re)));
	tmp = 0.0;
	if (t_1 <= -Inf)
		tmp = -3.0 * (x_46_im * (x_46_im * x_46_re));
	elseif (t_1 <= 2e+296)
		tmp = t_0 - (x_46_im * (x_46_re * (x_46_im + x_46_im)));
	else
		tmp = x_46_im * ((x_46_im * x_46_re) * -3.0);
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_] := N[(N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision] - N[(N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision]), $MachinePrecision]
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(x$46$re * N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[(x$46$im * N[(N[(x$46$im * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(-3.0 * N[(x$46$im * N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+296], N[(t$95$0 - N[(x$46$im * N[(x$46$re * N[(x$46$im + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$im * N[(N[(x$46$im * x$46$re), $MachinePrecision] * -3.0), $MachinePrecision]), $MachinePrecision]]]]]
\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im
\begin{array}{l}
t_0 := x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right)\\
t_1 := t_0 - x.im \cdot \left(x.im \cdot x.re + x.im \cdot x.re\right)\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;-3 \cdot \left(x.im \cdot \left(x.im \cdot x.re\right)\right)\\

\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+296}:\\
\;\;\;\;t_0 - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x.im \cdot \left(\left(x.im \cdot x.re\right) \cdot -3\right)\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original88.2%
Target99.6%
Herbie99.2%
\[\left(x.re \cdot x.re\right) \cdot \left(x.re - x.im\right) + \left(x.re \cdot x.im\right) \cdot \left(x.re - 3 \cdot x.im\right) \]

Derivation?

  1. Split input into 3 regimes
  2. if (-.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im)) < -inf.0

    1. Initial program 0.0%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Simplified0.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x.re, x.im \cdot \left(x.im \cdot -3\right), {x.re}^{3}\right)} \]
      Proof

      [Start]0.0

      \[ \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]

      sub-neg [=>]0.0

      \[ \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re + \left(-\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right)} \]

      *-commutative [=>]0.0

      \[ \color{blue}{x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right)} + \left(-\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right) \]

      sub-neg [=>]0.0

      \[ x.re \cdot \color{blue}{\left(x.re \cdot x.re + \left(-x.im \cdot x.im\right)\right)} + \left(-\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right) \]

      distribute-rgt-in [=>]0.0

      \[ \color{blue}{\left(\left(x.re \cdot x.re\right) \cdot x.re + \left(-x.im \cdot x.im\right) \cdot x.re\right)} + \left(-\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right) \]

      associate-+l+ [=>]0.0

      \[ \color{blue}{\left(x.re \cdot x.re\right) \cdot x.re + \left(\left(-x.im \cdot x.im\right) \cdot x.re + \left(-\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right)\right)} \]

      +-commutative [=>]0.0

      \[ \color{blue}{\left(\left(-x.im \cdot x.im\right) \cdot x.re + \left(-\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right)\right) + \left(x.re \cdot x.re\right) \cdot x.re} \]

      *-commutative [=>]0.0

      \[ \left(\color{blue}{x.re \cdot \left(-x.im \cdot x.im\right)} + \left(-\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right)\right) + \left(x.re \cdot x.re\right) \cdot x.re \]

      distribute-rgt-neg-in [=>]0.0

      \[ \left(x.re \cdot \left(-x.im \cdot x.im\right) + \color{blue}{\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot \left(-x.im\right)}\right) + \left(x.re \cdot x.re\right) \cdot x.re \]

      *-commutative [=>]0.0

      \[ \left(x.re \cdot \left(-x.im \cdot x.im\right) + \left(\color{blue}{x.im \cdot x.re} + x.im \cdot x.re\right) \cdot \left(-x.im\right)\right) + \left(x.re \cdot x.re\right) \cdot x.re \]

      distribute-rgt-out [=>]0.0

      \[ \left(x.re \cdot \left(-x.im \cdot x.im\right) + \color{blue}{\left(x.re \cdot \left(x.im + x.im\right)\right)} \cdot \left(-x.im\right)\right) + \left(x.re \cdot x.re\right) \cdot x.re \]

      associate-*l* [=>]0.0

      \[ \left(x.re \cdot \left(-x.im \cdot x.im\right) + \color{blue}{x.re \cdot \left(\left(x.im + x.im\right) \cdot \left(-x.im\right)\right)}\right) + \left(x.re \cdot x.re\right) \cdot x.re \]

      distribute-lft-out [=>]0.0

      \[ \color{blue}{x.re \cdot \left(\left(-x.im \cdot x.im\right) + \left(x.im + x.im\right) \cdot \left(-x.im\right)\right)} + \left(x.re \cdot x.re\right) \cdot x.re \]

      fma-def [=>]0.0

      \[ \color{blue}{\mathsf{fma}\left(x.re, \left(-x.im \cdot x.im\right) + \left(x.im + x.im\right) \cdot \left(-x.im\right), \left(x.re \cdot x.re\right) \cdot x.re\right)} \]
    3. Taylor expanded in x.re around 0 0.0%

      \[\leadsto \color{blue}{-3 \cdot \left(x.re \cdot {x.im}^{2}\right)} \]
    4. Simplified99.4%

      \[\leadsto \color{blue}{-3 \cdot \left(x.im \cdot \left(x.re \cdot x.im\right)\right)} \]
      Proof

      [Start]0.0

      \[ -3 \cdot \left(x.re \cdot {x.im}^{2}\right) \]

      unpow2 [=>]0.0

      \[ -3 \cdot \left(x.re \cdot \color{blue}{\left(x.im \cdot x.im\right)}\right) \]

      associate-*r* [=>]99.4

      \[ -3 \cdot \color{blue}{\left(\left(x.re \cdot x.im\right) \cdot x.im\right)} \]

      *-commutative [=>]99.4

      \[ -3 \cdot \color{blue}{\left(x.im \cdot \left(x.re \cdot x.im\right)\right)} \]

    if -inf.0 < (-.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im)) < 1.99999999999999996e296

    1. Initial program 99.7%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Simplified99.7%

      \[\leadsto \color{blue}{x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right)} \]
      Proof

      [Start]99.7

      \[ \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]

      *-commutative [=>]99.7

      \[ \color{blue}{x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right)} - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]

      *-commutative [=>]99.7

      \[ x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) - \color{blue}{x.im \cdot \left(x.re \cdot x.im + x.im \cdot x.re\right)} \]

      *-commutative [=>]99.7

      \[ x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) - x.im \cdot \left(\color{blue}{x.im \cdot x.re} + x.im \cdot x.re\right) \]

      distribute-rgt-out [=>]99.7

      \[ x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) - x.im \cdot \color{blue}{\left(x.re \cdot \left(x.im + x.im\right)\right)} \]

    if 1.99999999999999996e296 < (-.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im))

    1. Initial program 9.3%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Simplified9.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x.re, x.im \cdot \left(x.im \cdot -3\right), {x.re}^{3}\right)} \]
      Proof

      [Start]9.3

      \[ \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]

      sub-neg [=>]9.3

      \[ \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re + \left(-\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right)} \]

      *-commutative [=>]9.3

      \[ \color{blue}{x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right)} + \left(-\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right) \]

      sub-neg [=>]9.3

      \[ x.re \cdot \color{blue}{\left(x.re \cdot x.re + \left(-x.im \cdot x.im\right)\right)} + \left(-\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right) \]

      distribute-rgt-in [=>]9.3

      \[ \color{blue}{\left(\left(x.re \cdot x.re\right) \cdot x.re + \left(-x.im \cdot x.im\right) \cdot x.re\right)} + \left(-\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right) \]

      associate-+l+ [=>]9.3

      \[ \color{blue}{\left(x.re \cdot x.re\right) \cdot x.re + \left(\left(-x.im \cdot x.im\right) \cdot x.re + \left(-\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right)\right)} \]

      +-commutative [=>]9.3

      \[ \color{blue}{\left(\left(-x.im \cdot x.im\right) \cdot x.re + \left(-\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right)\right) + \left(x.re \cdot x.re\right) \cdot x.re} \]

      *-commutative [=>]9.3

      \[ \left(\color{blue}{x.re \cdot \left(-x.im \cdot x.im\right)} + \left(-\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right)\right) + \left(x.re \cdot x.re\right) \cdot x.re \]

      distribute-rgt-neg-in [=>]9.3

      \[ \left(x.re \cdot \left(-x.im \cdot x.im\right) + \color{blue}{\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot \left(-x.im\right)}\right) + \left(x.re \cdot x.re\right) \cdot x.re \]

      *-commutative [=>]9.3

      \[ \left(x.re \cdot \left(-x.im \cdot x.im\right) + \left(\color{blue}{x.im \cdot x.re} + x.im \cdot x.re\right) \cdot \left(-x.im\right)\right) + \left(x.re \cdot x.re\right) \cdot x.re \]

      distribute-rgt-out [=>]9.3

      \[ \left(x.re \cdot \left(-x.im \cdot x.im\right) + \color{blue}{\left(x.re \cdot \left(x.im + x.im\right)\right)} \cdot \left(-x.im\right)\right) + \left(x.re \cdot x.re\right) \cdot x.re \]

      associate-*l* [=>]9.3

      \[ \left(x.re \cdot \left(-x.im \cdot x.im\right) + \color{blue}{x.re \cdot \left(\left(x.im + x.im\right) \cdot \left(-x.im\right)\right)}\right) + \left(x.re \cdot x.re\right) \cdot x.re \]

      distribute-lft-out [=>]9.3

      \[ \color{blue}{x.re \cdot \left(\left(-x.im \cdot x.im\right) + \left(x.im + x.im\right) \cdot \left(-x.im\right)\right)} + \left(x.re \cdot x.re\right) \cdot x.re \]

      fma-def [=>]9.3

      \[ \color{blue}{\mathsf{fma}\left(x.re, \left(-x.im \cdot x.im\right) + \left(x.im + x.im\right) \cdot \left(-x.im\right), \left(x.re \cdot x.re\right) \cdot x.re\right)} \]
    3. Taylor expanded in x.re around 0 2.5%

      \[\leadsto \color{blue}{-3 \cdot \left(x.re \cdot {x.im}^{2}\right)} \]
    4. Simplified92.6%

      \[\leadsto \color{blue}{-3 \cdot \left(x.im \cdot \left(x.re \cdot x.im\right)\right)} \]
      Proof

      [Start]2.5

      \[ -3 \cdot \left(x.re \cdot {x.im}^{2}\right) \]

      unpow2 [=>]2.5

      \[ -3 \cdot \left(x.re \cdot \color{blue}{\left(x.im \cdot x.im\right)}\right) \]

      associate-*r* [=>]92.6

      \[ -3 \cdot \color{blue}{\left(\left(x.re \cdot x.im\right) \cdot x.im\right)} \]

      *-commutative [=>]92.6

      \[ -3 \cdot \color{blue}{\left(x.im \cdot \left(x.re \cdot x.im\right)\right)} \]
    5. Taylor expanded in x.im around 0 2.5%

      \[\leadsto \color{blue}{-3 \cdot \left(x.re \cdot {x.im}^{2}\right)} \]
    6. Simplified92.6%

      \[\leadsto \color{blue}{x.im \cdot \left(-3 \cdot \left(x.re \cdot x.im\right)\right)} \]
      Proof

      [Start]2.5

      \[ -3 \cdot \left(x.re \cdot {x.im}^{2}\right) \]

      *-commutative [=>]2.5

      \[ -3 \cdot \color{blue}{\left({x.im}^{2} \cdot x.re\right)} \]

      unpow2 [=>]2.5

      \[ -3 \cdot \left(\color{blue}{\left(x.im \cdot x.im\right)} \cdot x.re\right) \]

      associate-*r* [<=]92.6

      \[ -3 \cdot \color{blue}{\left(x.im \cdot \left(x.im \cdot x.re\right)\right)} \]

      *-commutative [=>]92.6

      \[ \color{blue}{\left(x.im \cdot \left(x.im \cdot x.re\right)\right) \cdot -3} \]

      associate-*r* [<=]92.6

      \[ \color{blue}{x.im \cdot \left(\left(x.im \cdot x.re\right) \cdot -3\right)} \]

      *-commutative [=>]92.6

      \[ x.im \cdot \color{blue}{\left(-3 \cdot \left(x.im \cdot x.re\right)\right)} \]

      *-commutative [=>]92.6

      \[ x.im \cdot \left(-3 \cdot \color{blue}{\left(x.re \cdot x.im\right)}\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) - x.im \cdot \left(x.im \cdot x.re + x.im \cdot x.re\right) \leq -\infty:\\ \;\;\;\;-3 \cdot \left(x.im \cdot \left(x.im \cdot x.re\right)\right)\\ \mathbf{elif}\;x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) - x.im \cdot \left(x.im \cdot x.re + x.im \cdot x.re\right) \leq 2 \cdot 10^{+296}:\\ \;\;\;\;x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x.im \cdot \left(\left(x.im \cdot x.re\right) \cdot -3\right)\\ \end{array} \]

Alternatives

Alternative 1
Accuracy99.7%
Cost7616
\[\mathsf{fma}\left(x.im, -2 \cdot \left(x.im \cdot x.re\right), \left(x.re \cdot \left(x.im + x.re\right)\right) \cdot \left(x.re - x.im\right) + x.re \cdot 0\right) \]
Alternative 2
Accuracy99.7%
Cost7040
\[{x.re}^{3} + x.im \cdot \left(x.re \cdot \left(x.im \cdot -3\right)\right) \]
Alternative 3
Accuracy99.6%
Cost1224
\[\begin{array}{l} \mathbf{if}\;x.im \leq -5.8 \cdot 10^{+92}:\\ \;\;\;\;-3 \cdot \left(x.im \cdot \left(x.im \cdot x.re\right)\right)\\ \mathbf{elif}\;x.im \leq 2 \cdot 10^{+106}:\\ \;\;\;\;x.re \cdot \left(\left(x.re \cdot x.re - x.im \cdot x.im\right) - x.im \cdot \left(x.im + x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x.im \cdot \left(\left(x.im \cdot x.re\right) \cdot -3\right)\\ \end{array} \]
Alternative 4
Accuracy99.6%
Cost1216
\[\left(x.im + x.re\right) \cdot \frac{x.re}{\frac{1}{x.re - x.im}} - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
Alternative 5
Accuracy99.6%
Cost968
\[\begin{array}{l} \mathbf{if}\;x.im \leq -6.8 \cdot 10^{+123}:\\ \;\;\;\;-3 \cdot \left(x.im \cdot \left(x.im \cdot x.re\right)\right)\\ \mathbf{elif}\;x.im \leq 5 \cdot 10^{+83}:\\ \;\;\;\;x.re \cdot \left(x.re \cdot x.re + x.im \cdot \left(x.im \cdot -3\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x.im \cdot \left(\left(x.im \cdot x.re\right) \cdot -3\right)\\ \end{array} \]
Alternative 6
Accuracy91.5%
Cost840
\[\begin{array}{l} \mathbf{if}\;x.im \leq -4.4 \cdot 10^{-75}:\\ \;\;\;\;-3 \cdot \left(x.im \cdot \left(x.im \cdot x.re\right)\right)\\ \mathbf{elif}\;x.im \leq 8 \cdot 10^{-8}:\\ \;\;\;\;x.re \cdot \left(\left(x.im + x.re\right) \cdot \left(x.re - x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x.im \cdot \left(\left(x.im \cdot x.re\right) \cdot -3\right)\\ \end{array} \]
Alternative 7
Accuracy91.1%
Cost713
\[\begin{array}{l} \mathbf{if}\;x.im \leq -3.4 \cdot 10^{-75} \lor \neg \left(x.im \leq 8 \cdot 10^{-8}\right):\\ \;\;\;\;-3 \cdot \left(x.im \cdot \left(x.im \cdot x.re\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\ \end{array} \]
Alternative 8
Accuracy91.1%
Cost712
\[\begin{array}{l} \mathbf{if}\;x.im \leq -3.8 \cdot 10^{-75}:\\ \;\;\;\;-3 \cdot \left(x.im \cdot \left(x.im \cdot x.re\right)\right)\\ \mathbf{elif}\;x.im \leq 1.25 \cdot 10^{-7}:\\ \;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\ \mathbf{else}:\\ \;\;\;\;x.im \cdot \left(\left(x.im \cdot x.re\right) \cdot -3\right)\\ \end{array} \]
Alternative 9
Accuracy58.0%
Cost649
\[\begin{array}{l} \mathbf{if}\;x.re \leq -2.55 \cdot 10^{-107} \lor \neg \left(x.re \leq 2.75 \cdot 10^{-104}\right):\\ \;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot \left(-x.im\right)\right)\\ \end{array} \]
Alternative 10
Accuracy55.8%
Cost320
\[x.re \cdot \left(x.re \cdot x.re\right) \]

Error

Reproduce?

herbie shell --seed 2023137 
(FPCore (x.re x.im)
  :name "math.cube on complex, real part"
  :precision binary64

  :herbie-target
  (+ (* (* x.re x.re) (- x.re x.im)) (* (* x.re x.im) (- x.re (* 3.0 x.im))))

  (- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))