math.cube on complex, imaginary part

Percentage Accurate: 82.6% → 99.2%
Time: 7.8s
Alternatives: 13
Speedup: 1.0×

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 13 alternatives:

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -1.5e117 or 1.49999999999999993e80 < x.im

    1. Initial program 71.6%

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

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

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

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

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

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

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

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

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

        \[\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-+85.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) \]
    5. Applied egg-rr85.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)} \]
    6. Step-by-step derivation
      1. difference-of-squares100.0%

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

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

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

    if -1.5e117 < x.im < 1.49999999999999993e80

    1. Initial program 92.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. +-commutative92.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. *-commutative92.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-neg92.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-in92.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+92.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-out92.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-neg92.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)} \]
    3. Simplified99.8%

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

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

Alternative 2: 99.2% accurate, 0.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -1.5e117 or 1.99999999999999993e79 < x.im

    1. Initial program 71.6%

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

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

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

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

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

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

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

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

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

        \[\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-+85.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) \]
    5. Applied egg-rr85.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)} \]
    6. Step-by-step derivation
      1. difference-of-squares100.0%

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

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

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

    if -1.5e117 < x.im < 1.99999999999999993e79

    1. Initial program 92.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. +-commutative92.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. *-commutative92.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-neg92.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-in92.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+92.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-out92.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-neg92.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*99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.3% accurate, 0.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -1.5e117 or 1.99999999999999993e79 < x.im

    1. Initial program 71.6%

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

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

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

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

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

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

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

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

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

        \[\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-+85.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) \]
    5. Applied egg-rr85.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)} \]
    6. Step-by-step derivation
      1. difference-of-squares100.0%

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

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

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

    if -1.5e117 < x.im < 1.99999999999999993e79

    1. Initial program 92.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. +-commutative92.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. *-commutative92.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-neg92.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-in92.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+92.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-out92.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-neg92.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*99.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\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. expm1-log1p-u85.1%

        \[\leadsto x.re \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(3 \cdot \left(x.re \cdot x.im\right)\right)\right)} - {x.im}^{3} \]
      2. expm1-udef54.7%

        \[\leadsto x.re \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(3 \cdot \left(x.re \cdot x.im\right)\right)} - 1\right)} - {x.im}^{3} \]
    6. Applied egg-rr54.7%

      \[\leadsto x.re \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(3 \cdot \left(x.re \cdot x.im\right)\right)} - 1\right)} - {x.im}^{3} \]
    7. Step-by-step derivation
      1. expm1-def85.1%

        \[\leadsto x.re \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(3 \cdot \left(x.re \cdot x.im\right)\right)\right)} - {x.im}^{3} \]
      2. expm1-log1p99.7%

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

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

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

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

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

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

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

Alternative 4: 99.3% accurate, 0.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -1.5e117 or 1.49999999999999993e80 < x.im

    1. Initial program 71.6%

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

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

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

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

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

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

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

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

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

        \[\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-+85.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) \]
    5. Applied egg-rr85.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)} \]
    6. Step-by-step derivation
      1. difference-of-squares100.0%

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

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

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

    if -1.5e117 < x.im < 1.49999999999999993e80

    1. Initial program 92.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. +-commutative92.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. *-commutative92.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-neg92.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-in92.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+92.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-out92.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-neg92.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*99.8%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 94.0% 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.im \cdot x.re + x.im \cdot x.re\right)\\ \mathbf{if}\;t_0 \leq \infty:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\left(x.im + x.im\right) + x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.im + x.re\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.im x.re) (* x.im x.re))))))
   (if (<= t_0 INFINITY)
     t_0
     (+ (+ x.im x.im) (* x.im (* (- x.re x.im) (+ x.im x.re)))))))
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_im * x_46_re) + (x_46_im * x_46_re)));
	double tmp;
	if (t_0 <= ((double) INFINITY)) {
		tmp = t_0;
	} else {
		tmp = (x_46_im + x_46_im) + (x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re)));
	}
	return tmp;
}
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_im * x_46_re) + (x_46_im * x_46_re)));
	double tmp;
	if (t_0 <= Double.POSITIVE_INFINITY) {
		tmp = t_0;
	} else {
		tmp = (x_46_im + x_46_im) + (x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re)));
	}
	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_im * x_46_re) + (x_46_im * x_46_re)))
	tmp = 0
	if t_0 <= math.inf:
		tmp = t_0
	else:
		tmp = (x_46_im + x_46_im) + (x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re)))
	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_im * x_46_re) + Float64(x_46_im * x_46_re))))
	tmp = 0.0
	if (t_0 <= Inf)
		tmp = t_0;
	else
		tmp = Float64(Float64(x_46_im + x_46_im) + Float64(x_46_im * Float64(Float64(x_46_re - x_46_im) * Float64(x_46_im + x_46_re))));
	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_im * x_46_re) + (x_46_im * x_46_re)));
	tmp = 0.0;
	if (t_0 <= Inf)
		tmp = t_0;
	else
		tmp = (x_46_im + x_46_im) + (x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re)));
	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$im * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], t$95$0, N[(N[(x$46$im + x$46$im), $MachinePrecision] + N[(x$46$im * N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$im + x$46$re), $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.im \cdot x.re + x.im \cdot x.re\right)\\
\mathbf{if}\;t_0 \leq \infty:\\
\;\;\;\;t_0\\

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

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

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

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

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

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

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

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

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

        \[\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-+47.8%

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

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

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

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

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

    \[\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.im \cdot x.re + x.im \cdot x.re\right) \leq \infty:\\ \;\;\;\;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}:\\ \;\;\;\;\left(x.im + x.im\right) + x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.im + x.re\right)\right)\\ \end{array} \]

