math.cube on complex, real part

Percentage Accurate: 82.2% → 99.8%
Time: 7.4s
Alternatives: 11
Speedup: 0.8×

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 11 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.2% 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: 99.8% accurate, 0.2× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ \begin{array}{l} t_0 := \frac{x.re}{-x.re}\\ \mathbf{if}\;x.re \leq -4.8 \cdot 10^{+103}:\\ \;\;\;\;x.re \cdot \left(\left(x.re + -27\right) \cdot \left(x.re + x.im\right)\right) + t_0\\ \mathbf{elif}\;x.re \leq 2 \cdot 10^{+86}:\\ \;\;\;\;{x.re}^{3} + x.im \cdot \left(x.re \cdot \left(x.im \cdot -3\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) + t_0\\ \end{array} \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
 :precision binary64
 (let* ((t_0 (/ x.re (- x.re))))
   (if (<= x.re -4.8e+103)
     (+ (* x.re (* (+ x.re -27.0) (+ x.re x.im))) t_0)
     (if (<= x.re 2e+86)
       (+ (pow x.re 3.0) (* x.im (* x.re (* x.im -3.0))))
       (+ (* x.re (* (- x.re x.im) (+ x.re x.im))) t_0)))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
	double t_0 = x_46_re / -x_46_re;
	double tmp;
	if (x_46_re <= -4.8e+103) {
		tmp = (x_46_re * ((x_46_re + -27.0) * (x_46_re + x_46_im))) + t_0;
	} else if (x_46_re <= 2e+86) {
		tmp = pow(x_46_re, 3.0) + (x_46_im * (x_46_re * (x_46_im * -3.0)));
	} else {
		tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) + t_0;
	}
	return tmp;
}
NOTE: x.im should be positive before calling this function
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
    if (x_46re <= (-4.8d+103)) then
        tmp = (x_46re * ((x_46re + (-27.0d0)) * (x_46re + x_46im))) + t_0
    else if (x_46re <= 2d+86) then
        tmp = (x_46re ** 3.0d0) + (x_46im * (x_46re * (x_46im * (-3.0d0))))
    else
        tmp = (x_46re * ((x_46re - x_46im) * (x_46re + x_46im))) + t_0
    end if
    code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
	double t_0 = x_46_re / -x_46_re;
	double tmp;
	if (x_46_re <= -4.8e+103) {
		tmp = (x_46_re * ((x_46_re + -27.0) * (x_46_re + x_46_im))) + t_0;
	} else if (x_46_re <= 2e+86) {
		tmp = Math.pow(x_46_re, 3.0) + (x_46_im * (x_46_re * (x_46_im * -3.0)));
	} else {
		tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) + t_0;
	}
	return tmp;
}
x.im = abs(x.im)
def code(x_46_re, x_46_im):
	t_0 = x_46_re / -x_46_re
	tmp = 0
	if x_46_re <= -4.8e+103:
		tmp = (x_46_re * ((x_46_re + -27.0) * (x_46_re + x_46_im))) + t_0
	elif x_46_re <= 2e+86:
		tmp = math.pow(x_46_re, 3.0) + (x_46_im * (x_46_re * (x_46_im * -3.0)))
	else:
		tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) + t_0
	return tmp
x.im = abs(x.im)
function code(x_46_re, x_46_im)
	t_0 = Float64(x_46_re / Float64(-x_46_re))
	tmp = 0.0
	if (x_46_re <= -4.8e+103)
		tmp = Float64(Float64(x_46_re * Float64(Float64(x_46_re + -27.0) * Float64(x_46_re + x_46_im))) + t_0);
	elseif (x_46_re <= 2e+86)
		tmp = Float64((x_46_re ^ 3.0) + Float64(x_46_im * Float64(x_46_re * Float64(x_46_im * -3.0))));
	else
		tmp = Float64(Float64(x_46_re * Float64(Float64(x_46_re - x_46_im) * Float64(x_46_re + x_46_im))) + t_0);
	end
	return tmp
end
x.im = abs(x.im)
function tmp_2 = code(x_46_re, x_46_im)
	t_0 = x_46_re / -x_46_re;
	tmp = 0.0;
	if (x_46_re <= -4.8e+103)
		tmp = (x_46_re * ((x_46_re + -27.0) * (x_46_re + x_46_im))) + t_0;
	elseif (x_46_re <= 2e+86)
		tmp = (x_46_re ^ 3.0) + (x_46_im * (x_46_re * (x_46_im * -3.0)));
	else
		tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) + t_0;
	end
	tmp_2 = tmp;
