math.cube on complex, imaginary part

Percentage Accurate: 82.6% → 99.8%
Time: 6.0s
Alternatives: 9
Speedup: 1.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 82.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.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -6.4 \cdot 10^{+103} \lor \neg \left(x.im \leq 5 \cdot 10^{+86}\right):\\
\;\;\;\;x.im \cdot \left(\left(x.im + x.re\right) \cdot \left(x.re - x.im\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -6.39999999999999985e103 or 4.9999999999999998e86 < x.im

    1. Initial program 72.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. *-commutative72.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. *-commutative72.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 - x.im}} \]
      8. flip-+78.3%

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

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

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

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

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

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

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

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

    if -6.39999999999999985e103 < x.im < 4.9999999999999998e86

    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}{\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. *-commutative89.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x.im \cdot \left(\left(x.im + x.re\right) \cdot \left(x.re - x.im\right)\right)\\ t_1 := x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) + x.re \cdot \left(x.im \cdot x.re + x.im \cdot x.re\right)\\ \mathbf{if}\;x.im \leq -4 \cdot 10^{+163}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.im \leq -4.4 \cdot 10^{-95}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x.im \leq 1.32 \cdot 10^{-106}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot \left(x.re \cdot 3\right)\right)\\ \mathbf{elif}\;x.im \leq 5 \cdot 10^{+86}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x.re x.im)
 :precision binary64
 (let* ((t_0 (* x.im (* (+ x.im x.re) (- x.re x.im))))
        (t_1
         (+
          (* x.im (- (* x.re x.re) (* x.im x.im)))
          (* x.re (+ (* x.im x.re) (* x.im x.re))))))
   (if (<= x.im -4e+163)
     t_0
     (if (<= x.im -4.4e-95)
       t_1
       (if (<= x.im 1.32e-106)
         (* x.re (* x.im (* x.re 3.0)))
         (if (<= x.im 5e+86) t_1 t_0))))))
