math.cube on complex, real part

Percentage Accurate: 82.0% → 95.9%
Time: 6.3s
Alternatives: 8
Speedup: 1.7×

Specification

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

\\
\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im
\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 8 alternatives:

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

Initial Program: 82.0% accurate, 1.0× speedup?

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

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

Alternative 1: 95.9% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x.re \cdot \mathsf{fma}\left(x.re, x.re, x.im \cdot \left(x.im \cdot -3\right)\right)\\ \mathbf{if}\;x.re \leq -4 \cdot 10^{-144}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.re \leq 5.9 \cdot 10^{-130}:\\ \;\;\;\;x.im \cdot \left(x.re \cdot \left(x.im \cdot -3\right)\right)\\ \mathbf{elif}\;x.re \leq 5 \cdot 10^{+177}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im)
 :precision binary64
 (let* ((t_0 (* x.re (fma x.re x.re (* x.im (* x.im -3.0))))))
   (if (<= x.re -4e-144)
     t_0
     (if (<= x.re 5.9e-130)
       (* x.im (* x.re (* x.im -3.0)))
       (if (<= x.re 5e+177) t_0 (* x.re (* x.re x.re)))))))
double code(double x_46_re, double x_46_im) {
	double t_0 = x_46_re * fma(x_46_re, x_46_re, (x_46_im * (x_46_im * -3.0)));
	double tmp;
	if (x_46_re <= -4e-144) {
		tmp = t_0;
	} else if (x_46_re <= 5.9e-130) {
		tmp = x_46_im * (x_46_re * (x_46_im * -3.0));
	} else if (x_46_re <= 5e+177) {
		tmp = t_0;
	} else {
		tmp = x_46_re * (x_46_re * x_46_re);
	}
	return tmp;
}
function code(x_46_re, x_46_im)
	t_0 = Float64(x_46_re * fma(x_46_re, x_46_re, Float64(x_46_im * Float64(x_46_im * -3.0))))
	tmp = 0.0
	if (x_46_re <= -4e-144)
		tmp = t_0;
	elseif (x_46_re <= 5.9e-130)
		tmp = Float64(x_46_im * Float64(x_46_re * Float64(x_46_im * -3.0)));
	elseif (x_46_re <= 5e+177)
		tmp = t_0;
	else
		tmp = Float64(x_46_re * Float64(x_46_re * x_46_re));
	end
	return tmp
