?

Average Accuracy: 82.6% → 99.8%
Time: 11.7s
Precision: binary64
Cost: 2500

?

\[\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 \]
\[\begin{array}{l} t_0 := \left(x.im \cdot \left(x.im + x.re\right)\right) \cdot \left(x.re - x.im\right)\\ t_1 := x.re \cdot \left(x.im \cdot x.re + x.im \cdot x.re\right)\\ \mathbf{if}\;t_1 + x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) \leq \infty:\\ \;\;\;\;t_0 + t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
(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)))
(FPCore (x.re x.im)
 :precision binary64
 (let* ((t_0 (* (* x.im (+ x.im x.re)) (- x.re x.im)))
        (t_1 (* x.re (+ (* x.im x.re) (* x.im x.re)))))
   (if (<= (+ t_1 (* x.im (- (* x.re x.re) (* x.im x.im)))) INFINITY)
     (+ t_0 t_1)
     t_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_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re);
}
double code(double x_46_re, double x_46_im) {
	double t_0 = (x_46_im * (x_46_im + x_46_re)) * (x_46_re - x_46_im);
	double t_1 = x_46_re * ((x_46_im * x_46_re) + (x_46_im * x_46_re));
	double tmp;
	if ((t_1 + (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im)))) <= ((double) INFINITY)) {
		tmp = t_0 + t_1;
	} else {
		tmp = t_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_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re);
}
public static double code(double x_46_re, double x_46_im) {
	double t_0 = (x_46_im * (x_46_im + x_46_re)) * (x_46_re - x_46_im);
	double t_1 = x_46_re * ((x_46_im * x_46_re) + (x_46_im * x_46_re));
	double tmp;
	if ((t_1 + (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im)))) <= Double.POSITIVE_INFINITY) {
		tmp = t_0 + t_1;
	} else {
		tmp = t_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_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re)
def code(x_46_re, x_46_im):
	t_0 = (x_46_im * (x_46_im + x_46_re)) * (x_46_re - x_46_im)
	t_1 = x_46_re * ((x_46_im * x_46_re) + (x_46_im * x_46_re))
	tmp = 0
	if (t_1 + (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im)))) <= math.inf:
		tmp = t_0 + t_1
	else:
		tmp = t_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_im) + Float64(Float64(Float64(x_46_re * x_46_im) + Float64(x_46_im * x_46_re)) * x_46_re))
end
function code(x_46_re, x_46_im)
	t_0 = Float64(Float64(x_46_im * Float64(x_46_im + x_46_re)) * Float64(x_46_re - x_46_im))
	t_1 = Float64(x_46_re * Float64(Float64(x_46_im * x_46_re) + Float64(x_46_im * x_46_re)))
	tmp = 0.0
	if (Float64(t_1 + Float64(x_46_im * Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im)))) <= Inf)
		tmp = Float64(t_0 + t_1);
	else
		tmp = t_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_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re);
end
function tmp_2 = code(x_46_re, x_46_im)
	t_0 = (x_46_im * (x_46_im + x_46_re)) * (x_46_re - x_46_im);
	t_1 = x_46_re * ((x_46_im * x_46_re) + (x_46_im * x_46_re));
	tmp = 0.0;
	if ((t_1 + (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im)))) <= Inf)
		tmp = t_0 + t_1;
	else
		tmp = t_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$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]
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(N[(x$46$im * N[(x$46$im + x$46$re), $MachinePrecision]), $MachinePrecision] * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x$46$re * N[(N[(x$46$im * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 + N[(x$46$im * N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$0 + t$95$1), $MachinePrecision], t$95$0]]]
\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
\begin{array}{l}
t_0 := \left(x.im \cdot \left(x.im + x.re\right)\right) \cdot \left(x.re - x.im\right)\\
t_1 := x.re \cdot \left(x.im \cdot x.re + x.im \cdot x.re\right)\\
\mathbf{if}\;t_1 + x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) \leq \infty:\\
\;\;\;\;t_0 + t_1\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original82.6%
Target91.6%
Herbie99.8%
\[\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) \]

