math.cube on complex, imaginary part

Percentage Accurate: 82.2% → 98.0%
Time: 6.9s
Alternatives: 7
Speedup: 1.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

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

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

Alternative 1: 98.0% accurate, 0.8× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.im < -1.66000000000000003e162 or 5.00000000000000003e40 < x.im

    1. Initial program 69.4%

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

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

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(e^{\mathsf{log1p}\left(\color{blue}{x.re \cdot \left(x.re \cdot x.im + x.im \cdot x.re\right)}\right)} - 1\right) \]
      4. *-commutative57.6%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(e^{\mathsf{log1p}\left(x.re \cdot \left(x.re \cdot x.im + \color{blue}{x.re \cdot x.im}\right)\right)} - 1\right) \]
      5. count-257.6%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(e^{\mathsf{log1p}\left(x.re \cdot \color{blue}{\left(2 \cdot \left(x.re \cdot x.im\right)\right)}\right)} - 1\right) \]
      6. *-commutative57.6%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(e^{\mathsf{log1p}\left(x.re \cdot \color{blue}{\left(\left(x.re \cdot x.im\right) \cdot 2\right)}\right)} - 1\right) \]
      7. associate-*r*57.6%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(e^{\mathsf{log1p}\left(x.re \cdot \color{blue}{\left(x.re \cdot \left(x.im \cdot 2\right)\right)}\right)} - 1\right) \]
      8. associate-*r*57.6%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(e^{\mathsf{log1p}\left(x.re \cdot \color{blue}{\left(\left(x.re \cdot x.im\right) \cdot 2\right)}\right)} - 1\right) \]
      9. *-commutative57.6%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(e^{\mathsf{log1p}\left(x.re \cdot \color{blue}{\left(2 \cdot \left(x.re \cdot x.im\right)\right)}\right)} - 1\right) \]
      10. count-257.6%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(e^{\mathsf{log1p}\left(x.re \cdot \color{blue}{\left(x.re \cdot x.im + x.re \cdot x.im\right)}\right)} - 1\right) \]
      11. flip-+0.0%

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

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

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \color{blue}{\left(e^{\mathsf{log1p}\left(x.re \cdot \frac{0}{0}\right)} - 1\right)} \]
    4. Simplified85.9%

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

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

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

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

    if -1.66000000000000003e162 < x.im < -1.28e-76 or 4.59999999999999989e-100 < x.im < 5.00000000000000003e40

    1. Initial program 97.1%

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

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

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

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

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

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

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

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

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

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

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

    if -1.28e-76 < x.im < 4.59999999999999989e-100

    1. Initial program 83.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -1.66 \cdot 10^{+162}:\\ \;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right)\\ \mathbf{elif}\;x.im \leq -1.28 \cdot 10^{-76}:\\ \;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) + x.re \cdot \left(\left(x.re \cdot x.im\right) \cdot 2\right)\\ \mathbf{elif}\;x.im \leq 4.6 \cdot 10^{-100}:\\ \;\;\;\;3 \cdot \left(x.re \cdot \left(x.re \cdot x.im\right)\right)\\ \mathbf{elif}\;x.im \leq 5 \cdot 10^{+40}:\\ \;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) + x.re \cdot \left(\left(x.re \cdot x.im\right) \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right)\\ \end{array} \]

Alternative 2: 97.1% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 92.9%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    2. Simplified98.5%

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

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

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

    1. Initial program 0.0%

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

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \color{blue}{\left(e^{\mathsf{log1p}\left(\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\right)} - 1\right)} \]
      3. *-commutative0.0%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(e^{\mathsf{log1p}\left(x.re \cdot \left(x.re \cdot x.im + \color{blue}{x.re \cdot x.im}\right)\right)} - 1\right) \]
      5. count-20.0%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(e^{\mathsf{log1p}\left(x.re \cdot \color{blue}{\left(2 \cdot \left(x.re \cdot x.im\right)\right)}\right)} - 1\right) \]
      6. *-commutative0.0%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(e^{\mathsf{log1p}\left(x.re \cdot \color{blue}{\left(\left(x.re \cdot x.im\right) \cdot 2\right)}\right)} - 1\right) \]
      7. associate-*r*0.0%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(e^{\mathsf{log1p}\left(x.re \cdot \color{blue}{\left(x.re \cdot \left(x.im \cdot 2\right)\right)}\right)} - 1\right) \]
      8. associate-*r*0.0%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(e^{\mathsf{log1p}\left(x.re \cdot \color{blue}{\left(\left(x.re \cdot x.im\right) \cdot 2\right)}\right)} - 1\right) \]
      9. *-commutative0.0%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(e^{\mathsf{log1p}\left(x.re \cdot \color{blue}{\left(2 \cdot \left(x.re \cdot x.im\right)\right)}\right)} - 1\right) \]
      10. count-20.0%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(e^{\mathsf{log1p}\left(x.re \cdot \color{blue}{\left(x.re \cdot x.im + x.re \cdot x.im\right)}\right)} - 1\right) \]
      11. flip-+0.0%

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

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

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \color{blue}{\left(e^{\mathsf{log1p}\left(x.re \cdot \frac{0}{0}\right)} - 1\right)} \]
    4. Simplified50.0%

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

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

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

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

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