end
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(x$46$re * N[(x$46$re * x$46$re + N[(x$46$im * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, -4e-144], t$95$0, If[LessEqual[x$46$re, 5.9e-130], N[(x$46$im * N[(x$46$re * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 5e+177], t$95$0, N[(x$46$re * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x.re \cdot \mathsf{fma}\left(x.re, x.re, x.im \cdot \left(x.im \cdot -3\right)\right)\\
\mathbf{if}\;x.re \leq -4 \cdot 10^{-144}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;x.re \leq 5 \cdot 10^{+177}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.re < -3.9999999999999998e-144 or 5.9000000000000003e-130 < x.re < 5.0000000000000003e177

    1. Initial program 90.8%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{\left(2 \cdot x.im\right)} \cdot x.im\right) \]
      13. associate-*l*97.9%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{2 \cdot \left(x.im \cdot x.im\right)}\right) \]
      14. distribute-rgt-out--97.9%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{\left(x.im \cdot x.im\right) \cdot \left(-1 - 2\right)}\right) \]
      15. associate-*r*98.0%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{x.im \cdot \left(x.im \cdot \left(-1 - 2\right)\right)}\right) \]
      16. metadata-eval98.0%

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

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

    if -3.9999999999999998e-144 < x.re < 5.9000000000000003e-130

    1. Initial program 85.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{\left(2 \cdot x.im\right)} \cdot x.im\right) \]
      13. associate-*l*85.9%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{2 \cdot \left(x.im \cdot x.im\right)}\right) \]
      14. distribute-rgt-out--85.9%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{\left(x.im \cdot x.im\right) \cdot \left(-1 - 2\right)}\right) \]
      15. associate-*r*85.8%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{x.im \cdot \left(x.im \cdot \left(-1 - 2\right)\right)}\right) \]
      16. metadata-eval85.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000003e177 < x.re

    1. Initial program 53.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{\left(2 \cdot x.im\right)} \cdot x.im\right) \]
      13. associate-*l*78.6%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{2 \cdot \left(x.im \cdot x.im\right)}\right) \]
      14. distribute-rgt-out--78.6%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{\left(x.im \cdot x.im\right) \cdot \left(-1 - 2\right)}\right) \]
      15. associate-*r*78.6%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{x.im \cdot \left(x.im \cdot \left(-1 - 2\right)\right)}\right) \]
      16. metadata-eval78.6%

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

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

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

        \[\leadsto x.re \cdot \color{blue}{\left(x.re \cdot x.re\right)} \]
    6. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \leq -4 \cdot 10^{-144}:\\ \;\;\;\;x.re \cdot \mathsf{fma}\left(x.re, x.re, x.im \cdot \left(x.im \cdot -3\right)\right)\\ \mathbf{elif}\;x.re \leq 5.9 \cdot 10^{-130}:\\ \;\;\;\;x.im \cdot \left(x.re \cdot \left(x.im \cdot -3\right)\right)\\ \mathbf{elif}\;x.re \leq 5 \cdot 10^{+177}:\\ \;\;\;\;x.re \cdot \mathsf{fma}\left(x.re, x.re, x.im \cdot \left(x.im \cdot -3\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\ \end{array} \]

Alternative 2: 96.5% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 95.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{\left(2 \cdot x.im\right)} \cdot x.im\right) \]
      13. associate-*l*69.2%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{2 \cdot \left(x.im \cdot x.im\right)}\right) \]
      14. distribute-rgt-out--69.2%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{\left(x.im \cdot x.im\right) \cdot \left(-1 - 2\right)}\right) \]
      15. associate-*r*69.2%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{x.im \cdot \left(x.im \cdot \left(-1 - 2\right)\right)}\right) \]
      16. metadata-eval69.2%

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

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

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

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

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

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

Alternative 3: 93.8% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) - x.im \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right) \leq \infty:\\ \;\;\;\;{x.re}^{3} + -3 \cdot \left(x.im \cdot \left(x.re \cdot x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im)
 :precision binary64
 (if (<=
      (-
       (* x.re (- (* x.re x.re) (* x.im x.im)))
       (* x.im (+ (* x.re x.im) (* x.re x.im))))
      INFINITY)
   (+ (pow x.re 3.0) (* -3.0 (* x.im (* x.re x.im))))
   (* x.re (* x.re x.re))))
double code(double x_46_re, double x_46_im) {
	double tmp;
	if (((x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)))) <= ((double) INFINITY)) {
		tmp = pow(x_46_re, 3.0) + (-3.0 * (x_46_im * (x_46_re * x_46_im)));
	} else {
		tmp = x_46_re * (x_46_re * x_46_re);
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im) {
	double tmp;
	if (((x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)))) <= Double.POSITIVE_INFINITY) {
		tmp = Math.pow(x_46_re, 3.0) + (-3.0 * (x_46_im * (x_46_re * x_46_im)));
	} else {
		tmp = x_46_re * (x_46_re * x_46_re);
	}
	return tmp;
}
def code(x_46_re, x_46_im):
	tmp = 0
	if ((x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)))) <= math.inf:
		tmp = math.pow(x_46_re, 3.0) + (-3.0 * (x_46_im * (x_46_re * x_46_im)))
	else:
		tmp = x_46_re * (x_46_re * x_46_re)
	return tmp
