math.cube on complex, real part

Percentage Accurate: 82.4% → 97.4%
Time: 8.0s
Alternatives: 13
Speedup: 0.5×

Specification

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

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

\\
\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im
\end{array}

Alternative 1: 97.4% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) - x.im \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right) \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(x.re \cdot x.im, x.im \cdot -3, {x.re}^{3}\right)\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) - x.im \cdot -2\\ \end{array} \end{array} \]
(FPCore (x.re x.im)
 :precision binary64
 (if (<=
      (-
       (* x.re (- (* x.re x.re) (* x.im x.im)))
       (* x.im (+ (* x.re x.im) (* x.re x.im))))
      INFINITY)
   (fma (* x.re x.im) (* x.im -3.0) (pow x.re 3.0))
   (- (* x.re (* (- x.re x.im) (+ x.re x.im))) (* x.im -2.0))))
double code(double x_46_re, double x_46_im) {
	double tmp;
	if (((x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)))) <= ((double) INFINITY)) {
		tmp = fma((x_46_re * x_46_im), (x_46_im * -3.0), pow(x_46_re, 3.0));
	} else {
		tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) - (x_46_im * -2.0);
	}
	return tmp;
}
function code(x_46_re, x_46_im)
	tmp = 0.0
	if (Float64(Float64(x_46_re * Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im))) - Float64(x_46_im * Float64(Float64(x_46_re * x_46_im) + Float64(x_46_re * x_46_im)))) <= Inf)
		tmp = fma(Float64(x_46_re * x_46_im), Float64(x_46_im * -3.0), (x_46_re ^ 3.0));
	else
		tmp = Float64(Float64(x_46_re * Float64(Float64(x_46_re - x_46_im) * Float64(x_46_re + x_46_im))) - Float64(x_46_im * -2.0));
	end
	return tmp
end
code[x$46$re_, x$46$im_] := If[LessEqual[N[(N[(x$46$re * N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$im * N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(x$46$re * x$46$im), $MachinePrecision] * N[(x$46$im * -3.0), $MachinePrecision] + N[Power[x$46$re, 3.0], $MachinePrecision]), $MachinePrecision], N[(N[(x$46$re * N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$im * -2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) - x.im \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right) \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(x.re \cdot x.im, x.im \cdot -3, {x.re}^{3}\right)\\

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


\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.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im)) < +inf.0

    1. Initial program 93.9%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x.re \cdot x.im, x.im \cdot -3, {x.re}^{3}\right)} \]
    4. Applied egg-rr98.5%

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

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

    1. Initial program 0.0%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Step-by-step derivation
      1. difference-of-squares19.4%

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

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

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

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \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}} \cdot x.im \]
      3. +-inverses0.0%

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

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

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\color{blue}{\left(\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)\right)}}{0} \cdot x.im \]
      7. *-commutative0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\left(\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)\right)}{\color{blue}{\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)}} \cdot x.im \]
      9. *-commutative0.0%

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\left(\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)\right)}{\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \color{blue}{\left(x.re \cdot x.im\right)} \cdot \left(x.im \cdot x.re\right)} \cdot x.im \]
      10. distribute-neg-frac0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \left(-\frac{\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \color{blue}{\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) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      12. *-commutative0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \left(-\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)}{\color{blue}{0}}\right) \cdot x.im \]
    5. Applied egg-rr0.0%

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

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

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

Alternative 2: 92.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x.im \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\\ \mathbf{if}\;x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) - t_0 \leq 2 \cdot 10^{+271}:\\ \;\;\;\;x.re \cdot \left(x.re \cdot \left(x.re - x.im\right) + x.im \cdot \left(x.re - x.im\right)\right) - t_0\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) - x.im \cdot -2\\ \end{array} \end{array} \]
(FPCore (x.re x.im)
 :precision binary64
 (let* ((t_0 (* x.im (+ (* x.re x.im) (* x.re x.im)))))
   (if (<= (- (* x.re (- (* x.re x.re) (* x.im x.im))) t_0) 2e+271)
     (- (* x.re (+ (* x.re (- x.re x.im)) (* x.im (- x.re x.im)))) t_0)
     (- (* x.re (* (- x.re x.im) (+ x.re x.im))) (* x.im -2.0)))))
double code(double x_46_re, double x_46_im) {
	double t_0 = x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im));
	double tmp;
	if (((x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - t_0) <= 2e+271) {
		tmp = (x_46_re * ((x_46_re * (x_46_re - x_46_im)) + (x_46_im * (x_46_re - x_46_im)))) - t_0;
	} else {
		tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) - (x_46_im * -2.0);
	}
	return tmp;
}
real(8) function code(x_46re, x_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x_46im * ((x_46re * x_46im) + (x_46re * x_46im))
    if (((x_46re * ((x_46re * x_46re) - (x_46im * x_46im))) - t_0) <= 2d+271) then
        tmp = (x_46re * ((x_46re * (x_46re - x_46im)) + (x_46im * (x_46re - x_46im)))) - t_0
    else
        tmp = (x_46re * ((x_46re - x_46im) * (x_46re + x_46im))) - (x_46im * (-2.0d0))
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
	double t_0 = x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im));
	double tmp;
	if (((x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - t_0) <= 2e+271) {
		tmp = (x_46_re * ((x_46_re * (x_46_re - x_46_im)) + (x_46_im * (x_46_re - x_46_im)))) - t_0;
	} else {
		tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) - (x_46_im * -2.0);
	}
	return tmp;
}
def code(x_46_re, x_46_im):
	t_0 = x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im))
	tmp = 0
	if ((x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - t_0) <= 2e+271:
		tmp = (x_46_re * ((x_46_re * (x_46_re - x_46_im)) + (x_46_im * (x_46_re - x_46_im)))) - t_0
	else:
		tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) - (x_46_im * -2.0)
	return tmp
