math.cube on complex, imaginary part

Percentage Accurate: 82.6% → 99.8%
Time: 9.6s
Alternatives: 16
Speedup: 1.3×

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

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

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

Alternative 1: 99.8% accurate, 0.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 94.9%

      \[\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. *-commutative94.9%

        \[\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. *-commutative94.9%

        \[\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-squares94.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + \left(\sqrt[3]{\color{blue}{\left(-1 \cdot -1\right)} \cdot -1} \cdot \sqrt[3]{{x.im}^{3}}\right) \cdot x.re\right) \]
      12. add-cbrt-cube3.4%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + \left(\color{blue}{-1} \cdot \sqrt[3]{{x.im}^{3}}\right) \cdot x.re\right) \]
      13. rem-cbrt-cube20.7%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + \left(-1 \cdot \color{blue}{x.im}\right) \cdot x.re\right) \]
      14. neg-mul-120.7%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + \color{blue}{\left(-x.im\right)} \cdot x.re\right) \]
      15. cancel-sign-sub-inv20.7%

        \[\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.im \cdot x.re\right)} \]
      16. *-commutative20.7%

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

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

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

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

      \[\leadsto \color{blue}{\left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)} \cdot x.im + 0 \]
  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 2: 93.2% 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 2 \cdot 10^{+302}:\\ \;\;\;\;3 \cdot \left(\left(x.re \cdot x.re\right) \cdot x.im\right) - {x.im}^{3}\\ \mathbf{else}:\\ \;\;\;\;\left(x.im + x.im\right) + \left(x.re + x.im\right) \cdot \left(x.im \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))))
      2e+302)
   (- (* 3.0 (* (* x.re x.re) x.im)) (pow x.im 3.0))
   (+ (+ x.im x.im) (* (+ x.re x.im) (* 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)))) <= 2e+302) {
		tmp = (3.0 * ((x_46_re * x_46_re) * x_46_im)) - pow(x_46_im, 3.0);
	} else {
		tmp = (x_46_im + x_46_im) + ((x_46_re + x_46_im) * (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 * ((x_46re * x_46re) - (x_46im * x_46im))) + (x_46re * ((x_46re * x_46im) + (x_46re * x_46im)))) <= 2d+302) then
        tmp = (3.0d0 * ((x_46re * x_46re) * x_46im)) - (x_46im ** 3.0d0)
    else
        tmp = (x_46im + x_46im) + ((x_46re + x_46im) * (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 * ((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)))) <= 2e+302) {
		tmp = (3.0 * ((x_46_re * x_46_re) * x_46_im)) - Math.pow(x_46_im, 3.0);
	} else {
		tmp = (x_46_im + x_46_im) + ((x_46_re + x_46_im) * (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 * ((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)))) <= 2e+302:
		tmp = (3.0 * ((x_46_re * x_46_re) * x_46_im)) - math.pow(x_46_im, 3.0)
	else:
		tmp = (x_46_im + x_46_im) + ((x_46_re + x_46_im) * (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)))) <= 2e+302)
		tmp = Float64(Float64(3.0 * Float64(Float64(x_46_re * x_46_re) * x_46_im)) - (x_46_im ^ 3.0));
	else
		tmp = Float64(Float64(x_46_im + x_46_im) + Float64(Float64(x_46_re + x_46_im) * Float64(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 * ((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)))) <= 2e+302)
		tmp = (3.0 * ((x_46_re * x_46_re) * x_46_im)) - (x_46_im ^ 3.0);
	else
		tmp = (x_46_im + x_46_im) + ((x_46_re + x_46_im) * (x_46_im * (x_46_re - x_46_im)));
	end
	tmp_2 = 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], 2e+302], N[(N[(3.0 * N[(N[(x$46$re * x$46$re), $MachinePrecision] * x$46$im), $MachinePrecision]), $MachinePrecision] - N[Power[x$46$im, 3.0], $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im + x$46$im), $MachinePrecision] + N[(N[(x$46$re + x$46$im), $MachinePrecision] * N[(x$46$im * N[(x$46$re - x$46$im), $MachinePrecision]), $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 2 \cdot 10^{+302}:\\
\;\;\;\;3 \cdot \left(\left(x.re \cdot x.re\right) \cdot x.im\right) - {x.im}^{3}\\

\mathbf{else}:\\
\;\;\;\;\left(x.im + x.im\right) + \left(x.re + x.im\right) \cdot \left(x.im \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)) < 2.0000000000000002e302

    1. Initial program 97.7%

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

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

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

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

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

        \[\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.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-97.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--97.6%

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

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

    if 2.0000000000000002e302 < (+.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 54.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. +-commutative54.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. *-commutative54.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 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}} + x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) \]
      8. associate-*r/0.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.im + x.im\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im} \]
      18. difference-of-squares90.7%

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

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

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

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

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