function code(x_46_re, x_46_im)
	tmp = 0.0
	if (Float64(Float64(x_46_re * Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im))) - Float64(x_46_im * Float64(Float64(x_46_re * x_46_im) + Float64(x_46_re * x_46_im)))) <= Inf)
		tmp = Float64((x_46_re ^ 3.0) + Float64(-3.0 * Float64(x_46_im * Float64(x_46_re * x_46_im))));
	else
		tmp = Float64(x_46_re * 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_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)))) <= Inf)
		tmp = (x_46_re ^ 3.0) + (-3.0 * (x_46_im * (x_46_re * x_46_im)));
	else
		tmp = x_46_re * (x_46_re * x_46_re);
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_] := If[LessEqual[N[(N[(x$46$re * N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$im * N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[Power[x$46$re, 3.0], $MachinePrecision] + N[(-3.0 * N[(x$46$im * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$re * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 95.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{\left(2 \cdot x.im\right)} \cdot x.im\right) \]
      13. associate-*l*69.2%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{2 \cdot \left(x.im \cdot x.im\right)}\right) \]
      14. distribute-rgt-out--69.2%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{\left(x.im \cdot x.im\right) \cdot \left(-1 - 2\right)}\right) \]
      15. associate-*r*69.2%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{x.im \cdot \left(x.im \cdot \left(-1 - 2\right)\right)}\right) \]
      16. metadata-eval69.2%

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

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

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

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

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

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

Alternative 4: 72.8% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -1.95 \cdot 10^{-26} \lor \neg \left(x.re \leq 6.2 \cdot 10^{-49}\right) \land \left(x.re \leq 2.3 \cdot 10^{-18} \lor \neg \left(x.re \leq 1.36 \cdot 10^{+103}\right)\right):\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.re < -1.94999999999999993e-26 or 6.2e-49 < x.re < 2.3000000000000001e-18 or 1.36e103 < x.re

    1. Initial program 76.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{\left(2 \cdot x.im\right)} \cdot x.im\right) \]
      13. associate-*l*92.9%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{2 \cdot \left(x.im \cdot x.im\right)}\right) \]
      14. distribute-rgt-out--92.9%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{\left(x.im \cdot x.im\right) \cdot \left(-1 - 2\right)}\right) \]
      15. associate-*r*92.9%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{x.im \cdot \left(x.im \cdot \left(-1 - 2\right)\right)}\right) \]
      16. metadata-eval92.9%

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

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

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

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

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

    if -1.94999999999999993e-26 < x.re < 6.2e-49 or 2.3000000000000001e-18 < x.re < 1.36e103

    1. Initial program 92.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{\left(2 \cdot x.im\right)} \cdot x.im\right) \]
      13. associate-*l*91.9%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{2 \cdot \left(x.im \cdot x.im\right)}\right) \]
      14. distribute-rgt-out--91.9%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{\left(x.im \cdot x.im\right) \cdot \left(-1 - 2\right)}\right) \]
      15. associate-*r*91.9%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{x.im \cdot \left(x.im \cdot \left(-1 - 2\right)\right)}\right) \]
      16. metadata-eval91.9%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \leq -1.95 \cdot 10^{-26} \lor \neg \left(x.re \leq 6.2 \cdot 10^{-49}\right) \land \left(x.re \leq 2.3 \cdot 10^{-18} \lor \neg \left(x.re \leq 1.36 \cdot 10^{+103}\right)\right):\\ \;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\ \mathbf{else}:\\ \;\;\;\;-3 \cdot \left(x.re \cdot \left(x.im \cdot x.im\right)\right)\\ \end{array} \]

