math.cube on complex, real part

Percentage Accurate: 82.6% → 98.8%
Time: 13.1s
Alternatives: 11
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 11 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: 98.8% accurate, 0.1× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ \begin{array}{l} \mathbf{if}\;x.re \leq -2.3 \cdot 10^{+153}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re + x.im\right)\\ \mathbf{elif}\;x.re \leq 2 \cdot 10^{+101}:\\ \;\;\;\;\mathsf{fma}\left(x.re \cdot x.im, x.im \cdot -3, {x.re}^{3}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re - x.im\right)\\ \end{array} \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
 :precision binary64
 (if (<= x.re -2.3e+153)
   (* (* x.re x.re) (+ x.re x.im))
   (if (<= x.re 2e+101)
     (fma (* x.re x.im) (* x.im -3.0) (pow x.re 3.0))
     (* (* x.re x.re) (- x.re x.im)))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
	double tmp;
	if (x_46_re <= -2.3e+153) {
		tmp = (x_46_re * x_46_re) * (x_46_re + x_46_im);
	} else if (x_46_re <= 2e+101) {
		tmp = fma((x_46_re * x_46_im), (x_46_im * -3.0), pow(x_46_re, 3.0));
	} else {
		tmp = (x_46_re * x_46_re) * (x_46_re - x_46_im);
	}
	return tmp;
}
x.im = abs(x.im)
function code(x_46_re, x_46_im)
	tmp = 0.0
	if (x_46_re <= -2.3e+153)
		tmp = Float64(Float64(x_46_re * x_46_re) * Float64(x_46_re + x_46_im));
	elseif (x_46_re <= 2e+101)
		tmp = fma(Float64(x_46_re * x_46_im), Float64(x_46_im * -3.0), (x_46_re ^ 3.0));
	else
		tmp = Float64(Float64(x_46_re * x_46_re) * Float64(x_46_re - x_46_im));
	end
	return tmp