function code(x_46_re, x_46_im)
	t_0 = Float64(x_46_im * Float64(Float64(x_46_re * x_46_im) + Float64(x_46_re * x_46_im)))
	tmp = 0.0
	if (Float64(Float64(x_46_re * Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im))) - t_0) <= 2e+271)
		tmp = Float64(Float64(x_46_re * Float64(Float64(x_46_re * Float64(x_46_re - x_46_im)) + Float64(x_46_im * Float64(x_46_re - x_46_im)))) - t_0);
	else
		tmp = Float64(Float64(x_46_re * Float64(Float64(x_46_re - x_46_im) * Float64(x_46_re + x_46_im))) - Float64(x_46_im * -2.0));
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im)
	t_0 = x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im));
	tmp = 0.0;
	if (((x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - t_0) <= 2e+271)
		tmp = (x_46_re * ((x_46_re * (x_46_re - x_46_im)) + (x_46_im * (x_46_re - x_46_im)))) - t_0;
	else
		tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) - (x_46_im * -2.0);
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(x$46$im * N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(x$46$re * N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], 2e+271], N[(N[(x$46$re * N[(N[(x$46$re * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision] + N[(x$46$im * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(x$46$re * N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$im * -2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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


\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.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im)) < 1.99999999999999991e271

    1. Initial program 97.6%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Step-by-step derivation
      1. difference-of-squares97.6%

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

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

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

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

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

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

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

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

    if 1.99999999999999991e271 < (-.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im))

    1. Initial program 47.2%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Step-by-step derivation
      1. difference-of-squares55.4%

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

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

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

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \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}} \cdot x.im \]
      3. +-inverses0.0%

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

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

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\color{blue}{\left(\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)\right)}}{0} \cdot x.im \]
      7. *-commutative0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\left(\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)\right)}{\color{blue}{\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)}} \cdot x.im \]
      9. *-commutative0.0%

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\left(\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)\right)}{\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \color{blue}{\left(x.re \cdot x.im\right)} \cdot \left(x.im \cdot x.re\right)} \cdot x.im \]
      10. distribute-neg-frac0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \left(-\frac{\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \color{blue}{\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) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      12. *-commutative0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \left(-\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)}{\color{blue}{0}}\right) \cdot x.im \]
    5. Applied egg-rr0.0%

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

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

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

Alternative 3: 93.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right)\\ \mathbf{if}\;x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) - x.im \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right) \leq 2 \cdot 10^{+271}:\\ \;\;\;\;t_0 - x.im \cdot \left(\left(x.re \cdot x.im\right) \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 - x.im \cdot -2\\ \end{array} \end{array} \]
(FPCore (x.re x.im)
 :precision binary64
 (let* ((t_0 (* x.re (* (- x.re x.im) (+ x.re x.im)))))
   (if (<=
        (-
         (* x.re (- (* x.re x.re) (* x.im x.im)))
         (* x.im (+ (* x.re x.im) (* x.re x.im))))
        2e+271)
     (- t_0 (* x.im (* (* x.re x.im) 2.0)))
     (- t_0 (* x.im -2.0)))))
double code(double x_46_re, double x_46_im) {
	double t_0 = x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im));
	double tmp;
	if (((x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)))) <= 2e+271) {
		tmp = t_0 - (x_46_im * ((x_46_re * x_46_im) * 2.0));
	} else {
		tmp = t_0 - (x_46_im * -2.0);
	}
	return tmp;
}
real(8) function code(x_46re, x_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x_46re * ((x_46re - x_46im) * (x_46re + x_46im))
    if (((x_46re * ((x_46re * x_46re) - (x_46im * x_46im))) - (x_46im * ((x_46re * x_46im) + (x_46re * x_46im)))) <= 2d+271) then
        tmp = t_0 - (x_46im * ((x_46re * x_46im) * 2.0d0))
    else
        tmp = t_0 - (x_46im * (-2.0d0))
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
	double t_0 = x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im));
	double tmp;
	if (((x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)))) <= 2e+271) {
		tmp = t_0 - (x_46_im * ((x_46_re * x_46_im) * 2.0));
	} else {
		tmp = t_0 - (x_46_im * -2.0);
	}
	return tmp;
}
def code(x_46_re, x_46_im):
	t_0 = x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))
	tmp = 0
	if ((x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)))) <= 2e+271:
		tmp = t_0 - (x_46_im * ((x_46_re * x_46_im) * 2.0))
	else:
		tmp = t_0 - (x_46_im * -2.0)
	return tmp
function code(x_46_re, x_46_im)
	t_0 = 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_re * Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im))) - Float64(x_46_im * Float64(Float64(x_46_re * x_46_im) + Float64(x_46_re * x_46_im)))) <= 2e+271)
		tmp = Float64(t_0 - Float64(x_46_im * Float64(Float64(x_46_re * x_46_im) * 2.0)));
	else
		tmp = Float64(t_0 - Float64(x_46_im * -2.0));
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im)
	t_0 = x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im));
	tmp = 0.0;
	if (((x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)))) <= 2e+271)
		tmp = t_0 - (x_46_im * ((x_46_re * x_46_im) * 2.0));
	else
		tmp = t_0 - (x_46_im * -2.0);
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_] := Block[{t$95$0 = 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$re * N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$im * N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+271], N[(t$95$0 - N[(x$46$im * N[(N[(x$46$re * x$46$im), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - N[(x$46$im * -2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;t_0 - x.im \cdot -2\\


\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.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im)) < 1.99999999999999991e271

    1. Initial program 97.6%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Step-by-step derivation
      1. difference-of-squares97.6%

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

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

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

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\color{blue}{x.im \cdot x.re} + x.im \cdot x.re\right) \cdot x.im \]
      2. *-un-lft-identity33.7%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\color{blue}{1 \cdot \left(x.im \cdot x.re\right)} + x.im \cdot x.re\right) \cdot x.im \]
      3. *-un-lft-identity33.7%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(1 \cdot \left(x.im \cdot x.re\right) + \color{blue}{1 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      4. distribute-rgt-out33.7%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \color{blue}{\left(\left(x.im \cdot x.re\right) \cdot \left(1 + 1\right)\right)} \cdot x.im \]
      5. *-commutative33.7%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\color{blue}{\left(x.re \cdot x.im\right)} \cdot \left(1 + 1\right)\right) \cdot x.im \]
      6. metadata-eval33.7%

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

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

    if 1.99999999999999991e271 < (-.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im))

    1. Initial program 47.2%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Step-by-step derivation
      1. difference-of-squares55.4%

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

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

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

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \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}} \cdot x.im \]
      3. +-inverses0.0%

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

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

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\color{blue}{\left(\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)\right)}}{0} \cdot x.im \]
      7. *-commutative0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\left(\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)\right)}{\color{blue}{\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)}} \cdot x.im \]
      9. *-commutative0.0%

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\left(\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)\right)}{\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \color{blue}{\left(x.re \cdot x.im\right)} \cdot \left(x.im \cdot x.re\right)} \cdot x.im \]
      10. distribute-neg-frac0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \left(-\frac{\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \color{blue}{\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) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      12. *-commutative0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \left(-\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)}{\color{blue}{0}}\right) \cdot x.im \]
    5. Applied egg-rr0.0%

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

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

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