double code(double x_46_re, double x_46_im) {
	double t_0 = x_46_im * ((x_46_im + x_46_re) * (x_46_re - x_46_im));
	double t_1 = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_im * x_46_re) + (x_46_im * x_46_re)));
	double tmp;
	if (x_46_im <= -4e+163) {
		tmp = t_0;
	} else if (x_46_im <= -4.4e-95) {
		tmp = t_1;
	} else if (x_46_im <= 1.32e-106) {
		tmp = x_46_re * (x_46_im * (x_46_re * 3.0));
	} else if (x_46_im <= 5e+86) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x_46re, x_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = x_46im * ((x_46im + x_46re) * (x_46re - x_46im))
    t_1 = (x_46im * ((x_46re * x_46re) - (x_46im * x_46im))) + (x_46re * ((x_46im * x_46re) + (x_46im * x_46re)))
    if (x_46im <= (-4d+163)) then
        tmp = t_0
    else if (x_46im <= (-4.4d-95)) then
        tmp = t_1
    else if (x_46im <= 1.32d-106) then
        tmp = x_46re * (x_46im * (x_46re * 3.0d0))
    else if (x_46im <= 5d+86) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
	double t_0 = x_46_im * ((x_46_im + x_46_re) * (x_46_re - x_46_im));
	double t_1 = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_im * x_46_re) + (x_46_im * x_46_re)));
	double tmp;
	if (x_46_im <= -4e+163) {
		tmp = t_0;
	} else if (x_46_im <= -4.4e-95) {
		tmp = t_1;
	} else if (x_46_im <= 1.32e-106) {
		tmp = x_46_re * (x_46_im * (x_46_re * 3.0));
	} else if (x_46_im <= 5e+86) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x_46_re, x_46_im):
	t_0 = x_46_im * ((x_46_im + x_46_re) * (x_46_re - x_46_im))
	t_1 = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_im * x_46_re) + (x_46_im * x_46_re)))
	tmp = 0
	if x_46_im <= -4e+163:
		tmp = t_0
	elif x_46_im <= -4.4e-95:
		tmp = t_1
	elif x_46_im <= 1.32e-106:
		tmp = x_46_re * (x_46_im * (x_46_re * 3.0))
	elif x_46_im <= 5e+86:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x_46_re, x_46_im)
	t_0 = Float64(x_46_im * Float64(Float64(x_46_im + x_46_re) * Float64(x_46_re - x_46_im)))
	t_1 = 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_im * x_46_re) + Float64(x_46_im * x_46_re))))
	tmp = 0.0
	if (x_46_im <= -4e+163)
		tmp = t_0;
	elseif (x_46_im <= -4.4e-95)
		tmp = t_1;
	elseif (x_46_im <= 1.32e-106)
		tmp = Float64(x_46_re * Float64(x_46_im * Float64(x_46_re * 3.0)));
	elseif (x_46_im <= 5e+86)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im)
	t_0 = x_46_im * ((x_46_im + x_46_re) * (x_46_re - x_46_im));
	t_1 = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_im * x_46_re) + (x_46_im * x_46_re)));
	tmp = 0.0;
	if (x_46_im <= -4e+163)
		tmp = t_0;
	elseif (x_46_im <= -4.4e-95)
		tmp = t_1;
	elseif (x_46_im <= 1.32e-106)
		tmp = x_46_re * (x_46_im * (x_46_re * 3.0));
	elseif (x_46_im <= 5e+86)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(x$46$im * N[(N[(x$46$im + x$46$re), $MachinePrecision] * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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$im * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$im, -4e+163], t$95$0, If[LessEqual[x$46$im, -4.4e-95], t$95$1, If[LessEqual[x$46$im, 1.32e-106], N[(x$46$re * N[(x$46$im * N[(x$46$re * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 5e+86], t$95$1, t$95$0]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x.im \leq -4.4 \cdot 10^{-95}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;x.im \leq 5 \cdot 10^{+86}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.im < -3.9999999999999998e163 or 4.9999999999999998e86 < x.im

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.9999999999999998e163 < x.im < -4.3999999999999998e-95 or 1.32000000000000001e-106 < x.im < 4.9999999999999998e86

    1. Initial program 99.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 -4.3999999999999998e-95 < x.im < 1.32000000000000001e-106

    1. Initial program 80.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. Taylor expanded in x.re around inf 80.4%

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

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

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

      \[\leadsto \color{blue}{\left(x.re \cdot x.re\right) \cdot \left(3 \cdot x.im\right)} \]
    6. Step-by-step derivation
      1. add-log-exp47.3%

        \[\leadsto \color{blue}{\log \left(e^{\left(x.re \cdot x.re\right) \cdot \left(3 \cdot x.im\right)}\right)} \]
      2. *-un-lft-identity47.3%

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

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

        \[\leadsto \color{blue}{0} + \log \left(e^{\left(x.re \cdot x.re\right) \cdot \left(3 \cdot x.im\right)}\right) \]
      5. add-log-exp80.3%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -4 \cdot 10^{+163}:\\ \;\;\;\;x.im \cdot \left(\left(x.im + x.re\right) \cdot \left(x.re - x.im\right)\right)\\ \mathbf{elif}\;x.im \leq -4.4 \cdot 10^{-95}:\\ \;\;\;\;x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) + x.re \cdot \left(x.im \cdot x.re + x.im \cdot x.re\right)\\ \mathbf{elif}\;x.im \leq 1.32 \cdot 10^{-106}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot \left(x.re \cdot 3\right)\right)\\ \mathbf{elif}\;x.im \leq 5 \cdot 10^{+86}:\\ \;\;\;\;x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) + x.re \cdot \left(x.im \cdot x.re + x.im \cdot x.re\right)\\ \mathbf{else}:\\ \;\;\;\;x.im \cdot \left(\left(x.im + x.re\right) \cdot \left(x.re - x.im\right)\right)\\ \end{array} \]

Alternative 3: 93.3% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -3.4 \cdot 10^{-51} \lor \neg \left(x.im \leq 2.05 \cdot 10^{-104}\right):\\
\;\;\;\;x.im \cdot \left(\left(x.im + x.re\right) \cdot \left(x.re - x.im\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -3.40000000000000003e-51 or 2.04999999999999992e-104 < x.im

    1. Initial program 84.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. *-commutative84.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. *-commutative84.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 - x.im}} \]
      8. flip-+77.4%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + x.re \cdot \color{blue}{\left(x.im + x.im\right)} \]
      9. distribute-lft-in77.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-rr77.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. +-commutative77.4%

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

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

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

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

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

    if -3.40000000000000003e-51 < x.im < 2.04999999999999992e-104

    1. Initial program 82.5%

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

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

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

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

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

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

        \[\leadsto \log \color{blue}{\left(1 \cdot e^{\left(x.re \cdot x.re\right) \cdot \left(3 \cdot x.im\right)}\right)} \]
      3. log-prod46.4%

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

        \[\leadsto \color{blue}{0} + \log \left(e^{\left(x.re \cdot x.re\right) \cdot \left(3 \cdot x.im\right)}\right) \]
      5. add-log-exp81.7%

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

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

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

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

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

Alternative 4: 77.9% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -1.95 \cdot 10^{+109} \lor \neg \left(x.im \leq 1.4 \cdot 10^{-57}\right):\\
\;\;\;\;x.im \cdot \left(x.im \cdot \left(-x.im\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -1.95000000000000008e109 or 1.4e-57 < x.im

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0 + x.im \cdot \left(-1 \cdot \color{blue}{\left(x.im \cdot x.im\right)}\right) \]
      2. neg-mul-184.5%

        \[\leadsto 0 + x.im \cdot \color{blue}{\left(-x.im \cdot x.im\right)} \]
      3. distribute-rgt-neg-in84.5%

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

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

    if -1.95000000000000008e109 < x.im < 1.4e-57

    1. Initial program 87.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. +-commutative87.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. *-commutative87.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x.re \cdot 3, x.re \cdot x.im, -{x.im}^{3}\right)} \]
    7. Taylor expanded in x.re around inf 74.9%

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

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

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

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

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

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

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

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

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

