math.cube on complex, imaginary part

Percentage Accurate: 82.7% → 99.4%
Time: 7.5s
Alternatives: 16
Speedup: 1.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 16 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.7% accurate, 1.0× speedup?

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

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

Alternative 1: 99.4% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -6.2 \cdot 10^{+110} \lor \neg \left(x.im \leq 7.8 \cdot 10^{+69}\right):\\
\;\;\;\;x.im \cdot \left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -6.20000000000000035e110 or 7.7999999999999998e69 < x.im

    1. Initial program 63.2%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \frac{x.re \cdot \color{blue}{\left(x.im - x.im\right)}}{x.im \cdot x.im - x.im \cdot x.im} \]
      11. distribute-lft-out--0.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.20000000000000035e110 < x.im < 7.7999999999999998e69

    1. Initial program 88.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -6.2 \cdot 10^{+110} \lor \neg \left(x.im \leq 7.8 \cdot 10^{+69}\right):\\ \;\;\;\;x.im \cdot \left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.re \cdot \left(x.im \cdot 3\right)\right) - {x.im}^{3}\\ \end{array} \]

Alternative 2: 99.8% accurate, 0.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.im) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.re)) < +inf.0

    1. Initial program 91.8%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), \color{blue}{x.re \cdot \left(x.re \cdot x.im + x.im \cdot x.re\right)}\right) \]
      8. *-commutative99.8%

        \[\leadsto \mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), x.re \cdot \left(x.re \cdot x.im + \color{blue}{x.re \cdot x.im}\right)\right) \]
      9. distribute-lft-out99.8%

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \frac{x.re \cdot \color{blue}{\left(x.im - x.im\right)}}{x.im \cdot x.im - x.im \cdot x.im} \]
      11. distribute-lft-out--0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 95.9% accurate, 0.2× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.im < -2.5e-52 or 9.9999999999999995e59 < x.im

    1. Initial program 71.3%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \frac{x.re \cdot \color{blue}{\left(x.im - x.im\right)}}{x.im \cdot x.im - x.im \cdot x.im} \]
      11. distribute-lft-out--0.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{0}{0}, \frac{0}{0}, x.im \cdot \left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)\right)} \]
    6. Simplified98.4%

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

    if -2.5e-52 < x.im < 2.1200000000000001e-100

    1. Initial program 82.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(x.re \cdot x.re\right) \cdot \left(x.im \cdot 3\right) - {x.im}^{3}} \]
    8. Taylor expanded in x.re around inf 80.1%

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

      \[\leadsto \color{blue}{3 \cdot \left(x.im \cdot \left(x.re \cdot x.re\right)\right)} \]
    10. Taylor expanded in x.im around 0 80.1%

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

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

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

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

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

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

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

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

    if 2.1200000000000001e-100 < x.im < 9.9999999999999995e59

    1. Initial program 97.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -2.5 \cdot 10^{-52}:\\ \;\;\;\;x.im \cdot \left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)\\ \mathbf{elif}\;x.im \leq 2.12 \cdot 10^{-100}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot \left(x.re \cdot 3\right)\right)\\ \mathbf{elif}\;x.im \leq 10^{+60}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.im \cdot 3\right) - {x.im}^{3}\\ \mathbf{else}:\\ \;\;\;\;x.im \cdot \left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)\\ \end{array} \]