end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(x$46$re / (-x$46$re)), $MachinePrecision]}, If[LessEqual[x$46$re, -4.8e+103], N[(N[(x$46$re * N[(N[(x$46$re + -27.0), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[x$46$re, 2e+86], N[(N[Power[x$46$re, 3.0], $MachinePrecision] + N[(x$46$im * N[(x$46$re * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]), $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] + t$95$0), $MachinePrecision]]]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
t_0 := \frac{x.re}{-x.re}\\
\mathbf{if}\;x.re \leq -4.8 \cdot 10^{+103}:\\
\;\;\;\;x.re \cdot \left(\left(x.re + -27\right) \cdot \left(x.re + x.im\right)\right) + t_0\\

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

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


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

    1. Initial program 64.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. *-commutative64.3%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - x.im \cdot \color{blue}{\frac{{\left(x.re \cdot x.im\right)}^{3} + {\left(x.im \cdot x.re\right)}^{3}}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)}} \]
      3. associate-*r/33.3%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \left({\left(x.re \cdot x.im\right)}^{3} + {\color{blue}{\left(x.re \cdot x.im\right)}}^{3}\right)}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)} \]
      5. count-233.3%

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

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

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

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

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

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

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \color{blue}{\frac{-x.re}{-x.re}} \]
    5. Step-by-step derivation
      1. difference-of-squares100.0%

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

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

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

    if -4.7999999999999997e103 < x.re < 2e86

    1. Initial program 88.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. Simplified88.4%

      \[\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. associate-*r*88.5%

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

        \[\leadsto {x.re}^{3} + \color{blue}{\left(x.re \cdot \left(x.im \cdot x.im\right)\right) \cdot -3} \]
      3. add-sqr-sqrt65.1%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {x.re}^{3} + \sqrt{{x.re}^{2} \cdot \left(\left({x.im}^{2} \cdot \color{blue}{{x.im}^{2}}\right) \cdot \left(-3 \cdot -3\right)\right)} \]
      16. pow-prod-up59.7%

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

        \[\leadsto {x.re}^{3} + \sqrt{{x.re}^{2} \cdot \left({x.im}^{\color{blue}{4}} \cdot \left(-3 \cdot -3\right)\right)} \]
      18. metadata-eval59.7%

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

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

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

        \[\leadsto {x.re}^{3} + \sqrt{\color{blue}{\left({x.im}^{4} \cdot {x.re}^{2}\right)} \cdot 9} \]
      3. metadata-eval59.7%

        \[\leadsto {x.re}^{3} + \sqrt{\left({x.im}^{\color{blue}{\left(2 + 2\right)}} \cdot {x.re}^{2}\right) \cdot 9} \]
      4. pow-prod-up59.7%

        \[\leadsto {x.re}^{3} + \sqrt{\left(\color{blue}{\left({x.im}^{2} \cdot {x.im}^{2}\right)} \cdot {x.re}^{2}\right) \cdot 9} \]
      5. pow-prod-down59.7%

        \[\leadsto {x.re}^{3} + \sqrt{\left(\color{blue}{{\left(x.im \cdot x.im\right)}^{2}} \cdot {x.re}^{2}\right) \cdot 9} \]
      6. pow259.7%

        \[\leadsto {x.re}^{3} + \sqrt{\left(\color{blue}{\left(\left(x.im \cdot x.im\right) \cdot \left(x.im \cdot x.im\right)\right)} \cdot {x.re}^{2}\right) \cdot 9} \]
      7. unpow259.7%

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

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

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

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

        \[\leadsto {x.re}^{3} + \sqrt{\left(\color{blue}{{\left(x.im \cdot \sqrt{x.re}\right)}^{2}} \cdot \left(\left(x.im \cdot x.im\right) \cdot x.re\right)\right) \cdot 9} \]
      12. add-sqr-sqrt21.4%

        \[\leadsto {x.re}^{3} + \sqrt{\left({\left(x.im \cdot \sqrt{x.re}\right)}^{2} \cdot \left(\left(x.im \cdot x.im\right) \cdot \color{blue}{\left(\sqrt{x.re} \cdot \sqrt{x.re}\right)}\right)\right) \cdot 9} \]
      13. swap-sqr21.5%

        \[\leadsto {x.re}^{3} + \sqrt{\left({\left(x.im \cdot \sqrt{x.re}\right)}^{2} \cdot \color{blue}{\left(\left(x.im \cdot \sqrt{x.re}\right) \cdot \left(x.im \cdot \sqrt{x.re}\right)\right)}\right) \cdot 9} \]
      14. unpow221.5%

        \[\leadsto {x.re}^{3} + \sqrt{\left({\left(x.im \cdot \sqrt{x.re}\right)}^{2} \cdot \color{blue}{{\left(x.im \cdot \sqrt{x.re}\right)}^{2}}\right) \cdot 9} \]
      15. metadata-eval21.5%

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

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

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

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

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

    if 2e86 < x.re

    1. Initial program 67.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. *-commutative67.3%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - x.im \cdot \color{blue}{\frac{{\left(x.re \cdot x.im\right)}^{3} + {\left(x.im \cdot x.re\right)}^{3}}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)}} \]
      3. associate-*r/40.8%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \left({\left(x.re \cdot x.im\right)}^{3} + {\color{blue}{\left(x.re \cdot x.im\right)}}^{3}\right)}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)} \]
      5. count-240.8%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \color{blue}{\left(2 \cdot {\left(x.re \cdot x.im\right)}^{3}\right)}}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)} \]
      6. pow240.8%

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

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

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

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

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

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \color{blue}{\frac{-x.re}{-x.re}} \]
    5. Step-by-step derivation
      1. difference-of-squares100.0%

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

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

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

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

Alternative 2: 93.7% accurate, 0.5× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ \begin{array}{l} t_0 := 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)\\ \mathbf{if}\;t_0 \leq 10^{+300}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) + \frac{x.re}{-x.re}\\ \end{array} \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
 :precision binary64
 (let* ((t_0
         (-
          (* x.re (- (* x.re x.re) (* x.im x.im)))
          (* x.im (+ (* x.re x.im) (* x.re x.im))))))
   (if (<= t_0 1e+300)
     t_0
     (+ (* x.re (* (- x.re x.im) (+ x.re x.im))) (/ x.re (- x.re))))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
	double t_0 = (x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)));
	double tmp;
	if (t_0 <= 1e+300) {
		tmp = t_0;
	} else {
		tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) + (x_46_re / -x_46_re);
	}
	return tmp;
}
NOTE: x.im should be positive before calling this function
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_46re) - (x_46im * x_46im))) - (x_46im * ((x_46re * x_46im) + (x_46re * x_46im)))
    if (t_0 <= 1d+300) then
        tmp = t_0
    else
        tmp = (x_46re * ((x_46re - x_46im) * (x_46re + x_46im))) + (x_46re / -x_46re)
    end if
    code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
	double t_0 = (x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)));
	double tmp;
	if (t_0 <= 1e+300) {
		tmp = t_0;
	} else {
		tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) + (x_46_re / -x_46_re);
	}
	return tmp;
}
x.im = abs(x.im)
def code(x_46_re, x_46_im):
	t_0 = (x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)))
	tmp = 0
	if t_0 <= 1e+300:
		tmp = t_0
	else:
		tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) + (x_46_re / -x_46_re)
	return tmp
x.im = abs(x.im)
function code(x_46_re, x_46_im)
	t_0 = 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))))
	tmp = 0.0
	if (t_0 <= 1e+300)
		tmp = 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_re / Float64(-x_46_re)));
	end
	return tmp
end
x.im = abs(x.im)
function tmp_2 = code(x_46_re, x_46_im)
	t_0 = (x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)));
	tmp = 0.0;
	if (t_0 <= 1e+300)
		tmp = t_0;
	else
		tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) + (x_46_re / -x_46_re);
	end
	tmp_2 = tmp;
end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := Block[{t$95$0 = 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]}, If[LessEqual[t$95$0, 1e+300], t$95$0, 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$re / (-x$46$re)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
t_0 := 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)\\
\mathbf{if}\;t_0 \leq 10^{+300}:\\
\;\;\;\;t_0\\

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