Alternative 5: 77.9% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -1.95 \cdot 10^{+109} \lor \neg \left(x.im \leq 1.4 \cdot 10^{-57}\right):\\
\;\;\;\;x.im \cdot \left(x.im \cdot \left(-x.im\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -1.95000000000000008e109 or 1.4e-57 < x.im

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0 + x.im \cdot \left(-1 \cdot \color{blue}{\left(x.im \cdot x.im\right)}\right) \]
      2. neg-mul-184.5%

        \[\leadsto 0 + x.im \cdot \color{blue}{\left(-x.im \cdot x.im\right)} \]
      3. distribute-rgt-neg-in84.5%

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

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

    if -1.95000000000000008e109 < x.im < 1.4e-57

    1. Initial program 87.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. Taylor expanded in x.re around inf 74.8%

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

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

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

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

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

        \[\leadsto \log \color{blue}{\left(1 \cdot e^{\left(x.re \cdot x.re\right) \cdot \left(3 \cdot x.im\right)}\right)} \]
      3. log-prod43.4%

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

        \[\leadsto \color{blue}{0} + \log \left(e^{\left(x.re \cdot x.re\right) \cdot \left(3 \cdot x.im\right)}\right) \]
      5. add-log-exp74.8%

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

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

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

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

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

Alternative 6: 51.1% accurate, 2.1× speedup?

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

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

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


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

    1. Initial program 64.3%

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

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

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

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

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

        \[\leadsto -3 + 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 -3 + x.re \cdot \frac{\color{blue}{0}}{x.re \cdot x.im - x.re \cdot x.im} \]
      5. +-inverses0.0%

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

        \[\leadsto -3 + x.re \cdot \frac{x.im \cdot x.im - x.im \cdot x.im}{\color{blue}{x.im - x.im}} \]
      8. flip-+20.7%

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

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

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

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

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

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

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

    if -2.4999999999999999e134 < x.im

    1. Initial program 87.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. +-commutative87.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. *-commutative87.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 56.7% accurate, 2.1× speedup?

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

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

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


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

    1. Initial program 64.3%

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

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

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

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

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

        \[\leadsto -3 + 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 -3 + x.re \cdot \frac{\color{blue}{0}}{x.re \cdot x.im - x.re \cdot x.im} \]
      5. +-inverses0.0%

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

        \[\leadsto -3 + x.re \cdot \frac{x.im \cdot x.im - x.im \cdot x.im}{\color{blue}{x.im - x.im}} \]
      8. flip-+20.7%

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

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

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

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

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

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

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

    if -2.4999999999999999e134 < x.im

    1. Initial program 87.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. +-commutative87.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. *-commutative87.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 19.7% accurate, 6.3× speedup?

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

\\
x.im \cdot x.re
\end{array}
Derivation
  1. Initial program 83.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. Taylor expanded in x.re around 0 65.5%

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

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

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

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

      \[\leadsto -3 + 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 -3 + x.re \cdot \frac{\color{blue}{0}}{x.re \cdot x.im - x.re \cdot x.im} \]
    5. +-inverses0.0%

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

      \[\leadsto -3 + x.re \cdot \frac{x.im \cdot x.im - x.im \cdot x.im}{\color{blue}{x.im - x.im}} \]
    8. flip-+10.1%

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

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

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

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

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

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

    \[\leadsto \color{blue}{x.re \cdot x.im} \]
  8. Final simplification19.4%

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

Alternative 9: 2.7% accurate, 19.0× speedup?

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

\\
-10
\end{array}
Derivation
  1. Initial program 83.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. +-commutative83.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. *-commutative83.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto -10 \]

Developer target: 91.5% 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 2023178 
(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)))