Derivation?

  1. Split input into 2 regimes
  2. 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.0

    1. Initial program 93.4%

      \[\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 \]
    2. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\left(0 + \left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)\right)} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      Step-by-step derivation

      [Start]93.4

      \[ \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 \]

      add-log-exp [=>]54.9

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

      *-un-lft-identity [=>]54.9

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

      log-prod [=>]54.9

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

      metadata-eval [=>]54.9

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

      add-log-exp [<=]93.4

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

      *-commutative [=>]93.4

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

      difference-of-squares [=>]93.4

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

      associate-*r* [=>]99.8

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

    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))

    1. Initial program 0.0%

      \[\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 \]
    2. Applied egg-rr22.9%

      \[\leadsto \color{blue}{\left(0 + \left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)\right)} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      Step-by-step derivation

      [Start]0.0

      \[ \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 \]

      add-log-exp [=>]0.0

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

      *-un-lft-identity [=>]0.0

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

      log-prod [=>]0.0

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

      metadata-eval [=>]0.0

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

      add-log-exp [<=]0.0

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

      *-commutative [=>]0.0

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

      difference-of-squares [=>]22.9

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

      associate-*r* [=>]22.9

      \[ \left(0 + \color{blue}{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}\right) + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    3. Applied egg-rr0.0%

      \[\leadsto \left(0 + \left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)\right) + \color{blue}{\left(0 + \frac{x.re \cdot 0}{0}\right)} \]
      Step-by-step derivation

      [Start]22.9

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

      add-log-exp [=>]22.9

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

      *-un-lft-identity [=>]22.9

      \[ \left(0 + \left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)\right) + \log \color{blue}{\left(1 \cdot e^{\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re}\right)} \]

      log-prod [=>]22.9

      \[ \left(0 + \left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)\right) + \color{blue}{\left(\log 1 + \log \left(e^{\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re}\right)\right)} \]

      metadata-eval [=>]22.9

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

      add-log-exp [<=]22.9

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

      *-commutative [=>]22.9

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

      *-commutative [=>]22.9

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

      flip-+ [=>]0.0

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

      +-inverses [=>]0.0

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

      +-inverses [<=]0.0

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

      *-commutative [<=]0.0

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

      *-commutative [<=]0.0

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

      associate-*r/ [=>]0.0

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

      *-commutative [=>]0.0

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

      +-inverses [=>]0.0

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

      *-commutative [=>]0.0

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

      +-inverses [=>]0.0

      \[ \left(0 + \left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)\right) + \left(0 + \frac{x.re \cdot 0}{\color{blue}{0}}\right) \]
    4. Simplified100.0%

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

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

Alternatives