\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.0000000000000001e300

    1. Initial program 93.8%

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

    if 1.0000000000000001e300 < (-.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 53.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. *-commutative53.6%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - x.im \cdot \color{blue}{\frac{{\left(x.re \cdot x.im\right)}^{3} + {\left(x.im \cdot x.re\right)}^{3}}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)}} \]
      3. associate-*r/23.0%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \left({\left(x.re \cdot x.im\right)}^{3} + {\color{blue}{\left(x.re \cdot x.im\right)}}^{3}\right)}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)} \]
      5. count-223.0%

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

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

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

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

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

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

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \color{blue}{\frac{-x.re}{-x.re}} \]
    5. Step-by-step derivation
      1. difference-of-squares90.1%

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

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

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

    \[\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 10^{+300}:\\ \;\;\;\;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)\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) + \frac{x.re}{-x.re}\\ \end{array} \]

Alternative 3: 93.7% accurate, 0.8× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ \begin{array}{l} t_0 := x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right)\\ t_1 := \frac{x.re}{-x.re}\\ \mathbf{if}\;x.re \leq -5 \cdot 10^{+132}:\\ \;\;\;\;x.re \cdot \left(\left(x.re + -27\right) \cdot \left(x.re + x.im\right)\right) + t_1\\ \mathbf{elif}\;x.re \leq 4 \cdot 10^{+80}:\\ \;\;\;\;t_0 - x.im \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 + t_1\\ \end{array} \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
 :precision binary64
 (let* ((t_0 (* x.re (* (- x.re x.im) (+ x.re x.im)))) (t_1 (/ x.re (- x.re))))
   (if (<= x.re -5e+132)
     (+ (* x.re (* (+ x.re -27.0) (+ x.re x.im))) t_1)
     (if (<= x.re 4e+80)
       (- t_0 (* x.im (+ (* x.re x.im) (* x.re x.im))))
       (+ t_0 t_1)))))
x.im = abs(x.im);
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 t_1 = x_46_re / -x_46_re;
	double tmp;
	if (x_46_re <= -5e+132) {
		tmp = (x_46_re * ((x_46_re + -27.0) * (x_46_re + x_46_im))) + t_1;
	} else if (x_46_re <= 4e+80) {
		tmp = t_0 - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)));
	} else {
		tmp = t_0 + t_1;
	}
	return tmp;
}
NOTE: x.im should be positive before calling this function
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) :: t_1
    real(8) :: tmp
    t_0 = x_46re * ((x_46re - x_46im) * (x_46re + x_46im))
    t_1 = x_46re / -x_46re
    if (x_46re <= (-5d+132)) then
        tmp = (x_46re * ((x_46re + (-27.0d0)) * (x_46re + x_46im))) + t_1
    else if (x_46re <= 4d+80) then
        tmp = t_0 - (x_46im * ((x_46re * x_46im) + (x_46re * x_46im)))
    else
        tmp = t_0 + t_1
    end if
    code = tmp
end function
x.im = Math.abs(x.im);
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 t_1 = x_46_re / -x_46_re;
	double tmp;
	if (x_46_re <= -5e+132) {
		tmp = (x_46_re * ((x_46_re + -27.0) * (x_46_re + x_46_im))) + t_1;
	} else if (x_46_re <= 4e+80) {
		tmp = t_0 - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)));
	} else {
		tmp = t_0 + t_1;
	}
	return tmp;
}
x.im = abs(x.im)
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))
	t_1 = x_46_re / -x_46_re
	tmp = 0
	if x_46_re <= -5e+132:
		tmp = (x_46_re * ((x_46_re + -27.0) * (x_46_re + x_46_im))) + t_1
	elif x_46_re <= 4e+80:
		tmp = t_0 - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)))
	else:
		tmp = t_0 + t_1
	return tmp
x.im = abs(x.im)
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)))
	t_1 = Float64(x_46_re / Float64(-x_46_re))
	tmp = 0.0
	if (x_46_re <= -5e+132)
		tmp = Float64(Float64(x_46_re * Float64(Float64(x_46_re + -27.0) * Float64(x_46_re + x_46_im))) + t_1);
	elseif (x_46_re <= 4e+80)
		tmp = Float64(t_0 - Float64(x_46_im * Float64(Float64(x_46_re * x_46_im) + Float64(x_46_re * x_46_im))));
	else
		tmp = Float64(t_0 + t_1);
	end
	return tmp
end
x.im = abs(x.im)
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));
	t_1 = x_46_re / -x_46_re;
	tmp = 0.0;
	if (x_46_re <= -5e+132)
		tmp = (x_46_re * ((x_46_re + -27.0) * (x_46_re + x_46_im))) + t_1;
	elseif (x_46_re <= 4e+80)
		tmp = t_0 - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)));
	else
		tmp = t_0 + t_1;
	end
	tmp_2 = tmp;