Alternative 4: 72.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -2 \cdot 10^{-48} \lor \neg \left(x.re \leq 1.75 \cdot 10^{-90}\right):\\
\;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) - x.im \cdot -2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.re < -1.9999999999999999e-48 or 1.7499999999999999e-90 < x.re

    1. Initial program 77.6%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Step-by-step derivation
      1. difference-of-squares81.8%

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

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

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

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \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}} \cdot x.im \]
      3. +-inverses0.0%

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

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

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\color{blue}{\left(\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)\right)}}{0} \cdot x.im \]
      7. *-commutative0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\left(\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)\right)}{\color{blue}{\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)}} \cdot x.im \]
      9. *-commutative0.0%

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\left(\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)\right)}{\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \color{blue}{\left(x.re \cdot x.im\right)} \cdot \left(x.im \cdot x.re\right)} \cdot x.im \]
      10. distribute-neg-frac0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \left(-\frac{\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \color{blue}{\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) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      12. *-commutative0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \left(-\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)}{\color{blue}{0}}\right) \cdot x.im \]
    5. Applied egg-rr0.0%

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

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

    if -1.9999999999999999e-48 < x.re < 1.7499999999999999e-90

    1. Initial program 86.3%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Step-by-step derivation
      1. difference-of-squares86.3%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \leq -2 \cdot 10^{-48} \lor \neg \left(x.re \leq 1.75 \cdot 10^{-90}\right):\\ \;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) - x.im \cdot -2\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot x.im\right) \cdot -27 - x.im \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\\ \end{array} \]

Alternative 5: 58.7% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.re \leq -9000000000000 \lor \neg \left(x.re \leq 2600000000\right):\\ \;\;\;\;x.re \cdot \left(x.re \cdot \left(x.re - 27\right)\right) - x.im \cdot -2\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot -27\right) - x.im \cdot \left(\left(x.re \cdot x.im\right) \cdot 2\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im)
 :precision binary64
 (if (or (<= x.re -9000000000000.0) (not (<= x.re 2600000000.0)))
   (- (* x.re (* x.re (- x.re 27.0))) (* x.im -2.0))
   (- (* x.re (* x.im -27.0)) (* x.im (* (* x.re x.im) 2.0)))))
double code(double x_46_re, double x_46_im) {
	double tmp;
	if ((x_46_re <= -9000000000000.0) || !(x_46_re <= 2600000000.0)) {
		tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) - (x_46_im * -2.0);
	} else {
		tmp = (x_46_re * (x_46_im * -27.0)) - (x_46_im * ((x_46_re * x_46_im) * 2.0));
	}
	return tmp;
}
real(8) function code(x_46re, x_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8) :: tmp
    if ((x_46re <= (-9000000000000.0d0)) .or. (.not. (x_46re <= 2600000000.0d0))) then
        tmp = (x_46re * (x_46re * (x_46re - 27.0d0))) - (x_46im * (-2.0d0))
    else
        tmp = (x_46re * (x_46im * (-27.0d0))) - (x_46im * ((x_46re * x_46im) * 2.0d0))
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
	double tmp;
	if ((x_46_re <= -9000000000000.0) || !(x_46_re <= 2600000000.0)) {
		tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) - (x_46_im * -2.0);
	} else {
		tmp = (x_46_re * (x_46_im * -27.0)) - (x_46_im * ((x_46_re * x_46_im) * 2.0));
	}
	return tmp;
}
def code(x_46_re, x_46_im):
	tmp = 0
	if (x_46_re <= -9000000000000.0) or not (x_46_re <= 2600000000.0):
		tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) - (x_46_im * -2.0)
	else:
		tmp = (x_46_re * (x_46_im * -27.0)) - (x_46_im * ((x_46_re * x_46_im) * 2.0))
	return tmp
