math.cube on complex, imaginary part

Percentage Accurate: 82.4% → 99.8%
Time: 6.6s
Alternatives: 9
Speedup: 1.1×

Specification

?
\[\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
 (+
  (* (- (* 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:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 9 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 82.4% accurate, 1.0× speedup?

\[\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
 (+
  (* (- (* 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}

Alternative 1: 99.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_0 := \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.re + x.im\right)\right)\\
t_1 := x.re \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\\
\mathbf{if}\;x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) + t_1 \leq \infty:\\
\;\;\;\;t_1 + t_0\\

\mathbf{else}:\\
\;\;\;\;t_0 + x.re \cdot 0\\


\end{array}
\end{array}
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. Step-by-step derivation
      1. add-cube-cbrt93.0%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im} \cdot \sqrt[3]{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im}\right) \cdot \sqrt[3]{\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. pow393.0%

        \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im}\right)}^{3}} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      3. *-commutative93.0%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right)}}\right)}^{3} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      4. difference-of-squares93.0%

        \[\leadsto {\left(\sqrt[3]{x.im \cdot \color{blue}{\left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)}}\right)}^{3} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      5. associate-*r*99.4%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}}\right)}^{3} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    3. Applied egg-rr99.4%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}\right)}^{3}} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    4. Step-by-step derivation
      1. unpow399.4%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)} \cdot \sqrt[3]{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}\right) \cdot \sqrt[3]{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      2. add-cube-cbrt99.7%

        \[\leadsto \color{blue}{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      3. *-commutative99.7%

        \[\leadsto \color{blue}{\left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.re + x.im\right)\right)} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      4. +-commutative99.7%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \color{blue}{\left(x.im + x.re\right)}\right) + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    5. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\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. Step-by-step derivation
      1. add-cube-cbrt0.0%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im} \cdot \sqrt[3]{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im}\right) \cdot \sqrt[3]{\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. pow30.0%

        \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im}\right)}^{3}} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      3. *-commutative0.0%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right)}}\right)}^{3} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      4. difference-of-squares28.9%

        \[\leadsto {\left(\sqrt[3]{x.im \cdot \color{blue}{\left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)}}\right)}^{3} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      5. associate-*r*28.9%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}}\right)}^{3} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    3. Applied egg-rr28.9%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}\right)}^{3}} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    4. Step-by-step derivation
      1. unpow328.9%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)} \cdot \sqrt[3]{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}\right) \cdot \sqrt[3]{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      2. add-cube-cbrt28.9%

        \[\leadsto \color{blue}{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      3. *-commutative28.9%

        \[\leadsto \color{blue}{\left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.re + x.im\right)\right)} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      4. +-commutative28.9%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \color{blue}{\left(x.im + x.re\right)}\right) + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    5. Applied egg-rr28.9%

      \[\leadsto \color{blue}{\left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right)} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    6. Step-by-step derivation
      1. *-commutative28.9%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(x.re \cdot x.im + \color{blue}{x.re \cdot x.im}\right) \cdot x.re \]
      2. flip-+0.0%

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

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

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{\color{blue}{{\left(x.re \cdot x.im\right)}^{2}}}{x.re \cdot x.im - x.re \cdot x.im} - \frac{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right)}{x.re \cdot x.im - x.re \cdot x.im}\right) \cdot x.re \]
      5. *-commutative0.0%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{{\color{blue}{\left(x.im \cdot x.re\right)}}^{2}}{x.re \cdot x.im - x.re \cdot x.im} - \frac{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right)}{x.re \cdot x.im - x.re \cdot x.im}\right) \cdot x.re \]
      6. *-commutative0.0%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{{\left(x.im \cdot x.re\right)}^{2}}{x.re \cdot x.im - \color{blue}{x.im \cdot x.re}} - \frac{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right)}{x.re \cdot x.im - x.re \cdot x.im}\right) \cdot x.re \]
      7. *-commutative0.0%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{{\left(x.im \cdot x.re\right)}^{2}}{\color{blue}{x.im \cdot x.re} - x.im \cdot x.re} - \frac{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right)}{x.re \cdot x.im - x.re \cdot x.im}\right) \cdot x.re \]
      8. pow20.0%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{{\left(x.im \cdot x.re\right)}^{2}}{x.im \cdot x.re - x.im \cdot x.re} - \frac{\color{blue}{{\left(x.re \cdot x.im\right)}^{2}}}{x.re \cdot x.im - x.re \cdot x.im}\right) \cdot x.re \]
      9. *-commutative0.0%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{{\left(x.im \cdot x.re\right)}^{2}}{x.im \cdot x.re - x.im \cdot x.re} - \frac{{\color{blue}{\left(x.im \cdot x.re\right)}}^{2}}{x.re \cdot x.im - x.re \cdot x.im}\right) \cdot x.re \]
      10. *-commutative0.0%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{{\left(x.im \cdot x.re\right)}^{2}}{x.im \cdot x.re - x.im \cdot x.re} - \frac{{\left(x.im \cdot x.re\right)}^{2}}{x.re \cdot x.im - \color{blue}{x.im \cdot x.re}}\right) \cdot x.re \]
      11. *-commutative0.0%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{{\left(x.im \cdot x.re\right)}^{2}}{x.im \cdot x.re - x.im \cdot x.re} - \frac{{\left(x.im \cdot x.re\right)}^{2}}{\color{blue}{x.im \cdot x.re} - x.im \cdot x.re}\right) \cdot x.re \]
    7. Applied egg-rr0.0%

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

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

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

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