Alternative 5: 96.4% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -6.6 \cdot 10^{+150} \lor \neg \left(x.im \leq 7.6 \cdot 10^{+153}\right):\\
\;\;\;\;x.im \cdot \left(\left(x.re \cdot x.im\right) \cdot -3\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -6.59999999999999962e150 or 7.59999999999999933e153 < x.im

    1. Initial program 56.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.59999999999999962e150 < x.im < 7.59999999999999933e153

    1. Initial program 93.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{\left(2 \cdot x.im\right)} \cdot x.im\right) \]
      13. associate-*l*99.8%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{2 \cdot \left(x.im \cdot x.im\right)}\right) \]
      14. distribute-rgt-out--99.8%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{\left(x.im \cdot x.im\right) \cdot \left(-1 - 2\right)}\right) \]
      15. associate-*r*99.8%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{x.im \cdot \left(x.im \cdot \left(-1 - 2\right)\right)}\right) \]
      16. metadata-eval99.8%

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

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

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

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

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

Alternative 6: 96.4% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.im < -6.59999999999999962e150

    1. Initial program 62.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.59999999999999962e150 < x.im < 7.59999999999999933e153

    1. Initial program 93.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{\left(2 \cdot x.im\right)} \cdot x.im\right) \]
      13. associate-*l*99.8%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{2 \cdot \left(x.im \cdot x.im\right)}\right) \]
      14. distribute-rgt-out--99.8%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{\left(x.im \cdot x.im\right) \cdot \left(-1 - 2\right)}\right) \]
      15. associate-*r*99.8%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{x.im \cdot \left(x.im \cdot \left(-1 - 2\right)\right)}\right) \]
      16. metadata-eval99.8%

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

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

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

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

    if 7.59999999999999933e153 < x.im

    1. Initial program 48.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{\left(2 \cdot x.im\right)} \cdot x.im\right) \]
      13. associate-*l*52.1%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{2 \cdot \left(x.im \cdot x.im\right)}\right) \]
      14. distribute-rgt-out--52.1%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{\left(x.im \cdot x.im\right) \cdot \left(-1 - 2\right)}\right) \]
      15. associate-*r*52.1%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{x.im \cdot \left(x.im \cdot \left(-1 - 2\right)\right)}\right) \]
      16. metadata-eval52.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 82.8% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -4.8 \cdot 10^{+26} \lor \neg \left(x.im \leq 0.052\right):\\
\;\;\;\;x.im \cdot \left(\left(x.re \cdot x.im\right) \cdot -3\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -4.80000000000000009e26 or 0.0519999999999999976 < x.im

    1. Initial program 67.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.80000000000000009e26 < x.im < 0.0519999999999999976

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{\left(2 \cdot x.im\right)} \cdot x.im\right) \]
      13. associate-*l*99.9%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{2 \cdot \left(x.im \cdot x.im\right)}\right) \]
      14. distribute-rgt-out--99.9%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{\left(x.im \cdot x.im\right) \cdot \left(-1 - 2\right)}\right) \]
      15. associate-*r*99.8%

        \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{x.im \cdot \left(x.im \cdot \left(-1 - 2\right)\right)}\right) \]
      16. metadata-eval99.8%

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

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

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

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

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

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

Alternative 8: 58.6% accurate, 3.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{\left(2 \cdot x.im\right)} \cdot x.im\right) \]
    13. associate-*l*92.3%

      \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, -1 \cdot \left(x.im \cdot x.im\right) - \color{blue}{2 \cdot \left(x.im \cdot x.im\right)}\right) \]
    14. distribute-rgt-out--92.3%

      \[\leadsto x.re \cdot \mathsf{fma}\left(x.re, x.re, \color{blue}{\left(x.im \cdot x.im\right) \cdot \left(-1 - 2\right)}\right) \]
    15. associate-*r*92.3%

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

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

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

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

      \[\leadsto x.re \cdot \color{blue}{\left(x.re \cdot x.re\right)} \]
  6. Simplified61.0%

    \[\leadsto x.re \cdot \color{blue}{\left(x.re \cdot x.re\right)} \]
  7. Final simplification61.0%

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

Developer target: 87.0% accurate, 1.1× speedup?

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

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

Reproduce

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

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

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