function code(x_46_re, x_46_im)
	tmp = 0.0
	if ((x_46_re <= -9000000000000.0) || !(x_46_re <= 2600000000.0))
		tmp = Float64(Float64(x_46_re * Float64(x_46_re * Float64(x_46_re - 27.0))) - Float64(x_46_im * -2.0));
	else
		tmp = Float64(Float64(x_46_re * Float64(x_46_im * -27.0)) - Float64(x_46_im * Float64(Float64(x_46_re * x_46_im) * 2.0)));
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im)
	tmp = 0.0;
	if ((x_46_re <= -9000000000000.0) || ~((x_46_re <= 2600000000.0)))
		tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) - (x_46_im * -2.0);
	else
		tmp = (x_46_re * (x_46_im * -27.0)) - (x_46_im * ((x_46_re * x_46_im) * 2.0));
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$re, -9000000000000.0], N[Not[LessEqual[x$46$re, 2600000000.0]], $MachinePrecision]], N[(N[(x$46$re * N[(x$46$re * N[(x$46$re - 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$im * -2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$re * N[(x$46$im * -27.0), $MachinePrecision]), $MachinePrecision] - N[(x$46$im * N[(N[(x$46$re * x$46$im), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -9000000000000 \lor \neg \left(x.re \leq 2600000000\right):\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(x.re - 27\right)\right) - x.im \cdot -2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.re < -9e12 or 2.6e9 < x.re

    1. Initial program 72.7%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Step-by-step derivation
      1. difference-of-squares78.0%

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

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

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

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

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \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}} \cdot x.im \]
      3. +-inverses0.0%

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

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

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\color{blue}{\left(\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)\right)}}{0} \cdot x.im \]
      7. *-commutative0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\left(\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)\right)}{\color{blue}{\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)}} \cdot x.im \]
      9. *-commutative0.0%

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\left(\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)\right)}{\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \color{blue}{\left(x.re \cdot x.im\right)} \cdot \left(x.im \cdot x.re\right)} \cdot x.im \]
      10. distribute-neg-frac0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \left(-\frac{\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \color{blue}{\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) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      12. *-commutative0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \left(-\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)}{\color{blue}{0}}\right) \cdot x.im \]
    7. Applied egg-rr0.0%

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

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

    if -9e12 < x.re < 2.6e9

    1. Initial program 89.1%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Step-by-step derivation
      1. difference-of-squares89.1%

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

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

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

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

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

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\color{blue}{x.im \cdot x.re} + x.im \cdot x.re\right) \cdot x.im \]
      2. *-un-lft-identity47.8%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\color{blue}{1 \cdot \left(x.im \cdot x.re\right)} + x.im \cdot x.re\right) \cdot x.im \]
      3. *-un-lft-identity47.8%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(1 \cdot \left(x.im \cdot x.re\right) + \color{blue}{1 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      4. distribute-rgt-out47.8%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \color{blue}{\left(\left(x.im \cdot x.re\right) \cdot \left(1 + 1\right)\right)} \cdot x.im \]
      5. *-commutative47.8%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\color{blue}{\left(x.re \cdot x.im\right)} \cdot \left(1 + 1\right)\right) \cdot x.im \]
      6. metadata-eval47.8%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\left(x.re \cdot x.im\right) \cdot \color{blue}{2}\right) \cdot x.im \]
    8. Applied egg-rr47.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \leq -9000000000000 \lor \neg \left(x.re \leq 2600000000\right):\\ \;\;\;\;x.re \cdot \left(x.re \cdot \left(x.re - 27\right)\right) - x.im \cdot -2\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot -27\right) - x.im \cdot \left(\left(x.re \cdot x.im\right) \cdot 2\right)\\ \end{array} \]

Alternative 6: 72.6% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -2 \cdot 10^{-48} \lor \neg \left(x.re \leq 2.8 \cdot 10^{-88}\right):\\
\;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) - x.im \cdot -2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.re < -1.9999999999999999e-48 or 2.79999999999999976e-88 < x.re

    1. Initial program 77.6%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Step-by-step derivation
      1. difference-of-squares81.8%

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

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

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

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \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}} \cdot x.im \]
      3. +-inverses0.0%

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

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

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\color{blue}{\left(\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)\right)}}{0} \cdot x.im \]
      7. *-commutative0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\left(\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)\right)}{\color{blue}{\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)}} \cdot x.im \]
      9. *-commutative0.0%

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\left(\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)\right)}{\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \color{blue}{\left(x.re \cdot x.im\right)} \cdot \left(x.im \cdot x.re\right)} \cdot x.im \]
      10. distribute-neg-frac0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \left(-\frac{\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \color{blue}{\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) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      12. *-commutative0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \left(-\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)}{\color{blue}{0}}\right) \cdot x.im \]
    5. Applied egg-rr0.0%

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

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

    if -1.9999999999999999e-48 < x.re < 2.79999999999999976e-88

    1. Initial program 86.3%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Step-by-step derivation
      1. difference-of-squares86.3%

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

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

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

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

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

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\color{blue}{x.im \cdot x.re} + x.im \cdot x.re\right) \cdot x.im \]
      2. *-un-lft-identity50.1%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\color{blue}{1 \cdot \left(x.im \cdot x.re\right)} + x.im \cdot x.re\right) \cdot x.im \]
      3. *-un-lft-identity50.1%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(1 \cdot \left(x.im \cdot x.re\right) + \color{blue}{1 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      4. distribute-rgt-out50.1%

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

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\color{blue}{\left(x.re \cdot x.im\right)} \cdot \left(1 + 1\right)\right) \cdot x.im \]
      6. metadata-eval50.1%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\left(x.re \cdot x.im\right) \cdot \color{blue}{2}\right) \cdot x.im \]
    8. Applied egg-rr50.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \leq -2 \cdot 10^{-48} \lor \neg \left(x.re \leq 2.8 \cdot 10^{-88}\right):\\ \;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) - x.im \cdot -2\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot -27\right) - x.im \cdot \left(\left(x.re \cdot x.im\right) \cdot 2\right)\\ \end{array} \]

Alternative 7: 49.1% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.re \leq -3.8 \cdot 10^{-86} \lor \neg \left(x.re \leq 120\right):\\ \;\;\;\;x.re \cdot \left(x.re \cdot \left(x.re - 27\right)\right) - x.im \cdot -2\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot x.im\right) \cdot -27\\ \end{array} \end{array} \]
(FPCore (x.re x.im)
 :precision binary64
 (if (or (<= x.re -3.8e-86) (not (<= x.re 120.0)))
   (- (* x.re (* x.re (- x.re 27.0))) (* x.im -2.0))
   (* (* x.re x.im) -27.0)))
double code(double x_46_re, double x_46_im) {
	double tmp;
	if ((x_46_re <= -3.8e-86) || !(x_46_re <= 120.0)) {
		tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) - (x_46_im * -2.0);
	} else {
		tmp = (x_46_re * x_46_im) * -27.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_46re <= (-3.8d-86)) .or. (.not. (x_46re <= 120.0d0))) then
        tmp = (x_46re * (x_46re * (x_46re - 27.0d0))) - (x_46im * (-2.0d0))
    else
        tmp = (x_46re * x_46im) * (-27.0d0)
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
	double tmp;
	if ((x_46_re <= -3.8e-86) || !(x_46_re <= 120.0)) {
		tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) - (x_46_im * -2.0);
	} else {
		tmp = (x_46_re * x_46_im) * -27.0;
	}
	return tmp;
}
def code(x_46_re, x_46_im):
	tmp = 0
	if (x_46_re <= -3.8e-86) or not (x_46_re <= 120.0):
		tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) - (x_46_im * -2.0)
	else:
		tmp = (x_46_re * x_46_im) * -27.0
	return tmp