end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := If[LessEqual[x$46$re, -2.3e+153], N[(N[(x$46$re * x$46$re), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 2e+101], N[(N[(x$46$re * x$46$im), $MachinePrecision] * N[(x$46$im * -3.0), $MachinePrecision] + N[Power[x$46$re, 3.0], $MachinePrecision]), $MachinePrecision], N[(N[(x$46$re * x$46$re), $MachinePrecision] * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -2.3 \cdot 10^{+153}:\\
\;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re + x.im\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.re < -2.3000000000000001e153

    1. Initial program 55.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\left(x.re + \color{blue}{\sqrt{x.im} \cdot \sqrt{x.im}}\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
      8. add-sqr-sqrt7.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{x.im \cdot {x.re}^{2} + {x.re}^{3}} \]
    12. Step-by-step derivation
      1. unpow230.0%

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

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

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

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

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

    if -2.3000000000000001e153 < x.re < 2e101

    1. Initial program 92.0%

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

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

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

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

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

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

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

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

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

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

    if 2e101 < x.re

    1. Initial program 64.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \leq -2.3 \cdot 10^{+153}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re + x.im\right)\\ \mathbf{elif}\;x.re \leq 2 \cdot 10^{+101}:\\ \;\;\;\;\mathsf{fma}\left(x.re \cdot x.im, x.im \cdot -3, {x.re}^{3}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re - x.im\right)\\ \end{array} \]

Alternative 2: 99.2% accurate, 0.2× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ \begin{array}{l} \mathbf{if}\;x.re \leq -1.8 \cdot 10^{+130}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re + x.im\right)\\ \mathbf{elif}\;x.re \leq 2 \cdot 10^{+101}:\\ \;\;\;\;{x.re}^{3} + \left(x.im \cdot -3\right) \cdot \left(x.re \cdot x.im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re - x.im\right)\\ \end{array} \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
 :precision binary64
 (if (<= x.re -1.8e+130)
   (* (* x.re x.re) (+ x.re x.im))
   (if (<= x.re 2e+101)
     (+ (pow x.re 3.0) (* (* x.im -3.0) (* x.re x.im)))
     (* (* x.re x.re) (- x.re x.im)))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
	double tmp;
	if (x_46_re <= -1.8e+130) {
		tmp = (x_46_re * x_46_re) * (x_46_re + x_46_im);
	} else if (x_46_re <= 2e+101) {
		tmp = pow(x_46_re, 3.0) + ((x_46_im * -3.0) * (x_46_re * x_46_im));
	} else {
		tmp = (x_46_re * x_46_re) * (x_46_re - x_46_im);
	}
	return tmp;
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8) :: tmp
    if (x_46re <= (-1.8d+130)) then
        tmp = (x_46re * x_46re) * (x_46re + x_46im)
    else if (x_46re <= 2d+101) then
        tmp = (x_46re ** 3.0d0) + ((x_46im * (-3.0d0)) * (x_46re * x_46im))
    else
        tmp = (x_46re * x_46re) * (x_46re - x_46im)
    end if
    code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
	double tmp;
	if (x_46_re <= -1.8e+130) {
		tmp = (x_46_re * x_46_re) * (x_46_re + x_46_im);
	} else if (x_46_re <= 2e+101) {
		tmp = Math.pow(x_46_re, 3.0) + ((x_46_im * -3.0) * (x_46_re * x_46_im));
	} else {
		tmp = (x_46_re * x_46_re) * (x_46_re - x_46_im);
	}
	return tmp;
}
x.im = abs(x.im)
def code(x_46_re, x_46_im):
	tmp = 0
	if x_46_re <= -1.8e+130:
		tmp = (x_46_re * x_46_re) * (x_46_re + x_46_im)
	elif x_46_re <= 2e+101:
		tmp = math.pow(x_46_re, 3.0) + ((x_46_im * -3.0) * (x_46_re * x_46_im))
	else:
		tmp = (x_46_re * x_46_re) * (x_46_re - x_46_im)
	return tmp
x.im = abs(x.im)
function code(x_46_re, x_46_im)
	tmp = 0.0
	if (x_46_re <= -1.8e+130)
		tmp = Float64(Float64(x_46_re * x_46_re) * Float64(x_46_re + x_46_im));
	elseif (x_46_re <= 2e+101)
		tmp = Float64((x_46_re ^ 3.0) + Float64(Float64(x_46_im * -3.0) * Float64(x_46_re * x_46_im)));
	else
		tmp = Float64(Float64(x_46_re * x_46_re) * Float64(x_46_re - x_46_im));
	end
	return tmp
end
x.im = abs(x.im)
function tmp_2 = code(x_46_re, x_46_im)
	tmp = 0.0;
	if (x_46_re <= -1.8e+130)
		tmp = (x_46_re * x_46_re) * (x_46_re + x_46_im);
	elseif (x_46_re <= 2e+101)
		tmp = (x_46_re ^ 3.0) + ((x_46_im * -3.0) * (x_46_re * x_46_im));
	else
		tmp = (x_46_re * x_46_re) * (x_46_re - x_46_im);
	end
	tmp_2 = tmp;
end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := If[LessEqual[x$46$re, -1.8e+130], N[(N[(x$46$re * x$46$re), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 2e+101], N[(N[Power[x$46$re, 3.0], $MachinePrecision] + N[(N[(x$46$im * -3.0), $MachinePrecision] * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$re * x$46$re), $MachinePrecision] * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -1.8 \cdot 10^{+130}:\\
\;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re + x.im\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.re < -1.8000000000000001e130

    1. Initial program 54.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. sqr-neg54.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\left(x.re + \color{blue}{\sqrt{x.im} \cdot \sqrt{x.im}}\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
      8. add-sqr-sqrt7.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{x.im \cdot {x.re}^{2} + {x.re}^{3}} \]
    12. Step-by-step derivation
      1. unpow231.0%

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

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

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

        \[\leadsto \left(x.re \cdot x.re\right) \cdot \color{blue}{\left(x.re + x.im\right)} \]
    13. Simplified92.9%

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

    if -1.8000000000000001e130 < x.re < 2e101

    1. Initial program 92.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. Simplified92.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e101 < x.re

    1. Initial program 64.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.4% accurate, 0.9× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ \begin{array}{l} \mathbf{if}\;x.re \leq -1 \cdot 10^{+140}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re + x.im\right)\\ \mathbf{elif}\;x.re \leq 5.1 \cdot 10^{+73}:\\ \;\;\;\;\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 \left(x.im + x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re - x.im\right)\\ \end{array} \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
 :precision binary64
 (if (<= x.re -1e+140)
   (* (* x.re x.re) (+ x.re x.im))
   (if (<= x.re 5.1e+73)
     (-
      (* (- x.re x.im) (* x.re (+ x.re x.im)))
      (* x.im (* x.re (+ x.im x.im))))
     (* (* x.re x.re) (- x.re x.im)))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
	double tmp;
	if (x_46_re <= -1e+140) {
		tmp = (x_46_re * x_46_re) * (x_46_re + x_46_im);
	} else if (x_46_re <= 5.1e+73) {
		tmp = ((x_46_re - x_46_im) * (x_46_re * (x_46_re + x_46_im))) - (x_46_im * (x_46_re * (x_46_im + x_46_im)));
	} else {
		tmp = (x_46_re * x_46_re) * (x_46_re - x_46_im);
	}
	return tmp;
}
NOTE: x.im should be positive before calling this function
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 <= (-1d+140)) then
        tmp = (x_46re * x_46re) * (x_46re + x_46im)
    else if (x_46re <= 5.1d+73) then
        tmp = ((x_46re - x_46im) * (x_46re * (x_46re + x_46im))) - (x_46im * (x_46re * (x_46im + x_46im)))
    else
        tmp = (x_46re * x_46re) * (x_46re - x_46im)
    end if
    code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
	double tmp;
	if (x_46_re <= -1e+140) {
		tmp = (x_46_re * x_46_re) * (x_46_re + x_46_im);
	} else if (x_46_re <= 5.1e+73) {
		tmp = ((x_46_re - x_46_im) * (x_46_re * (x_46_re + x_46_im))) - (x_46_im * (x_46_re * (x_46_im + x_46_im)));
	} else {
		tmp = (x_46_re * x_46_re) * (x_46_re - x_46_im);
	}
	return tmp;
}
x.im = abs(x.im)
def code(x_46_re, x_46_im):
	tmp = 0
	if x_46_re <= -1e+140:
		tmp = (x_46_re * x_46_re) * (x_46_re + x_46_im)
	elif x_46_re <= 5.1e+73:
		tmp = ((x_46_re - x_46_im) * (x_46_re * (x_46_re + x_46_im))) - (x_46_im * (x_46_re * (x_46_im + x_46_im)))
	else:
		tmp = (x_46_re * x_46_re) * (x_46_re - x_46_im)
	return tmp
x.im = abs(x.im)
function code(x_46_re, x_46_im)
	tmp = 0.0
	if (x_46_re <= -1e+140)
		tmp = Float64(Float64(x_46_re * x_46_re) * Float64(x_46_re + x_46_im));
	elseif (x_46_re <= 5.1e+73)
		tmp = Float64(Float64(Float64(x_46_re - x_46_im) * Float64(x_46_re * Float64(x_46_re + x_46_im))) - Float64(x_46_im * Float64(x_46_re * Float64(x_46_im + x_46_im))));
	else
		tmp = Float64(Float64(x_46_re * x_46_re) * Float64(x_46_re - x_46_im));
	end
	return tmp
end
x.im = abs(x.im)
function tmp_2 = code(x_46_re, x_46_im)
	tmp = 0.0;
	if (x_46_re <= -1e+140)
		tmp = (x_46_re * x_46_re) * (x_46_re + x_46_im);
	elseif (x_46_re <= 5.1e+73)
		tmp = ((x_46_re - x_46_im) * (x_46_re * (x_46_re + x_46_im))) - (x_46_im * (x_46_re * (x_46_im + x_46_im)));
	else
		tmp = (x_46_re * x_46_re) * (x_46_re - x_46_im);
	end
	tmp_2 = tmp;
end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := If[LessEqual[x$46$re, -1e+140], N[(N[(x$46$re * x$46$re), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 5.1e+73], N[(N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$re * N[(x$46$re + 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[(x$46$re * x$46$re), $MachinePrecision] * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -1 \cdot 10^{+140}:\\
\;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re + x.im\right)\\

\mathbf{elif}\;x.re \leq 5.1 \cdot 10^{+73}:\\
\;\;\;\;\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 \left(x.im + x.im\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.re < -1.00000000000000006e140

    1. Initial program 54.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. sqr-neg54.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\left(x.re + \color{blue}{\sqrt{x.im} \cdot \sqrt{x.im}}\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
      8. add-sqr-sqrt7.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{x.im \cdot {x.re}^{2} + {x.re}^{3}} \]
    12. Step-by-step derivation
      1. unpow231.0%

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

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

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

        \[\leadsto \left(x.re \cdot x.re\right) \cdot \color{blue}{\left(x.re + x.im\right)} \]
    13. Simplified92.9%

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

    if -1.00000000000000006e140 < x.re < 5.10000000000000024e73

    1. Initial program 92.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. sqr-neg92.1%

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

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

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

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

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

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

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

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

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

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

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

    if 5.10000000000000024e73 < x.re

    1. Initial program 70.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. sqr-neg70.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \leq -1 \cdot 10^{+140}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re + x.im\right)\\ \mathbf{elif}\;x.re \leq 5.1 \cdot 10^{+73}:\\ \;\;\;\;\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 \left(x.im + x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re - x.im\right)\\ \end{array} \]

Alternative 4: 90.4% accurate, 1.0× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ \begin{array}{l} t_0 := \left(x.re \cdot x.re\right) \cdot \left(x.re + x.im\right)\\ \mathbf{if}\;x.re \leq -1 \cdot 10^{+140}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.re \leq -1.16 \cdot 10^{-63}:\\ \;\;\;\;t_0 - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right)\\ \mathbf{elif}\;x.re \leq 3.9 \cdot 10^{-53}:\\ \;\;\;\;-3 \cdot \left(x.im \cdot \left(x.re \cdot x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re - x.im\right)\\ \end{array} \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
 :precision binary64
 (let* ((t_0 (* (* x.re x.re) (+ x.re x.im))))
   (if (<= x.re -1e+140)
     t_0
     (if (<= x.re -1.16e-63)
       (- t_0 (* x.im (* x.re (+ x.im x.im))))
       (if (<= x.re 3.9e-53)
         (* -3.0 (* x.im (* x.re x.im)))
         (* (* x.re x.re) (- x.re x.im)))))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
	double t_0 = (x_46_re * x_46_re) * (x_46_re + x_46_im);
	double tmp;
	if (x_46_re <= -1e+140) {
		tmp = t_0;
	} else if (x_46_re <= -1.16e-63) {
		tmp = t_0 - (x_46_im * (x_46_re * (x_46_im + x_46_im)));
	} else if (x_46_re <= 3.9e-53) {
		tmp = -3.0 * (x_46_im * (x_46_re * x_46_im));
	} else {
		tmp = (x_46_re * x_46_re) * (x_46_re - x_46_im);
	}
	return tmp;
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (x_46re * x_46re) * (x_46re + x_46im)
    if (x_46re <= (-1d+140)) then
        tmp = t_0
    else if (x_46re <= (-1.16d-63)) then
        tmp = t_0 - (x_46im * (x_46re * (x_46im + x_46im)))
    else if (x_46re <= 3.9d-53) then
        tmp = (-3.0d0) * (x_46im * (x_46re * x_46im))
    else
        tmp = (x_46re * x_46re) * (x_46re - x_46im)
    end if
    code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
	double t_0 = (x_46_re * x_46_re) * (x_46_re + x_46_im);
	double tmp;
	if (x_46_re <= -1e+140) {
		tmp = t_0;
	} else if (x_46_re <= -1.16e-63) {
		tmp = t_0 - (x_46_im * (x_46_re * (x_46_im + x_46_im)));
	} else if (x_46_re <= 3.9e-53) {
		tmp = -3.0 * (x_46_im * (x_46_re * x_46_im));
	} else {
		tmp = (x_46_re * x_46_re) * (x_46_re - x_46_im);
	}
	return tmp;
}
x.im = abs(x.im)
def code(x_46_re, x_46_im):
	t_0 = (x_46_re * x_46_re) * (x_46_re + x_46_im)
	tmp = 0
	if x_46_re <= -1e+140:
		tmp = t_0
	elif x_46_re <= -1.16e-63:
		tmp = t_0 - (x_46_im * (x_46_re * (x_46_im + x_46_im)))
	elif x_46_re <= 3.9e-53:
		tmp = -3.0 * (x_46_im * (x_46_re * x_46_im))
	else:
		tmp = (x_46_re * x_46_re) * (x_46_re - x_46_im)
	return tmp
x.im = abs(x.im)
function code(x_46_re, x_46_im)
	t_0 = Float64(Float64(x_46_re * x_46_re) * Float64(x_46_re + x_46_im))
	tmp = 0.0
	if (x_46_re <= -1e+140)
		tmp = t_0;
	elseif (x_46_re <= -1.16e-63)
		tmp = Float64(t_0 - Float64(x_46_im * Float64(x_46_re * Float64(x_46_im + x_46_im))));
	elseif (x_46_re <= 3.9e-53)
		tmp = Float64(-3.0 * Float64(x_46_im * Float64(x_46_re * x_46_im)));
	else
		tmp = Float64(Float64(x_46_re * x_46_re) * Float64(x_46_re - x_46_im));
	end
	return tmp
end
x.im = abs(x.im)
function tmp_2 = code(x_46_re, x_46_im)
	t_0 = (x_46_re * x_46_re) * (x_46_re + x_46_im);
	tmp = 0.0;
	if (x_46_re <= -1e+140)
		tmp = t_0;
	elseif (x_46_re <= -1.16e-63)
		tmp = t_0 - (x_46_im * (x_46_re * (x_46_im + x_46_im)));
	elseif (x_46_re <= 3.9e-53)
		tmp = -3.0 * (x_46_im * (x_46_re * x_46_im));
	else
		tmp = (x_46_re * x_46_re) * (x_46_re - x_46_im);
	end
	tmp_2 = tmp;
end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(N[(x$46$re * x$46$re), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, -1e+140], t$95$0, If[LessEqual[x$46$re, -1.16e-63], N[(t$95$0 - N[(x$46$im * N[(x$46$re * N[(x$46$im + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 3.9e-53], N[(-3.0 * N[(x$46$im * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$re * x$46$re), $MachinePrecision] * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
t_0 := \left(x.re \cdot x.re\right) \cdot \left(x.re + x.im\right)\\
\mathbf{if}\;x.re \leq -1 \cdot 10^{+140}:\\
\;\;\;\;t_0\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x.re < -1.00000000000000006e140

    1. Initial program 54.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. sqr-neg54.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\left(x.re + \color{blue}{\sqrt{x.im} \cdot \sqrt{x.im}}\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
      8. add-sqr-sqrt7.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{x.im \cdot {x.re}^{2} + {x.re}^{3}} \]
    12. Step-by-step derivation
      1. unpow231.0%

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

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

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

        \[\leadsto \left(x.re \cdot x.re\right) \cdot \color{blue}{\left(x.re + x.im\right)} \]
    13. Simplified92.9%

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

    if -1.00000000000000006e140 < x.re < -1.16e-63

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\left(x.re + \sqrt{\color{blue}{x.im \cdot x.im}}\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
      7. sqrt-unprod8.9%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\left(x.re + \color{blue}{\sqrt{x.im} \cdot \sqrt{x.im}}\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
      8. add-sqr-sqrt10.3%

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

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

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

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

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

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

    if -1.16e-63 < x.re < 3.9000000000000002e-53

    1. Initial program 88.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.im \cdot x.im\right) \cdot \left(x.re \cdot \color{blue}{\left(-1 - 2\right)}\right) \]
      8. distribute-rgt-out--84.0%

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

        \[\leadsto \color{blue}{x.im \cdot \left(x.im \cdot \left(-1 \cdot x.re - 2 \cdot x.re\right)\right)} \]
      10. distribute-rgt-out--95.1%

        \[\leadsto x.im \cdot \left(x.im \cdot \color{blue}{\left(x.re \cdot \left(-1 - 2\right)\right)}\right) \]
      11. metadata-eval95.1%

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

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

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

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

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

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

    if 3.9000000000000002e-53 < x.re

    1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \leq -1 \cdot 10^{+140}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re + x.im\right)\\ \mathbf{elif}\;x.re \leq -1.16 \cdot 10^{-63}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re + x.im\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right)\\ \mathbf{elif}\;x.re \leq 3.9 \cdot 10^{-53}:\\ \;\;\;\;-3 \cdot \left(x.im \cdot \left(x.re \cdot x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re - x.im\right)\\ \end{array} \]

Alternative 5: 84.2% accurate, 1.2× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ \begin{array}{l} \mathbf{if}\;x.re \leq -23000 \lor \neg \left(x.re \leq -6.8 \cdot 10^{-25}\right) \land \left(x.re \leq -2.15 \cdot 10^{-60} \lor \neg \left(x.re \leq 3.1 \cdot 10^{-52}\right)\right):\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re + x.im\right)\\ \mathbf{else}:\\ \;\;\;\;-3 \cdot \left(x.im \cdot \left(x.re \cdot x.im\right)\right)\\ \end{array} \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
 :precision binary64
 (if (or (<= x.re -23000.0)
         (and (not (<= x.re -6.8e-25))
              (or (<= x.re -2.15e-60) (not (<= x.re 3.1e-52)))))
   (* (* x.re x.re) (+ x.re x.im))
   (* -3.0 (* x.im (* x.re x.im)))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
	double tmp;
	if ((x_46_re <= -23000.0) || (!(x_46_re <= -6.8e-25) && ((x_46_re <= -2.15e-60) || !(x_46_re <= 3.1e-52)))) {
		tmp = (x_46_re * x_46_re) * (x_46_re + x_46_im);
	} else {
		tmp = -3.0 * (x_46_im * (x_46_re * x_46_im));
	}
	return tmp;
}
NOTE: x.im should be positive before calling this function
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 <= (-23000.0d0)) .or. (.not. (x_46re <= (-6.8d-25))) .and. (x_46re <= (-2.15d-60)) .or. (.not. (x_46re <= 3.1d-52))) then
        tmp = (x_46re * x_46re) * (x_46re + x_46im)
    else
        tmp = (-3.0d0) * (x_46im * (x_46re * x_46im))
    end if
    code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
	double tmp;
	if ((x_46_re <= -23000.0) || (!(x_46_re <= -6.8e-25) && ((x_46_re <= -2.15e-60) || !(x_46_re <= 3.1e-52)))) {
		tmp = (x_46_re * x_46_re) * (x_46_re + x_46_im);
	} else {
		tmp = -3.0 * (x_46_im * (x_46_re * x_46_im));
	}
	return tmp;
}
x.im = abs(x.im)
def code(x_46_re, x_46_im):
	tmp = 0
	if (x_46_re <= -23000.0) or (not (x_46_re <= -6.8e-25) and ((x_46_re <= -2.15e-60) or not (x_46_re <= 3.1e-52))):
		tmp = (x_46_re * x_46_re) * (x_46_re + x_46_im)
	else:
		tmp = -3.0 * (x_46_im * (x_46_re * x_46_im))
	return tmp
x.im = abs(x.im)
function code(x_46_re, x_46_im)
	tmp = 0.0
	if ((x_46_re <= -23000.0) || (!(x_46_re <= -6.8e-25) && ((x_46_re <= -2.15e-60) || !(x_46_re <= 3.1e-52))))
		tmp = Float64(Float64(x_46_re * x_46_re) * Float64(x_46_re + x_46_im));
	else
		tmp = Float64(-3.0 * Float64(x_46_im * Float64(x_46_re * x_46_im)));
	end
	return tmp
end
x.im = abs(x.im)
function tmp_2 = code(x_46_re, x_46_im)
	tmp = 0.0;
	if ((x_46_re <= -23000.0) || (~((x_46_re <= -6.8e-25)) && ((x_46_re <= -2.15e-60) || ~((x_46_re <= 3.1e-52)))))
		tmp = (x_46_re * x_46_re) * (x_46_re + x_46_im);
	else
		tmp = -3.0 * (x_46_im * (x_46_re * x_46_im));
	end
	tmp_2 = tmp;
end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$re, -23000.0], And[N[Not[LessEqual[x$46$re, -6.8e-25]], $MachinePrecision], Or[LessEqual[x$46$re, -2.15e-60], N[Not[LessEqual[x$46$re, 3.1e-52]], $MachinePrecision]]]], N[(N[(x$46$re * x$46$re), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision], N[(-3.0 * N[(x$46$im * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -23000 \lor \neg \left(x.re \leq -6.8 \cdot 10^{-25}\right) \land \left(x.re \leq -2.15 \cdot 10^{-60} \lor \neg \left(x.re \leq 3.1 \cdot 10^{-52}\right)\right):\\
\;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re + x.im\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.re < -23000 or -6.80000000000000003e-25 < x.re < -2.15e-60 or 3.0999999999999999e-52 < x.re

    1. Initial program 75.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\left(x.re + \color{blue}{\sqrt{x.im} \cdot \sqrt{x.im}}\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
      8. add-sqr-sqrt32.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{x.im \cdot {x.re}^{2} + {x.re}^{3}} \]
    12. Step-by-step derivation
      1. unpow256.2%

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

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

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

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

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

    if -23000 < x.re < -6.80000000000000003e-25 or -2.15e-60 < x.re < 3.0999999999999999e-52

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.im \cdot x.im\right) \cdot \left(x.re \cdot \color{blue}{\left(-1 - 2\right)}\right) \]
      8. distribute-rgt-out--84.7%

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

        \[\leadsto \color{blue}{x.im \cdot \left(x.im \cdot \left(-1 \cdot x.re - 2 \cdot x.re\right)\right)} \]
      10. distribute-rgt-out--95.4%

        \[\leadsto x.im \cdot \left(x.im \cdot \color{blue}{\left(x.re \cdot \left(-1 - 2\right)\right)}\right) \]
      11. metadata-eval95.4%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \leq -23000 \lor \neg \left(x.re \leq -6.8 \cdot 10^{-25}\right) \land \left(x.re \leq -2.15 \cdot 10^{-60} \lor \neg \left(x.re \leq 3.1 \cdot 10^{-52}\right)\right):\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re + x.im\right)\\ \mathbf{else}:\\ \;\;\;\;-3 \cdot \left(x.im \cdot \left(x.re \cdot x.im\right)\right)\\ \end{array} \]

Alternative 6: 88.3% accurate, 1.2× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ \begin{array}{l} t_0 := \left(x.re \cdot x.re\right) \cdot \left(x.re + x.im\right)\\ t_1 := -3 \cdot \left(x.im \cdot \left(x.re \cdot x.im\right)\right)\\ \mathbf{if}\;x.re \leq -26500:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.re \leq -4 \cdot 10^{-25}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x.re \leq -7.5 \cdot 10^{-64}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.re \leq 5.5 \cdot 10^{-52}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re - x.im\right)\\ \end{array} \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
 :precision binary64
 (let* ((t_0 (* (* x.re x.re) (+ x.re x.im)))
        (t_1 (* -3.0 (* x.im (* x.re x.im)))))
   (if (<= x.re -26500.0)
     t_0
     (if (<= x.re -4e-25)
       t_1
       (if (<= x.re -7.5e-64)
         t_0
         (if (<= x.re 5.5e-52) t_1 (* (* x.re x.re) (- x.re x.im))))))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
	double t_0 = (x_46_re * x_46_re) * (x_46_re + x_46_im);
	double t_1 = -3.0 * (x_46_im * (x_46_re * x_46_im));
	double tmp;
	if (x_46_re <= -26500.0) {
		tmp = t_0;
	} else if (x_46_re <= -4e-25) {
		tmp = t_1;
	} else if (x_46_re <= -7.5e-64) {
		tmp = t_0;
	} else if (x_46_re <= 5.5e-52) {
		tmp = t_1;
	} else {
		tmp = (x_46_re * x_46_re) * (x_46_re - x_46_im);
	}
	return tmp;
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (x_46re * x_46re) * (x_46re + x_46im)
    t_1 = (-3.0d0) * (x_46im * (x_46re * x_46im))
    if (x_46re <= (-26500.0d0)) then
        tmp = t_0
    else if (x_46re <= (-4d-25)) then
        tmp = t_1
    else if (x_46re <= (-7.5d-64)) then
        tmp = t_0
    else if (x_46re <= 5.5d-52) then
        tmp = t_1
    else
        tmp = (x_46re * x_46re) * (x_46re - x_46im)
    end if
    code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
	double t_0 = (x_46_re * x_46_re) * (x_46_re + x_46_im);
	double t_1 = -3.0 * (x_46_im * (x_46_re * x_46_im));
	double tmp;
	if (x_46_re <= -26500.0) {
		tmp = t_0;
	} else if (x_46_re <= -4e-25) {
		tmp = t_1;
	} else if (x_46_re <= -7.5e-64) {
		tmp = t_0;
	} else if (x_46_re <= 5.5e-52) {
		tmp = t_1;
	} else {
		tmp = (x_46_re * x_46_re) * (x_46_re - x_46_im);
	}
	return tmp;
}
x.im = abs(x.im)
def code(x_46_re, x_46_im):
	t_0 = (x_46_re * x_46_re) * (x_46_re + x_46_im)
	t_1 = -3.0 * (x_46_im * (x_46_re * x_46_im))
	tmp = 0
	if x_46_re <= -26500.0:
		tmp = t_0
	elif x_46_re <= -4e-25:
		tmp = t_1
	elif x_46_re <= -7.5e-64:
		tmp = t_0
	elif x_46_re <= 5.5e-52:
		tmp = t_1
	else:
		tmp = (x_46_re * x_46_re) * (x_46_re - x_46_im)
	return tmp
x.im = abs(x.im)
function code(x_46_re, x_46_im)
	t_0 = Float64(Float64(x_46_re * x_46_re) * Float64(x_46_re + x_46_im))
	t_1 = Float64(-3.0 * Float64(x_46_im * Float64(x_46_re * x_46_im)))
	tmp = 0.0
	if (x_46_re <= -26500.0)
		tmp = t_0;
	elseif (x_46_re <= -4e-25)
		tmp = t_1;
	elseif (x_46_re <= -7.5e-64)
		tmp = t_0;
	elseif (x_46_re <= 5.5e-52)
		tmp = t_1;
	else
		tmp = Float64(Float64(x_46_re * x_46_re) * Float64(x_46_re - x_46_im));
	end
	return tmp
end
x.im = abs(x.im)
function tmp_2 = code(x_46_re, x_46_im)
	t_0 = (x_46_re * x_46_re) * (x_46_re + x_46_im);
	t_1 = -3.0 * (x_46_im * (x_46_re * x_46_im));
	tmp = 0.0;
	if (x_46_re <= -26500.0)
		tmp = t_0;
	elseif (x_46_re <= -4e-25)
		tmp = t_1;
	elseif (x_46_re <= -7.5e-64)
		tmp = t_0;
	elseif (x_46_re <= 5.5e-52)
		tmp = t_1;
	else
		tmp = (x_46_re * x_46_re) * (x_46_re - x_46_im);
	end
	tmp_2 = tmp;
end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(N[(x$46$re * x$46$re), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-3.0 * N[(x$46$im * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, -26500.0], t$95$0, If[LessEqual[x$46$re, -4e-25], t$95$1, If[LessEqual[x$46$re, -7.5e-64], t$95$0, If[LessEqual[x$46$re, 5.5e-52], t$95$1, N[(N[(x$46$re * x$46$re), $MachinePrecision] * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
t_0 := \left(x.re \cdot x.re\right) \cdot \left(x.re + x.im\right)\\
t_1 := -3 \cdot \left(x.im \cdot \left(x.re \cdot x.im\right)\right)\\
\mathbf{if}\;x.re \leq -26500:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x.re \leq -4 \cdot 10^{-25}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x.re \leq -7.5 \cdot 10^{-64}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x.re \leq 5.5 \cdot 10^{-52}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.re < -26500 or -4.00000000000000015e-25 < x.re < -7.49999999999999949e-64

    1. Initial program 73.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\left(x.re + \color{blue}{\sqrt{x.im} \cdot \sqrt{x.im}}\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
      8. add-sqr-sqrt6.4%

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\left(x.im + x.re\right)} \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
    8. Applied egg-rr6.4%

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

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

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

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

      \[\leadsto \color{blue}{x.im \cdot {x.re}^{2} + {x.re}^{3}} \]
    12. Step-by-step derivation
      1. unpow254.4%

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

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

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

        \[\leadsto \left(x.re \cdot x.re\right) \cdot \color{blue}{\left(x.re + x.im\right)} \]
    13. Simplified90.9%

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

    if -26500 < x.re < -4.00000000000000015e-25 or -7.49999999999999949e-64 < x.re < 5.5e-52

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.im \cdot x.im\right) \cdot \left(x.re \cdot \color{blue}{\left(-1 - 2\right)}\right) \]
      8. distribute-rgt-out--84.7%

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

        \[\leadsto \color{blue}{x.im \cdot \left(x.im \cdot \left(-1 \cdot x.re - 2 \cdot x.re\right)\right)} \]
      10. distribute-rgt-out--95.4%

        \[\leadsto x.im \cdot \left(x.im \cdot \color{blue}{\left(x.re \cdot \left(-1 - 2\right)\right)}\right) \]
      11. metadata-eval95.4%

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

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

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

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

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

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

    if 5.5e-52 < x.re

    1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \leq -26500:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re + x.im\right)\\ \mathbf{elif}\;x.re \leq -4 \cdot 10^{-25}:\\ \;\;\;\;-3 \cdot \left(x.im \cdot \left(x.re \cdot x.im\right)\right)\\ \mathbf{elif}\;x.re \leq -7.5 \cdot 10^{-64}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re + x.im\right)\\ \mathbf{elif}\;x.re \leq 5.5 \cdot 10^{-52}:\\ \;\;\;\;-3 \cdot \left(x.im \cdot \left(x.re \cdot x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot \left(x.re - x.im\right)\\ \end{array} \]

Alternative 7: 67.0% accurate, 1.7× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ \begin{array}{l} \mathbf{if}\;x.re \leq -4.3 \cdot 10^{+186}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot x.im\right)\\ \mathbf{elif}\;x.re \leq 1.22 \cdot 10^{+96}:\\ \;\;\;\;-3 \cdot \left(x.im \cdot \left(x.re \cdot x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot x.im\\ \end{array} \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
 :precision binary64
 (if (<= x.re -4.3e+186)
   (* x.re (* x.im x.im))
   (if (<= x.re 1.22e+96)
     (* -3.0 (* x.im (* x.re x.im)))
     (* (* x.re x.re) x.im))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
	double tmp;
	if (x_46_re <= -4.3e+186) {
		tmp = x_46_re * (x_46_im * x_46_im);
	} else if (x_46_re <= 1.22e+96) {
		tmp = -3.0 * (x_46_im * (x_46_re * x_46_im));
	} else {
		tmp = (x_46_re * x_46_re) * x_46_im;
	}
	return tmp;
}
NOTE: x.im should be positive before calling this function
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 <= (-4.3d+186)) then
        tmp = x_46re * (x_46im * x_46im)
    else if (x_46re <= 1.22d+96) then
        tmp = (-3.0d0) * (x_46im * (x_46re * x_46im))
    else
        tmp = (x_46re * x_46re) * x_46im
    end if
    code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
	double tmp;
	if (x_46_re <= -4.3e+186) {
		tmp = x_46_re * (x_46_im * x_46_im);
	} else if (x_46_re <= 1.22e+96) {
		tmp = -3.0 * (x_46_im * (x_46_re * x_46_im));
	} else {
		tmp = (x_46_re * x_46_re) * x_46_im;
	}
	return tmp;
}
x.im = abs(x.im)
def code(x_46_re, x_46_im):
	tmp = 0
	if x_46_re <= -4.3e+186:
		tmp = x_46_re * (x_46_im * x_46_im)
	elif x_46_re <= 1.22e+96:
		tmp = -3.0 * (x_46_im * (x_46_re * x_46_im))
	else:
		tmp = (x_46_re * x_46_re) * x_46_im
	return tmp
x.im = abs(x.im)
function code(x_46_re, x_46_im)
	tmp = 0.0
	if (x_46_re <= -4.3e+186)
		tmp = Float64(x_46_re * Float64(x_46_im * x_46_im));
	elseif (x_46_re <= 1.22e+96)
		tmp = Float64(-3.0 * Float64(x_46_im * Float64(x_46_re * x_46_im)));
	else
		tmp = Float64(Float64(x_46_re * x_46_re) * x_46_im);
	end
	return tmp
end
x.im = abs(x.im)
function tmp_2 = code(x_46_re, x_46_im)
	tmp = 0.0;
	if (x_46_re <= -4.3e+186)
		tmp = x_46_re * (x_46_im * x_46_im);
	elseif (x_46_re <= 1.22e+96)
		tmp = -3.0 * (x_46_im * (x_46_re * x_46_im));
	else
		tmp = (x_46_re * x_46_re) * x_46_im;
	end
	tmp_2 = tmp;
end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := If[LessEqual[x$46$re, -4.3e+186], N[(x$46$re * N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 1.22e+96], N[(-3.0 * N[(x$46$im * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$re * x$46$re), $MachinePrecision] * x$46$im), $MachinePrecision]]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -4.3 \cdot 10^{+186}:\\
\;\;\;\;x.re \cdot \left(x.im \cdot x.im\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.re < -4.3e186

    1. Initial program 55.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-{x.im}^{2} \cdot x.re} \]
      2. unpow211.6%

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

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

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

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

      \[\leadsto \color{blue}{x.im \cdot \left(x.im \cdot \left(-x.re\right)\right)} \]
    9. Step-by-step derivation
      1. expm1-log1p-u11.5%

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(-x.re\right) \cdot \left(x.im \cdot x.im\right)}\right)} - 1 \]
      6. add-sqr-sqrt11.7%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(\sqrt{-x.re} \cdot \sqrt{-x.re}\right)} \cdot \left(x.im \cdot x.im\right)\right)} - 1 \]
      7. sqrt-unprod11.1%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\sqrt{\left(-x.re\right) \cdot \left(-x.re\right)}} \cdot \left(x.im \cdot x.im\right)\right)} - 1 \]
      8. sqr-neg11.1%

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(\sqrt{x.re} \cdot \sqrt{x.re}\right)} \cdot \left(x.im \cdot x.im\right)\right)} - 1 \]
      10. add-sqr-sqrt0.6%

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(x.im \cdot x.re\right)} \cdot x.im\right)} - 1 \]
      13. associate-*l*0.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{x.re \cdot \left(x.im \cdot x.im\right)} \]
    12. Simplified35.4%

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

    if -4.3e186 < x.re < 1.21999999999999992e96

    1. Initial program 90.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. sqr-neg90.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.im \cdot x.im\right) \cdot \left(x.re \cdot \color{blue}{\left(-1 - 2\right)}\right) \]
      8. distribute-rgt-out--64.9%

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

        \[\leadsto \color{blue}{x.im \cdot \left(x.im \cdot \left(-1 \cdot x.re - 2 \cdot x.re\right)\right)} \]
      10. distribute-rgt-out--71.9%

        \[\leadsto x.im \cdot \left(x.im \cdot \color{blue}{\left(x.re \cdot \left(-1 - 2\right)\right)}\right) \]
      11. metadata-eval71.9%

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

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

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

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

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

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

    if 1.21999999999999992e96 < x.re

    1. Initial program 66.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\left(x.re + \left(-x.im\right)\right)} \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
      4. add-sqr-sqrt35.3%

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

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\left(x.re + \sqrt{\color{blue}{x.im \cdot x.im}}\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
      7. sqrt-unprod30.8%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\left(x.re + \color{blue}{\sqrt{x.im} \cdot \sqrt{x.im}}\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
      8. add-sqr-sqrt66.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{x.im \cdot {x.re}^{2} + {x.re}^{3}} \]
    12. Step-by-step derivation
      1. unpow250.0%

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

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

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

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

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

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

        \[\leadsto x.im \cdot \color{blue}{\left(x.re \cdot x.re\right)} \]
    16. Simplified37.7%

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

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

Alternative 8: 67.0% accurate, 1.7× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ \begin{array}{l} \mathbf{if}\;x.re \leq -1.12 \cdot 10^{+187}:\\ \;\;\;\;x.re \cdot \left(3 \cdot \left(x.im \cdot x.im\right)\right)\\ \mathbf{elif}\;x.re \leq 1.22 \cdot 10^{+96}:\\ \;\;\;\;-3 \cdot \left(x.im \cdot \left(x.re \cdot x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot x.im\\ \end{array} \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
 :precision binary64
 (if (<= x.re -1.12e+187)
   (* x.re (* 3.0 (* x.im x.im)))
   (if (<= x.re 1.22e+96)
     (* -3.0 (* x.im (* x.re x.im)))
     (* (* x.re x.re) x.im))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
	double tmp;
	if (x_46_re <= -1.12e+187) {
		tmp = x_46_re * (3.0 * (x_46_im * x_46_im));
	} else if (x_46_re <= 1.22e+96) {
		tmp = -3.0 * (x_46_im * (x_46_re * x_46_im));
	} else {
		tmp = (x_46_re * x_46_re) * x_46_im;
	}
	return tmp;
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8) :: tmp
    if (x_46re <= (-1.12d+187)) then
        tmp = x_46re * (3.0d0 * (x_46im * x_46im))
    else if (x_46re <= 1.22d+96) then
        tmp = (-3.0d0) * (x_46im * (x_46re * x_46im))
    else
        tmp = (x_46re * x_46re) * x_46im
    end if
    code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
	double tmp;
	if (x_46_re <= -1.12e+187) {
		tmp = x_46_re * (3.0 * (x_46_im * x_46_im));
	} else if (x_46_re <= 1.22e+96) {
		tmp = -3.0 * (x_46_im * (x_46_re * x_46_im));
	} else {
		tmp = (x_46_re * x_46_re) * x_46_im;
	}
	return tmp;
}
x.im = abs(x.im)
def code(x_46_re, x_46_im):
	tmp = 0
	if x_46_re <= -1.12e+187:
		tmp = x_46_re * (3.0 * (x_46_im * x_46_im))
	elif x_46_re <= 1.22e+96:
		tmp = -3.0 * (x_46_im * (x_46_re * x_46_im))
	else:
		tmp = (x_46_re * x_46_re) * x_46_im
	return tmp
x.im = abs(x.im)
function code(x_46_re, x_46_im)
	tmp = 0.0
	if (x_46_re <= -1.12e+187)
		tmp = Float64(x_46_re * Float64(3.0 * Float64(x_46_im * x_46_im)));
	elseif (x_46_re <= 1.22e+96)
		tmp = Float64(-3.0 * Float64(x_46_im * Float64(x_46_re * x_46_im)));
	else
		tmp = Float64(Float64(x_46_re * x_46_re) * x_46_im);
	end
	return tmp
end
x.im = abs(x.im)
function tmp_2 = code(x_46_re, x_46_im)
	tmp = 0.0;
	if (x_46_re <= -1.12e+187)
		tmp = x_46_re * (3.0 * (x_46_im * x_46_im));
	elseif (x_46_re <= 1.22e+96)
		tmp = -3.0 * (x_46_im * (x_46_re * x_46_im));
	else
		tmp = (x_46_re * x_46_re) * x_46_im;
	end
	tmp_2 = tmp;
end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := If[LessEqual[x$46$re, -1.12e+187], N[(x$46$re * N[(3.0 * N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 1.22e+96], N[(-3.0 * N[(x$46$im * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$re * x$46$re), $MachinePrecision] * x$46$im), $MachinePrecision]]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -1.12 \cdot 10^{+187}:\\
\;\;\;\;x.re \cdot \left(3 \cdot \left(x.im \cdot x.im\right)\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.re < -1.12000000000000007e187

    1. Initial program 55.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x.im \cdot \left(\color{blue}{\left(\sqrt{x.im} \cdot \sqrt{x.im}\right)} \cdot x.re\right) + \left(-x.im\right) \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
      7. add-sqr-sqrt0.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.12000000000000007e187 < x.re < 1.21999999999999992e96

    1. Initial program 90.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. sqr-neg90.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x.im \cdot x.im\right) \cdot \left(x.re \cdot \color{blue}{\left(-1 - 2\right)}\right) \]
      8. distribute-rgt-out--64.9%

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

        \[\leadsto \color{blue}{x.im \cdot \left(x.im \cdot \left(-1 \cdot x.re - 2 \cdot x.re\right)\right)} \]
      10. distribute-rgt-out--71.9%

        \[\leadsto x.im \cdot \left(x.im \cdot \color{blue}{\left(x.re \cdot \left(-1 - 2\right)\right)}\right) \]
      11. metadata-eval71.9%

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

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

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

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

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

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

    if 1.21999999999999992e96 < x.re

    1. Initial program 66.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\left(x.re + \left(-x.im\right)\right)} \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
      4. add-sqr-sqrt35.3%

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

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\left(x.re + \sqrt{\color{blue}{x.im \cdot x.im}}\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
      7. sqrt-unprod30.8%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\left(x.re + \color{blue}{\sqrt{x.im} \cdot \sqrt{x.im}}\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
      8. add-sqr-sqrt66.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{x.im \cdot {x.re}^{2} + {x.re}^{3}} \]
    12. Step-by-step derivation
      1. unpow250.0%

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

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

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

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

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

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

        \[\leadsto x.im \cdot \color{blue}{\left(x.re \cdot x.re\right)} \]
    16. Simplified37.7%

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

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

Alternative 9: 43.1% accurate, 1.9× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ \begin{array}{l} \mathbf{if}\;x.im \leq 5.2 \cdot 10^{+45}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot x.im\\ \mathbf{elif}\;x.im \leq 5.5 \cdot 10^{+152}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot x.im\right)\\ \mathbf{else}:\\ \;\;\;\;x.im \cdot \left(x.re \cdot \left(-x.im\right)\right)\\ \end{array} \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
 :precision binary64
 (if (<= x.im 5.2e+45)
   (* (* x.re x.re) x.im)
   (if (<= x.im 5.5e+152) (* x.re (* x.im x.im)) (* x.im (* x.re (- x.im))))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
	double tmp;
	if (x_46_im <= 5.2e+45) {
		tmp = (x_46_re * x_46_re) * x_46_im;
	} else if (x_46_im <= 5.5e+152) {
		tmp = x_46_re * (x_46_im * x_46_im);
	} else {
		tmp = x_46_im * (x_46_re * -x_46_im);
	}
	return tmp;
}
NOTE: x.im should be positive before calling this function
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 <= 5.2d+45) then
        tmp = (x_46re * x_46re) * x_46im
    else if (x_46im <= 5.5d+152) then
        tmp = x_46re * (x_46im * x_46im)
    else
        tmp = x_46im * (x_46re * -x_46im)
    end if
    code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
	double tmp;
	if (x_46_im <= 5.2e+45) {
		tmp = (x_46_re * x_46_re) * x_46_im;
	} else if (x_46_im <= 5.5e+152) {
		tmp = x_46_re * (x_46_im * x_46_im);
	} else {
		tmp = x_46_im * (x_46_re * -x_46_im);
	}
	return tmp;
}
x.im = abs(x.im)
def code(x_46_re, x_46_im):
	tmp = 0
	if x_46_im <= 5.2e+45:
		tmp = (x_46_re * x_46_re) * x_46_im
	elif x_46_im <= 5.5e+152:
		tmp = x_46_re * (x_46_im * x_46_im)
	else:
		tmp = x_46_im * (x_46_re * -x_46_im)
	return tmp
x.im = abs(x.im)
function code(x_46_re, x_46_im)
	tmp = 0.0
	if (x_46_im <= 5.2e+45)
		tmp = Float64(Float64(x_46_re * x_46_re) * x_46_im);
	elseif (x_46_im <= 5.5e+152)
		tmp = Float64(x_46_re * Float64(x_46_im * x_46_im));
	else
		tmp = Float64(x_46_im * Float64(x_46_re * Float64(-x_46_im)));
	end
	return tmp
end
x.im = abs(x.im)
function tmp_2 = code(x_46_re, x_46_im)
	tmp = 0.0;
	if (x_46_im <= 5.2e+45)
		tmp = (x_46_re * x_46_re) * x_46_im;
	elseif (x_46_im <= 5.5e+152)
		tmp = x_46_re * (x_46_im * x_46_im);
	else
		tmp = x_46_im * (x_46_re * -x_46_im);
	end
	tmp_2 = tmp;
end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := If[LessEqual[x$46$im, 5.2e+45], N[(N[(x$46$re * x$46$re), $MachinePrecision] * x$46$im), $MachinePrecision], If[LessEqual[x$46$im, 5.5e+152], N[(x$46$re * N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision], N[(x$46$im * N[(x$46$re * (-x$46$im)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 5.2 \cdot 10^{+45}:\\
\;\;\;\;\left(x.re \cdot x.re\right) \cdot x.im\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.im < 5.20000000000000014e45

    1. Initial program 90.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. sqr-neg90.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\left(x.re + \color{blue}{\sqrt{x.im} \cdot \sqrt{x.im}}\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
      8. add-sqr-sqrt43.6%

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

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

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

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

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

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

      \[\leadsto \color{blue}{x.im \cdot {x.re}^{2} + {x.re}^{3}} \]
    12. Step-by-step derivation
      1. unpow258.9%

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

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

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

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

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

      \[\leadsto \color{blue}{x.im \cdot {x.re}^{2}} \]
    15. Step-by-step derivation
      1. unpow234.2%

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

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

    if 5.20000000000000014e45 < x.im < 5.4999999999999999e152

    1. Initial program 57.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-{x.im}^{2} \cdot x.re} \]
      2. unpow28.9%

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

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

        \[\leadsto \color{blue}{x.im \cdot \left(-x.im \cdot x.re\right)} \]
      5. distribute-rgt-neg-in8.9%

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

      \[\leadsto \color{blue}{x.im \cdot \left(x.im \cdot \left(-x.re\right)\right)} \]
    9. Step-by-step derivation
      1. expm1-log1p-u2.5%

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(-x.re\right) \cdot \left(x.im \cdot x.im\right)}\right)} - 1 \]
      6. add-sqr-sqrt1.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(\sqrt{-x.re} \cdot \sqrt{-x.re}\right)} \cdot \left(x.im \cdot x.im\right)\right)} - 1 \]
      7. sqrt-unprod9.2%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\sqrt{\left(-x.re\right) \cdot \left(-x.re\right)}} \cdot \left(x.im \cdot x.im\right)\right)} - 1 \]
      8. sqr-neg9.2%

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(\sqrt{x.re} \cdot \sqrt{x.re}\right)} \cdot \left(x.im \cdot x.im\right)\right)} - 1 \]
      10. add-sqr-sqrt7.7%

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(x.re \cdot x.im\right) \cdot x.im}\right)} - 1 \]
      12. *-commutative7.7%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(x.im \cdot x.re\right)} \cdot x.im\right)} - 1 \]
      13. associate-*l*7.7%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{x.im \cdot \left(x.re \cdot x.im\right)}\right)} - 1 \]
      14. *-commutative7.7%

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

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

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

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

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

        \[\leadsto \color{blue}{x.re \cdot \left(x.im \cdot x.im\right)} \]
    12. Simplified44.4%

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

    if 5.4999999999999999e152 < x.im

    1. Initial program 41.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. sqr-neg41.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-{x.im}^{2} \cdot x.re} \]
      2. unpow271.5%

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

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

        \[\leadsto \color{blue}{x.im \cdot \left(-x.im \cdot x.re\right)} \]
      5. distribute-rgt-neg-in74.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq 5.2 \cdot 10^{+45}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot x.im\\ \mathbf{elif}\;x.im \leq 5.5 \cdot 10^{+152}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot x.im\right)\\ \mathbf{else}:\\ \;\;\;\;x.im \cdot \left(x.re \cdot \left(-x.im\right)\right)\\ \end{array} \]