Alternative 4: 95.9% accurate, 0.8× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.im < -1.35e-50 or 3.99999999999999993e67 < x.im

    1. Initial program 71.3%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \frac{x.re \cdot \color{blue}{\left(x.im - x.im\right)}}{x.im \cdot x.im - x.im \cdot x.im} \]
      11. distribute-lft-out--0.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{0}{0}, \frac{0}{0}, x.im \cdot \left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)\right)} \]
    6. Simplified98.4%

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

    if -1.35e-50 < x.im < 2.14999999999999999e-100

    1. Initial program 82.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(x.re \cdot x.re\right) \cdot \left(x.im \cdot 3\right) - {x.im}^{3}} \]
    8. Taylor expanded in x.re around inf 80.1%

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

      \[\leadsto \color{blue}{3 \cdot \left(x.im \cdot \left(x.re \cdot x.re\right)\right)} \]
    10. Taylor expanded in x.im around 0 80.1%

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

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

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

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

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

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

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

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

    if 2.14999999999999999e-100 < x.im < 3.99999999999999993e67

    1. Initial program 97.1%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
  3. Recombined 3 regimes into one program.
  4. Final simplification97.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -1.35 \cdot 10^{-50}:\\ \;\;\;\;x.im \cdot \left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)\\ \mathbf{elif}\;x.im \leq 2.15 \cdot 10^{-100}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot \left(x.re \cdot 3\right)\right)\\ \mathbf{elif}\;x.im \leq 4 \cdot 10^{+67}:\\ \;\;\;\;x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) + x.re \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\\ \mathbf{else}:\\ \;\;\;\;x.im \cdot \left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)\\ \end{array} \]

Alternative 5: 92.7% accurate, 1.3× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{x.im}{\frac{\frac{1}{x.re - x.im}}{x.re + x.im}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.im < -1.5500000000000001e-50

    1. Initial program 79.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \frac{x.re \cdot \color{blue}{\left(x.im - x.im\right)}}{x.im \cdot x.im - x.im \cdot x.im} \]
      11. distribute-lft-out--0.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.5500000000000001e-50 < x.im < 9.60000000000000076e-96

    1. Initial program 82.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(x.re \cdot x.re\right) \cdot \left(x.im \cdot 3\right) - {x.im}^{3}} \]
    8. Taylor expanded in x.re around inf 80.1%

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

      \[\leadsto \color{blue}{3 \cdot \left(x.im \cdot \left(x.re \cdot x.re\right)\right)} \]
    10. Taylor expanded in x.im around 0 80.1%

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

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

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

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

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

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

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

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

    if 9.60000000000000076e-96 < x.im

    1. Initial program 75.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \frac{x.re \cdot \color{blue}{\left(x.im - x.im\right)}}{x.im \cdot x.im - x.im \cdot x.im} \]
      11. distribute-lft-out--0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0 + \left(x.im \cdot x.im + x.re \cdot x.im\right) \cdot \frac{x.re \cdot x.re - x.im \cdot x.im}{\color{blue}{x.im + x.re}} \]
      5. associate-*r/67.5%

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

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

      \[\leadsto 0 + \color{blue}{\frac{\left(x.im \cdot \left(x.im + x.re\right)\right) \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right)}{x.im + x.re}} \]
    9. Step-by-step derivation
      1. associate-/l*75.4%

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

        \[\leadsto 0 + \color{blue}{\frac{x.im}{\frac{\frac{x.im + x.re}{x.re \cdot x.re - x.im \cdot x.im}}{x.im + x.re}}} \]
      3. difference-of-squares90.9%

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

        \[\leadsto 0 + \frac{x.im}{\frac{\frac{x.im + x.re}{\color{blue}{\left(x.im + x.re\right)} \cdot \left(x.re - x.im\right)}}{x.im + x.re}} \]
      5. associate-/r*91.1%

        \[\leadsto 0 + \frac{x.im}{\frac{\color{blue}{\frac{\frac{x.im + x.re}{x.im + x.re}}{x.re - x.im}}}{x.im + x.re}} \]
      6. *-inverses91.1%

        \[\leadsto 0 + \frac{x.im}{\frac{\frac{\color{blue}{1}}{x.re - x.im}}{x.im + x.re}} \]
      7. +-commutative91.1%

        \[\leadsto 0 + \frac{x.im}{\frac{\frac{1}{x.re - x.im}}{\color{blue}{x.re + x.im}}} \]
    10. Simplified91.1%

      \[\leadsto 0 + \color{blue}{\frac{x.im}{\frac{\frac{1}{x.re - x.im}}{x.re + x.im}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification95.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -1.55 \cdot 10^{-50}:\\ \;\;\;\;x.im \cdot \left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)\\ \mathbf{elif}\;x.im \leq 9.6 \cdot 10^{-96}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot \left(x.re \cdot 3\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{\frac{\frac{1}{x.re - x.im}}{x.re + x.im}}\\ \end{array} \]

Alternative 6: 92.7% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -1.7 \cdot 10^{-49} \lor \neg \left(x.im \leq 5.5 \cdot 10^{-98}\right):\\
\;\;\;\;x.im \cdot \left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -1.70000000000000002e-49 or 5.4999999999999997e-98 < x.im

    1. Initial program 77.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \frac{x.re \cdot \color{blue}{\left(x.im - x.im\right)}}{x.im \cdot x.im - x.im \cdot x.im} \]
      11. distribute-lft-out--0.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.70000000000000002e-49 < x.im < 5.4999999999999997e-98

    1. Initial program 82.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(x.re \cdot x.re\right) \cdot \left(x.im \cdot 3\right) - {x.im}^{3}} \]
    8. Taylor expanded in x.re around inf 80.1%

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

      \[\leadsto \color{blue}{3 \cdot \left(x.im \cdot \left(x.re \cdot x.re\right)\right)} \]
    10. Taylor expanded in x.im around 0 80.1%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -1.7 \cdot 10^{-49} \lor \neg \left(x.im \leq 5.5 \cdot 10^{-98}\right):\\ \;\;\;\;x.im \cdot \left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot \left(x.re \cdot 3\right)\right)\\ \end{array} \]