Alternative 3: 97.6% 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:\\ \;\;\;\;x.re \cdot \left(x.re \cdot \left(x.im \cdot 3\right)\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} \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)
   (- (* x.re (* x.re (* x.im 3.0))) (pow x.im 3.0))
   (* x.im (* (+ x.re x.im) (- x.re x.im)))))
double code(double x_46_re, double x_46_im) {
	double tmp;
	if (((x_46_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 = (x_46_re * (x_46_re * (x_46_im * 3.0))) - pow(x_46_im, 3.0);
	} else {
		tmp = x_46_im * ((x_46_re + x_46_im) * (x_46_re - x_46_im));
	}
	return tmp;
}
public static 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.POSITIVE_INFINITY) {
		tmp = (x_46_re * (x_46_re * (x_46_im * 3.0))) - Math.pow(x_46_im, 3.0);
	} else {
		tmp = x_46_im * ((x_46_re + x_46_im) * (x_46_re - x_46_im));
	}
	return tmp;
}
def code(x_46_re, x_46_im):
	tmp = 0
	if ((x_46_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)))) <= math.inf:
		tmp = (x_46_re * (x_46_re * (x_46_im * 3.0))) - math.pow(x_46_im, 3.0)
	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 = Float64(Float64(x_46_re * Float64(x_46_re * Float64(x_46_im * 3.0))) - (x_46_im ^ 3.0));
	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
function tmp_2 = code(x_46_re, x_46_im)
	tmp = 0.0;
	if (((x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_re * x_46_im) + (x_46_re * x_46_im)))) <= Inf)
		tmp = (x_46_re * (x_46_re * (x_46_im * 3.0))) - (x_46_im ^ 3.0);
	else
		tmp = x_46_im * ((x_46_re + x_46_im) * (x_46_re - x_46_im));
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_] := If[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 * N[(x$46$re * N[(x$46$im * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[x$46$im, 3.0], $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:\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(x.im \cdot 3\right)\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}
\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 94.9%

      \[\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. +-commutative94.9%

        \[\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. *-commutative94.9%

        \[\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-out94.9%

        \[\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*94.9%

        \[\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. *-commutative94.9%

        \[\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-out94.9%

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

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

        \[\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. Simplified94.1%

      \[\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-neg94.1%

        \[\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*94.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + \left(\sqrt[3]{\color{blue}{\left(-1 \cdot -1\right)} \cdot -1} \cdot \sqrt[3]{{x.im}^{3}}\right) \cdot x.re\right) \]
      12. add-cbrt-cube3.4%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + \left(\color{blue}{-1} \cdot \sqrt[3]{{x.im}^{3}}\right) \cdot x.re\right) \]
      13. rem-cbrt-cube20.7%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + \left(-1 \cdot \color{blue}{x.im}\right) \cdot x.re\right) \]
      14. neg-mul-120.7%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + \color{blue}{\left(-x.im\right)} \cdot x.re\right) \]
      15. cancel-sign-sub-inv20.7%

        \[\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.im \cdot x.re\right)} \]
      16. *-commutative20.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) + x.re \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right) \leq \infty:\\ \;\;\;\;x.re \cdot \left(x.re \cdot \left(x.im \cdot 3\right)\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: 94.2% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_0 := 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{if}\;t_0 \leq 2 \cdot 10^{+302}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\left(x.im + x.im\right) + \left(x.re + x.im\right) \cdot \left(x.im \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)) < 2.0000000000000002e302

    1. Initial program 97.7%

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

    if 2.0000000000000002e302 < (+.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 54.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. +-commutative54.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. *-commutative54.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 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}} + x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) \]
      8. associate-*r/0.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.im + x.im\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im} \]
      18. difference-of-squares90.7%

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

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

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

      \[\leadsto \color{blue}{\left(x.im + x.im\right) + \left(x.re + x.im\right) \cdot \left(x.im \cdot \left(x.re - x.im\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification95.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 2 \cdot 10^{+302}:\\ \;\;\;\;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}:\\ \;\;\;\;\left(x.im + x.im\right) + \left(x.re + x.im\right) \cdot \left(x.im \cdot \left(x.re - x.im\right)\right)\\ \end{array} \]

Alternative 5: 92.4% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.im \leq -5.5 \cdot 10^{-46} \lor \neg \left(x.im \leq 3.2 \cdot 10^{-97}\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 x.im + 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 -5.5e-46) (not (<= x.im 3.2e-97)))
   (* x.im (* (+ x.re x.im) (- x.re x.im)))
   (* x.re (+ (* x.im x.im) (* x.im (* x.re 3.0))))))
