math.cube on complex, real part

Percentage Accurate: 82.6% → 99.8%
Time: 9.1s
Alternatives: 6
Speedup: 1.2×

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

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

Initial Program: 82.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.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: 99.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x.im \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\\ \mathbf{if}\;x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) - t\_0 \leq \infty:\\ \;\;\;\;\left(x.re + x.im\right) \cdot \left(x.re \cdot \left(x.re - x.im\right)\right) - t\_0\\ \mathbf{else}:\\ \;\;\;\;\left(-3 + \frac{x.re}{x.im \cdot \frac{x.im}{x.re}}\right) \cdot \left(x.re \cdot \left(x.im \cdot x.im\right)\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im)
 :precision binary64
 (let* ((t_0 (* x.im (+ (* x.re x.im) (* x.re x.im)))))
   (if (<= (- (* x.re (- (* x.re x.re) (* x.im x.im))) t_0) INFINITY)
     (- (* (+ x.re x.im) (* x.re (- x.re x.im))) t_0)
     (* (+ -3.0 (/ x.re (* x.im (/ x.im x.re)))) (* x.re (* x.im x.im))))))
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 tmp;
	if (((x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - t_0) <= ((double) INFINITY)) {
		tmp = ((x_46_re + x_46_im) * (x_46_re * (x_46_re - x_46_im))) - t_0;
	} else {
		tmp = (-3.0 + (x_46_re / (x_46_im * (x_46_im / x_46_re)))) * (x_46_re * (x_46_im * x_46_im));
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im) {
	double t_0 = x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im));
	double tmp;
	if (((x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - t_0) <= Double.POSITIVE_INFINITY) {
		tmp = ((x_46_re + x_46_im) * (x_46_re * (x_46_re - x_46_im))) - t_0;
	} else {
		tmp = (-3.0 + (x_46_re / (x_46_im * (x_46_im / x_46_re)))) * (x_46_re * (x_46_im * x_46_im));
	}
	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))
	tmp = 0
	if ((x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - t_0) <= math.inf:
		tmp = ((x_46_re + x_46_im) * (x_46_re * (x_46_re - x_46_im))) - t_0
	else:
		tmp = (-3.0 + (x_46_re / (x_46_im * (x_46_im / x_46_re)))) * (x_46_re * (x_46_im * x_46_im))
	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)))
	tmp = 0.0
	if (Float64(Float64(x_46_re * Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im))) - t_0) <= Inf)
		tmp = Float64(Float64(Float64(x_46_re + x_46_im) * Float64(x_46_re * Float64(x_46_re - x_46_im))) - t_0);
	else
		tmp = Float64(Float64(-3.0 + Float64(x_46_re / Float64(x_46_im * Float64(x_46_im / x_46_re)))) * 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)
	t_0 = x_46_im * ((x_46_re * x_46_im) + (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))) - t_0) <= Inf)
		tmp = ((x_46_re + x_46_im) * (x_46_re * (x_46_re - x_46_im))) - t_0;
	else
		tmp = (-3.0 + (x_46_re / (x_46_im * (x_46_im / x_46_re)))) * (x_46_re * (x_46_im * x_46_im));
	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]}, 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] - t$95$0), $MachinePrecision], Infinity], N[(N[(N[(x$46$re + x$46$im), $MachinePrecision] * N[(x$46$re * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(-3.0 + N[(x$46$re / N[(x$46$im * N[(x$46$im / x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x$46$re * N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\left(-3 + \frac{x.re}{x.im \cdot \frac{x.im}{x.re}}\right) \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 (-.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 94.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. Add Preprocessing
    3. Step-by-step derivation
      1. difference-of-squaresN/A

        \[\leadsto \mathsf{\_.f64}\left(\left(\left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right) \cdot x.re\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(x.re, x.im\right)}, \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      2. associate-*l*N/A

        \[\leadsto \mathsf{\_.f64}\left(\left(\left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.re\right)\right), \mathsf{*.f64}\left(\color{blue}{\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right)}, x.im\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\left(x.re + x.im\right), \left(\left(x.re - x.im\right) \cdot x.re\right)\right), \mathsf{*.f64}\left(\color{blue}{\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right)}, x.im\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(\left(x.re - x.im\right) \cdot x.re\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(x.re, x.im\right)}, \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(\left(x.re - x.im\right), x.re\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \color{blue}{\mathsf{*.f64}\left(x.im, x.re\right)}\right), x.im\right)\right) \]
      6. --lowering--.f6499.8%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(x.re, x.im\right), x.re\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(\color{blue}{x.im}, x.re\right)\right), x.im\right)\right) \]
    4. Applied egg-rr99.8%

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

    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. Add Preprocessing
    3. Step-by-step derivation
      1. difference-of-squaresN/A

        \[\leadsto \mathsf{\_.f64}\left(\left(\left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right) \cdot x.re\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(x.re, x.im\right)}, \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      2. associate-*l*N/A

        \[\leadsto \mathsf{\_.f64}\left(\left(\left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.re\right)\right), \mathsf{*.f64}\left(\color{blue}{\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right)}, x.im\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\left(x.re + x.im\right), \left(\left(x.re - x.im\right) \cdot x.re\right)\right), \mathsf{*.f64}\left(\color{blue}{\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right)}, x.im\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(\left(x.re - x.im\right) \cdot x.re\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(x.re, x.im\right)}, \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(\left(x.re - x.im\right), x.re\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \color{blue}{\mathsf{*.f64}\left(x.im, x.re\right)}\right), x.im\right)\right) \]
      6. --lowering--.f6432.4%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(x.re, x.im\right), x.re\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(\color{blue}{x.im}, x.re\right)\right), x.im\right)\right) \]
    4. Applied egg-rr32.4%

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

      \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \color{blue}{\left(x.im \cdot \left(-1 \cdot x.re + \frac{{x.re}^{2}}{x.im}\right)\right)}\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(x.im \cdot \left(\left(\mathsf{neg}\left(x.re\right)\right) + \frac{{x.re}^{2}}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(x.im \cdot \left(\left(0 - x.re\right) + \frac{{x.re}^{2}}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      3. associate-+l-N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(x.im \cdot \left(0 - \left(x.re - \frac{{x.re}^{2}}{x.im}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right), x.im\right)\right) \]
      4. unsub-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(x.im \cdot \left(0 - \left(x.re + \left(\mathsf{neg}\left(\frac{{x.re}^{2}}{x.im}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      5. mul-1-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(x.im \cdot \left(0 - \left(x.re + -1 \cdot \frac{{x.re}^{2}}{x.im}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      6. neg-sub0N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(x.im \cdot \left(\mathsf{neg}\left(\left(x.re + -1 \cdot \frac{{x.re}^{2}}{x.im}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right), x.im\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(\mathsf{neg}\left(\left(x.re + -1 \cdot \frac{{x.re}^{2}}{x.im}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \color{blue}{\mathsf{*.f64}\left(x.im, x.re\right)}\right), x.im\right)\right) \]
      8. neg-sub0N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(0 - \left(x.re + -1 \cdot \frac{{x.re}^{2}}{x.im}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right), x.im\right)\right) \]
      9. mul-1-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(0 - \left(x.re + \left(\mathsf{neg}\left(\frac{{x.re}^{2}}{x.im}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      10. unsub-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(0 - \left(x.re - \frac{{x.re}^{2}}{x.im}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      11. associate-+l-N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(\left(0 - x.re\right) + \frac{{x.re}^{2}}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right), x.im\right)\right) \]
      12. neg-sub0N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(\left(\mathsf{neg}\left(x.re\right)\right) + \frac{{x.re}^{2}}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(-1 \cdot x.re + \frac{{x.re}^{2}}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      14. *-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(x.re \cdot -1 + \frac{{x.re}^{2}}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(x.re \cdot -1 + \frac{x.re \cdot x.re}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      16. associate-/l*N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(x.re \cdot -1 + x.re \cdot \frac{x.re}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      17. distribute-lft-outN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(x.re \cdot \left(-1 + \frac{x.re}{x.im}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right), x.im\right)\right) \]
      18. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \left(-1 + \frac{x.re}{x.im}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right), x.im\right)\right) \]
      19. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \left(\frac{x.re}{x.im}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      20. /-lowering-/.f6432.4%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
    7. Simplified32.4%

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

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

      \[\leadsto \color{blue}{\left(x.im \cdot x.im\right) \cdot \left(x.re \cdot \left(-3 + \frac{\frac{x.re \cdot x.re}{x.im}}{x.im}\right)\right)} \]
    10. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(\left(x.im \cdot x.im\right) \cdot x.re\right) \cdot \color{blue}{\left(-3 + \frac{\frac{x.re \cdot x.re}{x.im}}{x.im}\right)} \]
      2. *-commutativeN/A

        \[\leadsto \left(-3 + \frac{\frac{x.re \cdot x.re}{x.im}}{x.im}\right) \cdot \color{blue}{\left(\left(x.im \cdot x.im\right) \cdot x.re\right)} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(-3 + \frac{\frac{x.re \cdot x.re}{x.im}}{x.im}\right), \color{blue}{\left(\left(x.im \cdot x.im\right) \cdot x.re\right)}\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-3, \left(\frac{\frac{x.re \cdot x.re}{x.im}}{x.im}\right)\right), \left(\color{blue}{\left(x.im \cdot x.im\right)} \cdot x.re\right)\right) \]
      5. associate-*l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-3, \left(\frac{\frac{x.re}{x.im} \cdot x.re}{x.im}\right)\right), \left(\left(x.im \cdot x.im\right) \cdot x.re\right)\right) \]
      6. associate-/r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-3, \left(\frac{\frac{x.re}{\frac{x.im}{x.re}}}{x.im}\right)\right), \left(\left(x.im \cdot x.im\right) \cdot x.re\right)\right) \]
      7. associate-/l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-3, \left(\frac{x.re}{x.im \cdot \frac{x.im}{x.re}}\right)\right), \left(\left(x.im \cdot \color{blue}{x.im}\right) \cdot x.re\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-3, \mathsf{/.f64}\left(x.re, \left(x.im \cdot \frac{x.im}{x.re}\right)\right)\right), \left(\left(x.im \cdot \color{blue}{x.im}\right) \cdot x.re\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-3, \mathsf{/.f64}\left(x.re, \mathsf{*.f64}\left(x.im, \left(\frac{x.im}{x.re}\right)\right)\right)\right), \left(\left(x.im \cdot x.im\right) \cdot x.re\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-3, \mathsf{/.f64}\left(x.re, \mathsf{*.f64}\left(x.im, \mathsf{/.f64}\left(x.im, x.re\right)\right)\right)\right), \left(\left(x.im \cdot x.im\right) \cdot x.re\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-3, \mathsf{/.f64}\left(x.re, \mathsf{*.f64}\left(x.im, \mathsf{/.f64}\left(x.im, x.re\right)\right)\right)\right), \left(x.re \cdot \color{blue}{\left(x.im \cdot x.im\right)}\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-3, \mathsf{/.f64}\left(x.re, \mathsf{*.f64}\left(x.im, \mathsf{/.f64}\left(x.im, x.re\right)\right)\right)\right), \mathsf{*.f64}\left(x.re, \color{blue}{\left(x.im \cdot x.im\right)}\right)\right) \]
      13. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-3, \mathsf{/.f64}\left(x.re, \mathsf{*.f64}\left(x.im, \mathsf{/.f64}\left(x.im, x.re\right)\right)\right)\right), \mathsf{*.f64}\left(x.re, \mathsf{*.f64}\left(x.im, \color{blue}{x.im}\right)\right)\right) \]
    11. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\left(-3 + \frac{x.re}{x.im \cdot \frac{x.im}{x.re}}\right) \cdot \left(x.re \cdot \left(x.im \cdot x.im\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.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:\\ \;\;\;\;\left(x.re + x.im\right) \cdot \left(x.re \cdot \left(x.re - x.im\right)\right) - x.im \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-3 + \frac{x.re}{x.im \cdot \frac{x.im}{x.re}}\right) \cdot \left(x.re \cdot \left(x.im \cdot x.im\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 77.7% accurate, 0.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.re < 2.00000000000000006e-117

    1. Initial program 83.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. sub-negN/A

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

        \[\leadsto \left(\mathsf{neg}\left(\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re} \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \cdot x.re \]
      4. *-commutativeN/A

        \[\leadsto \left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot \color{blue}{x.re} - x.im \cdot x.im\right) \cdot x.re \]
      5. distribute-lft-outN/A

        \[\leadsto \left(x.re \cdot \left(x.im + x.im\right)\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(\color{blue}{x.re \cdot x.re} - x.im \cdot x.im\right) \cdot x.re \]
      6. associate-*l*N/A

        \[\leadsto x.re \cdot \left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \cdot x.re \]
      7. *-commutativeN/A

        \[\leadsto x.re \cdot \left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right) + x.re \cdot \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \]
      8. distribute-lft-outN/A

        \[\leadsto x.re \cdot \color{blue}{\left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot x.re - x.im \cdot x.im\right)\right)} \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \color{blue}{\left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot x.re - x.im \cdot x.im\right)\right)}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(\left(x.re \cdot x.re - x.im \cdot x.im\right) + \color{blue}{\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)}\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(\left(x.re \cdot x.re + \left(\mathsf{neg}\left(x.im \cdot x.im\right)\right)\right) + \color{blue}{\left(x.im + x.im\right)} \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)\right) \]
      12. associate-+l+N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(x.re \cdot x.re + \color{blue}{\left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)}\right)\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\left(x.re \cdot x.re\right), \color{blue}{\left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)}\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\color{blue}{\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right)} + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)\right)\right) \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(\mathsf{neg}\left(\left(x.im + x.im\right) \cdot x.im\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - \color{blue}{\left(x.im + x.im\right) \cdot x.im}\right)\right)\right) \]
      17. count-2N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - \left(2 \cdot x.im\right) \cdot x.im\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - 2 \cdot \color{blue}{\left(x.im \cdot x.im\right)}\right)\right)\right) \]
    3. Simplified86.7%

      \[\leadsto \color{blue}{x.re \cdot \left(x.re \cdot x.re + \left(x.im \cdot x.im\right) \cdot -3\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x.re around 0

      \[\leadsto \color{blue}{-3 \cdot \left({x.im}^{2} \cdot x.re\right)} \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(-3, \color{blue}{\left({x.im}^{2} \cdot x.re\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(-3, \left(\left(x.im \cdot x.im\right) \cdot x.re\right)\right) \]
      3. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(-3, \left(x.im \cdot \color{blue}{\left(x.im \cdot x.re\right)}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(-3, \mathsf{*.f64}\left(x.im, \color{blue}{\left(x.im \cdot x.re\right)}\right)\right) \]
      5. *-lowering-*.f6466.0%

        \[\leadsto \mathsf{*.f64}\left(-3, \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right)\right) \]
    7. Simplified66.0%

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

    if 2.00000000000000006e-117 < x.re < 9.9999999999999998e100

    1. Initial program 99.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \mathsf{*.f64}\left(x.im, x.im\right)\right), x.re\right), \mathsf{*.f64}\left(\left(x.im \cdot x.re + x.im \cdot x.re\right), x.im\right)\right) \]
      2. distribute-rgt-outN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \mathsf{*.f64}\left(x.im, x.im\right)\right), x.re\right), \mathsf{*.f64}\left(\left(x.re \cdot \left(x.im + x.im\right)\right), x.im\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \mathsf{*.f64}\left(x.im, x.im\right)\right), x.re\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x.re, \left(x.im + x.im\right)\right), x.im\right)\right) \]
      4. +-lowering-+.f6499.9%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \mathsf{*.f64}\left(x.im, x.im\right)\right), x.re\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(x.im, x.im\right)\right), x.im\right)\right) \]
    4. Applied egg-rr99.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 \]

    if 9.9999999999999998e100 < x.re

    1. Initial program 54.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. Add Preprocessing
    3. Step-by-step derivation
      1. difference-of-squaresN/A

        \[\leadsto \mathsf{\_.f64}\left(\left(\left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right) \cdot x.re\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(x.re, x.im\right)}, \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      2. associate-*l*N/A

        \[\leadsto \mathsf{\_.f64}\left(\left(\left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.re\right)\right), \mathsf{*.f64}\left(\color{blue}{\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right)}, x.im\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\left(x.re + x.im\right), \left(\left(x.re - x.im\right) \cdot x.re\right)\right), \mathsf{*.f64}\left(\color{blue}{\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right)}, x.im\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(\left(x.re - x.im\right) \cdot x.re\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(x.re, x.im\right)}, \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(\left(x.re - x.im\right), x.re\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \color{blue}{\mathsf{*.f64}\left(x.im, x.re\right)}\right), x.im\right)\right) \]
      6. --lowering--.f6468.2%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(x.re, x.im\right), x.re\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(\color{blue}{x.im}, x.re\right)\right), x.im\right)\right) \]
    4. Applied egg-rr68.2%

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

      \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \color{blue}{\left(x.im \cdot \left(-1 \cdot x.re + \frac{{x.re}^{2}}{x.im}\right)\right)}\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(x.im \cdot \left(\left(\mathsf{neg}\left(x.re\right)\right) + \frac{{x.re}^{2}}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(x.im \cdot \left(\left(0 - x.re\right) + \frac{{x.re}^{2}}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      3. associate-+l-N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(x.im \cdot \left(0 - \left(x.re - \frac{{x.re}^{2}}{x.im}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right), x.im\right)\right) \]
      4. unsub-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(x.im \cdot \left(0 - \left(x.re + \left(\mathsf{neg}\left(\frac{{x.re}^{2}}{x.im}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      5. mul-1-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(x.im \cdot \left(0 - \left(x.re + -1 \cdot \frac{{x.re}^{2}}{x.im}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      6. neg-sub0N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(x.im \cdot \left(\mathsf{neg}\left(\left(x.re + -1 \cdot \frac{{x.re}^{2}}{x.im}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right), x.im\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(\mathsf{neg}\left(\left(x.re + -1 \cdot \frac{{x.re}^{2}}{x.im}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \color{blue}{\mathsf{*.f64}\left(x.im, x.re\right)}\right), x.im\right)\right) \]
      8. neg-sub0N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(0 - \left(x.re + -1 \cdot \frac{{x.re}^{2}}{x.im}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right), x.im\right)\right) \]
      9. mul-1-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(0 - \left(x.re + \left(\mathsf{neg}\left(\frac{{x.re}^{2}}{x.im}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      10. unsub-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(0 - \left(x.re - \frac{{x.re}^{2}}{x.im}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      11. associate-+l-N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(\left(0 - x.re\right) + \frac{{x.re}^{2}}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right), x.im\right)\right) \]
      12. neg-sub0N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(\left(\mathsf{neg}\left(x.re\right)\right) + \frac{{x.re}^{2}}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(-1 \cdot x.re + \frac{{x.re}^{2}}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      14. *-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(x.re \cdot -1 + \frac{{x.re}^{2}}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(x.re \cdot -1 + \frac{x.re \cdot x.re}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      16. associate-/l*N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(x.re \cdot -1 + x.re \cdot \frac{x.re}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      17. distribute-lft-outN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(x.re \cdot \left(-1 + \frac{x.re}{x.im}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right), x.im\right)\right) \]
      18. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \left(-1 + \frac{x.re}{x.im}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right), x.im\right)\right) \]
      19. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \left(\frac{x.re}{x.im}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      20. /-lowering-/.f6468.2%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
    7. Simplified68.2%

      \[\leadsto \left(x.re + x.im\right) \cdot \color{blue}{\left(x.im \cdot \left(x.re \cdot \left(-1 + \frac{x.re}{x.im}\right)\right)\right)} - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    8. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\left(x.im \cdot x.re + x.im \cdot x.re\right), x.im\right)\right) \]
      2. distribute-rgt-outN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\left(x.re \cdot \left(x.im + x.im\right)\right), x.im\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x.re, \left(x.im + x.im\right)\right), x.im\right)\right) \]
      4. +-lowering-+.f6468.2%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(x.im, x.im\right)\right), x.im\right)\right) \]
    9. Applied egg-rr68.2%

      \[\leadsto \left(x.re + x.im\right) \cdot \left(x.im \cdot \left(x.re \cdot \left(-1 + \frac{x.re}{x.im}\right)\right)\right) - \color{blue}{\left(x.re \cdot \left(x.im + x.im\right)\right)} \cdot x.im \]
    10. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \left(x.im \cdot \color{blue}{\left(x.re \cdot \left(x.im + x.im\right)\right)}\right)\right) \]
      2. distribute-lft-inN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \left(x.im \cdot \left(x.re \cdot x.im + \color{blue}{x.re \cdot x.im}\right)\right)\right) \]
      3. flip-+N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \left(x.im \cdot \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)}{\color{blue}{x.re \cdot x.im - x.re \cdot x.im}}\right)\right) \]
      4. +-inversesN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \left(x.im \cdot \frac{0}{\color{blue}{x.re \cdot x.im} - x.re \cdot x.im}\right)\right) \]
      5. +-inversesN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \left(x.im \cdot \frac{0}{0}\right)\right) \]
      6. associate-*r/N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \left(\frac{x.im \cdot 0}{\color{blue}{0}}\right)\right) \]
      7. +-inversesN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \left(\frac{x.im \cdot \left(x.im - x.im\right)}{0}\right)\right) \]
      8. distribute-lft-out--N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \left(\frac{x.im \cdot x.im - x.im \cdot x.im}{0}\right)\right) \]
      9. +-inversesN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \left(\frac{x.im \cdot x.im - x.im \cdot x.im}{x.im - \color{blue}{x.im}}\right)\right) \]
      10. flip-+N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \left(x.im + \color{blue}{x.im}\right)\right) \]
      11. +-lowering-+.f64100.0%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \mathsf{+.f64}\left(x.im, \color{blue}{x.im}\right)\right) \]
    11. Applied egg-rr100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \leq 2 \cdot 10^{-117}:\\ \;\;\;\;-3 \cdot \left(x.im \cdot \left(x.re \cdot x.im\right)\right)\\ \mathbf{elif}\;x.re \leq 10^{+101}:\\ \;\;\;\;x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.re + x.im\right) \cdot \left(x.im \cdot \left(x.re \cdot \left(-1 + \frac{x.re}{x.im}\right)\right)\right) - \left(x.im + x.im\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 77.7% accurate, 0.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.re < 2.00000000000000006e-117

    1. Initial program 83.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. sub-negN/A

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

        \[\leadsto \left(\mathsf{neg}\left(\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re} \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \cdot x.re \]
      4. *-commutativeN/A

        \[\leadsto \left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot \color{blue}{x.re} - x.im \cdot x.im\right) \cdot x.re \]
      5. distribute-lft-outN/A

        \[\leadsto \left(x.re \cdot \left(x.im + x.im\right)\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(\color{blue}{x.re \cdot x.re} - x.im \cdot x.im\right) \cdot x.re \]
      6. associate-*l*N/A

        \[\leadsto x.re \cdot \left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \cdot x.re \]
      7. *-commutativeN/A

        \[\leadsto x.re \cdot \left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right) + x.re \cdot \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \]
      8. distribute-lft-outN/A

        \[\leadsto x.re \cdot \color{blue}{\left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot x.re - x.im \cdot x.im\right)\right)} \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \color{blue}{\left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot x.re - x.im \cdot x.im\right)\right)}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(\left(x.re \cdot x.re - x.im \cdot x.im\right) + \color{blue}{\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)}\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(\left(x.re \cdot x.re + \left(\mathsf{neg}\left(x.im \cdot x.im\right)\right)\right) + \color{blue}{\left(x.im + x.im\right)} \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)\right) \]
      12. associate-+l+N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(x.re \cdot x.re + \color{blue}{\left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)}\right)\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\left(x.re \cdot x.re\right), \color{blue}{\left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)}\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\color{blue}{\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right)} + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)\right)\right) \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(\mathsf{neg}\left(\left(x.im + x.im\right) \cdot x.im\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - \color{blue}{\left(x.im + x.im\right) \cdot x.im}\right)\right)\right) \]
      17. count-2N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - \left(2 \cdot x.im\right) \cdot x.im\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - 2 \cdot \color{blue}{\left(x.im \cdot x.im\right)}\right)\right)\right) \]
    3. Simplified86.7%

      \[\leadsto \color{blue}{x.re \cdot \left(x.re \cdot x.re + \left(x.im \cdot x.im\right) \cdot -3\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x.re around 0

      \[\leadsto \color{blue}{-3 \cdot \left({x.im}^{2} \cdot x.re\right)} \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(-3, \color{blue}{\left({x.im}^{2} \cdot x.re\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(-3, \left(\left(x.im \cdot x.im\right) \cdot x.re\right)\right) \]
      3. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(-3, \left(x.im \cdot \color{blue}{\left(x.im \cdot x.re\right)}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(-3, \mathsf{*.f64}\left(x.im, \color{blue}{\left(x.im \cdot x.re\right)}\right)\right) \]
      5. *-lowering-*.f6466.0%

        \[\leadsto \mathsf{*.f64}\left(-3, \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right)\right) \]
    7. Simplified66.0%

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

    if 2.00000000000000006e-117 < x.re < 9.9999999999999998e100

    1. Initial program 99.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. sub-negN/A

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

        \[\leadsto \left(\mathsf{neg}\left(\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re} \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \cdot x.re \]
      4. *-commutativeN/A

        \[\leadsto \left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot \color{blue}{x.re} - x.im \cdot x.im\right) \cdot x.re \]
      5. distribute-lft-outN/A

        \[\leadsto \left(x.re \cdot \left(x.im + x.im\right)\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(\color{blue}{x.re \cdot x.re} - x.im \cdot x.im\right) \cdot x.re \]
      6. associate-*l*N/A

        \[\leadsto x.re \cdot \left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \cdot x.re \]
      7. *-commutativeN/A

        \[\leadsto x.re \cdot \left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right) + x.re \cdot \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \]
      8. distribute-lft-outN/A

        \[\leadsto x.re \cdot \color{blue}{\left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot x.re - x.im \cdot x.im\right)\right)} \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \color{blue}{\left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot x.re - x.im \cdot x.im\right)\right)}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(\left(x.re \cdot x.re - x.im \cdot x.im\right) + \color{blue}{\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)}\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(\left(x.re \cdot x.re + \left(\mathsf{neg}\left(x.im \cdot x.im\right)\right)\right) + \color{blue}{\left(x.im + x.im\right)} \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)\right) \]
      12. associate-+l+N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(x.re \cdot x.re + \color{blue}{\left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)}\right)\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\left(x.re \cdot x.re\right), \color{blue}{\left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)}\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\color{blue}{\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right)} + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)\right)\right) \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(\mathsf{neg}\left(\left(x.im + x.im\right) \cdot x.im\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - \color{blue}{\left(x.im + x.im\right) \cdot x.im}\right)\right)\right) \]
      17. count-2N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - \left(2 \cdot x.im\right) \cdot x.im\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - 2 \cdot \color{blue}{\left(x.im \cdot x.im\right)}\right)\right)\right) \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{x.re \cdot \left(x.re \cdot x.re + \left(x.im \cdot x.im\right) \cdot -3\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(x.im \cdot \color{blue}{\left(x.im \cdot -3\right)}\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(x.im \cdot -3\right) \cdot \color{blue}{x.im}\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \mathsf{*.f64}\left(\left(x.im \cdot -3\right), \color{blue}{x.im}\right)\right)\right) \]
      4. *-lowering-*.f6499.9%

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x.im, -3\right), x.im\right)\right)\right) \]
    6. Applied egg-rr99.9%

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

    if 9.9999999999999998e100 < x.re

    1. Initial program 54.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. Add Preprocessing
    3. Step-by-step derivation
      1. difference-of-squaresN/A

        \[\leadsto \mathsf{\_.f64}\left(\left(\left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right) \cdot x.re\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(x.re, x.im\right)}, \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      2. associate-*l*N/A

        \[\leadsto \mathsf{\_.f64}\left(\left(\left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.re\right)\right), \mathsf{*.f64}\left(\color{blue}{\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right)}, x.im\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\left(x.re + x.im\right), \left(\left(x.re - x.im\right) \cdot x.re\right)\right), \mathsf{*.f64}\left(\color{blue}{\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right)}, x.im\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(\left(x.re - x.im\right) \cdot x.re\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(x.re, x.im\right)}, \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(\left(x.re - x.im\right), x.re\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \color{blue}{\mathsf{*.f64}\left(x.im, x.re\right)}\right), x.im\right)\right) \]
      6. --lowering--.f6468.2%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(x.re, x.im\right), x.re\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(\color{blue}{x.im}, x.re\right)\right), x.im\right)\right) \]
    4. Applied egg-rr68.2%

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

      \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \color{blue}{\left(x.im \cdot \left(-1 \cdot x.re + \frac{{x.re}^{2}}{x.im}\right)\right)}\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(x.im \cdot \left(\left(\mathsf{neg}\left(x.re\right)\right) + \frac{{x.re}^{2}}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(x.im \cdot \left(\left(0 - x.re\right) + \frac{{x.re}^{2}}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      3. associate-+l-N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(x.im \cdot \left(0 - \left(x.re - \frac{{x.re}^{2}}{x.im}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right), x.im\right)\right) \]
      4. unsub-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(x.im \cdot \left(0 - \left(x.re + \left(\mathsf{neg}\left(\frac{{x.re}^{2}}{x.im}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      5. mul-1-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(x.im \cdot \left(0 - \left(x.re + -1 \cdot \frac{{x.re}^{2}}{x.im}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      6. neg-sub0N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \left(x.im \cdot \left(\mathsf{neg}\left(\left(x.re + -1 \cdot \frac{{x.re}^{2}}{x.im}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right), x.im\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(\mathsf{neg}\left(\left(x.re + -1 \cdot \frac{{x.re}^{2}}{x.im}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \color{blue}{\mathsf{*.f64}\left(x.im, x.re\right)}\right), x.im\right)\right) \]
      8. neg-sub0N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(0 - \left(x.re + -1 \cdot \frac{{x.re}^{2}}{x.im}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right), x.im\right)\right) \]
      9. mul-1-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(0 - \left(x.re + \left(\mathsf{neg}\left(\frac{{x.re}^{2}}{x.im}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      10. unsub-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(0 - \left(x.re - \frac{{x.re}^{2}}{x.im}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      11. associate-+l-N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(\left(0 - x.re\right) + \frac{{x.re}^{2}}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right), x.im\right)\right) \]
      12. neg-sub0N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(\left(\mathsf{neg}\left(x.re\right)\right) + \frac{{x.re}^{2}}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(-1 \cdot x.re + \frac{{x.re}^{2}}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      14. *-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(x.re \cdot -1 + \frac{{x.re}^{2}}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(x.re \cdot -1 + \frac{x.re \cdot x.re}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      16. associate-/l*N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(x.re \cdot -1 + x.re \cdot \frac{x.re}{x.im}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      17. distribute-lft-outN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \left(x.re \cdot \left(-1 + \frac{x.re}{x.im}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right), x.im\right)\right) \]
      18. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \left(-1 + \frac{x.re}{x.im}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right), x.im\right)\right) \]
      19. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \left(\frac{x.re}{x.im}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
      20. /-lowering-/.f6468.2%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, x.re\right)\right), x.im\right)\right) \]
    7. Simplified68.2%

      \[\leadsto \left(x.re + x.im\right) \cdot \color{blue}{\left(x.im \cdot \left(x.re \cdot \left(-1 + \frac{x.re}{x.im}\right)\right)\right)} - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    8. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\left(x.im \cdot x.re + x.im \cdot x.re\right), x.im\right)\right) \]
      2. distribute-rgt-outN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\left(x.re \cdot \left(x.im + x.im\right)\right), x.im\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x.re, \left(x.im + x.im\right)\right), x.im\right)\right) \]
      4. +-lowering-+.f6468.2%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(x.im, x.im\right)\right), x.im\right)\right) \]
    9. Applied egg-rr68.2%

      \[\leadsto \left(x.re + x.im\right) \cdot \left(x.im \cdot \left(x.re \cdot \left(-1 + \frac{x.re}{x.im}\right)\right)\right) - \color{blue}{\left(x.re \cdot \left(x.im + x.im\right)\right)} \cdot x.im \]
    10. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \left(x.im \cdot \color{blue}{\left(x.re \cdot \left(x.im + x.im\right)\right)}\right)\right) \]
      2. distribute-lft-inN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \left(x.im \cdot \left(x.re \cdot x.im + \color{blue}{x.re \cdot x.im}\right)\right)\right) \]
      3. flip-+N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \left(x.im \cdot \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)}{\color{blue}{x.re \cdot x.im - x.re \cdot x.im}}\right)\right) \]
      4. +-inversesN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \left(x.im \cdot \frac{0}{\color{blue}{x.re \cdot x.im} - x.re \cdot x.im}\right)\right) \]
      5. +-inversesN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \left(x.im \cdot \frac{0}{0}\right)\right) \]
      6. associate-*r/N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \left(\frac{x.im \cdot 0}{\color{blue}{0}}\right)\right) \]
      7. +-inversesN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \left(\frac{x.im \cdot \left(x.im - x.im\right)}{0}\right)\right) \]
      8. distribute-lft-out--N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \left(\frac{x.im \cdot x.im - x.im \cdot x.im}{0}\right)\right) \]
      9. +-inversesN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \left(\frac{x.im \cdot x.im - x.im \cdot x.im}{x.im - \color{blue}{x.im}}\right)\right) \]
      10. flip-+N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \left(x.im + \color{blue}{x.im}\right)\right) \]
      11. +-lowering-+.f64100.0%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x.re, x.im\right), \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(x.re, x.im\right)\right)\right)\right)\right), \mathsf{+.f64}\left(x.im, \color{blue}{x.im}\right)\right) \]
    11. Applied egg-rr100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \leq 2 \cdot 10^{-117}:\\ \;\;\;\;-3 \cdot \left(x.im \cdot \left(x.re \cdot x.im\right)\right)\\ \mathbf{elif}\;x.re \leq 10^{+101}:\\ \;\;\;\;x.re \cdot \left(x.re \cdot x.re + x.im \cdot \left(x.im \cdot -3\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.re + x.im\right) \cdot \left(x.im \cdot \left(x.re \cdot \left(-1 + \frac{x.re}{x.im}\right)\right)\right) - \left(x.im + x.im\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 91.8% accurate, 1.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < 1.16e146

    1. Initial program 86.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. sub-negN/A

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

        \[\leadsto \left(\mathsf{neg}\left(\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re} \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \cdot x.re \]
      4. *-commutativeN/A

        \[\leadsto \left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot \color{blue}{x.re} - x.im \cdot x.im\right) \cdot x.re \]
      5. distribute-lft-outN/A

        \[\leadsto \left(x.re \cdot \left(x.im + x.im\right)\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(\color{blue}{x.re \cdot x.re} - x.im \cdot x.im\right) \cdot x.re \]
      6. associate-*l*N/A

        \[\leadsto x.re \cdot \left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \cdot x.re \]
      7. *-commutativeN/A

        \[\leadsto x.re \cdot \left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right) + x.re \cdot \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \]
      8. distribute-lft-outN/A

        \[\leadsto x.re \cdot \color{blue}{\left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot x.re - x.im \cdot x.im\right)\right)} \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \color{blue}{\left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot x.re - x.im \cdot x.im\right)\right)}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(\left(x.re \cdot x.re - x.im \cdot x.im\right) + \color{blue}{\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)}\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(\left(x.re \cdot x.re + \left(\mathsf{neg}\left(x.im \cdot x.im\right)\right)\right) + \color{blue}{\left(x.im + x.im\right)} \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)\right) \]
      12. associate-+l+N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(x.re \cdot x.re + \color{blue}{\left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)}\right)\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\left(x.re \cdot x.re\right), \color{blue}{\left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)}\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\color{blue}{\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right)} + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)\right)\right) \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(\mathsf{neg}\left(\left(x.im + x.im\right) \cdot x.im\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - \color{blue}{\left(x.im + x.im\right) \cdot x.im}\right)\right)\right) \]
      17. count-2N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - \left(2 \cdot x.im\right) \cdot x.im\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - 2 \cdot \color{blue}{\left(x.im \cdot x.im\right)}\right)\right)\right) \]
    3. Simplified93.3%

      \[\leadsto \color{blue}{x.re \cdot \left(x.re \cdot x.re + \left(x.im \cdot x.im\right) \cdot -3\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(x.im \cdot \color{blue}{\left(x.im \cdot -3\right)}\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(x.im \cdot -3\right) \cdot \color{blue}{x.im}\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \mathsf{*.f64}\left(\left(x.im \cdot -3\right), \color{blue}{x.im}\right)\right)\right) \]
      4. *-lowering-*.f6493.3%

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x.im, -3\right), x.im\right)\right)\right) \]
    6. Applied egg-rr93.3%

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

    if 1.16e146 < x.im

    1. Initial program 47.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. sub-negN/A

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

        \[\leadsto \left(\mathsf{neg}\left(\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re} \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \cdot x.re \]
      4. *-commutativeN/A

        \[\leadsto \left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot \color{blue}{x.re} - x.im \cdot x.im\right) \cdot x.re \]
      5. distribute-lft-outN/A

        \[\leadsto \left(x.re \cdot \left(x.im + x.im\right)\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(\color{blue}{x.re \cdot x.re} - x.im \cdot x.im\right) \cdot x.re \]
      6. associate-*l*N/A

        \[\leadsto x.re \cdot \left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \cdot x.re \]
      7. *-commutativeN/A

        \[\leadsto x.re \cdot \left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right) + x.re \cdot \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \]
      8. distribute-lft-outN/A

        \[\leadsto x.re \cdot \color{blue}{\left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot x.re - x.im \cdot x.im\right)\right)} \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \color{blue}{\left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot x.re - x.im \cdot x.im\right)\right)}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(\left(x.re \cdot x.re - x.im \cdot x.im\right) + \color{blue}{\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)}\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(\left(x.re \cdot x.re + \left(\mathsf{neg}\left(x.im \cdot x.im\right)\right)\right) + \color{blue}{\left(x.im + x.im\right)} \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)\right) \]
      12. associate-+l+N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(x.re \cdot x.re + \color{blue}{\left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)}\right)\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\left(x.re \cdot x.re\right), \color{blue}{\left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)}\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\color{blue}{\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right)} + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)\right)\right) \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(\mathsf{neg}\left(\left(x.im + x.im\right) \cdot x.im\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - \color{blue}{\left(x.im + x.im\right) \cdot x.im}\right)\right)\right) \]
      17. count-2N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - \left(2 \cdot x.im\right) \cdot x.im\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - 2 \cdot \color{blue}{\left(x.im \cdot x.im\right)}\right)\right)\right) \]
    3. Simplified47.9%

      \[\leadsto \color{blue}{x.re \cdot \left(x.re \cdot x.re + \left(x.im \cdot x.im\right) \cdot -3\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x.re around 0

      \[\leadsto \color{blue}{-3 \cdot \left({x.im}^{2} \cdot x.re\right)} \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(-3, \color{blue}{\left({x.im}^{2} \cdot x.re\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(-3, \left(\left(x.im \cdot x.im\right) \cdot x.re\right)\right) \]
      3. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(-3, \left(x.im \cdot \color{blue}{\left(x.im \cdot x.re\right)}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(-3, \mathsf{*.f64}\left(x.im, \color{blue}{\left(x.im \cdot x.re\right)}\right)\right) \]
      5. *-lowering-*.f6490.5%

        \[\leadsto \mathsf{*.f64}\left(-3, \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right)\right) \]
    7. Simplified90.5%

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

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

Alternative 5: 70.4% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 1.65 \cdot 10^{+83}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < 1.64999999999999992e83

    1. Initial program 87.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. sub-negN/A

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

        \[\leadsto \left(\mathsf{neg}\left(\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re} \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \cdot x.re \]
      4. *-commutativeN/A

        \[\leadsto \left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot \color{blue}{x.re} - x.im \cdot x.im\right) \cdot x.re \]
      5. distribute-lft-outN/A

        \[\leadsto \left(x.re \cdot \left(x.im + x.im\right)\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(\color{blue}{x.re \cdot x.re} - x.im \cdot x.im\right) \cdot x.re \]
      6. associate-*l*N/A

        \[\leadsto x.re \cdot \left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \cdot x.re \]
      7. *-commutativeN/A

        \[\leadsto x.re \cdot \left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right) + x.re \cdot \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \]
      8. distribute-lft-outN/A

        \[\leadsto x.re \cdot \color{blue}{\left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot x.re - x.im \cdot x.im\right)\right)} \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \color{blue}{\left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot x.re - x.im \cdot x.im\right)\right)}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(\left(x.re \cdot x.re - x.im \cdot x.im\right) + \color{blue}{\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)}\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(\left(x.re \cdot x.re + \left(\mathsf{neg}\left(x.im \cdot x.im\right)\right)\right) + \color{blue}{\left(x.im + x.im\right)} \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)\right) \]
      12. associate-+l+N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(x.re \cdot x.re + \color{blue}{\left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)}\right)\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\left(x.re \cdot x.re\right), \color{blue}{\left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)}\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\color{blue}{\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right)} + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)\right)\right) \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(\mathsf{neg}\left(\left(x.im + x.im\right) \cdot x.im\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - \color{blue}{\left(x.im + x.im\right) \cdot x.im}\right)\right)\right) \]
      17. count-2N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - \left(2 \cdot x.im\right) \cdot x.im\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - 2 \cdot \color{blue}{\left(x.im \cdot x.im\right)}\right)\right)\right) \]
    3. Simplified92.8%

      \[\leadsto \color{blue}{x.re \cdot \left(x.re \cdot x.re + \left(x.im \cdot x.im\right) \cdot -3\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x.re around inf

      \[\leadsto \color{blue}{{x.re}^{3}} \]
    6. Step-by-step derivation
      1. cube-multN/A

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

        \[\leadsto x.re \cdot {x.re}^{\color{blue}{2}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \color{blue}{\left({x.re}^{2}\right)}\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(x.re \cdot \color{blue}{x.re}\right)\right) \]
      5. *-lowering-*.f6464.2%

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{*.f64}\left(x.re, \color{blue}{x.re}\right)\right) \]
    7. Simplified64.2%

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

    if 1.64999999999999992e83 < x.im

    1. Initial program 57.7%

      \[\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. sub-negN/A

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

        \[\leadsto \left(\mathsf{neg}\left(\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re} \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \cdot x.re \]
      4. *-commutativeN/A

        \[\leadsto \left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot \color{blue}{x.re} - x.im \cdot x.im\right) \cdot x.re \]
      5. distribute-lft-outN/A

        \[\leadsto \left(x.re \cdot \left(x.im + x.im\right)\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(\color{blue}{x.re \cdot x.re} - x.im \cdot x.im\right) \cdot x.re \]
      6. associate-*l*N/A

        \[\leadsto x.re \cdot \left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \cdot x.re \]
      7. *-commutativeN/A

        \[\leadsto x.re \cdot \left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right) + x.re \cdot \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \]
      8. distribute-lft-outN/A

        \[\leadsto x.re \cdot \color{blue}{\left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot x.re - x.im \cdot x.im\right)\right)} \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \color{blue}{\left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot x.re - x.im \cdot x.im\right)\right)}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(\left(x.re \cdot x.re - x.im \cdot x.im\right) + \color{blue}{\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)}\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(\left(x.re \cdot x.re + \left(\mathsf{neg}\left(x.im \cdot x.im\right)\right)\right) + \color{blue}{\left(x.im + x.im\right)} \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)\right) \]
      12. associate-+l+N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \left(x.re \cdot x.re + \color{blue}{\left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)}\right)\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\left(x.re \cdot x.re\right), \color{blue}{\left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)}\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\color{blue}{\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right)} + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)\right)\right) \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(\mathsf{neg}\left(\left(x.im + x.im\right) \cdot x.im\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - \color{blue}{\left(x.im + x.im\right) \cdot x.im}\right)\right)\right) \]
      17. count-2N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - \left(2 \cdot x.im\right) \cdot x.im\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - 2 \cdot \color{blue}{\left(x.im \cdot x.im\right)}\right)\right)\right) \]
    3. Simplified65.8%

      \[\leadsto \color{blue}{x.re \cdot \left(x.re \cdot x.re + \left(x.im \cdot x.im\right) \cdot -3\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x.re around 0

      \[\leadsto \color{blue}{-3 \cdot \left({x.im}^{2} \cdot x.re\right)} \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(-3, \color{blue}{\left({x.im}^{2} \cdot x.re\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(-3, \left(\left(x.im \cdot x.im\right) \cdot x.re\right)\right) \]
      3. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(-3, \left(x.im \cdot \color{blue}{\left(x.im \cdot x.re\right)}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(-3, \mathsf{*.f64}\left(x.im, \color{blue}{\left(x.im \cdot x.re\right)}\right)\right) \]
      5. *-lowering-*.f6485.6%

        \[\leadsto \mathsf{*.f64}\left(-3, \mathsf{*.f64}\left(x.im, \mathsf{*.f64}\left(x.im, \color{blue}{x.re}\right)\right)\right) \]
    7. Simplified85.6%

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

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

Alternative 6: 59.0% 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 81.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. sub-negN/A

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

      \[\leadsto \left(\mathsf{neg}\left(\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re} \]
    3. distribute-rgt-neg-inN/A

      \[\leadsto \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \cdot x.re \]
    4. *-commutativeN/A

      \[\leadsto \left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot \color{blue}{x.re} - x.im \cdot x.im\right) \cdot x.re \]
    5. distribute-lft-outN/A

      \[\leadsto \left(x.re \cdot \left(x.im + x.im\right)\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(\color{blue}{x.re \cdot x.re} - x.im \cdot x.im\right) \cdot x.re \]
    6. associate-*l*N/A

      \[\leadsto x.re \cdot \left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right) + \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \cdot x.re \]
    7. *-commutativeN/A

      \[\leadsto x.re \cdot \left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right) + x.re \cdot \color{blue}{\left(x.re \cdot x.re - x.im \cdot x.im\right)} \]
    8. distribute-lft-outN/A

      \[\leadsto x.re \cdot \color{blue}{\left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot x.re - x.im \cdot x.im\right)\right)} \]
    9. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(x.re, \color{blue}{\left(\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right) + \left(x.re \cdot x.re - x.im \cdot x.im\right)\right)}\right) \]
    10. +-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(x.re, \left(\left(x.re \cdot x.re - x.im \cdot x.im\right) + \color{blue}{\left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)}\right)\right) \]
    11. sub-negN/A

      \[\leadsto \mathsf{*.f64}\left(x.re, \left(\left(x.re \cdot x.re + \left(\mathsf{neg}\left(x.im \cdot x.im\right)\right)\right) + \color{blue}{\left(x.im + x.im\right)} \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)\right) \]
    12. associate-+l+N/A

      \[\leadsto \mathsf{*.f64}\left(x.re, \left(x.re \cdot x.re + \color{blue}{\left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)}\right)\right) \]
    13. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\left(x.re \cdot x.re\right), \color{blue}{\left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)}\right)\right) \]
    14. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\color{blue}{\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right)} + \left(x.im + x.im\right) \cdot \left(\mathsf{neg}\left(x.im\right)\right)\right)\right)\right) \]
    15. distribute-rgt-neg-outN/A

      \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) + \left(\mathsf{neg}\left(\left(x.im + x.im\right) \cdot x.im\right)\right)\right)\right)\right) \]
    16. sub-negN/A

      \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - \color{blue}{\left(x.im + x.im\right) \cdot x.im}\right)\right)\right) \]
    17. count-2N/A

      \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - \left(2 \cdot x.im\right) \cdot x.im\right)\right)\right) \]
    18. associate-*l*N/A

      \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x.re, x.re\right), \left(\left(\mathsf{neg}\left(x.im \cdot x.im\right)\right) - 2 \cdot \color{blue}{\left(x.im \cdot x.im\right)}\right)\right)\right) \]
  3. Simplified87.7%

    \[\leadsto \color{blue}{x.re \cdot \left(x.re \cdot x.re + \left(x.im \cdot x.im\right) \cdot -3\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in x.re around inf

    \[\leadsto \color{blue}{{x.re}^{3}} \]
  6. Step-by-step derivation
    1. cube-multN/A

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

      \[\leadsto x.re \cdot {x.re}^{\color{blue}{2}} \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(x.re, \color{blue}{\left({x.re}^{2}\right)}\right) \]
    4. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(x.re, \left(x.re \cdot \color{blue}{x.re}\right)\right) \]
    5. *-lowering-*.f6454.9%

      \[\leadsto \mathsf{*.f64}\left(x.re, \mathsf{*.f64}\left(x.re, \color{blue}{x.re}\right)\right) \]
  7. Simplified54.9%

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

Developer Target 1: 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 2024144 
(FPCore (x.re x.im)
  :name "math.cube on complex, real part"
  :precision binary64

  :alt
  (! :herbie-platform default (+ (* (* x.re x.re) (- x.re x.im)) (* (* x.re x.im) (- x.re (* 3 x.im)))))

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