end
NOTE: x.im should be positive before calling this function
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]}, Block[{t$95$1 = N[(x$46$re / (-x$46$re)), $MachinePrecision]}, If[LessEqual[x$46$re, -5e+132], N[(N[(x$46$re * N[(N[(x$46$re + -27.0), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[x$46$re, 4e+80], N[(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]), $MachinePrecision], N[(t$95$0 + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
t_0 := x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right)\\
t_1 := \frac{x.re}{-x.re}\\
\mathbf{if}\;x.re \leq -5 \cdot 10^{+132}:\\
\;\;\;\;x.re \cdot \left(\left(x.re + -27\right) \cdot \left(x.re + x.im\right)\right) + t_1\\

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

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


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

    1. Initial program 59.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. *-commutative59.5%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - x.im \cdot \color{blue}{\frac{{\left(x.re \cdot x.im\right)}^{3} + {\left(x.im \cdot x.re\right)}^{3}}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)}} \]
      3. associate-*r/32.4%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \left({\left(x.re \cdot x.im\right)}^{3} + {\color{blue}{\left(x.re \cdot x.im\right)}}^{3}\right)}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)} \]
      5. count-232.4%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \color{blue}{\left(2 \cdot {\left(x.re \cdot x.im\right)}^{3}\right)}}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)} \]
      6. pow232.4%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \left(2 \cdot {\left(x.re \cdot x.im\right)}^{3}\right)}{{\left(x.re \cdot x.im\right)}^{2} + \left(\color{blue}{\left(x.re \cdot x.im\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)} \]
      8. *-commutative32.4%

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

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

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

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \color{blue}{\frac{-x.re}{-x.re}} \]
    5. Step-by-step derivation
      1. difference-of-squares100.0%

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

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

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

    if -5.0000000000000001e132 < x.re < 4e80

    1. Initial program 88.8%

      \[\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-squares34.0%

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

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

    if 4e80 < x.re

    1. Initial program 68.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. *-commutative68.0%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - x.im \cdot \color{blue}{\frac{{\left(x.re \cdot x.im\right)}^{3} + {\left(x.im \cdot x.re\right)}^{3}}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)}} \]
      3. associate-*r/42.0%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \left({\left(x.re \cdot x.im\right)}^{3} + {\color{blue}{\left(x.re \cdot x.im\right)}}^{3}\right)}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)} \]
      5. count-242.0%

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

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

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

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

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

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

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \color{blue}{\frac{-x.re}{-x.re}} \]
    5. Step-by-step derivation
      1. difference-of-squares100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \leq -5 \cdot 10^{+132}:\\ \;\;\;\;x.re \cdot \left(\left(x.re + -27\right) \cdot \left(x.re + x.im\right)\right) + \frac{x.re}{-x.re}\\ \mathbf{elif}\;x.re \leq 4 \cdot 10^{+80}:\\ \;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \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) + \frac{x.re}{-x.re}\\ \end{array} \]

Alternative 4: 57.7% accurate, 1.0× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ \begin{array}{l} \mathbf{if}\;x.re \leq -4.1 \cdot 10^{+42} \lor \neg \left(x.re \leq 9.5 \cdot 10^{+23}\right):\\ \;\;\;\;x.re \cdot \left(x.re \cdot \left(x.re - 27\right)\right) + \frac{x.re}{-x.re}\\ \mathbf{else}:\\ \;\;\;\;-27 \cdot \left(x.re \cdot x.im\right) - x.im \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\\ \end{array} \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
 :precision binary64
 (if (or (<= x.re -4.1e+42) (not (<= x.re 9.5e+23)))
   (+ (* x.re (* x.re (- x.re 27.0))) (/ x.re (- x.re)))
   (- (* -27.0 (* x.re x.im)) (* x.im (+ (* x.re x.im) (* x.re x.im))))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
	double tmp;
	if ((x_46_re <= -4.1e+42) || !(x_46_re <= 9.5e+23)) {
		tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) + (x_46_re / -x_46_re);
	} else {
		tmp = (-27.0 * (x_46_re * x_46_im)) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)));
	}
	return tmp;
}
NOTE: x.im should be positive before calling this function
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 <= (-4.1d+42)) .or. (.not. (x_46re <= 9.5d+23))) then
        tmp = (x_46re * (x_46re * (x_46re - 27.0d0))) + (x_46re / -x_46re)
    else
        tmp = ((-27.0d0) * (x_46re * x_46im)) - (x_46im * ((x_46re * x_46im) + (x_46re * x_46im)))
    end if
    code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
	double tmp;
	if ((x_46_re <= -4.1e+42) || !(x_46_re <= 9.5e+23)) {
		tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) + (x_46_re / -x_46_re);
	} else {
		tmp = (-27.0 * (x_46_re * x_46_im)) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)));
	}
	return tmp;
}
x.im = abs(x.im)
def code(x_46_re, x_46_im):
	tmp = 0
	if (x_46_re <= -4.1e+42) or not (x_46_re <= 9.5e+23):
		tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) + (x_46_re / -x_46_re)
	else:
		tmp = (-27.0 * (x_46_re * x_46_im)) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)))
	return tmp
x.im = abs(x.im)
function code(x_46_re, x_46_im)
	tmp = 0.0
	if ((x_46_re <= -4.1e+42) || !(x_46_re <= 9.5e+23))
		tmp = Float64(Float64(x_46_re * Float64(x_46_re * Float64(x_46_re - 27.0))) + Float64(x_46_re / Float64(-x_46_re)));
	else
		tmp = Float64(Float64(-27.0 * Float64(x_46_re * x_46_im)) - Float64(x_46_im * Float64(Float64(x_46_re * x_46_im) + Float64(x_46_re * x_46_im))));
	end
	return tmp
end
x.im = abs(x.im)
function tmp_2 = code(x_46_re, x_46_im)
	tmp = 0.0;
	if ((x_46_re <= -4.1e+42) || ~((x_46_re <= 9.5e+23)))
		tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) + (x_46_re / -x_46_re);
	else
		tmp = (-27.0 * (x_46_re * x_46_im)) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)));
	end
	tmp_2 = tmp;