Alternative 10: 33.7% accurate, 2.7× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ \begin{array}{l} \mathbf{if}\;x.re \leq -3.8 \cdot 10^{+181}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot x.im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot x.re\right) \cdot x.im\\ \end{array} \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
 :precision binary64
 (if (<= x.re -3.8e+181) (* x.re (* x.im x.im)) (* (* x.re x.re) x.im)))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
	double tmp;
	if (x_46_re <= -3.8e+181) {
		tmp = x_46_re * (x_46_im * x_46_im);
	} else {
		tmp = (x_46_re * x_46_re) * x_46_im;
	}
	return tmp;
}
NOTE: x.im should be positive before calling this function
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 <= (-3.8d+181)) then
        tmp = x_46re * (x_46im * x_46im)
    else
        tmp = (x_46re * x_46re) * x_46im
    end if
    code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
	double tmp;
	if (x_46_re <= -3.8e+181) {
		tmp = x_46_re * (x_46_im * x_46_im);
	} else {
		tmp = (x_46_re * x_46_re) * x_46_im;
	}
	return tmp;
}
x.im = abs(x.im)
def code(x_46_re, x_46_im):
	tmp = 0
	if x_46_re <= -3.8e+181:
		tmp = x_46_re * (x_46_im * x_46_im)
	else:
		tmp = (x_46_re * x_46_re) * x_46_im
	return tmp