Alternative 7: 54.8% accurate, 2.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -2.20000000000000009e145

    1. Initial program 61.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x.re + x.im, \left(x.re - x.im\right) \cdot x.im, \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\right)} \]
      6. *-commutative74.4%

        \[\leadsto \mathsf{fma}\left(x.re + x.im, \color{blue}{x.im \cdot \left(x.re - x.im\right)}, \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\right) \]
      7. *-commutative74.4%

        \[\leadsto \mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), \color{blue}{x.re \cdot \left(x.re \cdot x.im + x.im \cdot x.re\right)}\right) \]
      8. *-commutative74.4%

        \[\leadsto \mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), x.re \cdot \left(x.re \cdot x.im + \color{blue}{x.re \cdot x.im}\right)\right) \]
      9. distribute-lft-out74.4%

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

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

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

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

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

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

    if -2.20000000000000009e145 < x.im

    1. Initial program 82.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(x.re \cdot x.re\right) \cdot \left(x.im \cdot 3\right) - {x.im}^{3}} \]
    8. Taylor expanded in x.re around inf 56.3%

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

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

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

Alternative 8: 54.8% accurate, 2.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -1.35000000000000009e148

    1. Initial program 61.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x.re + x.im, \left(x.re - x.im\right) \cdot x.im, \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\right)} \]
      6. *-commutative74.4%

        \[\leadsto \mathsf{fma}\left(x.re + x.im, \color{blue}{x.im \cdot \left(x.re - x.im\right)}, \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\right) \]
      7. *-commutative74.4%

        \[\leadsto \mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), \color{blue}{x.re \cdot \left(x.re \cdot x.im + x.im \cdot x.re\right)}\right) \]
      8. *-commutative74.4%

        \[\leadsto \mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), x.re \cdot \left(x.re \cdot x.im + \color{blue}{x.re \cdot x.im}\right)\right) \]
      9. distribute-lft-out74.4%

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

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

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

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

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

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

    if -1.35000000000000009e148 < x.im

    1. Initial program 82.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 60.8% accurate, 2.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -4.5999999999999997e149

    1. Initial program 61.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x.re + x.im, \left(x.re - x.im\right) \cdot x.im, \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\right)} \]
      6. *-commutative74.4%

        \[\leadsto \mathsf{fma}\left(x.re + x.im, \color{blue}{x.im \cdot \left(x.re - x.im\right)}, \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\right) \]
      7. *-commutative74.4%

        \[\leadsto \mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), \color{blue}{x.re \cdot \left(x.re \cdot x.im + x.im \cdot x.re\right)}\right) \]
      8. *-commutative74.4%

        \[\leadsto \mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), x.re \cdot \left(x.re \cdot x.im + \color{blue}{x.re \cdot x.im}\right)\right) \]
      9. distribute-lft-out74.4%

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

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

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

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

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

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

    if -4.5999999999999997e149 < x.im

    1. Initial program 82.4%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), \color{blue}{x.re \cdot \left(x.re \cdot x.im + x.im \cdot x.re\right)}\right) \]
      8. *-commutative93.3%

        \[\leadsto \mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), x.re \cdot \left(x.re \cdot x.im + \color{blue}{x.re \cdot x.im}\right)\right) \]
      9. distribute-lft-out93.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 60.8% accurate, 2.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -1.7599999999999999e149

    1. Initial program 61.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x.re + x.im, \left(x.re - x.im\right) \cdot x.im, \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\right)} \]
      6. *-commutative74.4%

        \[\leadsto \mathsf{fma}\left(x.re + x.im, \color{blue}{x.im \cdot \left(x.re - x.im\right)}, \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\right) \]
      7. *-commutative74.4%

        \[\leadsto \mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), \color{blue}{x.re \cdot \left(x.re \cdot x.im + x.im \cdot x.re\right)}\right) \]
      8. *-commutative74.4%

        \[\leadsto \mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), x.re \cdot \left(x.re \cdot x.im + \color{blue}{x.re \cdot x.im}\right)\right) \]
      9. distribute-lft-out74.4%

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

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

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

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

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

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

    if -1.7599999999999999e149 < x.im

    1. Initial program 82.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(x.re \cdot x.re\right) \cdot \left(x.im \cdot 3\right) - {x.im}^{3}} \]
    8. Taylor expanded in x.re around inf 56.3%

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

      \[\leadsto \color{blue}{3 \cdot \left(x.im \cdot \left(x.re \cdot x.re\right)\right)} \]
    10. Taylor expanded in x.im around 0 56.3%

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

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

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

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

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

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

        \[\leadsto x.re \cdot \color{blue}{\left(x.im \cdot \left(x.re \cdot 3\right)\right)} \]
    12. Simplified64.5%

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

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