function code(x_46_re, x_46_im)
	tmp = 0.0
	if ((x_46_re <= -3.8e-86) || !(x_46_re <= 120.0))
		tmp = Float64(Float64(x_46_re * Float64(x_46_re * Float64(x_46_re - 27.0))) - Float64(x_46_im * -2.0));
	else
		tmp = Float64(Float64(x_46_re * x_46_im) * -27.0);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im)
	tmp = 0.0;
	if ((x_46_re <= -3.8e-86) || ~((x_46_re <= 120.0)))
		tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) - (x_46_im * -2.0);
	else
		tmp = (x_46_re * x_46_im) * -27.0;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$re, -3.8e-86], N[Not[LessEqual[x$46$re, 120.0]], $MachinePrecision]], N[(N[(x$46$re * N[(x$46$re * N[(x$46$re - 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$im * -2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$re * x$46$im), $MachinePrecision] * -27.0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -3.8 \cdot 10^{-86} \lor \neg \left(x.re \leq 120\right):\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(x.re - 27\right)\right) - x.im \cdot -2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.re < -3.8e-86 or 120 < x.re

    1. Initial program 75.6%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Step-by-step derivation
      1. difference-of-squares80.2%

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

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

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

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

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \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}} \cdot x.im \]
      3. +-inverses0.0%

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

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

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\color{blue}{\left(\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)\right)}}{0} \cdot x.im \]
      7. *-commutative0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\left(\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)\right)}{\color{blue}{\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)}} \cdot x.im \]
      9. *-commutative0.0%

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\left(\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)\right)}{\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \color{blue}{\left(x.re \cdot x.im\right)} \cdot \left(x.im \cdot x.re\right)} \cdot x.im \]
      10. distribute-neg-frac0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \left(-\frac{\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \color{blue}{\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) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      12. *-commutative0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \left(-\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)}{\color{blue}{0}}\right) \cdot x.im \]
    7. Applied egg-rr0.0%

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

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

    if -3.8e-86 < x.re < 120

    1. Initial program 88.0%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Step-by-step derivation
      1. difference-of-squares88.0%

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

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

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

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

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

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\color{blue}{x.im \cdot x.re} + x.im \cdot x.re\right) \cdot x.im \]
      2. *-un-lft-identity51.7%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\color{blue}{1 \cdot \left(x.im \cdot x.re\right)} + x.im \cdot x.re\right) \cdot x.im \]
      3. *-un-lft-identity51.7%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(1 \cdot \left(x.im \cdot x.re\right) + \color{blue}{1 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      4. distribute-rgt-out51.7%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \color{blue}{\left(\left(x.im \cdot x.re\right) \cdot \left(1 + 1\right)\right)} \cdot x.im \]
      5. *-commutative51.7%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\color{blue}{\left(x.re \cdot x.im\right)} \cdot \left(1 + 1\right)\right) \cdot x.im \]
      6. metadata-eval51.7%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\left(x.re \cdot x.im\right) \cdot \color{blue}{2}\right) \cdot x.im \]
    8. Applied egg-rr51.7%

      \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \color{blue}{\left(\left(x.re \cdot x.im\right) \cdot 2\right)} \cdot x.im \]
    9. Taylor expanded in x.im around 0 32.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \leq -3.8 \cdot 10^{-86} \lor \neg \left(x.re \leq 120\right):\\ \;\;\;\;x.re \cdot \left(x.re \cdot \left(x.re - 27\right)\right) - x.im \cdot -2\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot x.im\right) \cdot -27\\ \end{array} \]

Alternative 8: 35.0% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.re \leq -1.35 \cdot 10^{+173}:\\ \;\;\;\;x.re \cdot \left(x.re \cdot -27\right) - x.im \cdot -2\\ \mathbf{elif}\;x.re \leq 3.15 \cdot 10^{+63}:\\ \;\;\;\;\left(x.re \cdot x.im\right) \cdot -27\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.re + -27\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im)
 :precision binary64
 (if (<= x.re -1.35e+173)
   (- (* x.re (* x.re -27.0)) (* x.im -2.0))
   (if (<= x.re 3.15e+63) (* (* x.re x.im) -27.0) (* x.re (+ x.re -27.0)))))