end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$re, -4.1e+42], N[Not[LessEqual[x$46$re, 9.5e+23]], $MachinePrecision]], N[(N[(x$46$re * N[(x$46$re * N[(x$46$re - 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x$46$re / (-x$46$re)), $MachinePrecision]), $MachinePrecision], N[(N[(-27.0 * N[(x$46$re * x$46$im), $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]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -4.1 \cdot 10^{+42} \lor \neg \left(x.re \leq 9.5 \cdot 10^{+23}\right):\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(x.re - 27\right)\right) + \frac{x.re}{-x.re}\\

\mathbf{else}:\\
\;\;\;\;-27 \cdot \left(x.re \cdot x.im\right) - 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 < -4.1e42 or 9.50000000000000038e23 < x.re

    1. Initial program 72.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. *-commutative72.2%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - x.im \cdot \color{blue}{\frac{{\left(x.re \cdot x.im\right)}^{3} + {\left(x.im \cdot x.re\right)}^{3}}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)}} \]
      3. associate-*r/39.2%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \left({\left(x.re \cdot x.im\right)}^{3} + {\color{blue}{\left(x.re \cdot x.im\right)}}^{3}\right)}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)} \]
      5. count-239.2%

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

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

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

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

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

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

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \color{blue}{\frac{-x.re}{-x.re}} \]
    5. Step-by-step derivation
      1. difference-of-squares98.4%

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

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

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

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

    if -4.1e42 < x.re < 9.50000000000000038e23

    1. Initial program 86.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-squares23.8%

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

      \[\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. Simplified42.5%

      \[\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 46.2%

      \[\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 simplification61.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \leq -4.1 \cdot 10^{+42} \lor \neg \left(x.re \leq 9.5 \cdot 10^{+23}\right):\\ \;\;\;\;x.re \cdot \left(x.re \cdot \left(x.re - 27\right)\right) + \frac{x.re}{-x.re}\\ \mathbf{else}:\\ \;\;\;\;-27 \cdot \left(x.re \cdot x.im\right) - x.im \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\\ \end{array} \]

Alternative 5: 69.2% accurate, 1.0× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ \begin{array}{l} \mathbf{if}\;x.re \leq -6.5 \cdot 10^{-15} \lor \neg \left(x.re \leq 1\right):\\ \;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) + \frac{x.re}{-x.re}\\ \mathbf{else}:\\ \;\;\;\;-27 \cdot \left(x.re \cdot x.im\right) - x.im \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\\ \end{array} \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
 :precision binary64
 (if (or (<= x.re -6.5e-15) (not (<= x.re 1.0)))
   (+ (* x.re (* (- x.re x.im) (+ x.re x.im))) (/ x.re (- x.re)))
   (- (* -27.0 (* x.re x.im)) (* x.im (+ (* x.re x.im) (* x.re x.im))))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
	double tmp;
	if ((x_46_re <= -6.5e-15) || !(x_46_re <= 1.0)) {
		tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) + (x_46_re / -x_46_re);
	} else {
		tmp = (-27.0 * (x_46_re * x_46_im)) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)));
	}
	return tmp;
}
NOTE: x.im should be positive before calling this function
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 <= (-6.5d-15)) .or. (.not. (x_46re <= 1.0d0))) then
        tmp = (x_46re * ((x_46re - x_46im) * (x_46re + x_46im))) + (x_46re / -x_46re)
    else
        tmp = ((-27.0d0) * (x_46re * x_46im)) - (x_46im * ((x_46re * x_46im) + (x_46re * x_46im)))
    end if
    code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
	double tmp;
	if ((x_46_re <= -6.5e-15) || !(x_46_re <= 1.0)) {
		tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) + (x_46_re / -x_46_re);
	} else {
		tmp = (-27.0 * (x_46_re * x_46_im)) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)));
	}
	return tmp;
}
x.im = abs(x.im)
def code(x_46_re, x_46_im):
	tmp = 0
	if (x_46_re <= -6.5e-15) or not (x_46_re <= 1.0):
		tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) + (x_46_re / -x_46_re)
	else:
		tmp = (-27.0 * (x_46_re * x_46_im)) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)))
	return tmp
x.im = abs(x.im)
function code(x_46_re, x_46_im)
	tmp = 0.0
	if ((x_46_re <= -6.5e-15) || !(x_46_re <= 1.0))
		tmp = Float64(Float64(x_46_re * Float64(Float64(x_46_re - x_46_im) * Float64(x_46_re + x_46_im))) + Float64(x_46_re / Float64(-x_46_re)));
	else
		tmp = Float64(Float64(-27.0 * Float64(x_46_re * x_46_im)) - Float64(x_46_im * Float64(Float64(x_46_re * x_46_im) + Float64(x_46_re * x_46_im))));
	end
	return tmp
end
x.im = abs(x.im)
function tmp_2 = code(x_46_re, x_46_im)
	tmp = 0.0;
	if ((x_46_re <= -6.5e-15) || ~((x_46_re <= 1.0)))
		tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) + (x_46_re / -x_46_re);
	else
		tmp = (-27.0 * (x_46_re * x_46_im)) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)));
	end
	tmp_2 = tmp;
end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$re, -6.5e-15], N[Not[LessEqual[x$46$re, 1.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$re / (-x$46$re)), $MachinePrecision]), $MachinePrecision], N[(N[(-27.0 * N[(x$46$re * x$46$im), $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]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -6.5 \cdot 10^{-15} \lor \neg \left(x.re \leq 1\right):\\
\;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) + \frac{x.re}{-x.re}\\

\mathbf{else}:\\
\;\;\;\;-27 \cdot \left(x.re \cdot x.im\right) - 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 < -6.49999999999999991e-15 or 1 < x.re

    1. Initial program 75.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. *-commutative75.7%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - x.im \cdot \color{blue}{\frac{{\left(x.re \cdot x.im\right)}^{3} + {\left(x.im \cdot x.re\right)}^{3}}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)}} \]
      3. associate-*r/37.6%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \left({\left(x.re \cdot x.im\right)}^{3} + {\color{blue}{\left(x.re \cdot x.im\right)}}^{3}\right)}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)} \]
      5. count-237.6%

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

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \left(2 \cdot {\left(x.re \cdot x.im\right)}^{3}\right)}{{\left(x.re \cdot x.im\right)}^{2} + \left(\color{blue}{\left(x.re \cdot x.im\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)} \]
      8. *-commutative37.6%

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

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

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

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \color{blue}{\frac{-x.re}{-x.re}} \]
    5. Step-by-step derivation
      1. difference-of-squares94.7%

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

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

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

    if -6.49999999999999991e-15 < x.re < 1

    1. Initial program 85.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-squares18.2%

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

      \[\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 46.4%

      \[\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 simplification70.5%

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

Alternative 6: 61.8% accurate, 1.0× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ \begin{array}{l} t_0 := \frac{x.re}{-x.re}\\ \mathbf{if}\;x.re \leq -1.32 \cdot 10^{+42}:\\ \;\;\;\;x.re \cdot \left(\left(x.re + -27\right) \cdot \left(x.re + x.im\right)\right) + t_0\\ \mathbf{elif}\;x.re \leq 10^{+24}:\\ \;\;\;\;-27 \cdot \left(x.re \cdot x.im\right) - x.im \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.re \cdot \left(x.re - 27\right)\right) + t_0\\ \end{array} \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
 :precision binary64
 (let* ((t_0 (/ x.re (- x.re))))
   (if (<= x.re -1.32e+42)
     (+ (* x.re (* (+ x.re -27.0) (+ x.re x.im))) t_0)
     (if (<= x.re 1e+24)
       (- (* -27.0 (* x.re x.im)) (* x.im (+ (* x.re x.im) (* x.re x.im))))
       (+ (* x.re (* x.re (- x.re 27.0))) t_0)))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
	double t_0 = x_46_re / -x_46_re;
	double tmp;
	if (x_46_re <= -1.32e+42) {
		tmp = (x_46_re * ((x_46_re + -27.0) * (x_46_re + x_46_im))) + t_0;
	} else if (x_46_re <= 1e+24) {
		tmp = (-27.0 * (x_46_re * x_46_im)) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)));
	} else {
		tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) + t_0;
	}
	return tmp;
}
NOTE: x.im should be positive before calling this function
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
    if (x_46re <= (-1.32d+42)) then
        tmp = (x_46re * ((x_46re + (-27.0d0)) * (x_46re + x_46im))) + t_0
    else if (x_46re <= 1d+24) then
        tmp = ((-27.0d0) * (x_46re * x_46im)) - (x_46im * ((x_46re * x_46im) + (x_46re * x_46im)))
    else
        tmp = (x_46re * (x_46re * (x_46re - 27.0d0))) + t_0
    end if
    code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
	double t_0 = x_46_re / -x_46_re;
	double tmp;
	if (x_46_re <= -1.32e+42) {
		tmp = (x_46_re * ((x_46_re + -27.0) * (x_46_re + x_46_im))) + t_0;
	} else if (x_46_re <= 1e+24) {
		tmp = (-27.0 * (x_46_re * x_46_im)) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)));
	} else {
		tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) + t_0;
	}
	return tmp;
}
x.im = abs(x.im)
def code(x_46_re, x_46_im):
	t_0 = x_46_re / -x_46_re
	tmp = 0
	if x_46_re <= -1.32e+42:
		tmp = (x_46_re * ((x_46_re + -27.0) * (x_46_re + x_46_im))) + t_0
	elif x_46_re <= 1e+24:
		tmp = (-27.0 * (x_46_re * x_46_im)) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)))
	else:
		tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) + t_0
	return tmp