double code(double x_46_re, double x_46_im) {
	double tmp;
	if ((x_46_im <= -5.5e-46) || !(x_46_im <= 3.2e-97)) {
		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_im) + (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 <= (-5.5d-46)) .or. (.not. (x_46im <= 3.2d-97))) then
        tmp = x_46im * ((x_46re + x_46im) * (x_46re - x_46im))
    else
        tmp = x_46re * ((x_46im * x_46im) + (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 <= -5.5e-46) || !(x_46_im <= 3.2e-97)) {
		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_im) + (x_46_im * (x_46_re * 3.0)));
	}
	return tmp;
}
def code(x_46_re, x_46_im):
	tmp = 0
	if (x_46_im <= -5.5e-46) or not (x_46_im <= 3.2e-97):
		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_im) + (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 <= -5.5e-46) || !(x_46_im <= 3.2e-97))
		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(Float64(x_46_im * x_46_im) + 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 <= -5.5e-46) || ~((x_46_im <= 3.2e-97)))
		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_im) + (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, -5.5e-46], N[Not[LessEqual[x$46$im, 3.2e-97]], $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[(N[(x$46$im * x$46$im), $MachinePrecision] + N[(x$46$im * N[(x$46$re * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -5.5 \cdot 10^{-46} \lor \neg \left(x.im \leq 3.2 \cdot 10^{-97}\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 x.im + 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 < -5.49999999999999983e-46 or 3.1999999999999998e-97 < x.im

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

        \[\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. *-commutative80.8%

        \[\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-+71.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-rr71.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. *-commutative71.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + \left(-1 \cdot \color{blue}{x.im}\right) \cdot x.re\right) \]
      14. neg-mul-174.1%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + \color{blue}{\left(-x.im\right)} \cdot x.re\right) \]
      15. cancel-sign-sub-inv74.1%

        \[\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.im \cdot x.re\right)} \]
      16. *-commutative74.1%

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

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

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

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

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

    if -5.49999999999999983e-46 < x.im < 3.1999999999999998e-97

    1. Initial program 89.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. *-commutative89.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. *-commutative89.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-squares89.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*99.7%

        \[\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)} \]
    4. Taylor expanded in x.im around 0 95.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -5.5 \cdot 10^{-46} \lor \neg \left(x.im \leq 3.2 \cdot 10^{-97}\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 x.im + x.im \cdot \left(x.re \cdot 3\right)\right)\\ \end{array} \]

Alternative 6: 92.4% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.im \leq -1.85 \cdot 10^{-44} \lor \neg \left(x.im \leq 1.1 \cdot 10^{-96}\right):\\ \;\;\;\;\frac{x.re + x.im}{\frac{\frac{1}{x.re - x.im}}{x.im}}\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot x.im + 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.85e-44) (not (<= x.im 1.1e-96)))
   (/ (+ x.re x.im) (/ (/ 1.0 (- x.re x.im)) x.im))
   (* x.re (+ (* x.im x.im) (* x.im (* x.re 3.0))))))