double code(double x_46_re, double x_46_im) {
	double tmp;
	if (x_46_re <= -1.35e+173) {
		tmp = (x_46_re * (x_46_re * -27.0)) - (x_46_im * -2.0);
	} else if (x_46_re <= 3.15e+63) {
		tmp = (x_46_re * x_46_im) * -27.0;
	} else {
		tmp = x_46_re * (x_46_re + -27.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_46re <= (-1.35d+173)) then
        tmp = (x_46re * (x_46re * (-27.0d0))) - (x_46im * (-2.0d0))
    else if (x_46re <= 3.15d+63) then
        tmp = (x_46re * x_46im) * (-27.0d0)
    else
        tmp = x_46re * (x_46re + (-27.0d0))
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
	double tmp;
	if (x_46_re <= -1.35e+173) {
		tmp = (x_46_re * (x_46_re * -27.0)) - (x_46_im * -2.0);
	} else if (x_46_re <= 3.15e+63) {
		tmp = (x_46_re * x_46_im) * -27.0;
	} else {
		tmp = x_46_re * (x_46_re + -27.0);
	}
	return tmp;
}
def code(x_46_re, x_46_im):
	tmp = 0
	if x_46_re <= -1.35e+173:
		tmp = (x_46_re * (x_46_re * -27.0)) - (x_46_im * -2.0)
	elif x_46_re <= 3.15e+63:
		tmp = (x_46_re * x_46_im) * -27.0
	else:
		tmp = x_46_re * (x_46_re + -27.0)
	return tmp
function code(x_46_re, x_46_im)
	tmp = 0.0
	if (x_46_re <= -1.35e+173)
		tmp = Float64(Float64(x_46_re * Float64(x_46_re * -27.0)) - Float64(x_46_im * -2.0));
	elseif (x_46_re <= 3.15e+63)
		tmp = Float64(Float64(x_46_re * x_46_im) * -27.0);
	else
		tmp = Float64(x_46_re * Float64(x_46_re + -27.0));
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im)
	tmp = 0.0;
	if (x_46_re <= -1.35e+173)
		tmp = (x_46_re * (x_46_re * -27.0)) - (x_46_im * -2.0);
	elseif (x_46_re <= 3.15e+63)
		tmp = (x_46_re * x_46_im) * -27.0;
	else
		tmp = x_46_re * (x_46_re + -27.0);
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_] := If[LessEqual[x$46$re, -1.35e+173], N[(N[(x$46$re * N[(x$46$re * -27.0), $MachinePrecision]), $MachinePrecision] - N[(x$46$im * -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 3.15e+63], N[(N[(x$46$re * x$46$im), $MachinePrecision] * -27.0), $MachinePrecision], N[(x$46$re * N[(x$46$re + -27.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -1.35 \cdot 10^{+173}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot -27\right) - x.im \cdot -2\\

\mathbf{elif}\;x.re \leq 3.15 \cdot 10^{+63}:\\
\;\;\;\;\left(x.re \cdot x.im\right) \cdot -27\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.re < -1.3500000000000001e173

    1. Initial program 62.9%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Step-by-step derivation
      1. difference-of-squares65.7%

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

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

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

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

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \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}} \cdot x.im \]
      3. +-inverses0.0%

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

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

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\color{blue}{\left(\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)\right)}}{0} \cdot x.im \]
      7. *-commutative0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\left(\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)\right)}{\color{blue}{\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)}} \cdot x.im \]
      9. *-commutative0.0%

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\left(\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)\right)}{\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \color{blue}{\left(x.re \cdot x.im\right)} \cdot \left(x.im \cdot x.re\right)} \cdot x.im \]
      10. distribute-neg-frac0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \left(-\frac{\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \color{blue}{\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) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      12. *-commutative0.0%

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

        \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \left(-\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)}{\color{blue}{0}}\right) \cdot x.im \]
    7. Applied egg-rr0.0%

      \[\leadsto \left(x.re \cdot \left(x.re - 27\right)\right) \cdot x.re - \color{blue}{\left(0 - \frac{0}{0}\right)} \cdot x.im \]
    8. Simplified97.1%

      \[\leadsto \left(x.re \cdot \left(x.re - 27\right)\right) \cdot x.re - \color{blue}{-2} \cdot x.im \]
    9. Taylor expanded in x.re around 0 97.1%

      \[\leadsto \color{blue}{\left(-27 \cdot x.re\right)} \cdot x.re - -2 \cdot x.im \]
    10. Simplified97.1%

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

    if -1.3500000000000001e173 < x.re < 3.1499999999999999e63

    1. Initial program 89.9%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Step-by-step derivation
      1. difference-of-squares90.5%

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

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

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

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

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

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\color{blue}{x.im \cdot x.re} + x.im \cdot x.re\right) \cdot x.im \]
      2. *-un-lft-identity40.8%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\color{blue}{1 \cdot \left(x.im \cdot x.re\right)} + x.im \cdot x.re\right) \cdot x.im \]
      3. *-un-lft-identity40.8%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(1 \cdot \left(x.im \cdot x.re\right) + \color{blue}{1 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      4. distribute-rgt-out40.8%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \color{blue}{\left(\left(x.im \cdot x.re\right) \cdot \left(1 + 1\right)\right)} \cdot x.im \]
      5. *-commutative40.8%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\color{blue}{\left(x.re \cdot x.im\right)} \cdot \left(1 + 1\right)\right) \cdot x.im \]
      6. metadata-eval40.8%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\left(x.re \cdot x.im\right) \cdot \color{blue}{2}\right) \cdot x.im \]
    8. Applied egg-rr40.8%

      \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \color{blue}{\left(\left(x.re \cdot x.im\right) \cdot 2\right)} \cdot x.im \]
    9. Taylor expanded in x.im around 0 23.4%

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

    if 3.1499999999999999e63 < x.re

    1. Initial program 65.5%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Step-by-step derivation
      1. difference-of-squares74.1%

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

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

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

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

      \[\leadsto \color{blue}{{x.re}^{2} \cdot \left(x.re - 27\right)} \]
    7. Simplified67.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \leq -1.35 \cdot 10^{+173}:\\ \;\;\;\;x.re \cdot \left(x.re \cdot -27\right) - x.im \cdot -2\\ \mathbf{elif}\;x.re \leq 3.15 \cdot 10^{+63}:\\ \;\;\;\;\left(x.re \cdot x.im\right) \cdot -27\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.re + -27\right)\\ \end{array} \]

Alternative 9: 27.8% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.re \leq -7.2 \cdot 10^{+174}:\\ \;\;\;\;x.re \cdot x.im\\ \mathbf{elif}\;x.re \leq 3.2 \cdot 10^{+63}:\\ \;\;\;\;\left(x.re \cdot x.im\right) \cdot -27\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.re + -27\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im)
 :precision binary64
 (if (<= x.re -7.2e+174)
   (* x.re x.im)
   (if (<= x.re 3.2e+63) (* (* x.re x.im) -27.0) (* x.re (+ x.re -27.0)))))