x.im = abs(x.im)
function code(x_46_re, x_46_im)
	tmp = 0.0
	if (x_46_re <= -3.8e+181)
		tmp = Float64(x_46_re * Float64(x_46_im * x_46_im));
	else
		tmp = Float64(Float64(x_46_re * x_46_re) * x_46_im);
	end
	return tmp
end
x.im = abs(x.im)
function tmp_2 = code(x_46_re, x_46_im)
	tmp = 0.0;
	if (x_46_re <= -3.8e+181)
		tmp = x_46_re * (x_46_im * x_46_im);
	else
		tmp = (x_46_re * x_46_re) * x_46_im;
	end
	tmp_2 = tmp;
end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := If[LessEqual[x$46$re, -3.8e+181], N[(x$46$re * N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$re * x$46$re), $MachinePrecision] * x$46$im), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -3.8 \cdot 10^{+181}:\\
\;\;\;\;x.re \cdot \left(x.im \cdot x.im\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.re < -3.8000000000000001e181

    1. Initial program 56.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. sqr-neg56.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-{x.im}^{2} \cdot x.re} \]
      2. unpow211.3%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(\sqrt{-x.re} \cdot \sqrt{-x.re}\right)} \cdot \left(x.im \cdot x.im\right)\right)} - 1 \]
      7. sqrt-unprod10.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\sqrt{\left(-x.re\right) \cdot \left(-x.re\right)}} \cdot \left(x.im \cdot x.im\right)\right)} - 1 \]
      8. sqr-neg10.8%

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(\sqrt{x.re} \cdot \sqrt{x.re}\right)} \cdot \left(x.im \cdot x.im\right)\right)} - 1 \]
      10. add-sqr-sqrt0.6%

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(x.im \cdot x.re\right)} \cdot x.im\right)} - 1 \]
      13. associate-*l*0.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{x.re \cdot \left(x.im \cdot x.im\right)} \]
    12. Simplified34.5%

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

    if -3.8000000000000001e181 < x.re

    1. Initial program 85.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\left(x.re + \left(-x.im\right)\right)} \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
      4. add-sqr-sqrt21.2%

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\left(x.re + \color{blue}{\sqrt{\left(-x.im\right) \cdot \left(-x.im\right)}}\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
      6. sqr-neg45.8%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\left(x.re + \sqrt{\color{blue}{x.im \cdot x.im}}\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
      7. sqrt-unprod28.8%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\left(x.re + \color{blue}{\sqrt{x.im} \cdot \sqrt{x.im}}\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
      8. add-sqr-sqrt46.4%

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\left(x.im + x.re\right)} \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
    8. Applied egg-rr46.4%

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

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

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

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

      \[\leadsto \color{blue}{x.im \cdot {x.re}^{2} + {x.re}^{3}} \]
    12. Step-by-step derivation
      1. unpow250.3%

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

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

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

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

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

      \[\leadsto \color{blue}{x.im \cdot {x.re}^{2}} \]
    15. Step-by-step derivation
      1. unpow228.1%

        \[\leadsto x.im \cdot \color{blue}{\left(x.re \cdot x.re\right)} \]
    16. Simplified28.1%

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

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

Alternative 11: 31.2% accurate, 3.8× speedup?

\[\begin{array}{l} x.im = |x.im|\\ \\ \left(x.re \cdot x.re\right) \cdot x.im \end{array} \]
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im) :precision binary64 (* (* x.re x.re) x.im))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
	return (x_46_re * x_46_re) * x_46_im;
}
NOTE: x.im should be positive before calling this function
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
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
	return (x_46_re * x_46_re) * x_46_im;
}
x.im = abs(x.im)
def code(x_46_re, x_46_im):
	return (x_46_re * x_46_re) * x_46_im