Alternative 1
Accuracy78.8%
Cost7305
\[\begin{array}{l} \mathbf{if}\;x.im \leq 3 \cdot 10^{+106} \lor \neg \left(x.im \leq 4 \cdot 10^{+101}\right):\\ \;\;\;\;\left(x.im \cdot \left(x.im + x.re\right)\right) \cdot \left(x.re - x.im\right)\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(3 \cdot \left(x.im \cdot x.re\right)\right) - {x.im}^{3}\\ \end{array} \]
Alternative 2
Accuracy78.8%
Cost1744
\[\begin{array}{l} t_0 := \left(x.im \cdot \left(x.im + x.re\right)\right) \cdot \left(x.re - x.im\right)\\ t_1 := x.re \cdot \left(x.im \cdot x.re + x.im \cdot x.re\right) + x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right)\\ \mathbf{if}\;x.im \leq 2.1 \cdot 10^{+154}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.im \leq 7.5 \cdot 10^{-107}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x.im \leq 1.5 \cdot 10^{-117}:\\ \;\;\;\;x.re \cdot \left(3 \cdot \left(x.im \cdot x.re\right)\right)\\ \mathbf{elif}\;x.im \leq 7200000000000:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Accuracy78.8%
Cost1480
\[\begin{array}{l} t_0 := \left(x.im \cdot \left(x.im + x.re\right)\right) \cdot \left(x.re - x.im\right)\\ \mathbf{if}\;x.im \leq 2 \cdot 10^{+158}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.im \leq 7200000000000:\\ \;\;\;\;t_0 + x.re \cdot \left(x.im \cdot x.re + x.im \cdot x.re\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(x.im + x.re\right) \cdot \left(x.im \cdot \left(x.re - x.im\right)\right)\right) \cdot \left(\left(x.im + x.re\right) \cdot \frac{1}{x.im + x.re}\right)\\ \end{array} \]
Alternative 4
Accuracy58.0%
Cost1232
\[\begin{array}{l} t_0 := \left(x.im \cdot x.im\right) \cdot \left(-x.im\right)\\ t_1 := x.im \cdot \left(3 \cdot \left(x.re \cdot x.re\right) - x.im \cdot x.im\right)\\ \mathbf{if}\;x.im \leq 2.1 \cdot 10^{+154}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.im \leq 9.4 \cdot 10^{-108}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x.im \leq 1.8 \cdot 10^{-101}:\\ \;\;\;\;x.re \cdot \left(3 \cdot \left(x.im \cdot x.re\right)\right)\\ \mathbf{elif}\;x.im \leq 6.6 \cdot 10^{+152}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Accuracy78.8%
Cost1232
\[\begin{array}{l} t_0 := \left(x.im \cdot \left(x.im + x.re\right)\right) \cdot \left(x.re - x.im\right)\\ t_1 := x.im \cdot \left(3 \cdot \left(x.re \cdot x.re\right) - x.im \cdot x.im\right)\\ \mathbf{if}\;x.im \leq 2.1 \cdot 10^{+154}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.im \leq 1.7 \cdot 10^{-107}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x.im \leq 7 \cdot 10^{-108}:\\ \;\;\;\;x.re \cdot \left(3 \cdot \left(x.im \cdot x.re\right)\right)\\ \mathbf{elif}\;x.im \leq 2000000:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Accuracy58.0%
Cost1104
\[\begin{array}{l} t_0 := \left(x.im \cdot x.im\right) \cdot \left(-x.im\right)\\ t_1 := x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right)\\ \mathbf{if}\;x.im \leq 2.1 \cdot 10^{+154}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.im \leq 6 \cdot 10^{-91}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x.im \leq 2.05 \cdot 10^{-32}:\\ \;\;\;\;x.re \cdot \left(3 \cdot \left(x.im \cdot x.re\right)\right)\\ \mathbf{elif}\;x.im \leq 6.6 \cdot 10^{+152}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Accuracy50.4%
Cost978
\[\begin{array}{l} \mathbf{if}\;x.re \leq 1.15 \cdot 10^{+89} \lor \neg \left(x.re \leq 4.7 \cdot 10^{+20} \lor \neg \left(x.re \leq 1.12 \cdot 10^{-55}\right) \land x.re \leq 4.9 \cdot 10^{-17}\right):\\ \;\;\;\;3 \cdot \left(x.im \cdot \left(x.re \cdot x.re\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.im \cdot x.im\right) \cdot \left(-x.im\right)\\ \end{array} \]
Alternative 8
Accuracy56.3%
Cost976
\[\begin{array}{l} t_0 := 3 \cdot \left(x.re \cdot \left(x.im \cdot x.re\right)\right)\\ t_1 := \left(x.im \cdot x.im\right) \cdot \left(-x.im\right)\\ \mathbf{if}\;x.re \leq 1.15 \cdot 10^{+89}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.re \leq 2.05 \cdot 10^{+20}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x.re \leq 1.26 \cdot 10^{-55}:\\ \;\;\;\;3 \cdot \left(x.im \cdot \left(x.re \cdot x.re\right)\right)\\ \mathbf{elif}\;x.re \leq 3.7 \cdot 10^{-16}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 9
Accuracy56.3%
Cost976
\[\begin{array}{l} t_0 := 3 \cdot \left(x.re \cdot \left(x.im \cdot x.re\right)\right)\\ t_1 := \left(x.im \cdot x.im\right) \cdot \left(-x.im\right)\\ \mathbf{if}\;x.re \leq 1.95 \cdot 10^{+89}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.re \leq 7.2 \cdot 10^{+20}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x.re \leq 1.26 \cdot 10^{-55}:\\ \;\;\;\;x.im \cdot \left(3 \cdot \left(x.re \cdot x.re\right)\right)\\ \mathbf{elif}\;x.re \leq 1.9 \cdot 10^{-18}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 10
Accuracy56.3%
Cost976
\[\begin{array}{l} t_0 := \left(x.im \cdot x.im\right) \cdot \left(-x.im\right)\\ \mathbf{if}\;x.re \leq 1.15 \cdot 10^{+89}:\\ \;\;\;\;3 \cdot \left(x.re \cdot \left(x.im \cdot x.re\right)\right)\\ \mathbf{elif}\;x.re \leq 4.2 \cdot 10^{+20}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.re \leq 1.26 \cdot 10^{-55}:\\ \;\;\;\;x.im \cdot \left(3 \cdot \left(x.re \cdot x.re\right)\right)\\ \mathbf{elif}\;x.re \leq 7.5 \cdot 10^{-18}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(3 \cdot \left(x.im \cdot x.re\right)\right)\\ \end{array} \]
Alternative 11
Accuracy34.9%
Cost649
\[\begin{array}{l} \mathbf{if}\;x.re \leq 2.35 \cdot 10^{+179} \lor \neg \left(x.re \leq 5.2 \cdot 10^{+138}\right):\\ \;\;\;\;x.im \cdot \left(x.re \cdot x.re\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.im \cdot x.im\right) \cdot \left(-x.im\right)\\ \end{array} \]
Alternative 12
Accuracy34.9%
Cost320
\[x.im \cdot \left(x.re \cdot x.re\right) \]
Alternative 13
Accuracy2.7%
Cost64
\[-1 \]

Error

Reproduce?

herbie shell --seed 2023159 
(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)))