double code(double x_46_re, double x_46_im) {
	double tmp;
	if (x_46_re <= -7.2e+174) {
		tmp = x_46_re * x_46_im;
	} else if (x_46_re <= 3.2e+63) {
		tmp = (x_46_re * x_46_im) * -27.0;
	} else {
		tmp = x_46_re * (x_46_re + -27.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_46re <= (-7.2d+174)) then
        tmp = x_46re * x_46im
    else if (x_46re <= 3.2d+63) then
        tmp = (x_46re * x_46im) * (-27.0d0)
    else
        tmp = x_46re * (x_46re + (-27.0d0))
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
	double tmp;
	if (x_46_re <= -7.2e+174) {
		tmp = x_46_re * x_46_im;
	} else if (x_46_re <= 3.2e+63) {
		tmp = (x_46_re * x_46_im) * -27.0;
	} else {
		tmp = x_46_re * (x_46_re + -27.0);
	}
	return tmp;
}
def code(x_46_re, x_46_im):
	tmp = 0
	if x_46_re <= -7.2e+174:
		tmp = x_46_re * x_46_im
	elif x_46_re <= 3.2e+63:
		tmp = (x_46_re * x_46_im) * -27.0
	else:
		tmp = x_46_re * (x_46_re + -27.0)
	return tmp
function code(x_46_re, x_46_im)
	tmp = 0.0
	if (x_46_re <= -7.2e+174)
		tmp = Float64(x_46_re * x_46_im);
	elseif (x_46_re <= 3.2e+63)
		tmp = Float64(Float64(x_46_re * x_46_im) * -27.0);
	else
		tmp = Float64(x_46_re * Float64(x_46_re + -27.0));
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im)
	tmp = 0.0;
	if (x_46_re <= -7.2e+174)
		tmp = x_46_re * x_46_im;
	elseif (x_46_re <= 3.2e+63)
		tmp = (x_46_re * x_46_im) * -27.0;
	else
		tmp = x_46_re * (x_46_re + -27.0);
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_] := If[LessEqual[x$46$re, -7.2e+174], N[(x$46$re * x$46$im), $MachinePrecision], If[LessEqual[x$46$re, 3.2e+63], N[(N[(x$46$re * x$46$im), $MachinePrecision] * -27.0), $MachinePrecision], N[(x$46$re * N[(x$46$re + -27.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -7.2 \cdot 10^{+174}:\\
\;\;\;\;x.re \cdot x.im\\

\mathbf{elif}\;x.re \leq 3.2 \cdot 10^{+63}:\\
\;\;\;\;\left(x.re \cdot x.im\right) \cdot -27\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.re < -7.2000000000000003e174

    1. Initial program 62.9%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Step-by-step derivation
      1. difference-of-squares65.7%

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

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

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

      \[\leadsto \color{blue}{x.re \cdot \left(-1 \cdot {x.im}^{2} - 2 \cdot {x.im}^{2}\right)} \]
    5. Simplified24.7%

      \[\leadsto \color{blue}{x.re \cdot x.im} \]

    if -7.2000000000000003e174 < x.re < 3.20000000000000011e63

    1. Initial program 89.9%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Step-by-step derivation
      1. difference-of-squares90.5%

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

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

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

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

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

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\color{blue}{x.im \cdot x.re} + x.im \cdot x.re\right) \cdot x.im \]
      2. *-un-lft-identity40.8%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\color{blue}{1 \cdot \left(x.im \cdot x.re\right)} + x.im \cdot x.re\right) \cdot x.im \]
      3. *-un-lft-identity40.8%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(1 \cdot \left(x.im \cdot x.re\right) + \color{blue}{1 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      4. distribute-rgt-out40.8%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \color{blue}{\left(\left(x.im \cdot x.re\right) \cdot \left(1 + 1\right)\right)} \cdot x.im \]
      5. *-commutative40.8%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\color{blue}{\left(x.re \cdot x.im\right)} \cdot \left(1 + 1\right)\right) \cdot x.im \]
      6. metadata-eval40.8%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\left(x.re \cdot x.im\right) \cdot \color{blue}{2}\right) \cdot x.im \]
    8. Applied egg-rr40.8%

      \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \color{blue}{\left(\left(x.re \cdot x.im\right) \cdot 2\right)} \cdot x.im \]
    9. Taylor expanded in x.im around 0 23.4%

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

    if 3.20000000000000011e63 < x.re

    1. Initial program 65.5%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Step-by-step derivation
      1. difference-of-squares74.1%

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

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

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

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

      \[\leadsto \color{blue}{{x.re}^{2} \cdot \left(x.re - 27\right)} \]
    7. Simplified67.0%

      \[\leadsto \color{blue}{x.re \cdot \left(x.re + -27\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification33.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \leq -7.2 \cdot 10^{+174}:\\ \;\;\;\;x.re \cdot x.im\\ \mathbf{elif}\;x.re \leq 3.2 \cdot 10^{+63}:\\ \;\;\;\;\left(x.re \cdot x.im\right) \cdot -27\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.re + -27\right)\\ \end{array} \]

Alternative 10: 22.0% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.im \leq 2.15 \cdot 10^{+219}:\\ \;\;\;\;x.re \cdot x.im\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot x.im\right) \cdot -27\\ \end{array} \end{array} \]
(FPCore (x.re x.im)
 :precision binary64
 (if (<= x.im 2.15e+219) (* x.re x.im) (* (* x.re x.im) -27.0)))
double code(double x_46_re, double x_46_im) {
	double tmp;
	if (x_46_im <= 2.15e+219) {
		tmp = x_46_re * x_46_im;
	} else {
		tmp = (x_46_re * x_46_im) * -27.0;
	}
	return tmp;
}
real(8) function code(x_46re, x_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8) :: tmp
    if (x_46im <= 2.15d+219) then
        tmp = x_46re * x_46im
    else
        tmp = (x_46re * x_46im) * (-27.0d0)
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
	double tmp;
	if (x_46_im <= 2.15e+219) {
		tmp = x_46_re * x_46_im;
	} else {
		tmp = (x_46_re * x_46_im) * -27.0;
	}
	return tmp;
}
def code(x_46_re, x_46_im):
	tmp = 0
	if x_46_im <= 2.15e+219:
		tmp = x_46_re * x_46_im
	else:
		tmp = (x_46_re * x_46_im) * -27.0
	return tmp