Alternative 2: 99.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.re + x.im\right)\right)\\ \mathbf{if}\;x.im \leq -1 \cdot 10^{+130} \lor \neg \left(x.im \leq 1.95 \cdot 10^{+44}\right):\\ \;\;\;\;t_0 + x.re \cdot 0\\ \mathbf{else}:\\ \;\;\;\;t_0 + x.re \cdot \left(x.re \cdot \left(x.im + x.im\right)\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im)
 :precision binary64
 (let* ((t_0 (* (- x.re x.im) (* x.im (+ x.re x.im)))))
   (if (or (<= x.im -1e+130) (not (<= x.im 1.95e+44)))
     (+ t_0 (* x.re 0.0))
     (+ t_0 (* x.re (* x.re (+ x.im x.im)))))))
double code(double x_46_re, double x_46_im) {
	double t_0 = (x_46_re - x_46_im) * (x_46_im * (x_46_re + x_46_im));
	double tmp;
	if ((x_46_im <= -1e+130) || !(x_46_im <= 1.95e+44)) {
		tmp = t_0 + (x_46_re * 0.0);
	} else {
		tmp = t_0 + (x_46_re * (x_46_re * (x_46_im + 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_46re - x_46im) * (x_46im * (x_46re + x_46im))
    if ((x_46im <= (-1d+130)) .or. (.not. (x_46im <= 1.95d+44))) then
        tmp = t_0 + (x_46re * 0.0d0)
    else
        tmp = t_0 + (x_46re * (x_46re * (x_46im + 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_re - x_46_im) * (x_46_im * (x_46_re + x_46_im));
	double tmp;
	if ((x_46_im <= -1e+130) || !(x_46_im <= 1.95e+44)) {
		tmp = t_0 + (x_46_re * 0.0);
	} else {
		tmp = t_0 + (x_46_re * (x_46_re * (x_46_im + x_46_im)));
	}
	return tmp;
}
def code(x_46_re, x_46_im):
	t_0 = (x_46_re - x_46_im) * (x_46_im * (x_46_re + x_46_im))
	tmp = 0
	if (x_46_im <= -1e+130) or not (x_46_im <= 1.95e+44):
		tmp = t_0 + (x_46_re * 0.0)
	else:
		tmp = t_0 + (x_46_re * (x_46_re * (x_46_im + x_46_im)))
	return tmp
function code(x_46_re, x_46_im)
	t_0 = Float64(Float64(x_46_re - x_46_im) * Float64(x_46_im * Float64(x_46_re + x_46_im)))
	tmp = 0.0
	if ((x_46_im <= -1e+130) || !(x_46_im <= 1.95e+44))
		tmp = Float64(t_0 + Float64(x_46_re * 0.0));
	else
		tmp = Float64(t_0 + Float64(x_46_re * Float64(x_46_re * Float64(x_46_im + x_46_im))));
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im)
	t_0 = (x_46_re - x_46_im) * (x_46_im * (x_46_re + x_46_im));
	tmp = 0.0;
	if ((x_46_im <= -1e+130) || ~((x_46_im <= 1.95e+44)))
		tmp = t_0 + (x_46_re * 0.0);
	else
		tmp = t_0 + (x_46_re * (x_46_re * (x_46_im + x_46_im)));
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$im * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x$46$im, -1e+130], N[Not[LessEqual[x$46$im, 1.95e+44]], $MachinePrecision]], N[(t$95$0 + N[(x$46$re * 0.0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(x$46$re * N[(x$46$re * N[(x$46$im + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.re + x.im\right)\right)\\
\mathbf{if}\;x.im \leq -1 \cdot 10^{+130} \lor \neg \left(x.im \leq 1.95 \cdot 10^{+44}\right):\\
\;\;\;\;t_0 + x.re \cdot 0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -1.0000000000000001e130 or 1.9500000000000001e44 < x.im

    1. Initial program 64.8%

      \[\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. Step-by-step derivation
      1. add-cube-cbrt64.7%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im} \cdot \sqrt[3]{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im}\right) \cdot \sqrt[3]{\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. pow364.7%

        \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im}\right)}^{3}} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      3. *-commutative64.7%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right)}}\right)}^{3} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      4. difference-of-squares74.9%

        \[\leadsto {\left(\sqrt[3]{x.im \cdot \color{blue}{\left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)}}\right)}^{3} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      5. associate-*r*74.9%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}}\right)}^{3} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    3. Applied egg-rr74.9%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}\right)}^{3}} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    4. Step-by-step derivation
      1. unpow374.9%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)} \cdot \sqrt[3]{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}\right) \cdot \sqrt[3]{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      2. add-cube-cbrt75.0%

        \[\leadsto \color{blue}{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      3. *-commutative75.0%

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

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

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

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(x.re \cdot x.im + \color{blue}{x.re \cdot x.im}\right) \cdot x.re \]
      2. flip-+0.0%

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

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

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{\color{blue}{{\left(x.re \cdot x.im\right)}^{2}}}{x.re \cdot x.im - x.re \cdot x.im} - \frac{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right)}{x.re \cdot x.im - x.re \cdot x.im}\right) \cdot x.re \]
      5. *-commutative0.0%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{{\color{blue}{\left(x.im \cdot x.re\right)}}^{2}}{x.re \cdot x.im - x.re \cdot x.im} - \frac{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right)}{x.re \cdot x.im - x.re \cdot x.im}\right) \cdot x.re \]
      6. *-commutative0.0%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{{\left(x.im \cdot x.re\right)}^{2}}{x.re \cdot x.im - \color{blue}{x.im \cdot x.re}} - \frac{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right)}{x.re \cdot x.im - x.re \cdot x.im}\right) \cdot x.re \]
      7. *-commutative0.0%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{{\left(x.im \cdot x.re\right)}^{2}}{\color{blue}{x.im \cdot x.re} - x.im \cdot x.re} - \frac{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right)}{x.re \cdot x.im - x.re \cdot x.im}\right) \cdot x.re \]
      8. pow20.0%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{{\left(x.im \cdot x.re\right)}^{2}}{x.im \cdot x.re - x.im \cdot x.re} - \frac{\color{blue}{{\left(x.re \cdot x.im\right)}^{2}}}{x.re \cdot x.im - x.re \cdot x.im}\right) \cdot x.re \]
      9. *-commutative0.0%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{{\left(x.im \cdot x.re\right)}^{2}}{x.im \cdot x.re - x.im \cdot x.re} - \frac{{\color{blue}{\left(x.im \cdot x.re\right)}}^{2}}{x.re \cdot x.im - x.re \cdot x.im}\right) \cdot x.re \]
      10. *-commutative0.0%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{{\left(x.im \cdot x.re\right)}^{2}}{x.im \cdot x.re - x.im \cdot x.re} - \frac{{\left(x.im \cdot x.re\right)}^{2}}{x.re \cdot x.im - \color{blue}{x.im \cdot x.re}}\right) \cdot x.re \]
      11. *-commutative0.0%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{{\left(x.im \cdot x.re\right)}^{2}}{x.im \cdot x.re - x.im \cdot x.re} - \frac{{\left(x.im \cdot x.re\right)}^{2}}{\color{blue}{x.im \cdot x.re} - x.im \cdot x.re}\right) \cdot x.re \]
    7. Applied egg-rr0.0%

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

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

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

    if -1.0000000000000001e130 < x.im < 1.9500000000000001e44

    1. Initial program 90.2%

      \[\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. Step-by-step derivation
      1. add-cube-cbrt89.8%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im} \cdot \sqrt[3]{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im}\right) \cdot \sqrt[3]{\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. pow389.8%

        \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im}\right)}^{3}} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      3. *-commutative89.8%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right)}}\right)}^{3} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      4. difference-of-squares89.8%

        \[\leadsto {\left(\sqrt[3]{x.im \cdot \color{blue}{\left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)}}\right)}^{3} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      5. associate-*r*99.2%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}}\right)}^{3} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    3. Applied egg-rr99.2%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}\right)}^{3}} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    4. Step-by-step derivation
      1. unpow399.1%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)} \cdot \sqrt[3]{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}\right) \cdot \sqrt[3]{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      2. add-cube-cbrt99.6%

        \[\leadsto \color{blue}{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      3. *-commutative99.6%

        \[\leadsto \color{blue}{\left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.re + x.im\right)\right)} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      4. +-commutative99.6%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \color{blue}{\left(x.im + x.re\right)}\right) + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    5. Applied egg-rr99.6%

      \[\leadsto \color{blue}{\left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right)} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    6. Step-by-step derivation
      1. *-commutative99.6%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(x.re \cdot x.im + \color{blue}{x.re \cdot x.im}\right) \cdot x.re \]
      2. distribute-lft-out99.6%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \color{blue}{\left(x.re \cdot \left(x.im + x.im\right)\right)} \cdot x.re \]
    7. Applied egg-rr99.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -1 \cdot 10^{+130} \lor \neg \left(x.im \leq 1.95 \cdot 10^{+44}\right):\\ \;\;\;\;\left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.re + x.im\right)\right) + x.re \cdot 0\\ \mathbf{else}:\\ \;\;\;\;\left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.re + x.im\right)\right) + x.re \cdot \left(x.re \cdot \left(x.im + x.im\right)\right)\\ \end{array} \]

