math.cube on complex, imaginary part

Percentage Accurate: 81.9% → 99.7%
Time: 10.6s
Alternatives: 14
Speedup: 1.1×

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 14 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: 81.9% 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.7% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.im \leq -1.35 \cdot 10^{+103} \lor \neg \left(x.im \leq 10^{+96}\right):\\ \;\;\;\;\left(x.im + x.im\right) + \left(x.im + x.re\right) \cdot \left(x.im \cdot \left(x.re - x.im\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.35e+103) (not (<= x.im 1e+96)))
   (+ (+ x.im x.im) (* (+ x.im x.re) (* x.im (- x.re x.im))))
   (- (* (* 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.35e+103) || !(x_46_im <= 1e+96)) {
		tmp = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * (x_46_re - x_46_im)));
	} else {
		tmp = ((x_46_re * (x_46_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.35d+103)) .or. (.not. (x_46im <= 1d+96))) then
        tmp = (x_46im + x_46im) + ((x_46im + x_46re) * (x_46im * (x_46re - x_46im)))
    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.35e+103) || !(x_46_im <= 1e+96)) {
		tmp = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * (x_46_re - x_46_im)));
	} else {
		tmp = ((x_46_re * (x_46_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.35e+103) or not (x_46_im <= 1e+96):
		tmp = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * (x_46_re - x_46_im)))
	else:
		tmp = ((x_46_re * (x_46_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.35e+103) || !(x_46_im <= 1e+96))
		tmp = Float64(Float64(x_46_im + x_46_im) + Float64(Float64(x_46_im + x_46_re) * Float64(x_46_im * Float64(x_46_re - x_46_im))));
	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.35e+103) || ~((x_46_im <= 1e+96)))
		tmp = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * (x_46_re - x_46_im)));
	else
		tmp = ((x_46_re * (x_46_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.35e+103], N[Not[LessEqual[x$46$im, 1e+96]], $MachinePrecision]], N[(N[(x$46$im + x$46$im), $MachinePrecision] + N[(N[(x$46$im + x$46$re), $MachinePrecision] * N[(x$46$im * N[(x$46$re - x$46$im), $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.35 \cdot 10^{+103} \lor \neg \left(x.im \leq 10^{+96}\right):\\
\;\;\;\;\left(x.im + x.im\right) + \left(x.im + x.re\right) \cdot \left(x.im \cdot \left(x.re - x.im\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.34999999999999996e103 or 1.00000000000000005e96 < x.im

    1. Initial program 58.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. +-commutative58.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. *-commutative58.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-def64.2%

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

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

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

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

      \[\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-udef58.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-in58.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.re \cdot x.im - x.re \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. *-commutative0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.34999999999999996e103 < x.im < 1.00000000000000005e96

    1. Initial program 90.8%

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

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

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

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

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

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

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

        \[\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.35 \cdot 10^{+103} \lor \neg \left(x.im \leq 10^{+96}\right):\\ \;\;\;\;\left(x.im + x.im\right) + \left(x.im + x.re\right) \cdot \left(x.im \cdot \left(x.re - x.im\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.7% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.im \leq -1.35 \cdot 10^{+103} \lor \neg \left(x.im \leq 10^{+96}\right):\\ \;\;\;\;\left(x.im + x.im\right) + \left(x.im + x.re\right) \cdot \left(x.im \cdot \left(x.re - x.im\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.35e+103) (not (<= x.im 1e+96)))
   (+ (+ x.im x.im) (* (+ x.im x.re) (* x.im (- x.re x.im))))
   (- (* 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.35e+103) || !(x_46_im <= 1e+96)) {
		tmp = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * (x_46_re - x_46_im)));
	} else {
		tmp = (x_46_re * ((x_46_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.35d+103)) .or. (.not. (x_46im <= 1d+96))) then
        tmp = (x_46im + x_46im) + ((x_46im + x_46re) * (x_46im * (x_46re - x_46im)))
    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.35e+103) || !(x_46_im <= 1e+96)) {
		tmp = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * (x_46_re - x_46_im)));
	} else {
		tmp = (x_46_re * ((x_46_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.35e+103) or not (x_46_im <= 1e+96):
		tmp = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * (x_46_re - x_46_im)))
	else:
		tmp = (x_46_re * ((x_46_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.35e+103) || !(x_46_im <= 1e+96))
		tmp = Float64(Float64(x_46_im + x_46_im) + Float64(Float64(x_46_im + x_46_re) * Float64(x_46_im * Float64(x_46_re - x_46_im))));
	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.35e+103) || ~((x_46_im <= 1e+96)))
		tmp = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * (x_46_re - x_46_im)));
	else
		tmp = (x_46_re * ((x_46_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.35e+103], N[Not[LessEqual[x$46$im, 1e+96]], $MachinePrecision]], N[(N[(x$46$im + x$46$im), $MachinePrecision] + N[(N[(x$46$im + x$46$re), $MachinePrecision] * N[(x$46$im * N[(x$46$re - x$46$im), $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.35 \cdot 10^{+103} \lor \neg \left(x.im \leq 10^{+96}\right):\\
\;\;\;\;\left(x.im + x.im\right) + \left(x.im + x.re\right) \cdot \left(x.im \cdot \left(x.re - x.im\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.34999999999999996e103 or 1.00000000000000005e96 < x.im

    1. Initial program 58.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. +-commutative58.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. *-commutative58.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-def64.2%

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

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

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

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

      \[\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-udef58.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-in58.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.re \cdot x.im - x.re \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. *-commutative0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.34999999999999996e103 < x.im < 1.00000000000000005e96

    1. Initial program 90.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x.re \cdot \left(\color{blue}{\left(x.re \cdot x.im\right)} \cdot 3\right) - x.im \cdot \left(x.im \cdot x.im\right) \]
      16. associate-*r*99.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.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -1.35 \cdot 10^{+103} \lor \neg \left(x.im \leq 10^{+96}\right):\\ \;\;\;\;\left(x.im + x.im\right) + \left(x.im + x.re\right) \cdot \left(x.im \cdot \left(x.re - x.im\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: 97.9% accurate, 0.7× 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)\\ t_1 := \left(x.im + x.im\right) + \left(x.im + x.re\right) \cdot \left(x.im \cdot \left(x.re - x.im\right)\right)\\ \mathbf{if}\;x.im \leq -2 \cdot 10^{+138}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x.im \leq -1.05 \cdot 10^{-107}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.im \leq 2 \cdot 10^{-68}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot x.re\right) + x.re \cdot \left(x.re \cdot \left(x.im \cdot 2\right)\right)\\ \mathbf{elif}\;x.im \leq 10^{+85}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \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)))))
        (t_1 (+ (+ x.im x.im) (* (+ x.im x.re) (* x.im (- x.re x.im))))))
   (if (<= x.im -2e+138)
     t_1
     (if (<= x.im -1.05e-107)
       t_0
       (if (<= x.im 2e-68)
         (+ (* x.re (* x.im x.re)) (* x.re (* x.re (* x.im 2.0))))
         (if (<= x.im 1e+85) t_0 t_1))))))
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 t_1 = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * (x_46_re - x_46_im)));
	double tmp;
	if (x_46_im <= -2e+138) {
		tmp = t_1;
	} else if (x_46_im <= -1.05e-107) {
		tmp = t_0;
	} else if (x_46_im <= 2e-68) {
		tmp = (x_46_re * (x_46_im * x_46_re)) + (x_46_re * (x_46_re * (x_46_im * 2.0)));
	} else if (x_46_im <= 1e+85) {
		tmp = t_0;
	} 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_46im * ((x_46re * x_46re) - (x_46im * x_46im))) + (x_46re * ((x_46im * x_46re) + (x_46im * x_46re)))
    t_1 = (x_46im + x_46im) + ((x_46im + x_46re) * (x_46im * (x_46re - x_46im)))
    if (x_46im <= (-2d+138)) then
        tmp = t_1
    else if (x_46im <= (-1.05d-107)) then
        tmp = t_0
    else if (x_46im <= 2d-68) then
        tmp = (x_46re * (x_46im * x_46re)) + (x_46re * (x_46re * (x_46im * 2.0d0)))
    else if (x_46im <= 1d+85) then
        tmp = t_0
    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_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 t_1 = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * (x_46_re - x_46_im)));
	double tmp;
	if (x_46_im <= -2e+138) {
		tmp = t_1;
	} else if (x_46_im <= -1.05e-107) {
		tmp = t_0;
	} else if (x_46_im <= 2e-68) {
		tmp = (x_46_re * (x_46_im * x_46_re)) + (x_46_re * (x_46_re * (x_46_im * 2.0)));
	} else if (x_46_im <= 1e+85) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	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)))
	t_1 = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * (x_46_re - x_46_im)))
	tmp = 0
	if x_46_im <= -2e+138:
		tmp = t_1
	elif x_46_im <= -1.05e-107:
		tmp = t_0
	elif x_46_im <= 2e-68:
		tmp = (x_46_re * (x_46_im * x_46_re)) + (x_46_re * (x_46_re * (x_46_im * 2.0)))
	elif x_46_im <= 1e+85:
		tmp = t_0
	else:
		tmp = t_1
	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))))
	t_1 = Float64(Float64(x_46_im + x_46_im) + Float64(Float64(x_46_im + x_46_re) * Float64(x_46_im * Float64(x_46_re - x_46_im))))
	tmp = 0.0
	if (x_46_im <= -2e+138)
		tmp = t_1;
	elseif (x_46_im <= -1.05e-107)
		tmp = t_0;
	elseif (x_46_im <= 2e-68)
		tmp = Float64(Float64(x_46_re * Float64(x_46_im * x_46_re)) + Float64(x_46_re * Float64(x_46_re * Float64(x_46_im * 2.0))));
	elseif (x_46_im <= 1e+85)
		tmp = t_0;
	else
		tmp = t_1;
	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)));
	t_1 = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * (x_46_re - x_46_im)));
	tmp = 0.0;
	if (x_46_im <= -2e+138)
		tmp = t_1;
	elseif (x_46_im <= -1.05e-107)
		tmp = t_0;
	elseif (x_46_im <= 2e-68)
		tmp = (x_46_re * (x_46_im * x_46_re)) + (x_46_re * (x_46_re * (x_46_im * 2.0)));
	elseif (x_46_im <= 1e+85)
		tmp = t_0;
	else
		tmp = t_1;
	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]}, Block[{t$95$1 = N[(N[(x$46$im + x$46$im), $MachinePrecision] + N[(N[(x$46$im + x$46$re), $MachinePrecision] * N[(x$46$im * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$im, -2e+138], t$95$1, If[LessEqual[x$46$im, -1.05e-107], t$95$0, If[LessEqual[x$46$im, 2e-68], N[(N[(x$46$re * N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] + N[(x$46$re * N[(x$46$re * N[(x$46$im * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 1e+85], t$95$0, t$95$1]]]]]]
\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)\\
t_1 := \left(x.im + x.im\right) + \left(x.im + x.re\right) \cdot \left(x.im \cdot \left(x.re - x.im\right)\right)\\
\mathbf{if}\;x.im \leq -2 \cdot 10^{+138}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x.im \leq -1.05 \cdot 10^{-107}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;x.im \leq 10^{+85}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.im < -2.0000000000000001e138 or 1e85 < x.im

    1. Initial program 57.5%

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

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

        \[\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-def63.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. *-commutative63.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-out63.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. *-commutative63.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. Simplified63.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-udef57.5%

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

        \[\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.re \cdot x.im - x.re \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. *-commutative0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.0000000000000001e138 < x.im < -1.05e-107 or 2.00000000000000013e-68 < x.im < 1e85

    1. Initial program 99.7%

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

    if -1.05e-107 < x.im < 2.00000000000000013e-68

    1. Initial program 84.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 83.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. Simplified83.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 83.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 \]
    5. Step-by-step derivation
      1. *-commutative83.4%

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

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

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

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

        \[\leadsto \log \color{blue}{\left(1 \cdot e^{\left(x.re \cdot x.re\right) \cdot x.im}\right)} + \left(x.re \cdot \left(x.im \cdot 2\right)\right) \cdot x.re \]
    8. Applied egg-rr98.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -2 \cdot 10^{+138}:\\ \;\;\;\;\left(x.im + x.im\right) + \left(x.im + x.re\right) \cdot \left(x.im \cdot \left(x.re - x.im\right)\right)\\ \mathbf{elif}\;x.im \leq -1.05 \cdot 10^{-107}:\\ \;\;\;\;x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) + x.re \cdot \left(x.im \cdot x.re + x.im \cdot x.re\right)\\ \mathbf{elif}\;x.im \leq 2 \cdot 10^{-68}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot x.re\right) + x.re \cdot \left(x.re \cdot \left(x.im \cdot 2\right)\right)\\ \mathbf{elif}\;x.im \leq 10^{+85}:\\ \;\;\;\;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) + \left(x.im + x.re\right) \cdot \left(x.im \cdot \left(x.re - x.im\right)\right)\\ \end{array} \]

Alternative 4: 76.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x.im \cdot \left(\left(x.re \cdot x.re - x.im \cdot x.im\right) + 2\right)\\ \mathbf{if}\;x.im \leq -2000000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.im \leq 0.0035:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.im \cdot 3\right)\\ \mathbf{elif}\;x.im \leq 2.3 \cdot 10^{+176} \lor \neg \left(x.im \leq 1.4 \cdot 10^{+214}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;x.im \cdot \left(x.re \cdot x.re + \left(x.re + 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)) 2.0))))
   (if (<= x.im -2000000000000.0)
     t_0
     (if (<= x.im 0.0035)
       (* (* x.re x.re) (* x.im 3.0))
       (if (or (<= x.im 2.3e+176) (not (<= x.im 1.4e+214)))
         t_0
         (* x.im (+ (* x.re x.re) (+ x.re 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)) + 2.0);
	double tmp;
	if (x_46_im <= -2000000000000.0) {
		tmp = t_0;
	} else if (x_46_im <= 0.0035) {
		tmp = (x_46_re * x_46_re) * (x_46_im * 3.0);
	} else if ((x_46_im <= 2.3e+176) || !(x_46_im <= 1.4e+214)) {
		tmp = t_0;
	} else {
		tmp = x_46_im * ((x_46_re * x_46_re) + (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) :: t_0
    real(8) :: tmp
    t_0 = x_46im * (((x_46re * x_46re) - (x_46im * x_46im)) + 2.0d0)
    if (x_46im <= (-2000000000000.0d0)) then
        tmp = t_0
    else if (x_46im <= 0.0035d0) then
        tmp = (x_46re * x_46re) * (x_46im * 3.0d0)
    else if ((x_46im <= 2.3d+176) .or. (.not. (x_46im <= 1.4d+214))) then
        tmp = t_0
    else
        tmp = x_46im * ((x_46re * x_46re) + (x_46re + x_46re))
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
	double t_0 = x_46_im * (((x_46_re * x_46_re) - (x_46_im * x_46_im)) + 2.0);
	double tmp;
	if (x_46_im <= -2000000000000.0) {
		tmp = t_0;
	} else if (x_46_im <= 0.0035) {
		tmp = (x_46_re * x_46_re) * (x_46_im * 3.0);
	} else if ((x_46_im <= 2.3e+176) || !(x_46_im <= 1.4e+214)) {
		tmp = t_0;
	} else {
		tmp = x_46_im * ((x_46_re * x_46_re) + (x_46_re + 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)) + 2.0)
	tmp = 0
	if x_46_im <= -2000000000000.0:
		tmp = t_0
	elif x_46_im <= 0.0035:
		tmp = (x_46_re * x_46_re) * (x_46_im * 3.0)
	elif (x_46_im <= 2.3e+176) or not (x_46_im <= 1.4e+214):
		tmp = t_0
	else:
		tmp = x_46_im * ((x_46_re * x_46_re) + (x_46_re + x_46_re))
	return tmp
function code(x_46_re, x_46_im)
	t_0 = Float64(x_46_im * Float64(Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im)) + 2.0))
	tmp = 0.0
	if (x_46_im <= -2000000000000.0)
		tmp = t_0;
	elseif (x_46_im <= 0.0035)
		tmp = Float64(Float64(x_46_re * x_46_re) * Float64(x_46_im * 3.0));
	elseif ((x_46_im <= 2.3e+176) || !(x_46_im <= 1.4e+214))
		tmp = t_0;
	else
		tmp = Float64(x_46_im * Float64(Float64(x_46_re * x_46_re) + Float64(x_46_re + 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)) + 2.0);
	tmp = 0.0;
	if (x_46_im <= -2000000000000.0)
		tmp = t_0;
	elseif (x_46_im <= 0.0035)
		tmp = (x_46_re * x_46_re) * (x_46_im * 3.0);
	elseif ((x_46_im <= 2.3e+176) || ~((x_46_im <= 1.4e+214)))
		tmp = t_0;
	else
		tmp = x_46_im * ((x_46_re * x_46_re) + (x_46_re + x_46_re));
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(x$46$im * N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$im, -2000000000000.0], t$95$0, If[LessEqual[x$46$im, 0.0035], N[(N[(x$46$re * x$46$re), $MachinePrecision] * N[(x$46$im * 3.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x$46$im, 2.3e+176], N[Not[LessEqual[x$46$im, 1.4e+214]], $MachinePrecision]], t$95$0, N[(x$46$im * N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$re + x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;x.im \leq 2.3 \cdot 10^{+176} \lor \neg \left(x.im \leq 1.4 \cdot 10^{+214}\right):\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.im < -2e12 or 0.00350000000000000007 < x.im < 2.29999999999999996e176 or 1.3999999999999999e214 < x.im

    1. Initial program 74.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. +-commutative74.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. *-commutative74.7%

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

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

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

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

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

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

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

        \[\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.re \cdot x.im - x.re \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. *-commutative0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2e12 < x.im < 0.00350000000000000007

    1. Initial program 88.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. +-commutative88.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. *-commutative88.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-neg88.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-in88.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+88.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-out88.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-neg88.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}} \]
    4. Step-by-step derivation
      1. sub-neg99.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.29999999999999996e176 < x.im < 1.3999999999999999e214

    1. Initial program 16.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. *-commutative16.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -2000000000000:\\ \;\;\;\;x.im \cdot \left(\left(x.re \cdot x.re - x.im \cdot x.im\right) + 2\right)\\ \mathbf{elif}\;x.im \leq 0.0035:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.im \cdot 3\right)\\ \mathbf{elif}\;x.im \leq 2.3 \cdot 10^{+176} \lor \neg \left(x.im \leq 1.4 \cdot 10^{+214}\right):\\ \;\;\;\;x.im \cdot \left(\left(x.re \cdot x.re - x.im \cdot x.im\right) + 2\right)\\ \mathbf{else}:\\ \;\;\;\;x.im \cdot \left(x.re \cdot x.re + \left(x.re + x.re\right)\right)\\ \end{array} \]

Alternative 5: 76.2% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;x.im \leq 2.3 \cdot 10^{+176}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.im < -1.8500000000000001e-66 or 1.80000000000000005e-18 < x.im < 2.29999999999999996e176

    1. Initial program 83.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. *-commutative83.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.8500000000000001e-66 < x.im < 1.80000000000000005e-18

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.29999999999999996e176 < x.im

    1. Initial program 37.5%

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

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

        \[\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-def41.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. *-commutative41.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-out41.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. *-commutative41.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. Simplified41.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-udef37.5%

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

        \[\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.re \cdot x.im - x.re \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. *-commutative0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -1.85 \cdot 10^{-66}:\\ \;\;\;\;x.im \cdot \left(\left(x.re \cdot x.re - x.im \cdot x.im\right) + \left(x.re + x.re\right)\right)\\ \mathbf{elif}\;x.im \leq 1.8 \cdot 10^{-18}:\\ \;\;\;\;x.im \cdot \left(x.re \cdot \left(x.re \cdot 3\right)\right)\\ \mathbf{elif}\;x.im \leq 2.3 \cdot 10^{+176}:\\ \;\;\;\;x.im \cdot \left(\left(x.re \cdot x.re - x.im \cdot x.im\right) + \left(x.re + x.re\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.im + x.im\right) + \left(x.im + x.re\right) \cdot \left(x.im \cdot x.re\right)\\ \end{array} \]

Alternative 6: 76.1% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;x.im \leq 2.8 \cdot 10^{+169}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.im < -7.9999999999999998e-66 or 3.7000000000000003e-18 < x.im < 2.8000000000000002e169

    1. Initial program 83.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. *-commutative83.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.9999999999999998e-66 < x.im < 3.7000000000000003e-18

    1. Initial program 86.2%

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

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

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

      \[\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 \]
    5. Step-by-step derivation
      1. *-commutative83.5%

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

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

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

    if 2.8000000000000002e169 < x.im

    1. Initial program 37.5%

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

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

        \[\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-def41.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. *-commutative41.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-out41.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. *-commutative41.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. Simplified41.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-udef37.5%

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

        \[\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.re \cdot x.im - x.re \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. *-commutative0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -8 \cdot 10^{-66}:\\ \;\;\;\;x.im \cdot \left(\left(x.re \cdot x.re - x.im \cdot x.im\right) + \left(x.re + x.re\right)\right)\\ \mathbf{elif}\;x.im \leq 3.7 \cdot 10^{-18}:\\ \;\;\;\;x.re \cdot \left(x.re \cdot \left(x.im \cdot 2\right)\right) + x.im \cdot \left(x.re \cdot x.re\right)\\ \mathbf{elif}\;x.im \leq 2.8 \cdot 10^{+169}:\\ \;\;\;\;x.im \cdot \left(\left(x.re \cdot x.re - x.im \cdot x.im\right) + \left(x.re + x.re\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.im + x.im\right) + \left(x.im + x.re\right) \cdot \left(x.im \cdot x.re\right)\\ \end{array} \]

Alternative 7: 74.5% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x.im \cdot \left(\left(x.re \cdot x.re - x.im \cdot x.im\right) + 2\right)\\ \mathbf{if}\;x.im \leq -2000000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.im \leq 0.0035:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.im \cdot 3\right)\\ \mathbf{elif}\;x.im \leq 2.2 \cdot 10^{+176}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\left(x.im + x.im\right) + \left(x.im + x.re\right) \cdot \left(x.im \cdot x.re\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)) 2.0))))
   (if (<= x.im -2000000000000.0)
     t_0
     (if (<= x.im 0.0035)
       (* (* x.re x.re) (* x.im 3.0))
       (if (<= x.im 2.2e+176)
         t_0
         (+ (+ x.im x.im) (* (+ x.im x.re) (* 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)) + 2.0);
	double tmp;
	if (x_46_im <= -2000000000000.0) {
		tmp = t_0;
	} else if (x_46_im <= 0.0035) {
		tmp = (x_46_re * x_46_re) * (x_46_im * 3.0);
	} else if (x_46_im <= 2.2e+176) {
		tmp = t_0;
	} else {
		tmp = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * x_46_re));
	}
	return tmp;
}
real(8) function code(x_46re, x_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x_46im * (((x_46re * x_46re) - (x_46im * x_46im)) + 2.0d0)
    if (x_46im <= (-2000000000000.0d0)) then
        tmp = t_0
    else if (x_46im <= 0.0035d0) then
        tmp = (x_46re * x_46re) * (x_46im * 3.0d0)
    else if (x_46im <= 2.2d+176) then
        tmp = t_0
    else
        tmp = (x_46im + x_46im) + ((x_46im + x_46re) * (x_46im * x_46re))
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
	double t_0 = x_46_im * (((x_46_re * x_46_re) - (x_46_im * x_46_im)) + 2.0);
	double tmp;
	if (x_46_im <= -2000000000000.0) {
		tmp = t_0;
	} else if (x_46_im <= 0.0035) {
		tmp = (x_46_re * x_46_re) * (x_46_im * 3.0);
	} else if (x_46_im <= 2.2e+176) {
		tmp = t_0;
	} else {
		tmp = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (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)) + 2.0)
	tmp = 0
	if x_46_im <= -2000000000000.0:
		tmp = t_0
	elif x_46_im <= 0.0035:
		tmp = (x_46_re * x_46_re) * (x_46_im * 3.0)
	elif x_46_im <= 2.2e+176:
		tmp = t_0
	else:
		tmp = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * x_46_re))
	return tmp
function code(x_46_re, x_46_im)
	t_0 = Float64(x_46_im * Float64(Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im)) + 2.0))
	tmp = 0.0
	if (x_46_im <= -2000000000000.0)
		tmp = t_0;
	elseif (x_46_im <= 0.0035)
		tmp = Float64(Float64(x_46_re * x_46_re) * Float64(x_46_im * 3.0));
	elseif (x_46_im <= 2.2e+176)
		tmp = t_0;
	else
		tmp = Float64(Float64(x_46_im + x_46_im) + Float64(Float64(x_46_im + x_46_re) * 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)) + 2.0);
	tmp = 0.0;
	if (x_46_im <= -2000000000000.0)
		tmp = t_0;
	elseif (x_46_im <= 0.0035)
		tmp = (x_46_re * x_46_re) * (x_46_im * 3.0);
	elseif (x_46_im <= 2.2e+176)
		tmp = t_0;
	else
		tmp = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * x_46_re));
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(x$46$im * N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$im, -2000000000000.0], t$95$0, If[LessEqual[x$46$im, 0.0035], N[(N[(x$46$re * x$46$re), $MachinePrecision] * N[(x$46$im * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 2.2e+176], t$95$0, N[(N[(x$46$im + x$46$im), $MachinePrecision] + N[(N[(x$46$im + x$46$re), $MachinePrecision] * N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;x.im \leq 2.2 \cdot 10^{+176}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.im < -2e12 or 0.00350000000000000007 < x.im < 2.20000000000000007e176

    1. Initial program 80.3%

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

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

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

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

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

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

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

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

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

        \[\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.re \cdot x.im - x.re \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. *-commutative0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2e12 < x.im < 0.00350000000000000007

    1. Initial program 88.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. +-commutative88.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. *-commutative88.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-neg88.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-in88.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+88.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-out88.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-neg88.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}} \]
    4. Step-by-step derivation
      1. sub-neg99.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.20000000000000007e176 < x.im

    1. Initial program 37.5%

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

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

        \[\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-def41.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. *-commutative41.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-out41.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. *-commutative41.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. Simplified41.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-udef37.5%

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

        \[\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.re \cdot x.im - x.re \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. *-commutative0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 84.1% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.im \leq -2000000000000 \lor \neg \left(x.im \leq 0.0035\right):\\ \;\;\;\;\left(x.im + x.im\right) + \left(x.im + x.re\right) \cdot \left(x.im \cdot \left(x.re - x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.re \cdot \left(x.im \cdot 2\right)\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 -2000000000000.0) (not (<= x.im 0.0035)))
   (+ (+ x.im x.im) (* (+ x.im x.re) (* x.im (- x.re x.im))))
   (+ (* x.re (* x.re (* x.im 2.0))) (* x.im (* x.re x.re)))))
double code(double x_46_re, double x_46_im) {
	double tmp;
	if ((x_46_im <= -2000000000000.0) || !(x_46_im <= 0.0035)) {
		tmp = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * (x_46_re - x_46_im)));
	} else {
		tmp = (x_46_re * (x_46_re * (x_46_im * 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 <= (-2000000000000.0d0)) .or. (.not. (x_46im <= 0.0035d0))) then
        tmp = (x_46im + x_46im) + ((x_46im + x_46re) * (x_46im * (x_46re - x_46im)))
    else
        tmp = (x_46re * (x_46re * (x_46im * 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 <= -2000000000000.0) || !(x_46_im <= 0.0035)) {
		tmp = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * (x_46_re - x_46_im)));
	} else {
		tmp = (x_46_re * (x_46_re * (x_46_im * 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 <= -2000000000000.0) or not (x_46_im <= 0.0035):
		tmp = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * (x_46_re - x_46_im)))
	else:
		tmp = (x_46_re * (x_46_re * (x_46_im * 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 <= -2000000000000.0) || !(x_46_im <= 0.0035))
		tmp = Float64(Float64(x_46_im + x_46_im) + Float64(Float64(x_46_im + x_46_re) * Float64(x_46_im * Float64(x_46_re - x_46_im))));
	else
		tmp = Float64(Float64(x_46_re * Float64(x_46_re * Float64(x_46_im * 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 <= -2000000000000.0) || ~((x_46_im <= 0.0035)))
		tmp = (x_46_im + x_46_im) + ((x_46_im + x_46_re) * (x_46_im * (x_46_re - x_46_im)));
	else
		tmp = (x_46_re * (x_46_re * (x_46_im * 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, -2000000000000.0], N[Not[LessEqual[x$46$im, 0.0035]], $MachinePrecision]], N[(N[(x$46$im + x$46$im), $MachinePrecision] + N[(N[(x$46$im + x$46$re), $MachinePrecision] * N[(x$46$im * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$re * N[(x$46$re * N[(x$46$im * 2.0), $MachinePrecision]), $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 -2000000000000 \lor \neg \left(x.im \leq 0.0035\right):\\
\;\;\;\;\left(x.im + x.im\right) + \left(x.im + x.re\right) \cdot \left(x.im \cdot \left(x.re - x.im\right)\right)\\

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

    1. Initial program 71.8%

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

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

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

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

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

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

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

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

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

        \[\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.re \cdot x.im - x.re \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. *-commutative0.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.im + x.im\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im} \]
      20. difference-of-squares96.5%

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

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

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

    if -2e12 < x.im < 0.00350000000000000007

    1. Initial program 88.2%

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

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

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

      \[\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 \]
    5. Step-by-step derivation
      1. *-commutative79.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -2000000000000 \lor \neg \left(x.im \leq 0.0035\right):\\ \;\;\;\;\left(x.im + x.im\right) + \left(x.im + x.re\right) \cdot \left(x.im \cdot \left(x.re - x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.re \cdot \left(x.im \cdot 2\right)\right) + x.im \cdot \left(x.re \cdot x.re\right)\\ \end{array} \]

Alternative 9: 90.5% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -2000000000000 \lor \neg \left(x.im \leq 0.0035\right):\\
\;\;\;\;\left(x.im + x.im\right) + \left(x.im + x.re\right) \cdot \left(x.im \cdot \left(x.re - x.im\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -2e12 or 0.00350000000000000007 < x.im

    1. Initial program 71.8%

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

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

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

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

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

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

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

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

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

        \[\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.re \cdot x.im - x.re \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. *-commutative0.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.im + x.im\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im} \]
      20. difference-of-squares96.5%

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

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

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

    if -2e12 < x.im < 0.00350000000000000007

    1. Initial program 88.2%

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

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

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

      \[\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 \]
    5. Step-by-step derivation
      1. *-commutative79.5%

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

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

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

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

        \[\leadsto \log \color{blue}{\left(1 \cdot e^{\left(x.re \cdot x.re\right) \cdot x.im}\right)} + \left(x.re \cdot \left(x.im \cdot 2\right)\right) \cdot x.re \]
    8. Applied egg-rr91.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -2000000000000 \lor \neg \left(x.im \leq 0.0035\right):\\ \;\;\;\;\left(x.im + x.im\right) + \left(x.im + x.re\right) \cdot \left(x.im \cdot \left(x.re - x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot x.re\right) + x.re \cdot \left(x.re \cdot \left(x.im \cdot 2\right)\right)\\ \end{array} \]

Alternative 10: 49.1% accurate, 2.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 49.1% accurate, 2.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 34.3% accurate, 3.8× speedup?

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

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

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

    \[\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. Step-by-step derivation
    1. add-log-exp35.0%

      \[\leadsto \color{blue}{\log \left(e^{\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}\right)} \]
    2. +-commutative35.0%

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

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

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

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

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 80.5%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto -3 \]

Alternative 14: 2.7% accurate, 19.0× speedup?

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

\\
0.1
\end{array}
Derivation
  1. Initial program 80.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 0.1 \]

Developer target: 91.0% 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 2023187 
(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)))