x.im = abs(x.im)
function code(x_46_re, x_46_im)
	return Float64(Float64(x_46_re * x_46_re) * x_46_im)
end
x.im = abs(x.im)
function tmp = code(x_46_re, x_46_im)
	tmp = (x_46_re * x_46_re) * x_46_im;
end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := N[(N[(x$46$re * x$46$re), $MachinePrecision] * x$46$im), $MachinePrecision]
\begin{array}{l}
x.im = |x.im|\\
\\
\left(x.re \cdot x.re\right) \cdot x.im
\end{array}
Derivation
  1. Initial program 81.4%

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

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

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

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

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

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

      \[\leadsto \left(x.re - x.im\right) \cdot \left(\left(x.re + \color{blue}{x.im}\right) \cdot x.re\right) - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    7. +-commutative90.8%

      \[\leadsto \left(x.re - x.im\right) \cdot \left(\left(x.re + x.im\right) \cdot x.re\right) - \color{blue}{\left(x.im \cdot x.re + x.re \cdot x.im\right)} \cdot x.im \]
    8. *-commutative90.8%

      \[\leadsto \left(x.re - x.im\right) \cdot \left(\left(x.re + x.im\right) \cdot x.re\right) - \color{blue}{x.im \cdot \left(x.im \cdot x.re + x.re \cdot x.im\right)} \]
    9. *-commutative90.8%

      \[\leadsto \left(x.re - x.im\right) \cdot \left(\left(x.re + x.im\right) \cdot x.re\right) - x.im \cdot \left(x.im \cdot x.re + \color{blue}{x.im \cdot x.re}\right) \]
    10. distribute-rgt-out90.8%

      \[\leadsto \left(x.re - x.im\right) \cdot \left(\left(x.re + x.im\right) \cdot x.re\right) - x.im \cdot \color{blue}{\left(x.re \cdot \left(x.im + x.im\right)\right)} \]
  3. Simplified90.8%

    \[\leadsto \color{blue}{\left(x.re - x.im\right) \cdot \left(\left(x.re + x.im\right) \cdot x.re\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right)} \]
  4. Taylor expanded in x.re around inf 68.7%

    \[\leadsto \left(x.re - x.im\right) \cdot \color{blue}{{x.re}^{2}} - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
  5. Step-by-step derivation
    1. unpow268.7%

      \[\leadsto \left(x.re - x.im\right) \cdot \color{blue}{\left(x.re \cdot x.re\right)} - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
  6. Simplified68.7%

    \[\leadsto \left(x.re - x.im\right) \cdot \color{blue}{\left(x.re \cdot x.re\right)} - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
  7. Step-by-step derivation
    1. expm1-log1p-u46.4%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(x.re - x.im\right) \cdot \left(x.re \cdot x.re\right)\right)\right)} - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
    2. expm1-udef40.0%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\left(x.re - x.im\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right)} - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
    3. sub-neg40.0%

      \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\left(x.re + \left(-x.im\right)\right)} \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
    4. add-sqr-sqrt18.9%

      \[\leadsto \left(e^{\mathsf{log1p}\left(\left(x.re + \color{blue}{\sqrt{-x.im} \cdot \sqrt{-x.im}}\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
    5. sqrt-unprod40.7%

      \[\leadsto \left(e^{\mathsf{log1p}\left(\left(x.re + \color{blue}{\sqrt{\left(-x.im\right) \cdot \left(-x.im\right)}}\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
    6. sqr-neg40.7%

      \[\leadsto \left(e^{\mathsf{log1p}\left(\left(x.re + \sqrt{\color{blue}{x.im \cdot x.im}}\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
    7. sqrt-unprod25.5%

      \[\leadsto \left(e^{\mathsf{log1p}\left(\left(x.re + \color{blue}{\sqrt{x.im} \cdot \sqrt{x.im}}\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
    8. add-sqr-sqrt40.5%

      \[\leadsto \left(e^{\mathsf{log1p}\left(\left(x.re + \color{blue}{x.im}\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
    9. +-commutative40.5%

      \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\left(x.im + x.re\right)} \cdot \left(x.re \cdot x.re\right)\right)} - 1\right) - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
  8. Applied egg-rr40.5%

    \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\left(x.im + x.re\right) \cdot \left(x.re \cdot x.re\right)\right)} - 1\right)} - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
  9. Step-by-step derivation
    1. expm1-def47.0%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(x.im + x.re\right) \cdot \left(x.re \cdot x.re\right)\right)\right)} - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
    2. expm1-log1p66.8%

      \[\leadsto \color{blue}{\left(x.im + x.re\right) \cdot \left(x.re \cdot x.re\right)} - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
  10. Simplified66.8%

    \[\leadsto \color{blue}{\left(x.im + x.re\right) \cdot \left(x.re \cdot x.re\right)} - x.im \cdot \left(x.re \cdot \left(x.im + x.im\right)\right) \]
  11. Taylor expanded in x.im around 0 47.7%

    \[\leadsto \color{blue}{x.im \cdot {x.re}^{2} + {x.re}^{3}} \]
  12. Step-by-step derivation
    1. unpow247.7%

      \[\leadsto x.im \cdot \color{blue}{\left(x.re \cdot x.re\right)} + {x.re}^{3} \]
    2. cube-mult47.6%

      \[\leadsto x.im \cdot \left(x.re \cdot x.re\right) + \color{blue}{x.re \cdot \left(x.re \cdot x.re\right)} \]
    3. distribute-rgt-in64.8%

      \[\leadsto \color{blue}{\left(x.re \cdot x.re\right) \cdot \left(x.im + x.re\right)} \]
    4. +-commutative64.8%

      \[\leadsto \left(x.re \cdot x.re\right) \cdot \color{blue}{\left(x.re + x.im\right)} \]
  13. Simplified64.8%

    \[\leadsto \color{blue}{\left(x.re \cdot x.re\right) \cdot \left(x.re + x.im\right)} \]
  14. Taylor expanded in x.re around 0 29.5%

    \[\leadsto \color{blue}{x.im \cdot {x.re}^{2}} \]
  15. Step-by-step derivation
    1. unpow229.5%

      \[\leadsto x.im \cdot \color{blue}{\left(x.re \cdot x.re\right)} \]
  16. Simplified29.5%

    \[\leadsto \color{blue}{x.im \cdot \left(x.re \cdot x.re\right)} \]
  17. Final simplification29.5%

    \[\leadsto \left(x.re \cdot x.re\right) \cdot x.im \]

Developer target: 87.6% 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 2023283 
(FPCore (x.re x.im)
  :name "math.cube on complex, real part"
  :precision binary64

  :herbie-target
  (+ (* (* x.re x.re) (- x.re x.im)) (* (* x.re x.im) (- x.re (* 3.0 x.im))))

  (- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))