Alternative 3: 85.9% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.im \leq -1.9 \cdot 10^{-101} \lor \neg \left(x.im \leq 1.4 \cdot 10^{-29}\right):\\ \;\;\;\;\left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.re + x.im\right)\right) + x.re \cdot 0\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.im \cdot 3\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im)
 :precision binary64
 (if (or (<= x.im -1.9e-101) (not (<= x.im 1.4e-29)))
   (+ (* (- x.re x.im) (* x.im (+ x.re x.im))) (* x.re 0.0))
   (* (* x.re x.re) (* x.im 3.0))))
double code(double x_46_re, double x_46_im) {
	double tmp;
	if ((x_46_im <= -1.9e-101) || !(x_46_im <= 1.4e-29)) {
		tmp = ((x_46_re - x_46_im) * (x_46_im * (x_46_re + x_46_im))) + (x_46_re * 0.0);
	} else {
		tmp = (x_46_re * x_46_re) * (x_46_im * 3.0);
	}
	return tmp;
}
real(8) function code(x_46re, x_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8) :: tmp
    if ((x_46im <= (-1.9d-101)) .or. (.not. (x_46im <= 1.4d-29))) then
        tmp = ((x_46re - x_46im) * (x_46im * (x_46re + x_46im))) + (x_46re * 0.0d0)
    else
        tmp = (x_46re * x_46re) * (x_46im * 3.0d0)
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
	double tmp;
	if ((x_46_im <= -1.9e-101) || !(x_46_im <= 1.4e-29)) {
		tmp = ((x_46_re - x_46_im) * (x_46_im * (x_46_re + x_46_im))) + (x_46_re * 0.0);
	} else {
		tmp = (x_46_re * x_46_re) * (x_46_im * 3.0);
	}
	return tmp;
}
def code(x_46_re, x_46_im):
	tmp = 0
	if (x_46_im <= -1.9e-101) or not (x_46_im <= 1.4e-29):
		tmp = ((x_46_re - x_46_im) * (x_46_im * (x_46_re + x_46_im))) + (x_46_re * 0.0)
	else:
		tmp = (x_46_re * x_46_re) * (x_46_im * 3.0)
	return tmp