double code(double x_46_re, double x_46_im) {
	double tmp;
	if ((x_46_im <= -1.85e-44) || !(x_46_im <= 1.1e-96)) {
		tmp = (x_46_re + x_46_im) / ((1.0 / (x_46_re - x_46_im)) / x_46_im);
	} else {
		tmp = x_46_re * ((x_46_im * x_46_im) + (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.85d-44)) .or. (.not. (x_46im <= 1.1d-96))) then
        tmp = (x_46re + x_46im) / ((1.0d0 / (x_46re - x_46im)) / x_46im)
    else
        tmp = x_46re * ((x_46im * x_46im) + (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.85e-44) || !(x_46_im <= 1.1e-96)) {
		tmp = (x_46_re + x_46_im) / ((1.0 / (x_46_re - x_46_im)) / x_46_im);
	} else {
		tmp = x_46_re * ((x_46_im * x_46_im) + (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.85e-44) or not (x_46_im <= 1.1e-96):
		tmp = (x_46_re + x_46_im) / ((1.0 / (x_46_re - x_46_im)) / x_46_im)
	else:
		tmp = x_46_re * ((x_46_im * x_46_im) + (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.85e-44) || !(x_46_im <= 1.1e-96))
		tmp = Float64(Float64(x_46_re + x_46_im) / Float64(Float64(1.0 / Float64(x_46_re - x_46_im)) / x_46_im));
	else
		tmp = Float64(x_46_re * Float64(Float64(x_46_im * x_46_im) + 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.85e-44) || ~((x_46_im <= 1.1e-96)))
		tmp = (x_46_re + x_46_im) / ((1.0 / (x_46_re - x_46_im)) / x_46_im);
	else
		tmp = x_46_re * ((x_46_im * x_46_im) + (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.85e-44], N[Not[LessEqual[x$46$im, 1.1e-96]], $MachinePrecision]], N[(N[(x$46$re + x$46$im), $MachinePrecision] / N[(N[(1.0 / N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision] / x$46$im), $MachinePrecision]), $MachinePrecision], N[(x$46$re * N[(N[(x$46$im * x$46$im), $MachinePrecision] + N[(x$46$im * N[(x$46$re * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -1.85 \cdot 10^{-44} \lor \neg \left(x.im \leq 1.1 \cdot 10^{-96}\right):\\
\;\;\;\;\frac{x.re + x.im}{\frac{\frac{1}{x.re - x.im}}{x.im}}\\

\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(x.im \cdot x.im + 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.85e-44 or 1.0999999999999999e-96 < x.im

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

        \[\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. *-commutative80.8%

        \[\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-+71.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-rr71.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. *-commutative71.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + \left(-1 \cdot \color{blue}{x.im}\right) \cdot x.re\right) \]
      14. neg-mul-174.1%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + \color{blue}{\left(-x.im\right)} \cdot x.re\right) \]
      15. cancel-sign-sub-inv74.1%

        \[\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.im \cdot x.re\right)} \]
      16. *-commutative74.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \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}}} + 0 \]
      10. *-commutative79.0%

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

        \[\leadsto \color{blue}{\frac{x.im + x.re}{\frac{\frac{x.im + x.re}{x.re \cdot x.re - x.im \cdot x.im}}{x.im}}} + 0 \]
      12. +-commutative79.1%

        \[\leadsto \frac{\color{blue}{x.re + x.im}}{\frac{\frac{x.im + x.re}{x.re \cdot x.re - x.im \cdot x.im}}{x.im}} + 0 \]
      13. clear-num79.2%

        \[\leadsto \frac{x.re + x.im}{\frac{\color{blue}{\frac{1}{\frac{x.re \cdot x.re - x.im \cdot x.im}{x.im + x.re}}}}{x.im}} + 0 \]
      14. +-commutative79.2%

        \[\leadsto \frac{x.re + x.im}{\frac{\frac{1}{\frac{x.re \cdot x.re - x.im \cdot x.im}{\color{blue}{x.re + x.im}}}}{x.im}} + 0 \]
      15. flip--90.7%

        \[\leadsto \frac{x.re + x.im}{\frac{\frac{1}{\color{blue}{x.re - x.im}}}{x.im}} + 0 \]
    9. Applied egg-rr90.7%

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

    if -1.85e-44 < x.im < 1.0999999999999999e-96

    1. Initial program 89.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. *-commutative89.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. *-commutative89.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-squares89.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*99.7%

        \[\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)} \]
    4. Taylor expanded in x.im around 0 95.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 64.1% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.im \leq -1.5 \cdot 10^{+140}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot x.im\right)\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot x.im + 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.5e+140)
   (* x.re (* x.im x.im))
   (* x.re (+ (* x.im x.im) (* x.im (* x.re 3.0))))))