Alternative 3: 93.3% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -4.2 \cdot 10^{-76} \lor \neg \left(x.im \leq 6.5 \cdot 10^{-82}\right):\\
\;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -4.19999999999999985e-76 or 6.4999999999999997e-82 < x.im

    1. Initial program 81.9%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\right)\right)} \]
      2. expm1-udef59.5%

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

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(e^{\mathsf{log1p}\left(x.re \cdot \left(x.re \cdot x.im + \color{blue}{x.re \cdot x.im}\right)\right)} - 1\right) \]
      5. count-259.5%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(e^{\mathsf{log1p}\left(x.re \cdot \color{blue}{\left(\left(x.re \cdot x.im\right) \cdot 2\right)}\right)} - 1\right) \]
      7. associate-*r*59.5%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(e^{\mathsf{log1p}\left(x.re \cdot \color{blue}{\left(x.re \cdot \left(x.im \cdot 2\right)\right)}\right)} - 1\right) \]
      8. associate-*r*59.5%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(e^{\mathsf{log1p}\left(x.re \cdot \color{blue}{\left(2 \cdot \left(x.re \cdot x.im\right)\right)}\right)} - 1\right) \]
      10. count-259.5%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(e^{\mathsf{log1p}\left(x.re \cdot \color{blue}{\left(x.re \cdot x.im + x.re \cdot x.im\right)}\right)} - 1\right) \]
      11. flip-+0.0%

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

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

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

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \color{blue}{\left(e^{\mathsf{log1p}\left(x.re \cdot \frac{0}{0}\right)} - 1\right)} \]
    4. Simplified85.6%

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

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

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

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

    if -4.19999999999999985e-76 < x.im < 6.4999999999999997e-82

    1. Initial program 84.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 56.4% accurate, 2.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 2.7% accurate, 19.0× speedup?

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

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

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

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

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

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

    \[\leadsto -3 \]

Alternative 6: 2.7% accurate, 19.0× speedup?

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

\\
-0.3333333333333333
\end{array}
Derivation
  1. Initial program 82.7%

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

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

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

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

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

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

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

      \[\leadsto {x.re}^{2} \cdot \color{blue}{\frac{x.im \cdot x.im - \left(2 \cdot x.im\right) \cdot \left(2 \cdot x.im\right)}{x.im - 2 \cdot x.im}} \]
    6. associate-*r/36.3%

      \[\leadsto \color{blue}{\frac{{x.re}^{2} \cdot \left(x.im \cdot x.im - \left(2 \cdot x.im\right) \cdot \left(2 \cdot x.im\right)\right)}{x.im - 2 \cdot x.im}} \]
    7. difference-of-squares39.4%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{-3 \cdot \left(-x.im\right)}{-x.im}} \]
  7. Applied egg-rr2.6%

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

    \[\leadsto -0.3333333333333333 \]

Alternative 7: 2.7% accurate, 19.0× speedup?

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

\\
0.3333333333333333
\end{array}
Derivation
  1. Initial program 82.7%

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

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

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

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

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

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

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

      \[\leadsto {x.re}^{2} \cdot \color{blue}{\frac{x.im \cdot x.im - \left(2 \cdot x.im\right) \cdot \left(2 \cdot x.im\right)}{x.im - 2 \cdot x.im}} \]
    6. associate-*r/36.3%

      \[\leadsto \color{blue}{\frac{{x.re}^{2} \cdot \left(x.im \cdot x.im - \left(2 \cdot x.im\right) \cdot \left(2 \cdot x.im\right)\right)}{x.im - 2 \cdot x.im}} \]
    7. difference-of-squares39.4%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{-3 \cdot \left(-x.im\right)}{-x.im}} \]
  7. Applied egg-rr2.8%

    \[\leadsto \color{blue}{0.3333333333333333} \]
  8. Final simplification2.8%

    \[\leadsto 0.3333333333333333 \]

Developer target: 91.3% accurate, 1.1× speedup?

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

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

Reproduce

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

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

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