function code(x_46_re, x_46_im)
	tmp = 0.0
	if ((x_46_im <= -1.9e-101) || !(x_46_im <= 1.4e-29))
		tmp = Float64(Float64(Float64(x_46_re - x_46_im) * Float64(x_46_im * Float64(x_46_re + x_46_im))) + Float64(x_46_re * 0.0));
	else
		tmp = Float64(Float64(x_46_re * x_46_re) * Float64(x_46_im * 3.0));
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im)
	tmp = 0.0;
	if ((x_46_im <= -1.9e-101) || ~((x_46_im <= 1.4e-29)))
		tmp = ((x_46_re - x_46_im) * (x_46_im * (x_46_re + x_46_im))) + (x_46_re * 0.0);
	else
		tmp = (x_46_re * x_46_re) * (x_46_im * 3.0);
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -1.9e-101], N[Not[LessEqual[x$46$im, 1.4e-29]], $MachinePrecision]], N[(N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$im * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x$46$re * 0.0), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$re * x$46$re), $MachinePrecision] * N[(x$46$im * 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -1.9 \cdot 10^{-101} \lor \neg \left(x.im \leq 1.4 \cdot 10^{-29}\right):\\
\;\;\;\;\left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.re + x.im\right)\right) + x.re \cdot 0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -1.90000000000000005e-101 or 1.4000000000000001e-29 < x.im

    1. Initial program 75.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. Step-by-step derivation
      1. add-cube-cbrt75.0%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im} \cdot \sqrt[3]{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im}\right) \cdot \sqrt[3]{\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. pow375.1%

        \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im}\right)}^{3}} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      3. *-commutative75.1%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right)}}\right)}^{3} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      4. difference-of-squares82.0%

        \[\leadsto {\left(\sqrt[3]{x.im \cdot \color{blue}{\left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)}}\right)}^{3} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      5. associate-*r*82.6%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}}\right)}^{3} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    3. Applied egg-rr82.6%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}\right)}^{3}} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    4. Step-by-step derivation
      1. unpow382.5%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)} \cdot \sqrt[3]{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}\right) \cdot \sqrt[3]{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      2. add-cube-cbrt82.9%

        \[\leadsto \color{blue}{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      3. *-commutative82.9%

        \[\leadsto \color{blue}{\left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.re + x.im\right)\right)} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      4. +-commutative82.9%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \color{blue}{\left(x.im + x.re\right)}\right) + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    5. Applied egg-rr82.9%

      \[\leadsto \color{blue}{\left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right)} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    6. Step-by-step derivation
      1. *-commutative82.9%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(x.re \cdot x.im + \color{blue}{x.re \cdot x.im}\right) \cdot x.re \]
      2. flip-+0.0%

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

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

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{\color{blue}{{\left(x.re \cdot x.im\right)}^{2}}}{x.re \cdot x.im - x.re \cdot x.im} - \frac{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right)}{x.re \cdot x.im - x.re \cdot x.im}\right) \cdot x.re \]
      5. *-commutative0.0%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{{\color{blue}{\left(x.im \cdot x.re\right)}}^{2}}{x.re \cdot x.im - x.re \cdot x.im} - \frac{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right)}{x.re \cdot x.im - x.re \cdot x.im}\right) \cdot x.re \]
      6. *-commutative0.0%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{{\left(x.im \cdot x.re\right)}^{2}}{x.re \cdot x.im - \color{blue}{x.im \cdot x.re}} - \frac{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right)}{x.re \cdot x.im - x.re \cdot x.im}\right) \cdot x.re \]
      7. *-commutative0.0%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{{\left(x.im \cdot x.re\right)}^{2}}{\color{blue}{x.im \cdot x.re} - x.im \cdot x.re} - \frac{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right)}{x.re \cdot x.im - x.re \cdot x.im}\right) \cdot x.re \]
      8. pow20.0%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{{\left(x.im \cdot x.re\right)}^{2}}{x.im \cdot x.re - x.im \cdot x.re} - \frac{\color{blue}{{\left(x.re \cdot x.im\right)}^{2}}}{x.re \cdot x.im - x.re \cdot x.im}\right) \cdot x.re \]
      9. *-commutative0.0%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{{\left(x.im \cdot x.re\right)}^{2}}{x.im \cdot x.re - x.im \cdot x.re} - \frac{{\color{blue}{\left(x.im \cdot x.re\right)}}^{2}}{x.re \cdot x.im - x.re \cdot x.im}\right) \cdot x.re \]
      10. *-commutative0.0%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{{\left(x.im \cdot x.re\right)}^{2}}{x.im \cdot x.re - x.im \cdot x.re} - \frac{{\left(x.im \cdot x.re\right)}^{2}}{x.re \cdot x.im - \color{blue}{x.im \cdot x.re}}\right) \cdot x.re \]
      11. *-commutative0.0%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \left(\frac{{\left(x.im \cdot x.re\right)}^{2}}{x.im \cdot x.re - x.im \cdot x.re} - \frac{{\left(x.im \cdot x.re\right)}^{2}}{\color{blue}{x.im \cdot x.re} - x.im \cdot x.re}\right) \cdot x.re \]
    7. Applied egg-rr0.0%

      \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \color{blue}{\left(\frac{{\left(x.im \cdot x.re\right)}^{2}}{x.im \cdot x.re - x.im \cdot x.re} - \frac{{\left(x.im \cdot x.re\right)}^{2}}{x.im \cdot x.re - x.im \cdot x.re}\right)} \cdot x.re \]
    8. Step-by-step derivation
      1. +-inverses93.8%

        \[\leadsto \left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.im + x.re\right)\right) + \color{blue}{0} \cdot x.re \]
    9. Simplified93.8%

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

    if -1.90000000000000005e-101 < x.im < 1.4000000000000001e-29

    1. Initial program 86.2%

      \[\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. Taylor expanded in x.re around inf 82.1%

      \[\leadsto \color{blue}{{x.re}^{2}} \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    3. Simplified82.1%

      \[\leadsto \color{blue}{\left(x.re \cdot x.re\right)} \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    4. Taylor expanded in x.re around 0 82.2%

      \[\leadsto \color{blue}{{x.re}^{2} \cdot \left(x.im + 2 \cdot x.im\right)} \]
    5. Step-by-step derivation
      1. unpow282.2%

        \[\leadsto \color{blue}{\left(x.re \cdot x.re\right)} \cdot \left(x.im + 2 \cdot x.im\right) \]
      2. distribute-rgt1-in82.2%

        \[\leadsto \left(x.re \cdot x.re\right) \cdot \color{blue}{\left(\left(2 + 1\right) \cdot x.im\right)} \]
      3. metadata-eval82.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -1.9 \cdot 10^{-101} \lor \neg \left(x.im \leq 1.4 \cdot 10^{-29}\right):\\ \;\;\;\;\left(x.re - x.im\right) \cdot \left(x.im \cdot \left(x.re + x.im\right)\right) + x.re \cdot 0\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.im \cdot 3\right)\\ \end{array} \]

Alternative 4: 34.8% accurate, 2.7× speedup?

\[\begin{array}{l} \\ 2 \cdot \left(x.re \cdot \left(x.re \cdot x.im\right)\right) \end{array} \]
(FPCore (x.re x.im) :precision binary64 (* 2.0 (* x.re (* x.re x.im))))
double code(double x_46_re, double x_46_im) {
	return 2.0 * (x_46_re * (x_46_re * x_46_im));
}
real(8) function code(x_46re, x_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    code = 2.0d0 * (x_46re * (x_46re * x_46im))
end function
public static double code(double x_46_re, double x_46_im) {
	return 2.0 * (x_46_re * (x_46_re * x_46_im));
}
def code(x_46_re, x_46_im):
	return 2.0 * (x_46_re * (x_46_re * x_46_im))
function code(x_46_re, x_46_im)
	return Float64(2.0 * Float64(x_46_re * Float64(x_46_re * x_46_im)))
end
function tmp = code(x_46_re, x_46_im)
	tmp = 2.0 * (x_46_re * (x_46_re * x_46_im));
end
code[x$46$re_, x$46$im_] := N[(2.0 * N[(x$46$re * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
2 \cdot \left(x.re \cdot \left(x.re \cdot x.im\right)\right)
\end{array}
Derivation
  1. Initial program 79.5%

    \[\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. Step-by-step derivation
    1. add-cube-cbrt79.2%

      \[\leadsto \color{blue}{\left(\sqrt[3]{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im} \cdot \sqrt[3]{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im}\right) \cdot \sqrt[3]{\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. pow379.2%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im}\right)}^{3}} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    3. *-commutative79.2%

      \[\leadsto {\left(\sqrt[3]{\color{blue}{x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right)}}\right)}^{3} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    4. difference-of-squares83.5%

      \[\leadsto {\left(\sqrt[3]{x.im \cdot \color{blue}{\left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)}}\right)}^{3} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    5. associate-*r*88.9%

      \[\leadsto {\left(\sqrt[3]{\color{blue}{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}}\right)}^{3} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
  3. Applied egg-rr88.9%

    \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x.im \cdot \left(x.re + x.im\right)\right) \cdot \left(x.re - x.im\right)}\right)}^{3}} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
  4. Taylor expanded in x.im around 0 31.0%

    \[\leadsto \color{blue}{2 \cdot \left({x.re}^{2} \cdot x.im\right)} \]
  5. Step-by-step derivation
    1. *-commutative31.0%

      \[\leadsto 2 \cdot \color{blue}{\left(x.im \cdot {x.re}^{2}\right)} \]
    2. unpow231.0%

      \[\leadsto 2 \cdot \left(x.im \cdot \color{blue}{\left(x.re \cdot x.re\right)}\right) \]
    3. associate-*r*31.8%

      \[\leadsto 2 \cdot \color{blue}{\left(\left(x.im \cdot x.re\right) \cdot x.re\right)} \]
  6. Simplified31.8%

    \[\leadsto \color{blue}{2 \cdot \left(\left(x.im \cdot x.re\right) \cdot x.re\right)} \]
  7. Final simplification31.8%

    \[\leadsto 2 \cdot \left(x.re \cdot \left(x.re \cdot x.im\right)\right) \]

Alternative 5: 49.1% accurate, 2.7× speedup?

\[\begin{array}{l} \\ x.im \cdot \left(\left(x.re \cdot x.re\right) \cdot 3\right) \end{array} \]
(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(Float64(x_46_re * 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[(N[(x$46$re * x$46$re), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x.im \cdot \left(\left(x.re \cdot x.re\right) \cdot 3\right)
\end{array}
Derivation
  1. Initial program 79.5%

    \[\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. Taylor expanded in x.re around inf 48.1%

    \[\leadsto \color{blue}{{x.re}^{2}} \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
  3. Simplified48.1%

    \[\leadsto \color{blue}{\left(x.re \cdot x.re\right)} \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
  4. Taylor expanded in x.im around 0 48.1%

    \[\leadsto \color{blue}{\left(2 \cdot {x.re}^{2} + {x.re}^{2}\right) \cdot x.im} \]
  5. Step-by-step derivation
    1. *-commutative48.1%

      \[\leadsto \color{blue}{x.im \cdot \left(2 \cdot {x.re}^{2} + {x.re}^{2}\right)} \]
    2. distribute-lft1-in48.1%

      \[\leadsto x.im \cdot \color{blue}{\left(\left(2 + 1\right) \cdot {x.re}^{2}\right)} \]
    3. metadata-eval48.1%

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

      \[\leadsto x.im \cdot \left(3 \cdot \color{blue}{\left(x.re \cdot x.re\right)}\right) \]
  6. Simplified48.1%

    \[\leadsto \color{blue}{x.im \cdot \left(3 \cdot \left(x.re \cdot x.re\right)\right)} \]
  7. Final simplification48.1%

    \[\leadsto x.im \cdot \left(\left(x.re \cdot x.re\right) \cdot 3\right) \]

Alternative 6: 49.1% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \left(x.re \cdot x.re\right) \cdot \left(x.im \cdot 3\right) \end{array} \]
(FPCore (x.re x.im) :precision binary64 (* (* x.re x.re) (* x.im 3.0)))
double code(double x_46_re, double x_46_im) {
	return (x_46_re * x_46_re) * (x_46_im * 3.0);
}
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 * 3.0d0)
end function
public static double code(double x_46_re, double x_46_im) {
	return (x_46_re * x_46_re) * (x_46_im * 3.0);
}
def code(x_46_re, x_46_im):
	return (x_46_re * x_46_re) * (x_46_im * 3.0)
function code(x_46_re, x_46_im)
	return Float64(Float64(x_46_re * x_46_re) * Float64(x_46_im * 3.0))
end
function tmp = code(x_46_re, x_46_im)
	tmp = (x_46_re * x_46_re) * (x_46_im * 3.0);
end
code[x$46$re_, x$46$im_] := N[(N[(x$46$re * x$46$re), $MachinePrecision] * N[(x$46$im * 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x.re \cdot x.re\right) \cdot \left(x.im \cdot 3\right)
\end{array}
Derivation
  1. Initial program 79.5%

    \[\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. Taylor expanded in x.re around inf 48.1%

    \[\leadsto \color{blue}{{x.re}^{2}} \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
  3. Simplified48.1%

    \[\leadsto \color{blue}{\left(x.re \cdot x.re\right)} \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
  4. Taylor expanded in x.re around 0 48.1%

    \[\leadsto \color{blue}{{x.re}^{2} \cdot \left(x.im + 2 \cdot x.im\right)} \]
  5. Step-by-step derivation
    1. unpow248.1%

      \[\leadsto \color{blue}{\left(x.re \cdot x.re\right)} \cdot \left(x.im + 2 \cdot x.im\right) \]
    2. distribute-rgt1-in48.1%

      \[\leadsto \left(x.re \cdot x.re\right) \cdot \color{blue}{\left(\left(2 + 1\right) \cdot x.im\right)} \]
    3. metadata-eval48.1%

      \[\leadsto \left(x.re \cdot x.re\right) \cdot \left(\color{blue}{3} \cdot x.im\right) \]
  6. Simplified48.1%

    \[\leadsto \color{blue}{\left(x.re \cdot x.re\right) \cdot \left(3 \cdot x.im\right)} \]
  7. Final simplification48.1%

    \[\leadsto \left(x.re \cdot x.re\right) \cdot \left(x.im \cdot 3\right) \]

Alternative 7: 33.5% accurate, 3.8× speedup?

\[\begin{array}{l} \\ \left(x.re \cdot x.re\right) \cdot x.im \end{array} \]
(FPCore (x.re x.im) :precision binary64 (* (* x.re x.re) x.im))
double code(double x_46_re, double x_46_im) {
	return (x_46_re * x_46_re) * x_46_im;
}
real(8) function code(x_46re, x_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    code = (x_46re * x_46re) * x_46im
end function
public static double code(double x_46_re, double x_46_im) {
	return (x_46_re * x_46_re) * x_46_im;
}
def code(x_46_re, x_46_im):
	return (x_46_re * x_46_re) * x_46_im
function code(x_46_re, x_46_im)
	return Float64(Float64(x_46_re * x_46_re) * x_46_im)
end
function tmp = code(x_46_re, x_46_im)
	tmp = (x_46_re * x_46_re) * x_46_im;
end
code[x$46$re_, x$46$im_] := N[(N[(x$46$re * x$46$re), $MachinePrecision] * x$46$im), $MachinePrecision]
\begin{array}{l}

\\
\left(x.re \cdot x.re\right) \cdot x.im
\end{array}
Derivation
  1. Initial program 79.5%

    \[\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. Step-by-step derivation
    1. *-commutative79.5%

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \color{blue}{x.re \cdot \left(x.re \cdot x.im + x.im \cdot x.re\right)} \]
    2. *-commutative79.5%

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + x.re \cdot \left(x.re \cdot x.im + \color{blue}{x.re \cdot x.im}\right) \]
    3. flip-+0.0%

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

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

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

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + x.re \cdot \frac{x.im \cdot x.im - x.im \cdot x.im}{\color{blue}{x.im - x.im}} \]
    8. flip-+60.0%

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + x.re \cdot \color{blue}{\left(x.im + x.im\right)} \]
    9. distribute-lft-in60.0%

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \color{blue}{\left(x.re \cdot x.im + x.re \cdot x.im\right)} \]
    10. flip-+0.0%

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

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

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

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \frac{x.im \cdot x.im - x.im \cdot x.im}{\color{blue}{x.im - x.im}} \]
    15. flip-+53.0%

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

    \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \color{blue}{\left(x.im + x.im\right)} \]
  4. Taylor expanded in x.re around inf 30.5%

    \[\leadsto \color{blue}{{x.re}^{2} \cdot x.im} \]
  5. Step-by-step derivation
    1. *-commutative30.5%

      \[\leadsto \color{blue}{x.im \cdot {x.re}^{2}} \]
    2. unpow230.5%

      \[\leadsto x.im \cdot \color{blue}{\left(x.re \cdot x.re\right)} \]
  6. Simplified30.5%

    \[\leadsto \color{blue}{x.im \cdot \left(x.re \cdot x.re\right)} \]
  7. Final simplification30.5%

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

Alternative 8: 34.2% accurate, 3.8× speedup?

\[\begin{array}{l} \\ x.re \cdot \left(x.re \cdot x.im\right) \end{array} \]
(FPCore (x.re x.im) :precision binary64 (* x.re (* x.re x.im)))
double code(double x_46_re, double x_46_im) {
	return x_46_re * (x_46_re * x_46_im);
}
real(8) function code(x_46re, x_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    code = x_46re * (x_46re * x_46im)
end function
public static double code(double x_46_re, double x_46_im) {
	return x_46_re * (x_46_re * x_46_im);
}
def code(x_46_re, x_46_im):
	return x_46_re * (x_46_re * x_46_im)
function code(x_46_re, x_46_im)
	return Float64(x_46_re * Float64(x_46_re * x_46_im))
end
function tmp = code(x_46_re, x_46_im)
	tmp = x_46_re * (x_46_re * x_46_im);
end
code[x$46$re_, x$46$im_] := N[(x$46$re * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x.re \cdot \left(x.re \cdot x.im\right)
\end{array}
Derivation
  1. Initial program 79.5%

    \[\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. Step-by-step derivation
    1. *-commutative79.5%

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \color{blue}{x.re \cdot \left(x.re \cdot x.im + x.im \cdot x.re\right)} \]
    2. *-commutative79.5%

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + x.re \cdot \left(x.re \cdot x.im + \color{blue}{x.re \cdot x.im}\right) \]
    3. flip-+0.0%

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

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

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

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + x.re \cdot \frac{x.im \cdot x.im - x.im \cdot x.im}{\color{blue}{x.im - x.im}} \]
    8. flip-+60.0%

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + x.re \cdot \color{blue}{\left(x.im + x.im\right)} \]
    9. distribute-lft-in60.0%

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \color{blue}{\left(x.re \cdot x.im + x.re \cdot x.im\right)} \]
    10. flip-+0.0%

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

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

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

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \frac{x.im \cdot x.im - x.im \cdot x.im}{\color{blue}{x.im - x.im}} \]
    15. flip-+53.0%

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

    \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \color{blue}{\left(x.im + x.im\right)} \]
  4. Taylor expanded in x.re around inf 30.5%

    \[\leadsto \color{blue}{{x.re}^{2} \cdot x.im} \]
  5. Step-by-step derivation
    1. *-commutative30.5%

      \[\leadsto \color{blue}{x.im \cdot {x.re}^{2}} \]
    2. unpow230.5%

      \[\leadsto x.im \cdot \color{blue}{\left(x.re \cdot x.re\right)} \]
    3. associate-*r*31.2%

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

    \[\leadsto \color{blue}{\left(x.im \cdot x.re\right) \cdot x.re} \]
  7. Final simplification31.2%

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

Alternative 9: 2.7% accurate, 19.0× speedup?

\[\begin{array}{l} \\ -10 \end{array} \]
(FPCore (x.re x.im) :precision binary64 -10.0)
double code(double x_46_re, double x_46_im) {
	return -10.0;
}
real(8) function code(x_46re, x_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    code = -10.0d0
end function
public static double code(double x_46_re, double x_46_im) {
	return -10.0;
}
def code(x_46_re, x_46_im):
	return -10.0
function code(x_46_re, x_46_im)
	return -10.0
end
function tmp = code(x_46_re, x_46_im)
	tmp = -10.0;
end
code[x$46$re_, x$46$im_] := -10.0
\begin{array}{l}

\\
-10
\end{array}
Derivation
  1. Initial program 79.5%

    \[\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. Step-by-step derivation
    1. +-commutative79.5%

      \[\leadsto \color{blue}{\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re + \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im} \]
    2. *-commutative79.5%

      \[\leadsto \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re + \color{blue}{x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right)} \]
    3. sub-neg79.5%

      \[\leadsto \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re + x.im \cdot \color{blue}{\left(x.re \cdot x.re + \left(-x.im \cdot x.im\right)\right)} \]
    4. distribute-lft-in76.8%

      \[\leadsto \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re + \color{blue}{\left(x.im \cdot \left(x.re \cdot x.re\right) + x.im \cdot \left(-x.im \cdot x.im\right)\right)} \]
    5. associate-+r+76.8%

      \[\leadsto \color{blue}{\left(\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re + x.im \cdot \left(x.re \cdot x.re\right)\right) + x.im \cdot \left(-x.im \cdot x.im\right)} \]
    6. distribute-rgt-neg-out76.8%

      \[\leadsto \left(\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re + x.im \cdot \left(x.re \cdot x.re\right)\right) + \color{blue}{\left(-x.im \cdot \left(x.im \cdot x.im\right)\right)} \]
    7. unsub-neg76.8%

      \[\leadsto \color{blue}{\left(\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re + x.im \cdot \left(x.re \cdot x.re\right)\right) - x.im \cdot \left(x.im \cdot x.im\right)} \]
    8. associate-*r*82.2%

      \[\leadsto \left(\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re + \color{blue}{\left(x.im \cdot x.re\right) \cdot x.re}\right) - x.im \cdot \left(x.im \cdot x.im\right) \]
    9. distribute-rgt-out82.2%

      \[\leadsto \color{blue}{x.re \cdot \left(\left(x.re \cdot x.im + x.im \cdot x.re\right) + x.im \cdot x.re\right)} - x.im \cdot \left(x.im \cdot x.im\right) \]
    10. *-commutative82.2%

      \[\leadsto x.re \cdot \left(\left(\color{blue}{x.im \cdot x.re} + x.im \cdot x.re\right) + x.im \cdot x.re\right) - x.im \cdot \left(x.im \cdot x.im\right) \]
    11. count-282.2%

      \[\leadsto x.re \cdot \left(\color{blue}{2 \cdot \left(x.im \cdot x.re\right)} + x.im \cdot x.re\right) - x.im \cdot \left(x.im \cdot x.im\right) \]
    12. distribute-lft1-in82.2%

      \[\leadsto x.re \cdot \color{blue}{\left(\left(2 + 1\right) \cdot \left(x.im \cdot x.re\right)\right)} - x.im \cdot \left(x.im \cdot x.im\right) \]
    13. metadata-eval82.2%

      \[\leadsto x.re \cdot \left(\color{blue}{3} \cdot \left(x.im \cdot x.re\right)\right) - x.im \cdot \left(x.im \cdot x.im\right) \]
    14. *-commutative82.2%

      \[\leadsto x.re \cdot \color{blue}{\left(\left(x.im \cdot x.re\right) \cdot 3\right)} - x.im \cdot \left(x.im \cdot x.im\right) \]
    15. *-commutative82.2%

      \[\leadsto x.re \cdot \left(\color{blue}{\left(x.re \cdot x.im\right)} \cdot 3\right) - x.im \cdot \left(x.im \cdot x.im\right) \]
    16. associate-*r*81.8%

      \[\leadsto x.re \cdot \color{blue}{\left(x.re \cdot \left(x.im \cdot 3\right)\right)} - x.im \cdot \left(x.im \cdot x.im\right) \]
    17. cube-unmult81.8%

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

    \[\leadsto \color{blue}{x.re \cdot \left(x.re \cdot \left(x.im \cdot 3\right)\right) - {x.im}^{3}} \]
  4. Step-by-step derivation
    1. associate-*r*82.3%

      \[\leadsto x.re \cdot \color{blue}{\left(\left(x.re \cdot x.im\right) \cdot 3\right)} - {x.im}^{3} \]
    2. associate-*l*82.2%

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

      \[\leadsto \color{blue}{\frac{\left(\left(x.re \cdot \left(x.re \cdot x.im\right)\right) \cdot 3\right) \cdot \left(\left(x.re \cdot \left(x.re \cdot x.im\right)\right) \cdot 3\right) - {x.im}^{3} \cdot {x.im}^{3}}{\left(x.re \cdot \left(x.re \cdot x.im\right)\right) \cdot 3 + {x.im}^{3}}} \]
    4. div-inv18.3%

      \[\leadsto \color{blue}{\left(\left(\left(x.re \cdot \left(x.re \cdot x.im\right)\right) \cdot 3\right) \cdot \left(\left(x.re \cdot \left(x.re \cdot x.im\right)\right) \cdot 3\right) - {x.im}^{3} \cdot {x.im}^{3}\right) \cdot \frac{1}{\left(x.re \cdot \left(x.re \cdot x.im\right)\right) \cdot 3 + {x.im}^{3}}} \]
    5. swap-sqr18.2%

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

      \[\leadsto \left(\color{blue}{{\left(x.re \cdot \left(x.re \cdot x.im\right)\right)}^{2}} \cdot \left(3 \cdot 3\right) - {x.im}^{3} \cdot {x.im}^{3}\right) \cdot \frac{1}{\left(x.re \cdot \left(x.re \cdot x.im\right)\right) \cdot 3 + {x.im}^{3}} \]
    7. metadata-eval18.2%

      \[\leadsto \left({\left(x.re \cdot \left(x.re \cdot x.im\right)\right)}^{2} \cdot \color{blue}{9} - {x.im}^{3} \cdot {x.im}^{3}\right) \cdot \frac{1}{\left(x.re \cdot \left(x.re \cdot x.im\right)\right) \cdot 3 + {x.im}^{3}} \]
    8. pow-prod-up18.2%

      \[\leadsto \left({\left(x.re \cdot \left(x.re \cdot x.im\right)\right)}^{2} \cdot 9 - \color{blue}{{x.im}^{\left(3 + 3\right)}}\right) \cdot \frac{1}{\left(x.re \cdot \left(x.re \cdot x.im\right)\right) \cdot 3 + {x.im}^{3}} \]
    9. metadata-eval18.2%

      \[\leadsto \left({\left(x.re \cdot \left(x.re \cdot x.im\right)\right)}^{2} \cdot 9 - {x.im}^{\color{blue}{6}}\right) \cdot \frac{1}{\left(x.re \cdot \left(x.re \cdot x.im\right)\right) \cdot 3 + {x.im}^{3}} \]
    10. associate-*l*18.2%

      \[\leadsto \left({\left(x.re \cdot \left(x.re \cdot x.im\right)\right)}^{2} \cdot 9 - {x.im}^{6}\right) \cdot \frac{1}{\color{blue}{x.re \cdot \left(\left(x.re \cdot x.im\right) \cdot 3\right)} + {x.im}^{3}} \]
    11. associate-*r*18.2%

      \[\leadsto \left({\left(x.re \cdot \left(x.re \cdot x.im\right)\right)}^{2} \cdot 9 - {x.im}^{6}\right) \cdot \frac{1}{x.re \cdot \color{blue}{\left(x.re \cdot \left(x.im \cdot 3\right)\right)} + {x.im}^{3}} \]
    12. fma-def18.2%

      \[\leadsto \left({\left(x.re \cdot \left(x.re \cdot x.im\right)\right)}^{2} \cdot 9 - {x.im}^{6}\right) \cdot \frac{1}{\color{blue}{\mathsf{fma}\left(x.re, x.re \cdot \left(x.im \cdot 3\right), {x.im}^{3}\right)}} \]
  5. Applied egg-rr18.2%

    \[\leadsto \color{blue}{\left({\left(x.re \cdot \left(x.re \cdot x.im\right)\right)}^{2} \cdot 9 - {x.im}^{6}\right) \cdot \frac{1}{\mathsf{fma}\left(x.re, x.re \cdot \left(x.im \cdot 3\right), {x.im}^{3}\right)}} \]
  6. Simplified2.7%

    \[\leadsto \color{blue}{-10} \]
  7. Final simplification2.7%

    \[\leadsto -10 \]

Developer target: 91.4% accurate, 1.1× speedup?

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

Reproduce

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