double code(double x_46_re, double x_46_im) {
	double tmp;
	if (x_46_im <= -1.5e+140) {
		tmp = x_46_re * (x_46_im * x_46_im);
	} else {
		tmp = x_46_re * ((x_46_im * x_46_im) + (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.5d+140)) then
        tmp = x_46re * (x_46im * x_46im)
    else
        tmp = x_46re * ((x_46im * x_46im) + (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.5e+140) {
		tmp = x_46_re * (x_46_im * x_46_im);
	} else {
		tmp = x_46_re * ((x_46_im * x_46_im) + (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.5e+140:
		tmp = x_46_re * (x_46_im * x_46_im)
	else:
		tmp = x_46_re * ((x_46_im * x_46_im) + (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.5e+140)
		tmp = Float64(x_46_re * Float64(x_46_im * x_46_im));
	else
		tmp = Float64(x_46_re * Float64(Float64(x_46_im * x_46_im) + 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.5e+140)
		tmp = x_46_re * (x_46_im * x_46_im);
	else
		tmp = x_46_re * ((x_46_im * x_46_im) + (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.5e+140], N[(x$46$re * N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision], N[(x$46$re * N[(N[(x$46$im * x$46$im), $MachinePrecision] + N[(x$46$im * N[(x$46$re * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(x.im \cdot x.im + 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.49999999999999998e140

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

        \[\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*78.1%

        \[\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-def78.1%

        \[\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. *-commutative78.1%

        \[\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. *-commutative78.1%

        \[\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. *-commutative78.1%

        \[\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-out78.1%

        \[\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. Simplified78.1%

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

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

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

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

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

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

    if -1.49999999999999998e140 < x.im

    1. Initial program 86.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. *-commutative86.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. *-commutative86.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-squares89.0%

        \[\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*94.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 60.4% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.im \leq -5.6 \cdot 10^{+138}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot x.im\right)\\ \mathbf{else}:\\ \;\;\;\;3 \cdot \left(x.re \cdot \left(x.re \cdot x.im\right)\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im)
 :precision binary64
 (if (<= x.im -5.6e+138)
   (* 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 <= -5.6e+138) {
		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 <= (-5.6d+138)) 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 <= -5.6e+138) {
		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 <= -5.6e+138:
		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 <= -5.6e+138)
		tmp = Float64(x_46_re * Float64(x_46_im * x_46_im));
	else
		tmp = Float64(3.0 * Float64(x_46_re * 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 <= -5.6e+138)
		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, -5.6e+138], N[(x$46$re * N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision], N[(3.0 * N[(x$46$re * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 69.7%

      \[\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. *-commutative69.7%

        \[\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. *-commutative69.7%

        \[\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-squares78.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*78.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-def78.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. *-commutative78.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. *-commutative78.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. *-commutative78.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-out78.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. Simplified78.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)} \]
    4. Taylor expanded in x.im around 0 26.3%

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

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

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

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

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

    if -5.6000000000000002e138 < x.im

    1. Initial program 86.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. +-commutative86.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. *-commutative86.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-out86.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*86.3%

        \[\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. *-commutative86.3%

        \[\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-out89.4%

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

        \[\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--85.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. Simplified85.4%

      \[\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-neg85.4%

        \[\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*85.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*90.4%

        \[\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-rr90.4%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 60.4% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.im \leq -3.8 \cdot 10^{+136}:\\ \;\;\;\;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 -3.8e+136)
   (* 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 <= -3.8e+136) {
		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 <= (-3.8d+136)) 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 <= -3.8e+136) {
		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 <= -3.8e+136:
		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 <= -3.8e+136)
		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 <= -3.8e+136)
		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, -3.8e+136], 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 -3.8 \cdot 10^{+136}:\\
\;\;\;\;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 < -3.80000000000000015e136

    1. Initial program 69.7%

      \[\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. *-commutative69.7%

        \[\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. *-commutative69.7%

        \[\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-squares78.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*78.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-def78.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. *-commutative78.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. *-commutative78.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. *-commutative78.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-out78.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. Simplified78.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)} \]
    4. Taylor expanded in x.im around 0 26.3%

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

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

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

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

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

    if -3.80000000000000015e136 < x.im

    1. Initial program 86.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. *-commutative86.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. *-commutative86.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-squares89.0%

        \[\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*94.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -3.8 \cdot 10^{+136}:\\ \;\;\;\;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 10: 38.8% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.im \leq -5.4 \cdot 10^{+138}:\\ \;\;\;\;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 -5.4e+138) (* 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 <= -5.4e+138) {
		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 <= (-5.4d+138)) 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 <= -5.4e+138) {
		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 <= -5.4e+138:
		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 <= -5.4e+138)
		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 <= -5.4e+138)
		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, -5.4e+138], 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 -5.4 \cdot 10^{+138}:\\
\;\;\;\;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 < -5.40000000000000018e138

    1. Initial program 69.7%

      \[\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. *-commutative69.7%

        \[\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. *-commutative69.7%

        \[\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-squares78.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*78.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-def78.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. *-commutative78.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. *-commutative78.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. *-commutative78.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-out78.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. Simplified78.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)} \]
    4. Taylor expanded in x.im around 0 26.3%

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

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

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

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

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

    if -5.40000000000000018e138 < x.im

    1. Initial program 86.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. *-commutative86.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. *-commutative86.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-+61.2%

        \[\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-rr61.2%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -5.4 \cdot 10^{+138}:\\ \;\;\;\;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 11: 39.6% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.im \leq -2.7 \cdot 10^{+133}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot x.im\right)\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.re \cdot x.im\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im)
 :precision binary64
 (if (<= x.im -2.7e+133) (* 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 <= -2.7e+133) {
		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 <= (-2.7d+133)) 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 <= -2.7e+133) {
		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 <= -2.7e+133:
		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 <= -2.7e+133)
		tmp = Float64(x_46_re * Float64(x_46_im * x_46_im));
	else
		tmp = Float64(x_46_re * 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 <= -2.7e+133)
		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, -2.7e+133], N[(x$46$re * N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision], N[(x$46$re * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 69.7%

      \[\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. *-commutative69.7%

        \[\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. *-commutative69.7%

        \[\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-squares78.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*78.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-def78.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. *-commutative78.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. *-commutative78.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. *-commutative78.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-out78.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. Simplified78.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)} \]
    4. Taylor expanded in x.im around 0 26.3%

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

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

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

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

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

    if -2.7000000000000002e133 < x.im

    1. Initial program 86.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. *-commutative86.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. *-commutative86.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-+61.2%

        \[\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-rr61.2%

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

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

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

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

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

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

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

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

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

Alternative 12: 34.3% accurate, 3.8× speedup?

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

\\
\left(x.re \cdot x.re\right) \cdot x.im
\end{array}
Derivation
  1. Initial program 84.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. *-commutative84.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. *-commutative84.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-+63.1%

      \[\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-rr63.1%

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

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

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

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

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

Alternative 13: 2.7% accurate, 19.0× speedup?

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

\\
-3
\end{array}
Derivation
  1. Initial program 84.2%

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

    \[\leadsto \color{blue}{-1 \cdot {x.im}^{3}} \]
  3. Simplified2.5%

    \[\leadsto \color{blue}{-3} \]
  4. Final simplification2.5%

    \[\leadsto -3 \]

Alternative 14: 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 84.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. +-commutative84.2%

      \[\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. *-commutative84.2%

      \[\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-out84.2%

      \[\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*84.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. *-commutative84.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-out88.4%

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

      \[\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--83.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. Simplified83.4%

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

      \[\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-rr6.8%

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

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

    \[\leadsto -2.6 \]

Alternative 15: 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 84.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. +-commutative84.2%

      \[\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. *-commutative84.2%

      \[\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-out84.2%

      \[\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*84.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. *-commutative84.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-out88.4%

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

      \[\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--83.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. Simplified83.4%

    \[\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. div-inv10.7%

      \[\leadsto \color{blue}{\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) \cdot \frac{1}{\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)}} \]
    3. *-commutative10.7%

      \[\leadsto \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) \cdot \frac{1}{\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)} \]
    4. unpow-prod-down10.6%

      \[\leadsto \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) \cdot \frac{1}{\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)} \]
    5. metadata-eval10.6%

      \[\leadsto \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) \cdot \frac{1}{\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)} \]
    6. associate-*l*10.6%

      \[\leadsto \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) \cdot \frac{1}{\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)} \]
    7. pow-pow10.6%

      \[\leadsto \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) \cdot \frac{1}{\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)} \]
    8. metadata-eval10.6%

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

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

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

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

    \[\leadsto 2.6 \]

Alternative 16: 2.7% accurate, 19.0× speedup?

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

\\
10
\end{array}
Derivation
  1. Initial program 84.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. +-commutative84.2%

      \[\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. *-commutative84.2%

      \[\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-out84.2%

      \[\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*84.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. *-commutative84.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-out88.4%

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

      \[\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--83.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. Simplified83.4%

    \[\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. flip--22.2%

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

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

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

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

    \[\leadsto 10 \]

Developer target: 91.7% 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 2023278 
(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)))