Alternative 6: 84.9% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;x.im \leq 6200:\\
\;\;\;\;x.im \cdot \left(x.im \cdot \left(-x.im\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.im < -5.6e7 or 6200 < x.im

    1. Initial program 80.6%

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

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

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

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

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

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

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

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

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

        \[\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-+86.7%

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

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

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

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

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

    if -5.6e7 < x.im < 7.2e-40

    1. Initial program 89.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 83.6%

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

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

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

    if 7.2e-40 < x.im < 6200

    1. Initial program 99.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. sub-neg99.4%

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

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

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

        \[\leadsto \frac{{x.re}^{2} \cdot \color{blue}{{x.re}^{2}} - \left(-x.im \cdot x.im\right) \cdot \left(-x.im \cdot x.im\right)}{x.re \cdot x.re - \left(-x.im \cdot x.im\right)} \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      5. pow-prod-up99.2%

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

        \[\leadsto \frac{{x.re}^{\color{blue}{4}} - \left(-x.im \cdot x.im\right) \cdot \left(-x.im \cdot x.im\right)}{x.re \cdot x.re - \left(-x.im \cdot x.im\right)} \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      7. distribute-rgt-neg-in99.2%

        \[\leadsto \frac{{x.re}^{4} - \color{blue}{\left(x.im \cdot \left(-x.im\right)\right)} \cdot \left(-x.im \cdot x.im\right)}{x.re \cdot x.re - \left(-x.im \cdot x.im\right)} \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      8. distribute-rgt-neg-in99.2%

        \[\leadsto \frac{{x.re}^{4} - \left(x.im \cdot \left(-x.im\right)\right) \cdot \color{blue}{\left(x.im \cdot \left(-x.im\right)\right)}}{x.re \cdot x.re - \left(-x.im \cdot x.im\right)} \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      9. distribute-rgt-neg-in99.2%

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

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

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

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

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

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

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

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

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

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

Alternative 7: 86.4% accurate, 1.0× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.im < -1.55e8 or 7.5999999999999999e55 < x.im

    1. Initial program 79.4%

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

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

        \[\leadsto \mathsf{fma}\left(x.re, \color{blue}{x.im \cdot x.re} + x.im \cdot x.re, \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im\right) \]
      5. distribute-rgt-out83.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. *-commutative83.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. Simplified83.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-udef79.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-in79.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-+87.8%

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

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

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

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

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

    if -1.55e8 < x.im < 7.49999999999999949e-64

    1. Initial program 89.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. Taylor expanded in x.re around inf 84.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. Simplified84.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 84.4%

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

    if 7.49999999999999949e-64 < x.im < 7.5999999999999999e55

    1. Initial program 99.6%

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

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

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

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

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

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

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

        \[\leadsto \frac{{x.re}^{4} - \color{blue}{\left(x.im \cdot \left(-x.im\right)\right)} \cdot \left(-x.im \cdot x.im\right)}{x.re \cdot x.re - \left(-x.im \cdot x.im\right)} \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      8. distribute-rgt-neg-in71.9%

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

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

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

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

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

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

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

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

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

Alternative 8: 73.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.im \leq -4.1 \cdot 10^{+96} \lor \neg \left(x.im \leq 1.55 \cdot 10^{-39}\right):\\ \;\;\;\;x.im \cdot \left(x.im \cdot \left(-x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(\left(x.im \cdot x.re\right) \cdot 2\right) + x.im \cdot \left(x.re \cdot x.re\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im)
 :precision binary64
 (if (or (<= x.im -4.1e+96) (not (<= x.im 1.55e-39)))
   (* x.im (* x.im (- x.im)))
   (+ (* x.re (* (* x.im x.re) 2.0)) (* x.im (* x.re x.re)))))
double code(double x_46_re, double x_46_im) {
	double tmp;
	if ((x_46_im <= -4.1e+96) || !(x_46_im <= 1.55e-39)) {
		tmp = x_46_im * (x_46_im * -x_46_im);
	} else {
		tmp = (x_46_re * ((x_46_im * x_46_re) * 2.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 <= (-4.1d+96)) .or. (.not. (x_46im <= 1.55d-39))) then
        tmp = x_46im * (x_46im * -x_46im)
    else
        tmp = (x_46re * ((x_46im * x_46re) * 2.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 <= -4.1e+96) || !(x_46_im <= 1.55e-39)) {
		tmp = x_46_im * (x_46_im * -x_46_im);
	} else {
		tmp = (x_46_re * ((x_46_im * x_46_re) * 2.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 <= -4.1e+96) or not (x_46_im <= 1.55e-39):
		tmp = x_46_im * (x_46_im * -x_46_im)
	else:
		tmp = (x_46_re * ((x_46_im * x_46_re) * 2.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 <= -4.1e+96) || !(x_46_im <= 1.55e-39))
		tmp = Float64(x_46_im * Float64(x_46_im * Float64(-x_46_im)));
	else
		tmp = Float64(Float64(x_46_re * Float64(Float64(x_46_im * x_46_re) * 2.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 <= -4.1e+96) || ~((x_46_im <= 1.55e-39)))
		tmp = x_46_im * (x_46_im * -x_46_im);
	else
		tmp = (x_46_re * ((x_46_im * x_46_re) * 2.0)) + (x_46_im * (x_46_re * x_46_re));
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -4.1e+96], N[Not[LessEqual[x$46$im, 1.55e-39]], $MachinePrecision]], N[(x$46$im * N[(x$46$im * (-x$46$im)), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$re * N[(N[(x$46$im * x$46$re), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] + 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 -4.1 \cdot 10^{+96} \lor \neg \left(x.im \leq 1.55 \cdot 10^{-39}\right):\\
\;\;\;\;x.im \cdot \left(x.im \cdot \left(-x.im\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -4.09999999999999998e96 or 1.54999999999999985e-39 < x.im

    1. Initial program 79.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. sub-neg79.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{{x.re}^{4} - \left(x.im \cdot \left(-x.im\right)\right) \cdot \color{blue}{\left(x.im \cdot \left(-x.im\right)\right)}}{x.re \cdot x.re - \left(-x.im \cdot x.im\right)} \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      9. distribute-rgt-neg-in28.1%

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

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

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

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

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

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

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

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

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

    if -4.09999999999999998e96 < x.im < 1.54999999999999985e-39

    1. Initial program 90.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 80.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. Simplified80.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 80.8%

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

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

Alternative 9: 72.9% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.im \leq -2.4 \cdot 10^{+96} \lor \neg \left(x.im \leq 4.9 \cdot 10^{-40}\right):\\ \;\;\;\;x.im \cdot \left(x.im \cdot \left(-x.im\right)\right)\\ \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 (or (<= x.im -2.4e+96) (not (<= x.im 4.9e-40)))
   (* x.im (* x.im (- x.im)))
   (* 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.4e+96) || !(x_46_im <= 4.9e-40)) {
		tmp = x_46_im * (x_46_im * -x_46_im);
	} 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.4d+96)) .or. (.not. (x_46im <= 4.9d-40))) then
        tmp = x_46im * (x_46im * -x_46im)
    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.4e+96) || !(x_46_im <= 4.9e-40)) {
		tmp = x_46_im * (x_46_im * -x_46_im);
	} 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.4e+96) or not (x_46_im <= 4.9e-40):
		tmp = x_46_im * (x_46_im * -x_46_im)
	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.4e+96) || !(x_46_im <= 4.9e-40))
		tmp = Float64(x_46_im * Float64(x_46_im * Float64(-x_46_im)));
	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.4e+96) || ~((x_46_im <= 4.9e-40)))
		tmp = x_46_im * (x_46_im * -x_46_im);
	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[Or[LessEqual[x$46$im, -2.4e+96], N[Not[LessEqual[x$46$im, 4.9e-40]], $MachinePrecision]], N[(x$46$im * N[(x$46$im * (-x$46$im)), $MachinePrecision]), $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.4 \cdot 10^{+96} \lor \neg \left(x.im \leq 4.9 \cdot 10^{-40}\right):\\
\;\;\;\;x.im \cdot \left(x.im \cdot \left(-x.im\right)\right)\\

\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.39999999999999993e96 or 4.8999999999999997e-40 < x.im

    1. Initial program 79.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. sub-neg79.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{{x.re}^{4} - \left(x.im \cdot \left(-x.im\right)\right) \cdot \color{blue}{\left(x.im \cdot \left(-x.im\right)\right)}}{x.re \cdot x.re - \left(-x.im \cdot x.im\right)} \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
      9. distribute-rgt-neg-in28.1%

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

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

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

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

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

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

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

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

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

    if -2.39999999999999993e96 < x.im < 4.8999999999999997e-40

    1. Initial program 90.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. +-commutative90.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. *-commutative90.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-neg90.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-in90.7%

        \[\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+90.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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. expm1-log1p-u85.1%

        \[\leadsto x.re \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(3 \cdot \left(x.re \cdot x.im\right)\right)\right)} - {x.im}^{3} \]
      2. expm1-udef49.0%

        \[\leadsto x.re \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(3 \cdot \left(x.re \cdot x.im\right)\right)} - 1\right)} - {x.im}^{3} \]
    6. Applied egg-rr49.0%

      \[\leadsto x.re \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(3 \cdot \left(x.re \cdot x.im\right)\right)} - 1\right)} - {x.im}^{3} \]
    7. Step-by-step derivation
      1. expm1-def85.1%

        \[\leadsto x.re \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(3 \cdot \left(x.re \cdot x.im\right)\right)\right)} - {x.im}^{3} \]
      2. expm1-log1p99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 50.0% accurate, 2.7× speedup?

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

\\
3 \cdot \left(x.im \cdot \left(x.re \cdot x.re\right)\right)
\end{array}
Derivation
  1. Initial program 85.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. +-commutative85.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. *-commutative85.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-neg85.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-in83.0%

      \[\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+83.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x.re \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(3 \cdot \left(x.re \cdot x.im\right)\right)\right)} - {x.im}^{3} \]
    2. expm1-udef50.7%

      \[\leadsto x.re \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(3 \cdot \left(x.re \cdot x.im\right)\right)} - 1\right)} - {x.im}^{3} \]
  6. Applied egg-rr50.7%

    \[\leadsto x.re \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(3 \cdot \left(x.re \cdot x.im\right)\right)} - 1\right)} - {x.im}^{3} \]
  7. Step-by-step derivation
    1. expm1-def71.5%

      \[\leadsto x.re \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(3 \cdot \left(x.re \cdot x.im\right)\right)\right)} - {x.im}^{3} \]
    2. expm1-log1p88.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 20.8% accurate, 3.8× speedup?

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

\\
x.im \cdot \left(x.im \cdot x.im\right)
\end{array}
Derivation
  1. Initial program 85.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. sub-neg85.7%

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

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

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

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

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

      \[\leadsto \frac{{x.re}^{\color{blue}{4}} - \left(-x.im \cdot x.im\right) \cdot \left(-x.im \cdot x.im\right)}{x.re \cdot x.re - \left(-x.im \cdot x.im\right)} \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    7. distribute-rgt-neg-in37.3%

      \[\leadsto \frac{{x.re}^{4} - \color{blue}{\left(x.im \cdot \left(-x.im\right)\right)} \cdot \left(-x.im \cdot x.im\right)}{x.re \cdot x.re - \left(-x.im \cdot x.im\right)} \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    8. distribute-rgt-neg-in37.3%

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(x.im \cdot x.im\right) \cdot x.im} \]
  9. Final simplification18.7%

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

Alternative 12: 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 85.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. +-commutative85.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. *-commutative85.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-neg85.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-in83.0%

      \[\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+83.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto -10 \]

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 85.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 0 52.7%

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

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

    \[\leadsto -3 \]

Developer target: 91.6% 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 2023201 
(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)))