x.im = abs(x.im)
function code(x_46_re, x_46_im)
	t_0 = Float64(x_46_re / Float64(-x_46_re))
	tmp = 0.0
	if (x_46_re <= -1.32e+42)
		tmp = Float64(Float64(x_46_re * Float64(Float64(x_46_re + -27.0) * Float64(x_46_re + x_46_im))) + t_0);
	elseif (x_46_re <= 1e+24)
		tmp = Float64(Float64(-27.0 * Float64(x_46_re * x_46_im)) - Float64(x_46_im * Float64(Float64(x_46_re * x_46_im) + Float64(x_46_re * x_46_im))));
	else
		tmp = Float64(Float64(x_46_re * Float64(x_46_re * Float64(x_46_re - 27.0))) + t_0);
	end
	return tmp
end
x.im = abs(x.im)
function tmp_2 = code(x_46_re, x_46_im)
	t_0 = x_46_re / -x_46_re;
	tmp = 0.0;
	if (x_46_re <= -1.32e+42)
		tmp = (x_46_re * ((x_46_re + -27.0) * (x_46_re + x_46_im))) + t_0;
	elseif (x_46_re <= 1e+24)
		tmp = (-27.0 * (x_46_re * x_46_im)) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)));
	else
		tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) + t_0;
	end
	tmp_2 = tmp;
end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(x$46$re / (-x$46$re)), $MachinePrecision]}, If[LessEqual[x$46$re, -1.32e+42], N[(N[(x$46$re * N[(N[(x$46$re + -27.0), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[x$46$re, 1e+24], N[(N[(-27.0 * N[(x$46$re * x$46$im), $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], N[(N[(x$46$re * N[(x$46$re * N[(x$46$re - 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]]]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
t_0 := \frac{x.re}{-x.re}\\
\mathbf{if}\;x.re \leq -1.32 \cdot 10^{+42}:\\
\;\;\;\;x.re \cdot \left(\left(x.re + -27\right) \cdot \left(x.re + x.im\right)\right) + t_0\\

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

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


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

    1. Initial program 72.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. *-commutative72.1%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - x.im \cdot \color{blue}{\frac{{\left(x.re \cdot x.im\right)}^{3} + {\left(x.im \cdot x.re\right)}^{3}}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)}} \]
      3. associate-*r/37.0%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \left({\left(x.re \cdot x.im\right)}^{3} + {\color{blue}{\left(x.re \cdot x.im\right)}}^{3}\right)}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)} \]
      5. count-237.0%

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

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

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

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

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

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

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \color{blue}{\frac{-x.re}{-x.re}} \]
    5. Step-by-step derivation
      1. difference-of-squares98.4%

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

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

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

    if -1.32e42 < x.re < 9.9999999999999998e23

    1. Initial program 86.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-squares23.8%

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

      \[\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. Simplified42.5%

      \[\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 46.2%

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

    if 9.9999999999999998e23 < x.re

    1. Initial program 72.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. *-commutative72.3%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - x.im \cdot \color{blue}{\frac{{\left(x.re \cdot x.im\right)}^{3} + {\left(x.im \cdot x.re\right)}^{3}}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)}} \]
      3. associate-*r/41.3%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \left({\left(x.re \cdot x.im\right)}^{3} + {\color{blue}{\left(x.re \cdot x.im\right)}}^{3}\right)}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)} \]
      5. count-241.3%

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

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

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

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

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

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

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \color{blue}{\frac{-x.re}{-x.re}} \]
    5. Step-by-step derivation
      1. difference-of-squares98.5%

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

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

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

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

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

Alternative 7: 42.1% accurate, 1.4× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ \begin{array}{l} t_0 := \frac{x.re}{-x.re}\\ \mathbf{if}\;x.im \leq 1.55 \cdot 10^{+223}:\\ \;\;\;\;x.re \cdot \left(x.re \cdot \left(x.re - 27\right)\right) + t_0\\ \mathbf{else}:\\ \;\;\;\;-27 \cdot \left(x.re \cdot x.im\right) + t_0\\ \end{array} \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
 :precision binary64
 (let* ((t_0 (/ x.re (- x.re))))
   (if (<= x.im 1.55e+223)
     (+ (* x.re (* x.re (- x.re 27.0))) t_0)
     (+ (* -27.0 (* x.re x.im)) t_0))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
	double t_0 = x_46_re / -x_46_re;
	double tmp;
	if (x_46_im <= 1.55e+223) {
		tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) + t_0;
	} else {
		tmp = (-27.0 * (x_46_re * x_46_im)) + t_0;
	}
	return tmp;
}
NOTE: x.im should be positive before calling this function
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
    if (x_46im <= 1.55d+223) then
        tmp = (x_46re * (x_46re * (x_46re - 27.0d0))) + t_0
    else
        tmp = ((-27.0d0) * (x_46re * x_46im)) + t_0
    end if
    code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
	double t_0 = x_46_re / -x_46_re;
	double tmp;
	if (x_46_im <= 1.55e+223) {
		tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) + t_0;
	} else {
		tmp = (-27.0 * (x_46_re * x_46_im)) + t_0;
	}
	return tmp;
}
x.im = abs(x.im)
def code(x_46_re, x_46_im):
	t_0 = x_46_re / -x_46_re
	tmp = 0
	if x_46_im <= 1.55e+223:
		tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) + t_0
	else:
		tmp = (-27.0 * (x_46_re * x_46_im)) + t_0
	return tmp