function code(x_46_re, x_46_im)
	tmp = 0.0
	if (x_46_im <= 2.15e+219)
		tmp = Float64(x_46_re * x_46_im);
	else
		tmp = Float64(Float64(x_46_re * x_46_im) * -27.0);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im)
	tmp = 0.0;
	if (x_46_im <= 2.15e+219)
		tmp = x_46_re * x_46_im;
	else
		tmp = (x_46_re * x_46_im) * -27.0;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_] := If[LessEqual[x$46$im, 2.15e+219], N[(x$46$re * x$46$im), $MachinePrecision], N[(N[(x$46$re * x$46$im), $MachinePrecision] * -27.0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 2.15 \cdot 10^{+219}:\\
\;\;\;\;x.re \cdot x.im\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < 2.1499999999999999e219

    1. Initial program 82.7%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Step-by-step derivation
      1. difference-of-squares84.3%

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

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

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

      \[\leadsto \color{blue}{x.re \cdot \left(-1 \cdot {x.im}^{2} - 2 \cdot {x.im}^{2}\right)} \]
    5. Simplified23.1%

      \[\leadsto \color{blue}{x.re \cdot x.im} \]

    if 2.1499999999999999e219 < x.im

    1. Initial program 50.4%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Step-by-step derivation
      1. difference-of-squares69.2%

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

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

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

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

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

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\color{blue}{x.im \cdot x.re} + x.im \cdot x.re\right) \cdot x.im \]
      2. *-un-lft-identity70.0%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\color{blue}{1 \cdot \left(x.im \cdot x.re\right)} + x.im \cdot x.re\right) \cdot x.im \]
      3. *-un-lft-identity70.0%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(1 \cdot \left(x.im \cdot x.re\right) + \color{blue}{1 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      4. distribute-rgt-out70.0%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \color{blue}{\left(\left(x.im \cdot x.re\right) \cdot \left(1 + 1\right)\right)} \cdot x.im \]
      5. *-commutative70.0%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\color{blue}{\left(x.re \cdot x.im\right)} \cdot \left(1 + 1\right)\right) \cdot x.im \]
      6. metadata-eval70.0%

        \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \left(\left(x.re \cdot x.im\right) \cdot \color{blue}{2}\right) \cdot x.im \]
    8. Applied egg-rr70.0%

      \[\leadsto \left(x.im \cdot -27\right) \cdot x.re - \color{blue}{\left(\left(x.re \cdot x.im\right) \cdot 2\right)} \cdot x.im \]
    9. Taylor expanded in x.im around 0 27.5%

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

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

Alternative 11: 3.7% accurate, 6.3× speedup?

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

\\
x.im \cdot 2
\end{array}
Derivation
  1. Initial program 80.7%

    \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
  2. Step-by-step derivation
    1. difference-of-squares83.4%

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

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

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

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

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

      \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \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}} \cdot x.im \]
    3. +-inverses0.0%

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

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

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

      \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\color{blue}{\left(\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)\right)}}{0} \cdot x.im \]
    7. *-commutative0.0%

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

      \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\left(\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)\right)}{\color{blue}{\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)}} \cdot x.im \]
    9. *-commutative0.0%

      \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\left(\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)\right)}{\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \color{blue}{\left(x.re \cdot x.im\right)} \cdot \left(x.im \cdot x.re\right)} \cdot x.im \]
    10. distribute-neg-frac0.0%

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

      \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \left(-\frac{\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \color{blue}{\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) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
    12. *-commutative0.0%

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

      \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \left(-\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)}{\color{blue}{0}}\right) \cdot x.im \]
  7. Applied egg-rr0.0%

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

    \[\leadsto \left(x.re \cdot \left(x.re - 27\right)\right) \cdot x.re - \color{blue}{-2} \cdot x.im \]
  9. Taylor expanded in x.re around 0 3.6%

    \[\leadsto \color{blue}{2 \cdot x.im} \]
  10. Final simplification3.6%

    \[\leadsto x.im \cdot 2 \]

Alternative 12: 19.9% accurate, 6.3× speedup?

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

\\
x.re \cdot x.im
\end{array}
Derivation
  1. Initial program 80.7%

    \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
  2. Step-by-step derivation
    1. difference-of-squares83.4%

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

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

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

    \[\leadsto \color{blue}{x.re \cdot \left(-1 \cdot {x.im}^{2} - 2 \cdot {x.im}^{2}\right)} \]
  5. Simplified23.2%

    \[\leadsto \color{blue}{x.re \cdot x.im} \]
  6. Final simplification23.2%

    \[\leadsto x.re \cdot x.im \]

Alternative 13: 3.6% accurate, 9.5× speedup?

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

\\
-x.im
\end{array}
Derivation
  1. Initial program 80.7%

    \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
  2. Step-by-step derivation
    1. difference-of-squares83.4%

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

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

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

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

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

      \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \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}} \cdot x.im \]
    3. +-inverses0.0%

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

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

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

      \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\color{blue}{\left(\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)\right)}}{0} \cdot x.im \]
    7. *-commutative0.0%

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

      \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\left(\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)\right)}{\color{blue}{\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)}} \cdot x.im \]
    9. *-commutative0.0%

      \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \frac{-\left(\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)\right)}{\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \color{blue}{\left(x.re \cdot x.im\right)} \cdot \left(x.im \cdot x.re\right)} \cdot x.im \]
    10. distribute-neg-frac0.0%

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

      \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \left(-\frac{\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot x.re\right) - \color{blue}{\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) - \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
    12. *-commutative0.0%

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

      \[\leadsto \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) \cdot x.re - \left(-\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)}{\color{blue}{0}}\right) \cdot x.im \]
  7. Applied egg-rr0.0%

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

    \[\leadsto \left(x.re \cdot \left(x.re - 27\right)\right) \cdot x.re - \color{blue}{-2} \cdot x.im \]
  9. Taylor expanded in x.re around 0 3.6%

    \[\leadsto \color{blue}{2 \cdot x.im} \]
  10. Simplified3.6%

    \[\leadsto \color{blue}{-x.im} \]
  11. Final simplification3.6%

    \[\leadsto -x.im \]

Developer target: 87.4% accurate, 1.1× speedup?

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

\\
\left(x.re \cdot x.re\right) \cdot \left(x.re - x.im\right) + \left(x.re \cdot x.im\right) \cdot \left(x.re - 3 \cdot x.im\right)
\end{array}

Reproduce

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

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

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