Alternative 11: 67.4% accurate, 2.1× speedup?

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x.re + x.im, \left(x.re - x.im\right) \cdot x.im, \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\right)} \]
    6. *-commutative90.5%

      \[\leadsto \mathsf{fma}\left(x.re + x.im, \color{blue}{x.im \cdot \left(x.re - x.im\right)}, \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\right) \]
    7. *-commutative90.5%

      \[\leadsto \mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), \color{blue}{x.re \cdot \left(x.re \cdot x.im + x.im \cdot x.re\right)}\right) \]
    8. *-commutative90.5%

      \[\leadsto \mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), x.re \cdot \left(x.re \cdot x.im + \color{blue}{x.re \cdot x.im}\right)\right) \]
    9. distribute-lft-out90.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{x.re \cdot \left(x.im \cdot x.im + x.im \cdot \left(3 \cdot x.re\right)\right)} \]
  8. Step-by-step derivation
    1. distribute-lft-out67.1%

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

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

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

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

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

Alternative 12: 37.5% accurate, 2.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -3.9999999999999999e147

    1. Initial program 61.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x.re + x.im, \left(x.re - x.im\right) \cdot x.im, \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\right)} \]
      6. *-commutative74.4%

        \[\leadsto \mathsf{fma}\left(x.re + x.im, \color{blue}{x.im \cdot \left(x.re - x.im\right)}, \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\right) \]
      7. *-commutative74.4%

        \[\leadsto \mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), \color{blue}{x.re \cdot \left(x.re \cdot x.im + x.im \cdot x.re\right)}\right) \]
      8. *-commutative74.4%

        \[\leadsto \mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), x.re \cdot \left(x.re \cdot x.im + \color{blue}{x.re \cdot x.im}\right)\right) \]
      9. distribute-lft-out74.4%

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

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

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

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

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

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

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

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

    if -3.9999999999999999e147 < x.im

    1. Initial program 82.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \frac{x.re \cdot \color{blue}{\left(x.im - x.im\right)}}{x.im \cdot x.im - x.im \cdot x.im} \]
      11. distribute-lft-out--0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 38.6% accurate, 2.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -9.19999999999999961e140

    1. Initial program 61.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x.re + x.im, \left(x.re - x.im\right) \cdot x.im, \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\right)} \]
      6. *-commutative74.4%

        \[\leadsto \mathsf{fma}\left(x.re + x.im, \color{blue}{x.im \cdot \left(x.re - x.im\right)}, \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\right) \]
      7. *-commutative74.4%

        \[\leadsto \mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), \color{blue}{x.re \cdot \left(x.re \cdot x.im + x.im \cdot x.re\right)}\right) \]
      8. *-commutative74.4%

        \[\leadsto \mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), x.re \cdot \left(x.re \cdot x.im + \color{blue}{x.re \cdot x.im}\right)\right) \]
      9. distribute-lft-out74.4%

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

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

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

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

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

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

    if -9.19999999999999961e140 < x.im

    1. Initial program 82.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \frac{x.re \cdot \color{blue}{\left(x.im - x.im\right)}}{x.im \cdot x.im - x.im \cdot x.im} \]
      11. distribute-lft-out--0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 27.7% accurate, 3.8× speedup?

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x.re + x.im, \left(x.re - x.im\right) \cdot x.im, \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\right)} \]
    6. *-commutative90.5%

      \[\leadsto \mathsf{fma}\left(x.re + x.im, \color{blue}{x.im \cdot \left(x.re - x.im\right)}, \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\right) \]
    7. *-commutative90.5%

      \[\leadsto \mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), \color{blue}{x.re \cdot \left(x.re \cdot x.im + x.im \cdot x.re\right)}\right) \]
    8. *-commutative90.5%

      \[\leadsto \mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), x.re \cdot \left(x.re \cdot x.im + \color{blue}{x.re \cdot x.im}\right)\right) \]
    9. distribute-lft-out90.5%

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

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

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

    \[\leadsto \color{blue}{x.re \cdot {x.im}^{2}} \]
  6. Step-by-step derivation
    1. unpow230.7%

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

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

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

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

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