x.im = abs(x.im)
function code(x_46_re, x_46_im)
	t_0 = Float64(x_46_re / Float64(-x_46_re))
	tmp = 0.0
	if (x_46_im <= 1.55e+223)
		tmp = Float64(Float64(x_46_re * Float64(x_46_re * Float64(x_46_re - 27.0))) + t_0);
	else
		tmp = Float64(Float64(-27.0 * Float64(x_46_re * x_46_im)) + t_0);
	end
	return tmp
end
x.im = abs(x.im)
function tmp_2 = code(x_46_re, x_46_im)
	t_0 = x_46_re / -x_46_re;
	tmp = 0.0;
	if (x_46_im <= 1.55e+223)
		tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) + t_0;
	else
		tmp = (-27.0 * (x_46_re * x_46_im)) + t_0;
	end
	tmp_2 = tmp;
end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(x$46$re / (-x$46$re)), $MachinePrecision]}, If[LessEqual[x$46$im, 1.55e+223], N[(N[(x$46$re * N[(x$46$re * N[(x$46$re - 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], N[(N[(-27.0 * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
t_0 := \frac{x.re}{-x.re}\\
\mathbf{if}\;x.im \leq 1.55 \cdot 10^{+223}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(x.re - 27\right)\right) + t_0\\

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


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

    1. Initial program 80.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. *-commutative80.6%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - x.im \cdot \color{blue}{\frac{{\left(x.re \cdot x.im\right)}^{3} + {\left(x.im \cdot x.re\right)}^{3}}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)}} \]
      3. associate-*r/31.8%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \left({\left(x.re \cdot x.im\right)}^{3} + {\color{blue}{\left(x.re \cdot x.im\right)}}^{3}\right)}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)} \]
      5. count-231.8%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \color{blue}{\left(2 \cdot {\left(x.re \cdot x.im\right)}^{3}\right)}}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)} \]
      6. pow231.8%

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

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

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

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

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

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \color{blue}{\frac{-x.re}{-x.re}} \]
    5. Step-by-step derivation
      1. difference-of-squares53.5%

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

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

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

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

    if 1.54999999999999991e223 < x.im

    1. Initial program 78.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. *-commutative78.1%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - x.im \cdot \color{blue}{\frac{{\left(x.re \cdot x.im\right)}^{3} + {\left(x.im \cdot x.re\right)}^{3}}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)}} \]
      3. associate-*r/17.0%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \left({\left(x.re \cdot x.im\right)}^{3} + {\color{blue}{\left(x.re \cdot x.im\right)}}^{3}\right)}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)} \]
      5. count-217.0%

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

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

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

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

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

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

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \color{blue}{\frac{-x.re}{-x.re}} \]
    5. Step-by-step derivation
      1. difference-of-squares94.8%

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

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

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

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

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

Alternative 8: 18.3% accurate, 1.6× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ x.im \cdot \left(x.re \cdot \left(x.re - 27\right)\right) + \frac{x.re}{-x.re} \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
 :precision binary64
 (+ (* x.im (* x.re (- x.re 27.0))) (/ x.re (- x.re))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
	return (x_46_im * (x_46_re * (x_46_re - 27.0))) + (x_46_re / -x_46_re);
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    code = (x_46im * (x_46re * (x_46re - 27.0d0))) + (x_46re / -x_46re)
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
	return (x_46_im * (x_46_re * (x_46_re - 27.0))) + (x_46_re / -x_46_re);
}
x.im = abs(x.im)
def code(x_46_re, x_46_im):
	return (x_46_im * (x_46_re * (x_46_re - 27.0))) + (x_46_re / -x_46_re)
x.im = abs(x.im)
function code(x_46_re, x_46_im)
	return Float64(Float64(x_46_im * Float64(x_46_re * Float64(x_46_re - 27.0))) + Float64(x_46_re / Float64(-x_46_re)))
end
x.im = abs(x.im)
function tmp = code(x_46_re, x_46_im)
	tmp = (x_46_im * (x_46_re * (x_46_re - 27.0))) + (x_46_re / -x_46_re);
end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := N[(N[(x$46$im * N[(x$46$re * N[(x$46$re - 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x$46$re / (-x$46$re)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x.im = |x.im|\\
\\
x.im \cdot \left(x.re \cdot \left(x.re - 27\right)\right) + \frac{x.re}{-x.re}
\end{array}
Derivation
  1. Initial program 80.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. *-commutative80.5%

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - x.im \cdot \color{blue}{\frac{{\left(x.re \cdot x.im\right)}^{3} + {\left(x.im \cdot x.re\right)}^{3}}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)}} \]
    3. associate-*r/30.8%

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \left({\left(x.re \cdot x.im\right)}^{3} + {\color{blue}{\left(x.re \cdot x.im\right)}}^{3}\right)}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)} \]
    5. count-230.8%

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \color{blue}{\left(2 \cdot {\left(x.re \cdot x.im\right)}^{3}\right)}}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)} \]
    6. pow230.8%

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

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

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

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

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

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

    \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \color{blue}{\frac{-x.re}{-x.re}} \]
  5. Step-by-step derivation
    1. difference-of-squares56.4%

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

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

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

    \[\leadsto \color{blue}{x.im \cdot \left(x.re \cdot \left(x.re - 27\right)\right)} - \frac{-x.re}{-x.re} \]
  9. Final simplification14.8%

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