Alternative 15: 4.5% accurate, 6.3× speedup?

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

\\
x.im \cdot -3
\end{array}
Derivation
  1. Initial program 79.3%

    \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
  2. Taylor expanded in x.re around 0 63.5%

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

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

    \[\leadsto \color{blue}{-3 \cdot x.im} \]
  5. Step-by-step derivation
    1. *-commutative4.5%

      \[\leadsto \color{blue}{x.im \cdot -3} \]
  6. Simplified4.5%

    \[\leadsto \color{blue}{x.im \cdot -3} \]
  7. Final simplification4.5%

    \[\leadsto x.im \cdot -3 \]

Alternative 16: 2.7% accurate, 19.0× speedup?

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

\\
-2.6
\end{array}
Derivation
  1. Initial program 79.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-\left(27 \cdot {\color{blue}{\left(x.re \cdot \left(x.re \cdot x.im\right)\right)}}^{3} - {\left({x.im}^{3}\right)}^{3}\right)}{-\left(\left(\left(\left(x.re \cdot x.re\right) \cdot x.im\right) \cdot 3\right) \cdot \left(\left(\left(x.re \cdot x.re\right) \cdot x.im\right) \cdot 3\right) + \left({x.im}^{3} \cdot {x.im}^{3} + \left(\left(\left(x.re \cdot x.re\right) \cdot x.im\right) \cdot 3\right) \cdot {x.im}^{3}\right)\right)} \]
    7. pow-pow10.6%

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

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

    \[\leadsto \color{blue}{\frac{-\left(27 \cdot {\left(x.re \cdot \left(x.re \cdot x.im\right)\right)}^{3} - {x.im}^{9}\right)}{-\left(\left(9 \cdot \left(\left(x.im \cdot x.im\right) \cdot {x.re}^{4}\right) + {x.im}^{6}\right) + \left(x.re \cdot x.re\right) \cdot \left(\left(x.im \cdot 3\right) \cdot {x.im}^{3}\right)\right)}} \]
  6. Simplified2.7%

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

    \[\leadsto -2.6 \]

Developer target: 91.9% accurate, 1.1× speedup?

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

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

Reproduce

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

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

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