Alternative 9: 9.2% accurate, 1.9× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ -27 \cdot \left(x.re \cdot x.im\right) + \frac{x.re}{-x.re} \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
 :precision binary64
 (+ (* -27.0 (* x.re x.im)) (/ x.re (- x.re))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
	return (-27.0 * (x_46_re * x_46_im)) + (x_46_re / -x_46_re);
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    code = ((-27.0d0) * (x_46re * x_46im)) + (x_46re / -x_46re)
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
	return (-27.0 * (x_46_re * x_46_im)) + (x_46_re / -x_46_re);
}
x.im = abs(x.im)
def code(x_46_re, x_46_im):
	return (-27.0 * (x_46_re * x_46_im)) + (x_46_re / -x_46_re)
x.im = abs(x.im)
function code(x_46_re, x_46_im)
	return Float64(Float64(-27.0 * Float64(x_46_re * x_46_im)) + Float64(x_46_re / Float64(-x_46_re)))
end
x.im = abs(x.im)
function tmp = code(x_46_re, x_46_im)
	tmp = (-27.0 * (x_46_re * x_46_im)) + (x_46_re / -x_46_re);
end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := N[(N[(-27.0 * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision] + N[(x$46$re / (-x$46$re)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x.im = |x.im|\\
\\
-27 \cdot \left(x.re \cdot x.im\right) + \frac{x.re}{-x.re}
\end{array}
Derivation
  1. Initial program 80.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. *-commutative80.5%

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - x.im \cdot \color{blue}{\frac{{\left(x.re \cdot x.im\right)}^{3} + {\left(x.im \cdot x.re\right)}^{3}}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)}} \]
    3. associate-*r/30.8%

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \left({\left(x.re \cdot x.im\right)}^{3} + {\color{blue}{\left(x.re \cdot x.im\right)}}^{3}\right)}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)} \]
    5. count-230.8%

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \color{blue}{\left(2 \cdot {\left(x.re \cdot x.im\right)}^{3}\right)}}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)} \]
    6. pow230.8%

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

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

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

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

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

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

    \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \color{blue}{\frac{-x.re}{-x.re}} \]
  5. Step-by-step derivation
    1. difference-of-squares56.4%

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

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

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

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

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

Alternative 10: 15.1% accurate, 1.9× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ x.re \cdot \left(x.re \cdot x.im\right) + \frac{x.re}{-x.re} \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
 :precision binary64
 (+ (* x.re (* x.re x.im)) (/ x.re (- x.re))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
	return (x_46_re * (x_46_re * x_46_im)) + (x_46_re / -x_46_re);
}
NOTE: x.im should be positive before calling this function
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_46re / -x_46re)
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
	return (x_46_re * (x_46_re * x_46_im)) + (x_46_re / -x_46_re);
}
x.im = abs(x.im)
def code(x_46_re, x_46_im):
	return (x_46_re * (x_46_re * x_46_im)) + (x_46_re / -x_46_re)
x.im = abs(x.im)
function code(x_46_re, x_46_im)
	return Float64(Float64(x_46_re * Float64(x_46_re * x_46_im)) + Float64(x_46_re / Float64(-x_46_re)))
end
x.im = abs(x.im)
function tmp = code(x_46_re, x_46_im)
	tmp = (x_46_re * (x_46_re * x_46_im)) + (x_46_re / -x_46_re);
end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := N[(N[(x$46$re * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision] + N[(x$46$re / (-x$46$re)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x.im = |x.im|\\
\\
x.re \cdot \left(x.re \cdot x.im\right) + \frac{x.re}{-x.re}
\end{array}
Derivation
  1. Initial program 80.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. *-commutative80.5%

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - x.im \cdot \color{blue}{\frac{{\left(x.re \cdot x.im\right)}^{3} + {\left(x.im \cdot x.re\right)}^{3}}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)}} \]
    3. associate-*r/30.8%

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \left({\left(x.re \cdot x.im\right)}^{3} + {\color{blue}{\left(x.re \cdot x.im\right)}}^{3}\right)}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)} \]
    5. count-230.8%

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \color{blue}{\left(2 \cdot {\left(x.re \cdot x.im\right)}^{3}\right)}}{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) + \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)} \]
    6. pow230.8%

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

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

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

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

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

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

    \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \color{blue}{\frac{-x.re}{-x.re}} \]
  5. Step-by-step derivation
    1. difference-of-squares56.4%

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

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

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

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

    \[\leadsto \color{blue}{\left(x.im \cdot x.re\right)} \cdot x.re - \frac{-x.re}{-x.re} \]
  10. Final simplification11.9%

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

Alternative 11: 0.0% accurate, 2.1× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ x.im \cdot \left(x.re \cdot -27 + \frac{0}{0}\right) \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
 :precision binary64
 (* x.im (+ (* x.re -27.0) (/ 0.0 0.0))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
	return x_46_im * ((x_46_re * -27.0) + (0.0 / 0.0));
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    code = x_46im * ((x_46re * (-27.0d0)) + (0.0d0 / 0.0d0))
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
	return x_46_im * ((x_46_re * -27.0) + (0.0 / 0.0));
}
x.im = abs(x.im)
def code(x_46_re, x_46_im):
	return x_46_im * ((x_46_re * -27.0) + (0.0 / 0.0))
x.im = abs(x.im)
function code(x_46_re, x_46_im)
	return Float64(x_46_im * Float64(Float64(x_46_re * -27.0) + Float64(0.0 / 0.0)))
end
x.im = abs(x.im)
function tmp = code(x_46_re, x_46_im)
	tmp = x_46_im * ((x_46_re * -27.0) + (0.0 / 0.0));
end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := N[(x$46$im * N[(N[(x$46$re * -27.0), $MachinePrecision] + N[(0.0 / 0.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x.im = |x.im|\\
\\
x.im \cdot \left(x.re \cdot -27 + \frac{0}{0}\right)
\end{array}
Derivation
  1. Initial program 80.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-squares56.4%

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

    \[\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 31.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. Simplified31.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. associate-*l*31.7%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{x.im \cdot \left(x.re \cdot -27 - \frac{0}{0}\right)} \]
  9. Final simplification0.0%

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

Developer target: 87.0% 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 2024024 
(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)))