math.cube on complex, real part

Percentage Accurate: 82.7% → 99.7%
Time: 14.0s
Alternatives: 10
Speedup: 0.4×

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

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

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

Alternative 1: 99.7% accurate, 0.1× speedup?

\[\begin{array}{l} x.re\_m = \left|x.re\right| \\ x.re\_s = \mathsf{copysign}\left(1, x.re\right) \\ x.re\_s \cdot \begin{array}{l} \mathbf{if}\;x.re\_m \cdot \left(x.re\_m \cdot x.re\_m - x.im \cdot x.im\right) - x.im \cdot \left(x.re\_m \cdot x.im + x.re\_m \cdot x.im\right) \leq 0:\\ \;\;\;\;\left(x.re\_m \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\ \mathbf{else}:\\ \;\;\;\;{x.re\_m}^{3} \cdot \left(1 + -3 \cdot \left(\frac{x.im}{x.re\_m} \cdot \frac{x.im}{x.re\_m}\right)\right)\\ \end{array} \end{array} \]
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
 :precision binary64
 (*
  x.re_s
  (if (<=
       (-
        (* x.re_m (- (* x.re_m x.re_m) (* x.im x.im)))
        (* x.im (+ (* x.re_m x.im) (* x.re_m x.im))))
       0.0)
    (* (* x.re_m x.im) (* x.im -3.0))
    (*
     (pow x.re_m 3.0)
     (+ 1.0 (* -3.0 (* (/ x.im x.re_m) (/ x.im x.re_m))))))))
x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
	double tmp;
	if (((x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)))) <= 0.0) {
		tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
	} else {
		tmp = pow(x_46_re_m, 3.0) * (1.0 + (-3.0 * ((x_46_im / x_46_re_m) * (x_46_im / x_46_re_m))));
	}
	return x_46_re_s * tmp;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
    real(8), intent (in) :: x_46re_s
    real(8), intent (in) :: x_46re_m
    real(8), intent (in) :: x_46im
    real(8) :: tmp
    if (((x_46re_m * ((x_46re_m * x_46re_m) - (x_46im * x_46im))) - (x_46im * ((x_46re_m * x_46im) + (x_46re_m * x_46im)))) <= 0.0d0) then
        tmp = (x_46re_m * x_46im) * (x_46im * (-3.0d0))
    else
        tmp = (x_46re_m ** 3.0d0) * (1.0d0 + ((-3.0d0) * ((x_46im / x_46re_m) * (x_46im / x_46re_m))))
    end if
    code = x_46re_s * tmp
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
	double tmp;
	if (((x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)))) <= 0.0) {
		tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
	} else {
		tmp = Math.pow(x_46_re_m, 3.0) * (1.0 + (-3.0 * ((x_46_im / x_46_re_m) * (x_46_im / x_46_re_m))));
	}
	return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re)
x.re\_s = math.copysign(1.0, x_46_re)
def code(x_46_re_s, x_46_re_m, x_46_im):
	tmp = 0
	if ((x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)))) <= 0.0:
		tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0)
	else:
		tmp = math.pow(x_46_re_m, 3.0) * (1.0 + (-3.0 * ((x_46_im / x_46_re_m) * (x_46_im / x_46_re_m))))
	return x_46_re_s * tmp
x.re\_m = abs(x_46_re)
x.re\_s = copysign(1.0, x_46_re)
function code(x_46_re_s, x_46_re_m, x_46_im)
	tmp = 0.0
	if (Float64(Float64(x_46_re_m * Float64(Float64(x_46_re_m * x_46_re_m) - Float64(x_46_im * x_46_im))) - Float64(x_46_im * Float64(Float64(x_46_re_m * x_46_im) + Float64(x_46_re_m * x_46_im)))) <= 0.0)
		tmp = Float64(Float64(x_46_re_m * x_46_im) * Float64(x_46_im * -3.0));
	else
		tmp = Float64((x_46_re_m ^ 3.0) * Float64(1.0 + Float64(-3.0 * Float64(Float64(x_46_im / x_46_re_m) * Float64(x_46_im / x_46_re_m)))));
	end
	return Float64(x_46_re_s * tmp)
end
x.re\_m = abs(x_46_re);
x.re\_s = sign(x_46_re) * abs(1.0);
function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im)
	tmp = 0.0;
	if (((x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)))) <= 0.0)
		tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
	else
		tmp = (x_46_re_m ^ 3.0) * (1.0 + (-3.0 * ((x_46_im / x_46_re_m) * (x_46_im / x_46_re_m))));
	end
	tmp_2 = x_46_re_s * tmp;
end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * If[LessEqual[N[(N[(x$46$re$95$m * N[(N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$im * N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] + N[(x$46$re$95$m * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision], N[(N[Power[x$46$re$95$m, 3.0], $MachinePrecision] * N[(1.0 + N[(-3.0 * N[(N[(x$46$im / x$46$re$95$m), $MachinePrecision] * N[(x$46$im / x$46$re$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)

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

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


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

    1. Initial program 90.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. Simplified86.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log \left(e^{-3 \cdot \left(x.im \cdot x.re\right)}\right)} \cdot x.im \]
      4. *-un-lft-identity41.7%

        \[\leadsto \log \color{blue}{\left(1 \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right)} \cdot x.im \]
      5. 1-exp41.7%

        \[\leadsto \log \left(\color{blue}{e^{0}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      6. mul0-lft41.7%

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

        \[\leadsto \log \left(e^{\color{blue}{x.re \cdot 0}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      8. mul0-lft41.7%

        \[\leadsto \log \left(e^{x.re \cdot \color{blue}{\left(0 \cdot x.re\right)}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      9. metadata-eval41.7%

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

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

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

        \[\leadsto \log \left(e^{\color{blue}{-3 \cdot \left(x.im \cdot x.re\right) + x.re \cdot \left(x.re + -1 \cdot x.re\right)}}\right) \cdot x.im \]
      13. add-log-exp66.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 63.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. Simplified60.4%

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

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

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

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

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

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

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

Alternative 2: 98.2% accurate, 0.2× speedup?

\[\begin{array}{l} x.re\_m = \left|x.re\right| \\ x.re\_s = \mathsf{copysign}\left(1, x.re\right) \\ x.re\_s \cdot \begin{array}{l} \mathbf{if}\;x.re\_m \leq 17:\\ \;\;\;\;{x.re\_m}^{3} + -3 \cdot \left(x.im \cdot \left(x.re\_m \cdot x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x.re\_m \cdot \left(\left(x.re\_m - x.im\right) \cdot \left(x.re\_m + x.im\right)\right)\\ \end{array} \end{array} \]
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
 :precision binary64
 (*
  x.re_s
  (if (<= x.re_m 17.0)
    (+ (pow x.re_m 3.0) (* -3.0 (* x.im (* x.re_m x.im))))
    (* x.re_m (* (- x.re_m x.im) (+ x.re_m x.im))))))
x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
	double tmp;
	if (x_46_re_m <= 17.0) {
		tmp = pow(x_46_re_m, 3.0) + (-3.0 * (x_46_im * (x_46_re_m * x_46_im)));
	} else {
		tmp = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im));
	}
	return x_46_re_s * tmp;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
    real(8), intent (in) :: x_46re_s
    real(8), intent (in) :: x_46re_m
    real(8), intent (in) :: x_46im
    real(8) :: tmp
    if (x_46re_m <= 17.0d0) then
        tmp = (x_46re_m ** 3.0d0) + ((-3.0d0) * (x_46im * (x_46re_m * x_46im)))
    else
        tmp = x_46re_m * ((x_46re_m - x_46im) * (x_46re_m + x_46im))
    end if
    code = x_46re_s * tmp
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
	double tmp;
	if (x_46_re_m <= 17.0) {
		tmp = Math.pow(x_46_re_m, 3.0) + (-3.0 * (x_46_im * (x_46_re_m * x_46_im)));
	} else {
		tmp = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im));
	}
	return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re)
x.re\_s = math.copysign(1.0, x_46_re)
def code(x_46_re_s, x_46_re_m, x_46_im):
	tmp = 0
	if x_46_re_m <= 17.0:
		tmp = math.pow(x_46_re_m, 3.0) + (-3.0 * (x_46_im * (x_46_re_m * x_46_im)))
	else:
		tmp = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im))
	return x_46_re_s * tmp
x.re\_m = abs(x_46_re)
x.re\_s = copysign(1.0, x_46_re)
function code(x_46_re_s, x_46_re_m, x_46_im)
	tmp = 0.0
	if (x_46_re_m <= 17.0)
		tmp = Float64((x_46_re_m ^ 3.0) + Float64(-3.0 * Float64(x_46_im * Float64(x_46_re_m * x_46_im))));
	else
		tmp = Float64(x_46_re_m * Float64(Float64(x_46_re_m - x_46_im) * Float64(x_46_re_m + x_46_im)));
	end
	return Float64(x_46_re_s * tmp)
end
x.re\_m = abs(x_46_re);
x.re\_s = sign(x_46_re) * abs(1.0);
function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im)
	tmp = 0.0;
	if (x_46_re_m <= 17.0)
		tmp = (x_46_re_m ^ 3.0) + (-3.0 * (x_46_im * (x_46_re_m * x_46_im)));
	else
		tmp = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im));
	end
	tmp_2 = x_46_re_s * tmp;
end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * If[LessEqual[x$46$re$95$m, 17.0], N[(N[Power[x$46$re$95$m, 3.0], $MachinePrecision] + N[(-3.0 * N[(x$46$im * N[(x$46$re$95$m * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$re$95$m * N[(N[(x$46$re$95$m - x$46$im), $MachinePrecision] * N[(x$46$re$95$m + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.re < 17

    1. Initial program 79.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. Simplified76.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 17 < x.re

    1. Initial program 72.7%

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

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

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

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

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

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - x.im \cdot \frac{\log 1}{\color{blue}{0}} \]
      7. metadata-eval0.0%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \color{blue}{\frac{x.im \cdot \log 1}{\log 1}} \]
      9. metadata-eval0.0%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \color{blue}{0}}{\log 1} \]
      10. metadata-eval0.0%

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

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

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

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

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

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

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

Alternative 3: 99.7% accurate, 0.3× speedup?

\[\begin{array}{l} x.re\_m = \left|x.re\right| \\ x.re\_s = \mathsf{copysign}\left(1, x.re\right) \\ \begin{array}{l} t_0 := x.re\_m \cdot \left(x.re\_m \cdot x.re\_m - x.im \cdot x.im\right) - x.im \cdot \left(x.re\_m \cdot x.im + x.re\_m \cdot x.im\right)\\ t_1 := x.re\_m \cdot \left(\left(x.re\_m - x.im\right) \cdot \left(x.re\_m + x.im\right)\right)\\ x.re\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;\left(x.re\_m \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\ \mathbf{elif}\;t\_0 \leq 10^{+72}:\\ \;\;\;\;t\_1 - x.im \cdot \left(\left(x.re\_m \cdot x.im\right) \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \end{array} \]
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
 :precision binary64
 (let* ((t_0
         (-
          (* x.re_m (- (* x.re_m x.re_m) (* x.im x.im)))
          (* x.im (+ (* x.re_m x.im) (* x.re_m x.im)))))
        (t_1 (* x.re_m (* (- x.re_m x.im) (+ x.re_m x.im)))))
   (*
    x.re_s
    (if (<= t_0 (- INFINITY))
      (* (* x.re_m x.im) (* x.im -3.0))
      (if (<= t_0 1e+72) (- t_1 (* x.im (* (* x.re_m x.im) 2.0))) t_1)))))
x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
	double t_0 = (x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)));
	double t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im));
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
	} else if (t_0 <= 1e+72) {
		tmp = t_1 - (x_46_im * ((x_46_re_m * x_46_im) * 2.0));
	} else {
		tmp = t_1;
	}
	return x_46_re_s * tmp;
}
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
	double t_0 = (x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)));
	double t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im));
	double tmp;
	if (t_0 <= -Double.POSITIVE_INFINITY) {
		tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
	} else if (t_0 <= 1e+72) {
		tmp = t_1 - (x_46_im * ((x_46_re_m * x_46_im) * 2.0));
	} else {
		tmp = t_1;
	}
	return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re)
x.re\_s = math.copysign(1.0, x_46_re)
def code(x_46_re_s, x_46_re_m, x_46_im):
	t_0 = (x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)))
	t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im))
	tmp = 0
	if t_0 <= -math.inf:
		tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0)
	elif t_0 <= 1e+72:
		tmp = t_1 - (x_46_im * ((x_46_re_m * x_46_im) * 2.0))
	else:
		tmp = t_1
	return x_46_re_s * tmp
x.re\_m = abs(x_46_re)
x.re\_s = copysign(1.0, x_46_re)
function code(x_46_re_s, x_46_re_m, x_46_im)
	t_0 = Float64(Float64(x_46_re_m * Float64(Float64(x_46_re_m * x_46_re_m) - Float64(x_46_im * x_46_im))) - Float64(x_46_im * Float64(Float64(x_46_re_m * x_46_im) + Float64(x_46_re_m * x_46_im))))
	t_1 = Float64(x_46_re_m * Float64(Float64(x_46_re_m - x_46_im) * Float64(x_46_re_m + x_46_im)))
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = Float64(Float64(x_46_re_m * x_46_im) * Float64(x_46_im * -3.0));
	elseif (t_0 <= 1e+72)
		tmp = Float64(t_1 - Float64(x_46_im * Float64(Float64(x_46_re_m * x_46_im) * 2.0)));
	else
		tmp = t_1;
	end
	return Float64(x_46_re_s * tmp)
end
x.re\_m = abs(x_46_re);
x.re\_s = sign(x_46_re) * abs(1.0);
function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im)
	t_0 = (x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)));
	t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im));
	tmp = 0.0;
	if (t_0 <= -Inf)
		tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
	elseif (t_0 <= 1e+72)
		tmp = t_1 - (x_46_im * ((x_46_re_m * x_46_im) * 2.0));
	else
		tmp = t_1;
	end
	tmp_2 = x_46_re_s * tmp;
end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := Block[{t$95$0 = N[(N[(x$46$re$95$m * N[(N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$im * N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] + N[(x$46$re$95$m * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x$46$re$95$m * N[(N[(x$46$re$95$m - x$46$im), $MachinePrecision] * N[(x$46$re$95$m + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$46$re$95$s * If[LessEqual[t$95$0, (-Infinity)], N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+72], N[(t$95$1 - N[(x$46$im * N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]), $MachinePrecision]]]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)

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

\mathbf{elif}\;t\_0 \leq 10^{+72}:\\
\;\;\;\;t\_1 - x.im \cdot \left(\left(x.re\_m \cdot x.im\right) \cdot 2\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


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

    1. Initial program 80.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. Simplified72.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log \left(e^{-3 \cdot \left(x.im \cdot x.re\right)}\right)} \cdot x.im \]
      4. *-un-lft-identity40.1%

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

        \[\leadsto \log \left(\color{blue}{e^{0}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      6. mul0-lft40.1%

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

        \[\leadsto \log \left(e^{\color{blue}{x.re \cdot 0}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      8. mul0-lft40.1%

        \[\leadsto \log \left(e^{x.re \cdot \color{blue}{\left(0 \cdot x.re\right)}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      9. metadata-eval40.1%

        \[\leadsto \log \left(e^{x.re \cdot \left(\color{blue}{\left(-1 + 1\right)} \cdot x.re\right)} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      10. distribute-rgt1-in40.1%

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

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

        \[\leadsto \log \left(e^{\color{blue}{-3 \cdot \left(x.im \cdot x.re\right) + x.re \cdot \left(x.re + -1 \cdot x.re\right)}}\right) \cdot x.im \]
      13. add-log-exp59.9%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(-3 \cdot \left(x.im \cdot x.re\right), x.im, \left(x.re \cdot \left(x.re + -1 \cdot x.re\right)\right) \cdot x.im\right)} \]
    10. Applied egg-rr60.0%

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

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

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

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

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

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

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

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

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

    1. Initial program 99.7%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. difference-of-squares67.9%

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

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

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

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

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

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

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

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

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

    if 9.99999999999999944e71 < (-.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im))

    1. Initial program 56.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative56.2%

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

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

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

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

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - x.im \cdot \frac{\log 1}{\color{blue}{0}} \]
      7. metadata-eval0.0%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \color{blue}{\frac{x.im \cdot \log 1}{\log 1}} \]
      9. metadata-eval0.0%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \color{blue}{0}}{\log 1} \]
      10. metadata-eval0.0%

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

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

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

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

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

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

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

Alternative 4: 92.8% accurate, 0.4× speedup?

\[\begin{array}{l} x.re\_m = \left|x.re\right| \\ x.re\_s = \mathsf{copysign}\left(1, x.re\right) \\ x.re\_s \cdot \begin{array}{l} \mathbf{if}\;x.re\_m \leq 2.05 \cdot 10^{-66}:\\ \;\;\;\;\left(x.re\_m \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\ \mathbf{elif}\;x.re\_m \leq 3.5 \cdot 10^{-30} \lor \neg \left(x.re\_m \leq 5.1 \cdot 10^{-30} \lor \neg \left(x.re\_m \leq 6.4 \cdot 10^{-16}\right) \land \left(x.re\_m \leq 0.000245 \lor \neg \left(x.re\_m \leq 8.8 \cdot 10^{+61}\right) \land x.re\_m \leq 9 \cdot 10^{+61}\right)\right):\\ \;\;\;\;x.re\_m \cdot \left(\left(x.re\_m - x.im\right) \cdot \left(x.re\_m + x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-3 \cdot \left(x.im \cdot \left(x.re\_m \cdot x.im\right)\right)\\ \end{array} \end{array} \]
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
 :precision binary64
 (*
  x.re_s
  (if (<= x.re_m 2.05e-66)
    (* (* x.re_m x.im) (* x.im -3.0))
    (if (or (<= x.re_m 3.5e-30)
            (not
             (or (<= x.re_m 5.1e-30)
                 (and (not (<= x.re_m 6.4e-16))
                      (or (<= x.re_m 0.000245)
                          (and (not (<= x.re_m 8.8e+61))
                               (<= x.re_m 9e+61)))))))
      (* x.re_m (* (- x.re_m x.im) (+ x.re_m x.im)))
      (* -3.0 (* x.im (* x.re_m x.im)))))))
x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
	double tmp;
	if (x_46_re_m <= 2.05e-66) {
		tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
	} else if ((x_46_re_m <= 3.5e-30) || !((x_46_re_m <= 5.1e-30) || (!(x_46_re_m <= 6.4e-16) && ((x_46_re_m <= 0.000245) || (!(x_46_re_m <= 8.8e+61) && (x_46_re_m <= 9e+61)))))) {
		tmp = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im));
	} else {
		tmp = -3.0 * (x_46_im * (x_46_re_m * x_46_im));
	}
	return x_46_re_s * tmp;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
    real(8), intent (in) :: x_46re_s
    real(8), intent (in) :: x_46re_m
    real(8), intent (in) :: x_46im
    real(8) :: tmp
    if (x_46re_m <= 2.05d-66) then
        tmp = (x_46re_m * x_46im) * (x_46im * (-3.0d0))
    else if ((x_46re_m <= 3.5d-30) .or. (.not. (x_46re_m <= 5.1d-30) .or. (.not. (x_46re_m <= 6.4d-16)) .and. (x_46re_m <= 0.000245d0) .or. (.not. (x_46re_m <= 8.8d+61)) .and. (x_46re_m <= 9d+61))) then
        tmp = x_46re_m * ((x_46re_m - x_46im) * (x_46re_m + x_46im))
    else
        tmp = (-3.0d0) * (x_46im * (x_46re_m * x_46im))
    end if
    code = x_46re_s * tmp
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
	double tmp;
	if (x_46_re_m <= 2.05e-66) {
		tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
	} else if ((x_46_re_m <= 3.5e-30) || !((x_46_re_m <= 5.1e-30) || (!(x_46_re_m <= 6.4e-16) && ((x_46_re_m <= 0.000245) || (!(x_46_re_m <= 8.8e+61) && (x_46_re_m <= 9e+61)))))) {
		tmp = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im));
	} else {
		tmp = -3.0 * (x_46_im * (x_46_re_m * x_46_im));
	}
	return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re)
x.re\_s = math.copysign(1.0, x_46_re)
def code(x_46_re_s, x_46_re_m, x_46_im):
	tmp = 0
	if x_46_re_m <= 2.05e-66:
		tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0)
	elif (x_46_re_m <= 3.5e-30) or not ((x_46_re_m <= 5.1e-30) or (not (x_46_re_m <= 6.4e-16) and ((x_46_re_m <= 0.000245) or (not (x_46_re_m <= 8.8e+61) and (x_46_re_m <= 9e+61))))):
		tmp = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im))
	else:
		tmp = -3.0 * (x_46_im * (x_46_re_m * x_46_im))
	return x_46_re_s * tmp
x.re\_m = abs(x_46_re)
x.re\_s = copysign(1.0, x_46_re)
function code(x_46_re_s, x_46_re_m, x_46_im)
	tmp = 0.0
	if (x_46_re_m <= 2.05e-66)
		tmp = Float64(Float64(x_46_re_m * x_46_im) * Float64(x_46_im * -3.0));
	elseif ((x_46_re_m <= 3.5e-30) || !((x_46_re_m <= 5.1e-30) || (!(x_46_re_m <= 6.4e-16) && ((x_46_re_m <= 0.000245) || (!(x_46_re_m <= 8.8e+61) && (x_46_re_m <= 9e+61))))))
		tmp = Float64(x_46_re_m * Float64(Float64(x_46_re_m - x_46_im) * Float64(x_46_re_m + x_46_im)));
	else
		tmp = Float64(-3.0 * Float64(x_46_im * Float64(x_46_re_m * x_46_im)));
	end
	return Float64(x_46_re_s * tmp)
end
x.re\_m = abs(x_46_re);
x.re\_s = sign(x_46_re) * abs(1.0);
function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im)
	tmp = 0.0;
	if (x_46_re_m <= 2.05e-66)
		tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
	elseif ((x_46_re_m <= 3.5e-30) || ~(((x_46_re_m <= 5.1e-30) || (~((x_46_re_m <= 6.4e-16)) && ((x_46_re_m <= 0.000245) || (~((x_46_re_m <= 8.8e+61)) && (x_46_re_m <= 9e+61)))))))
		tmp = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im));
	else
		tmp = -3.0 * (x_46_im * (x_46_re_m * x_46_im));
	end
	tmp_2 = x_46_re_s * tmp;
end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * If[LessEqual[x$46$re$95$m, 2.05e-66], N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x$46$re$95$m, 3.5e-30], N[Not[Or[LessEqual[x$46$re$95$m, 5.1e-30], And[N[Not[LessEqual[x$46$re$95$m, 6.4e-16]], $MachinePrecision], Or[LessEqual[x$46$re$95$m, 0.000245], And[N[Not[LessEqual[x$46$re$95$m, 8.8e+61]], $MachinePrecision], LessEqual[x$46$re$95$m, 9e+61]]]]]], $MachinePrecision]], N[(x$46$re$95$m * N[(N[(x$46$re$95$m - x$46$im), $MachinePrecision] * N[(x$46$re$95$m + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-3.0 * N[(x$46$im * N[(x$46$re$95$m * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)

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

\mathbf{elif}\;x.re\_m \leq 3.5 \cdot 10^{-30} \lor \neg \left(x.re\_m \leq 5.1 \cdot 10^{-30} \lor \neg \left(x.re\_m \leq 6.4 \cdot 10^{-16}\right) \land \left(x.re\_m \leq 0.000245 \lor \neg \left(x.re\_m \leq 8.8 \cdot 10^{+61}\right) \land x.re\_m \leq 9 \cdot 10^{+61}\right)\right):\\
\;\;\;\;x.re\_m \cdot \left(\left(x.re\_m - x.im\right) \cdot \left(x.re\_m + x.im\right)\right)\\

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


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

    1. Initial program 78.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. Simplified76.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log \left(e^{-3 \cdot \left(x.im \cdot x.re\right)}\right)} \cdot x.im \]
      4. *-un-lft-identity36.6%

        \[\leadsto \log \color{blue}{\left(1 \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right)} \cdot x.im \]
      5. 1-exp36.6%

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

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

        \[\leadsto \log \left(e^{\color{blue}{x.re \cdot 0}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      8. mul0-lft36.6%

        \[\leadsto \log \left(e^{x.re \cdot \color{blue}{\left(0 \cdot x.re\right)}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      9. metadata-eval36.6%

        \[\leadsto \log \left(e^{x.re \cdot \left(\color{blue}{\left(-1 + 1\right)} \cdot x.re\right)} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      10. distribute-rgt1-in36.6%

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

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

        \[\leadsto \log \left(e^{\color{blue}{-3 \cdot \left(x.im \cdot x.re\right) + x.re \cdot \left(x.re + -1 \cdot x.re\right)}}\right) \cdot x.im \]
      13. add-log-exp68.6%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(-3 \cdot \left(x.im \cdot x.re\right), x.im, \left(x.re \cdot \left(x.re + -1 \cdot x.re\right)\right) \cdot x.im\right)} \]
    10. Applied egg-rr68.6%

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

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

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

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

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

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

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

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

    if 2.04999999999999999e-66 < x.re < 3.5000000000000003e-30 or 5.09999999999999972e-30 < x.re < 6.40000000000000046e-16 or 2.4499999999999999e-4 < x.re < 8.8000000000000001e61 or 9e61 < 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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative75.2%

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

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

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

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

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - x.im \cdot \frac{\log 1}{\color{blue}{0}} \]
      7. metadata-eval0.0%

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

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \color{blue}{\frac{x.im \cdot \log 1}{\log 1}} \]
      9. metadata-eval0.0%

        \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \frac{x.im \cdot \color{blue}{0}}{\log 1} \]
      10. metadata-eval0.0%

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

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

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

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

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

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

    if 3.5000000000000003e-30 < x.re < 5.09999999999999972e-30 or 6.40000000000000046e-16 < x.re < 2.4499999999999999e-4 or 8.8000000000000001e61 < x.re < 9e61

    1. Initial program 54.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. Simplified53.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \leq 2.05 \cdot 10^{-66}:\\ \;\;\;\;\left(x.re \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\ \mathbf{elif}\;x.re \leq 3.5 \cdot 10^{-30} \lor \neg \left(x.re \leq 5.1 \cdot 10^{-30} \lor \neg \left(x.re \leq 6.4 \cdot 10^{-16}\right) \land \left(x.re \leq 0.000245 \lor \neg \left(x.re \leq 8.8 \cdot 10^{+61}\right) \land x.re \leq 9 \cdot 10^{+61}\right)\right):\\ \;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-3 \cdot \left(x.im \cdot \left(x.re \cdot x.im\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 70.1% accurate, 0.4× speedup?

\[\begin{array}{l} x.re\_m = \left|x.re\right| \\ x.re\_s = \mathsf{copysign}\left(1, x.re\right) \\ \begin{array}{l} t_0 := \left(x.re\_m \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\ t_1 := x.re\_m \cdot \left(\left(x.re\_m - x.im\right) \cdot \left(x.re\_m - x.im\right)\right)\\ x.re\_s \cdot \begin{array}{l} \mathbf{if}\;x.im \leq 245000000000:\\ \;\;\;\;\left(x.re\_m - x.im\right) \cdot \left(x.re\_m \cdot \left(x.re\_m - x.im\right)\right)\\ \mathbf{elif}\;x.im \leq 1.8 \cdot 10^{+82}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x.im \leq 10^{+109}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x.im \leq 1.42 \cdot 10^{+147}:\\ \;\;\;\;x.im \cdot \left(x.re\_m \cdot \left(x.im \cdot -3\right)\right)\\ \mathbf{elif}\;x.im \leq 1.05 \cdot 10^{+148} \lor \neg \left(x.im \leq 9 \cdot 10^{+181}\right) \land x.im \leq 9.5 \cdot 10^{+181}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \end{array} \]
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
 :precision binary64
 (let* ((t_0 (* (* x.re_m x.im) (* x.im -3.0)))
        (t_1 (* x.re_m (* (- x.re_m x.im) (- x.re_m x.im)))))
   (*
    x.re_s
    (if (<= x.im 245000000000.0)
      (* (- x.re_m x.im) (* x.re_m (- x.re_m x.im)))
      (if (<= x.im 1.8e+82)
        t_0
        (if (<= x.im 1e+109)
          t_1
          (if (<= x.im 1.42e+147)
            (* x.im (* x.re_m (* x.im -3.0)))
            (if (or (<= x.im 1.05e+148)
                    (and (not (<= x.im 9e+181)) (<= x.im 9.5e+181)))
              t_1
              t_0))))))))
x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
	double t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
	double t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im));
	double tmp;
	if (x_46_im <= 245000000000.0) {
		tmp = (x_46_re_m - x_46_im) * (x_46_re_m * (x_46_re_m - x_46_im));
	} else if (x_46_im <= 1.8e+82) {
		tmp = t_0;
	} else if (x_46_im <= 1e+109) {
		tmp = t_1;
	} else if (x_46_im <= 1.42e+147) {
		tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0));
	} else if ((x_46_im <= 1.05e+148) || (!(x_46_im <= 9e+181) && (x_46_im <= 9.5e+181))) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return x_46_re_s * tmp;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
    real(8), intent (in) :: x_46re_s
    real(8), intent (in) :: x_46re_m
    real(8), intent (in) :: x_46im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (x_46re_m * x_46im) * (x_46im * (-3.0d0))
    t_1 = x_46re_m * ((x_46re_m - x_46im) * (x_46re_m - x_46im))
    if (x_46im <= 245000000000.0d0) then
        tmp = (x_46re_m - x_46im) * (x_46re_m * (x_46re_m - x_46im))
    else if (x_46im <= 1.8d+82) then
        tmp = t_0
    else if (x_46im <= 1d+109) then
        tmp = t_1
    else if (x_46im <= 1.42d+147) then
        tmp = x_46im * (x_46re_m * (x_46im * (-3.0d0)))
    else if ((x_46im <= 1.05d+148) .or. (.not. (x_46im <= 9d+181)) .and. (x_46im <= 9.5d+181)) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = x_46re_s * tmp
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
	double t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
	double t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im));
	double tmp;
	if (x_46_im <= 245000000000.0) {
		tmp = (x_46_re_m - x_46_im) * (x_46_re_m * (x_46_re_m - x_46_im));
	} else if (x_46_im <= 1.8e+82) {
		tmp = t_0;
	} else if (x_46_im <= 1e+109) {
		tmp = t_1;
	} else if (x_46_im <= 1.42e+147) {
		tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0));
	} else if ((x_46_im <= 1.05e+148) || (!(x_46_im <= 9e+181) && (x_46_im <= 9.5e+181))) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re)
x.re\_s = math.copysign(1.0, x_46_re)
def code(x_46_re_s, x_46_re_m, x_46_im):
	t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0)
	t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im))
	tmp = 0
	if x_46_im <= 245000000000.0:
		tmp = (x_46_re_m - x_46_im) * (x_46_re_m * (x_46_re_m - x_46_im))
	elif x_46_im <= 1.8e+82:
		tmp = t_0
	elif x_46_im <= 1e+109:
		tmp = t_1
	elif x_46_im <= 1.42e+147:
		tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0))
	elif (x_46_im <= 1.05e+148) or (not (x_46_im <= 9e+181) and (x_46_im <= 9.5e+181)):
		tmp = t_1
	else:
		tmp = t_0
	return x_46_re_s * tmp
x.re\_m = abs(x_46_re)
x.re\_s = copysign(1.0, x_46_re)
function code(x_46_re_s, x_46_re_m, x_46_im)
	t_0 = Float64(Float64(x_46_re_m * x_46_im) * Float64(x_46_im * -3.0))
	t_1 = Float64(x_46_re_m * Float64(Float64(x_46_re_m - x_46_im) * Float64(x_46_re_m - x_46_im)))
	tmp = 0.0
	if (x_46_im <= 245000000000.0)
		tmp = Float64(Float64(x_46_re_m - x_46_im) * Float64(x_46_re_m * Float64(x_46_re_m - x_46_im)));
	elseif (x_46_im <= 1.8e+82)
		tmp = t_0;
	elseif (x_46_im <= 1e+109)
		tmp = t_1;
	elseif (x_46_im <= 1.42e+147)
		tmp = Float64(x_46_im * Float64(x_46_re_m * Float64(x_46_im * -3.0)));
	elseif ((x_46_im <= 1.05e+148) || (!(x_46_im <= 9e+181) && (x_46_im <= 9.5e+181)))
		tmp = t_1;
	else
		tmp = t_0;
	end
	return Float64(x_46_re_s * tmp)
end
x.re\_m = abs(x_46_re);
x.re\_s = sign(x_46_re) * abs(1.0);
function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im)
	t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
	t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im));
	tmp = 0.0;
	if (x_46_im <= 245000000000.0)
		tmp = (x_46_re_m - x_46_im) * (x_46_re_m * (x_46_re_m - x_46_im));
	elseif (x_46_im <= 1.8e+82)
		tmp = t_0;
	elseif (x_46_im <= 1e+109)
		tmp = t_1;
	elseif (x_46_im <= 1.42e+147)
		tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0));
	elseif ((x_46_im <= 1.05e+148) || (~((x_46_im <= 9e+181)) && (x_46_im <= 9.5e+181)))
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = x_46_re_s * tmp;
end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := Block[{t$95$0 = N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x$46$re$95$m * N[(N[(x$46$re$95$m - x$46$im), $MachinePrecision] * N[(x$46$re$95$m - x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$46$re$95$s * If[LessEqual[x$46$im, 245000000000.0], N[(N[(x$46$re$95$m - x$46$im), $MachinePrecision] * N[(x$46$re$95$m * N[(x$46$re$95$m - x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 1.8e+82], t$95$0, If[LessEqual[x$46$im, 1e+109], t$95$1, If[LessEqual[x$46$im, 1.42e+147], N[(x$46$im * N[(x$46$re$95$m * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x$46$im, 1.05e+148], And[N[Not[LessEqual[x$46$im, 9e+181]], $MachinePrecision], LessEqual[x$46$im, 9.5e+181]]], t$95$1, t$95$0]]]]]), $MachinePrecision]]]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)

\\
\begin{array}{l}
t_0 := \left(x.re\_m \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\
t_1 := x.re\_m \cdot \left(\left(x.re\_m - x.im\right) \cdot \left(x.re\_m - x.im\right)\right)\\
x.re\_s \cdot \begin{array}{l}
\mathbf{if}\;x.im \leq 245000000000:\\
\;\;\;\;\left(x.re\_m - x.im\right) \cdot \left(x.re\_m \cdot \left(x.re\_m - x.im\right)\right)\\

\mathbf{elif}\;x.im \leq 1.8 \cdot 10^{+82}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x.im \leq 10^{+109}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x.im \leq 1.05 \cdot 10^{+148} \lor \neg \left(x.im \leq 9 \cdot 10^{+181}\right) \land x.im \leq 9.5 \cdot 10^{+181}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x.im < 2.45e11

    1. Initial program 83.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. Add Preprocessing
    3. Step-by-step derivation
      1. difference-of-squares82.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x.re - x.im, x.re \cdot \left(x.im + x.re\right), \left(-\color{blue}{x.re \cdot \left(x.im \cdot 2\right)}\right) \cdot x.im\right) \]
    8. Applied egg-rr92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(x.re \cdot \left(x.re - x.im\right)\right) \cdot x.re + \left(x.re \cdot \left(x.re - x.im\right)\right) \cdot \left(-x.im\right)} \]
    15. Step-by-step derivation
      1. distribute-lft-out63.5%

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

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

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

    if 2.45e11 < x.im < 1.80000000000000007e82 or 1.04999999999999999e148 < x.im < 9e181 or 9.50000000000000032e181 < x.im

    1. Initial program 57.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. Simplified49.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log \left(e^{-3 \cdot \left(x.im \cdot x.re\right)}\right)} \cdot x.im \]
      4. *-un-lft-identity41.9%

        \[\leadsto \log \color{blue}{\left(1 \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right)} \cdot x.im \]
      5. 1-exp41.9%

        \[\leadsto \log \left(\color{blue}{e^{0}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      6. mul0-lft41.9%

        \[\leadsto \log \left(e^{\color{blue}{0 \cdot x.re}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      7. *-commutative41.9%

        \[\leadsto \log \left(e^{\color{blue}{x.re \cdot 0}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      8. mul0-lft41.9%

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

        \[\leadsto \log \left(e^{x.re \cdot \left(\color{blue}{\left(-1 + 1\right)} \cdot x.re\right)} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      10. distribute-rgt1-in41.9%

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

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

        \[\leadsto \log \left(e^{\color{blue}{-3 \cdot \left(x.im \cdot x.re\right) + x.re \cdot \left(x.re + -1 \cdot x.re\right)}}\right) \cdot x.im \]
      13. add-log-exp79.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.80000000000000007e82 < x.im < 9.99999999999999982e108 or 1.42e147 < x.im < 1.04999999999999999e148 or 9e181 < x.im < 9.50000000000000032e181

    1. Initial program 39.7%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. difference-of-squares67.1%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x.re - x.im, x.re \cdot \left(x.re + x.im\right), \left(-\left(x.re \cdot x.im\right) \cdot 2\right) \cdot x.im\right)} \]
      5. +-commutative39.7%

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

        \[\leadsto \mathsf{fma}\left(x.re - x.im, x.re \cdot \left(x.im + x.re\right), \left(-\color{blue}{x.re \cdot \left(x.im \cdot 2\right)}\right) \cdot x.im\right) \]
    8. Applied egg-rr39.7%

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

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

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

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

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

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

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

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

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

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

    if 9.99999999999999982e108 < x.im < 1.42e147

    1. Initial program 85.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \log \left(e^{x.re \cdot \left(\color{blue}{\left(-1 + 1\right)} \cdot x.re\right)} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      10. distribute-rgt1-in31.0%

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

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

        \[\leadsto \log \left(e^{\color{blue}{-3 \cdot \left(x.im \cdot x.re\right) + x.re \cdot \left(x.re + -1 \cdot x.re\right)}}\right) \cdot x.im \]
      13. add-log-exp85.3%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq 245000000000:\\ \;\;\;\;\left(x.re - x.im\right) \cdot \left(x.re \cdot \left(x.re - x.im\right)\right)\\ \mathbf{elif}\;x.im \leq 1.8 \cdot 10^{+82}:\\ \;\;\;\;\left(x.re \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\ \mathbf{elif}\;x.im \leq 10^{+109}:\\ \;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re - x.im\right)\right)\\ \mathbf{elif}\;x.im \leq 1.42 \cdot 10^{+147}:\\ \;\;\;\;x.im \cdot \left(x.re \cdot \left(x.im \cdot -3\right)\right)\\ \mathbf{elif}\;x.im \leq 1.05 \cdot 10^{+148} \lor \neg \left(x.im \leq 9 \cdot 10^{+181}\right) \land x.im \leq 9.5 \cdot 10^{+181}:\\ \;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re - x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 70.2% accurate, 0.4× speedup?

\[\begin{array}{l} x.re\_m = \left|x.re\right| \\ x.re\_s = \mathsf{copysign}\left(1, x.re\right) \\ \begin{array}{l} t_0 := \left(x.re\_m \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\ t_1 := x.re\_m \cdot \left(\left(x.re\_m - x.im\right) \cdot \left(x.re\_m - x.im\right)\right)\\ x.re\_s \cdot \begin{array}{l} \mathbf{if}\;x.im \leq 750000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x.im \leq 8.2 \cdot 10^{+81}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x.im \leq 5 \cdot 10^{+108}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x.im \leq 1.42 \cdot 10^{+147}:\\ \;\;\;\;x.im \cdot \left(x.re\_m \cdot \left(x.im \cdot -3\right)\right)\\ \mathbf{elif}\;x.im \leq 1.1 \cdot 10^{+148} \lor \neg \left(x.im \leq 9 \cdot 10^{+181}\right) \land x.im \leq 9.5 \cdot 10^{+181}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \end{array} \]
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
 :precision binary64
 (let* ((t_0 (* (* x.re_m x.im) (* x.im -3.0)))
        (t_1 (* x.re_m (* (- x.re_m x.im) (- x.re_m x.im)))))
   (*
    x.re_s
    (if (<= x.im 750000000.0)
      t_1
      (if (<= x.im 8.2e+81)
        t_0
        (if (<= x.im 5e+108)
          t_1
          (if (<= x.im 1.42e+147)
            (* x.im (* x.re_m (* x.im -3.0)))
            (if (or (<= x.im 1.1e+148)
                    (and (not (<= x.im 9e+181)) (<= x.im 9.5e+181)))
              t_1
              t_0))))))))
x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
	double t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
	double t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im));
	double tmp;
	if (x_46_im <= 750000000.0) {
		tmp = t_1;
	} else if (x_46_im <= 8.2e+81) {
		tmp = t_0;
	} else if (x_46_im <= 5e+108) {
		tmp = t_1;
	} else if (x_46_im <= 1.42e+147) {
		tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0));
	} else if ((x_46_im <= 1.1e+148) || (!(x_46_im <= 9e+181) && (x_46_im <= 9.5e+181))) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return x_46_re_s * tmp;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
    real(8), intent (in) :: x_46re_s
    real(8), intent (in) :: x_46re_m
    real(8), intent (in) :: x_46im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (x_46re_m * x_46im) * (x_46im * (-3.0d0))
    t_1 = x_46re_m * ((x_46re_m - x_46im) * (x_46re_m - x_46im))
    if (x_46im <= 750000000.0d0) then
        tmp = t_1
    else if (x_46im <= 8.2d+81) then
        tmp = t_0
    else if (x_46im <= 5d+108) then
        tmp = t_1
    else if (x_46im <= 1.42d+147) then
        tmp = x_46im * (x_46re_m * (x_46im * (-3.0d0)))
    else if ((x_46im <= 1.1d+148) .or. (.not. (x_46im <= 9d+181)) .and. (x_46im <= 9.5d+181)) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = x_46re_s * tmp
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
	double t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
	double t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im));
	double tmp;
	if (x_46_im <= 750000000.0) {
		tmp = t_1;
	} else if (x_46_im <= 8.2e+81) {
		tmp = t_0;
	} else if (x_46_im <= 5e+108) {
		tmp = t_1;
	} else if (x_46_im <= 1.42e+147) {
		tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0));
	} else if ((x_46_im <= 1.1e+148) || (!(x_46_im <= 9e+181) && (x_46_im <= 9.5e+181))) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re)
x.re\_s = math.copysign(1.0, x_46_re)
def code(x_46_re_s, x_46_re_m, x_46_im):
	t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0)
	t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im))
	tmp = 0
	if x_46_im <= 750000000.0:
		tmp = t_1
	elif x_46_im <= 8.2e+81:
		tmp = t_0
	elif x_46_im <= 5e+108:
		tmp = t_1
	elif x_46_im <= 1.42e+147:
		tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0))
	elif (x_46_im <= 1.1e+148) or (not (x_46_im <= 9e+181) and (x_46_im <= 9.5e+181)):
		tmp = t_1
	else:
		tmp = t_0
	return x_46_re_s * tmp
x.re\_m = abs(x_46_re)
x.re\_s = copysign(1.0, x_46_re)
function code(x_46_re_s, x_46_re_m, x_46_im)
	t_0 = Float64(Float64(x_46_re_m * x_46_im) * Float64(x_46_im * -3.0))
	t_1 = Float64(x_46_re_m * Float64(Float64(x_46_re_m - x_46_im) * Float64(x_46_re_m - x_46_im)))
	tmp = 0.0
	if (x_46_im <= 750000000.0)
		tmp = t_1;
	elseif (x_46_im <= 8.2e+81)
		tmp = t_0;
	elseif (x_46_im <= 5e+108)
		tmp = t_1;
	elseif (x_46_im <= 1.42e+147)
		tmp = Float64(x_46_im * Float64(x_46_re_m * Float64(x_46_im * -3.0)));
	elseif ((x_46_im <= 1.1e+148) || (!(x_46_im <= 9e+181) && (x_46_im <= 9.5e+181)))
		tmp = t_1;
	else
		tmp = t_0;
	end
	return Float64(x_46_re_s * tmp)
end
x.re\_m = abs(x_46_re);
x.re\_s = sign(x_46_re) * abs(1.0);
function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im)
	t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
	t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im));
	tmp = 0.0;
	if (x_46_im <= 750000000.0)
		tmp = t_1;
	elseif (x_46_im <= 8.2e+81)
		tmp = t_0;
	elseif (x_46_im <= 5e+108)
		tmp = t_1;
	elseif (x_46_im <= 1.42e+147)
		tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0));
	elseif ((x_46_im <= 1.1e+148) || (~((x_46_im <= 9e+181)) && (x_46_im <= 9.5e+181)))
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = x_46_re_s * tmp;
end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := Block[{t$95$0 = N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x$46$re$95$m * N[(N[(x$46$re$95$m - x$46$im), $MachinePrecision] * N[(x$46$re$95$m - x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$46$re$95$s * If[LessEqual[x$46$im, 750000000.0], t$95$1, If[LessEqual[x$46$im, 8.2e+81], t$95$0, If[LessEqual[x$46$im, 5e+108], t$95$1, If[LessEqual[x$46$im, 1.42e+147], N[(x$46$im * N[(x$46$re$95$m * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x$46$im, 1.1e+148], And[N[Not[LessEqual[x$46$im, 9e+181]], $MachinePrecision], LessEqual[x$46$im, 9.5e+181]]], t$95$1, t$95$0]]]]]), $MachinePrecision]]]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)

\\
\begin{array}{l}
t_0 := \left(x.re\_m \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\
t_1 := x.re\_m \cdot \left(\left(x.re\_m - x.im\right) \cdot \left(x.re\_m - x.im\right)\right)\\
x.re\_s \cdot \begin{array}{l}
\mathbf{if}\;x.im \leq 750000000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x.im \leq 8.2 \cdot 10^{+81}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x.im \leq 5 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x.im \leq 1.1 \cdot 10^{+148} \lor \neg \left(x.im \leq 9 \cdot 10^{+181}\right) \land x.im \leq 9.5 \cdot 10^{+181}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.im < 7.5e8 or 8.20000000000000024e81 < x.im < 4.99999999999999991e108 or 1.42e147 < x.im < 1.0999999999999999e148 or 9e181 < x.im < 9.50000000000000032e181

    1. Initial program 82.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. Add Preprocessing
    3. Step-by-step derivation
      1. difference-of-squares81.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.5e8 < x.im < 8.20000000000000024e81 or 1.0999999999999999e148 < x.im < 9e181 or 9.50000000000000032e181 < x.im

    1. Initial program 57.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. Simplified49.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log \left(e^{-3 \cdot \left(x.im \cdot x.re\right)}\right)} \cdot x.im \]
      4. *-un-lft-identity41.9%

        \[\leadsto \log \color{blue}{\left(1 \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right)} \cdot x.im \]
      5. 1-exp41.9%

        \[\leadsto \log \left(\color{blue}{e^{0}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      6. mul0-lft41.9%

        \[\leadsto \log \left(e^{\color{blue}{0 \cdot x.re}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      7. *-commutative41.9%

        \[\leadsto \log \left(e^{\color{blue}{x.re \cdot 0}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      8. mul0-lft41.9%

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

        \[\leadsto \log \left(e^{x.re \cdot \left(\color{blue}{\left(-1 + 1\right)} \cdot x.re\right)} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      10. distribute-rgt1-in41.9%

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

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

        \[\leadsto \log \left(e^{\color{blue}{-3 \cdot \left(x.im \cdot x.re\right) + x.re \cdot \left(x.re + -1 \cdot x.re\right)}}\right) \cdot x.im \]
      13. add-log-exp79.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.99999999999999991e108 < x.im < 1.42e147

    1. Initial program 85.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \log \left(e^{x.re \cdot \left(\color{blue}{\left(-1 + 1\right)} \cdot x.re\right)} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      10. distribute-rgt1-in31.0%

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

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

        \[\leadsto \log \left(e^{\color{blue}{-3 \cdot \left(x.im \cdot x.re\right) + x.re \cdot \left(x.re + -1 \cdot x.re\right)}}\right) \cdot x.im \]
      13. add-log-exp85.3%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq 750000000:\\ \;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re - x.im\right)\right)\\ \mathbf{elif}\;x.im \leq 8.2 \cdot 10^{+81}:\\ \;\;\;\;\left(x.re \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\ \mathbf{elif}\;x.im \leq 5 \cdot 10^{+108}:\\ \;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re - x.im\right)\right)\\ \mathbf{elif}\;x.im \leq 1.42 \cdot 10^{+147}:\\ \;\;\;\;x.im \cdot \left(x.re \cdot \left(x.im \cdot -3\right)\right)\\ \mathbf{elif}\;x.im \leq 1.1 \cdot 10^{+148} \lor \neg \left(x.im \leq 9 \cdot 10^{+181}\right) \land x.im \leq 9.5 \cdot 10^{+181}:\\ \;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re - x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 70.2% accurate, 0.4× speedup?

\[\begin{array}{l} x.re\_m = \left|x.re\right| \\ x.re\_s = \mathsf{copysign}\left(1, x.re\right) \\ \begin{array}{l} t_0 := \left(x.re\_m \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\ t_1 := x.re\_m \cdot \left(\left(x.re\_m - x.im\right) \cdot \left(x.re\_m - x.im\right)\right)\\ x.re\_s \cdot \begin{array}{l} \mathbf{if}\;x.im \leq 5800000000:\\ \;\;\;\;\left(x.re\_m - x.im\right) \cdot \left(x.re\_m \cdot \left(x.re\_m - x.im\right)\right)\\ \mathbf{elif}\;x.im \leq 2 \cdot 10^{+82}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x.im \leq 5.2 \cdot 10^{+108}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x.im \leq 1.42 \cdot 10^{+147}:\\ \;\;\;\;x.im \cdot \left(x.re\_m \cdot \left(x.im \cdot -3\right)\right)\\ \mathbf{elif}\;x.im \leq 1.05 \cdot 10^{+148}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x.im \leq 9 \cdot 10^{+181}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x.im \leq 1.45 \cdot 10^{+182}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x.im \cdot \left(x.im \cdot \left(x.re\_m \cdot -3\right)\right)\\ \end{array} \end{array} \end{array} \]
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
 :precision binary64
 (let* ((t_0 (* (* x.re_m x.im) (* x.im -3.0)))
        (t_1 (* x.re_m (* (- x.re_m x.im) (- x.re_m x.im)))))
   (*
    x.re_s
    (if (<= x.im 5800000000.0)
      (* (- x.re_m x.im) (* x.re_m (- x.re_m x.im)))
      (if (<= x.im 2e+82)
        t_0
        (if (<= x.im 5.2e+108)
          t_1
          (if (<= x.im 1.42e+147)
            (* x.im (* x.re_m (* x.im -3.0)))
            (if (<= x.im 1.05e+148)
              t_1
              (if (<= x.im 9e+181)
                t_0
                (if (<= x.im 1.45e+182)
                  t_1
                  (* x.im (* x.im (* x.re_m -3.0)))))))))))))
x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
	double t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
	double t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im));
	double tmp;
	if (x_46_im <= 5800000000.0) {
		tmp = (x_46_re_m - x_46_im) * (x_46_re_m * (x_46_re_m - x_46_im));
	} else if (x_46_im <= 2e+82) {
		tmp = t_0;
	} else if (x_46_im <= 5.2e+108) {
		tmp = t_1;
	} else if (x_46_im <= 1.42e+147) {
		tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0));
	} else if (x_46_im <= 1.05e+148) {
		tmp = t_1;
	} else if (x_46_im <= 9e+181) {
		tmp = t_0;
	} else if (x_46_im <= 1.45e+182) {
		tmp = t_1;
	} else {
		tmp = x_46_im * (x_46_im * (x_46_re_m * -3.0));
	}
	return x_46_re_s * tmp;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
    real(8), intent (in) :: x_46re_s
    real(8), intent (in) :: x_46re_m
    real(8), intent (in) :: x_46im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (x_46re_m * x_46im) * (x_46im * (-3.0d0))
    t_1 = x_46re_m * ((x_46re_m - x_46im) * (x_46re_m - x_46im))
    if (x_46im <= 5800000000.0d0) then
        tmp = (x_46re_m - x_46im) * (x_46re_m * (x_46re_m - x_46im))
    else if (x_46im <= 2d+82) then
        tmp = t_0
    else if (x_46im <= 5.2d+108) then
        tmp = t_1
    else if (x_46im <= 1.42d+147) then
        tmp = x_46im * (x_46re_m * (x_46im * (-3.0d0)))
    else if (x_46im <= 1.05d+148) then
        tmp = t_1
    else if (x_46im <= 9d+181) then
        tmp = t_0
    else if (x_46im <= 1.45d+182) then
        tmp = t_1
    else
        tmp = x_46im * (x_46im * (x_46re_m * (-3.0d0)))
    end if
    code = x_46re_s * tmp
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
	double t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
	double t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im));
	double tmp;
	if (x_46_im <= 5800000000.0) {
		tmp = (x_46_re_m - x_46_im) * (x_46_re_m * (x_46_re_m - x_46_im));
	} else if (x_46_im <= 2e+82) {
		tmp = t_0;
	} else if (x_46_im <= 5.2e+108) {
		tmp = t_1;
	} else if (x_46_im <= 1.42e+147) {
		tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0));
	} else if (x_46_im <= 1.05e+148) {
		tmp = t_1;
	} else if (x_46_im <= 9e+181) {
		tmp = t_0;
	} else if (x_46_im <= 1.45e+182) {
		tmp = t_1;
	} else {
		tmp = x_46_im * (x_46_im * (x_46_re_m * -3.0));
	}
	return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re)
x.re\_s = math.copysign(1.0, x_46_re)
def code(x_46_re_s, x_46_re_m, x_46_im):
	t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0)
	t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im))
	tmp = 0
	if x_46_im <= 5800000000.0:
		tmp = (x_46_re_m - x_46_im) * (x_46_re_m * (x_46_re_m - x_46_im))
	elif x_46_im <= 2e+82:
		tmp = t_0
	elif x_46_im <= 5.2e+108:
		tmp = t_1
	elif x_46_im <= 1.42e+147:
		tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0))
	elif x_46_im <= 1.05e+148:
		tmp = t_1
	elif x_46_im <= 9e+181:
		tmp = t_0
	elif x_46_im <= 1.45e+182:
		tmp = t_1
	else:
		tmp = x_46_im * (x_46_im * (x_46_re_m * -3.0))
	return x_46_re_s * tmp
x.re\_m = abs(x_46_re)
x.re\_s = copysign(1.0, x_46_re)
function code(x_46_re_s, x_46_re_m, x_46_im)
	t_0 = Float64(Float64(x_46_re_m * x_46_im) * Float64(x_46_im * -3.0))
	t_1 = Float64(x_46_re_m * Float64(Float64(x_46_re_m - x_46_im) * Float64(x_46_re_m - x_46_im)))
	tmp = 0.0
	if (x_46_im <= 5800000000.0)
		tmp = Float64(Float64(x_46_re_m - x_46_im) * Float64(x_46_re_m * Float64(x_46_re_m - x_46_im)));
	elseif (x_46_im <= 2e+82)
		tmp = t_0;
	elseif (x_46_im <= 5.2e+108)
		tmp = t_1;
	elseif (x_46_im <= 1.42e+147)
		tmp = Float64(x_46_im * Float64(x_46_re_m * Float64(x_46_im * -3.0)));
	elseif (x_46_im <= 1.05e+148)
		tmp = t_1;
	elseif (x_46_im <= 9e+181)
		tmp = t_0;
	elseif (x_46_im <= 1.45e+182)
		tmp = t_1;
	else
		tmp = Float64(x_46_im * Float64(x_46_im * Float64(x_46_re_m * -3.0)));
	end
	return Float64(x_46_re_s * tmp)
end
x.re\_m = abs(x_46_re);
x.re\_s = sign(x_46_re) * abs(1.0);
function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im)
	t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
	t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im));
	tmp = 0.0;
	if (x_46_im <= 5800000000.0)
		tmp = (x_46_re_m - x_46_im) * (x_46_re_m * (x_46_re_m - x_46_im));
	elseif (x_46_im <= 2e+82)
		tmp = t_0;
	elseif (x_46_im <= 5.2e+108)
		tmp = t_1;
	elseif (x_46_im <= 1.42e+147)
		tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0));
	elseif (x_46_im <= 1.05e+148)
		tmp = t_1;
	elseif (x_46_im <= 9e+181)
		tmp = t_0;
	elseif (x_46_im <= 1.45e+182)
		tmp = t_1;
	else
		tmp = x_46_im * (x_46_im * (x_46_re_m * -3.0));
	end
	tmp_2 = x_46_re_s * tmp;
end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := Block[{t$95$0 = N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x$46$re$95$m * N[(N[(x$46$re$95$m - x$46$im), $MachinePrecision] * N[(x$46$re$95$m - x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$46$re$95$s * If[LessEqual[x$46$im, 5800000000.0], N[(N[(x$46$re$95$m - x$46$im), $MachinePrecision] * N[(x$46$re$95$m * N[(x$46$re$95$m - x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 2e+82], t$95$0, If[LessEqual[x$46$im, 5.2e+108], t$95$1, If[LessEqual[x$46$im, 1.42e+147], N[(x$46$im * N[(x$46$re$95$m * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 1.05e+148], t$95$1, If[LessEqual[x$46$im, 9e+181], t$95$0, If[LessEqual[x$46$im, 1.45e+182], t$95$1, N[(x$46$im * N[(x$46$im * N[(x$46$re$95$m * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]), $MachinePrecision]]]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)

\\
\begin{array}{l}
t_0 := \left(x.re\_m \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\
t_1 := x.re\_m \cdot \left(\left(x.re\_m - x.im\right) \cdot \left(x.re\_m - x.im\right)\right)\\
x.re\_s \cdot \begin{array}{l}
\mathbf{if}\;x.im \leq 5800000000:\\
\;\;\;\;\left(x.re\_m - x.im\right) \cdot \left(x.re\_m \cdot \left(x.re\_m - x.im\right)\right)\\

\mathbf{elif}\;x.im \leq 2 \cdot 10^{+82}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x.im \leq 5.2 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x.im \leq 1.05 \cdot 10^{+148}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x.im \leq 9 \cdot 10^{+181}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x.im \leq 1.45 \cdot 10^{+182}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if x.im < 5.8e9

    1. Initial program 83.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. Add Preprocessing
    3. Step-by-step derivation
      1. difference-of-squares82.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x.re - x.im, x.re \cdot \left(x.im + x.re\right), \left(-\color{blue}{x.re \cdot \left(x.im \cdot 2\right)}\right) \cdot x.im\right) \]
    8. Applied egg-rr92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(x.re \cdot \left(x.re - x.im\right)\right) \cdot x.re + \left(x.re \cdot \left(x.re - x.im\right)\right) \cdot \left(-x.im\right)} \]
    15. Step-by-step derivation
      1. distribute-lft-out63.5%

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

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

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

    if 5.8e9 < x.im < 1.9999999999999999e82 or 1.04999999999999999e148 < x.im < 9e181

    1. Initial program 80.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. Simplified80.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \log \left(e^{\color{blue}{x.re \cdot 0}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      8. mul0-lft17.2%

        \[\leadsto \log \left(e^{x.re \cdot \color{blue}{\left(0 \cdot x.re\right)}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      9. metadata-eval17.2%

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

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

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

        \[\leadsto \log \left(e^{\color{blue}{-3 \cdot \left(x.im \cdot x.re\right) + x.re \cdot \left(x.re + -1 \cdot x.re\right)}}\right) \cdot x.im \]
      13. add-log-exp69.7%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(-3 \cdot \left(x.im \cdot x.re\right), x.im, \left(x.re \cdot \left(x.re + -1 \cdot x.re\right)\right) \cdot x.im\right)} \]
    10. Applied egg-rr69.7%

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

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

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

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

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

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

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

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

    if 1.9999999999999999e82 < x.im < 5.2000000000000005e108 or 1.42e147 < x.im < 1.04999999999999999e148 or 9e181 < x.im < 1.4499999999999999e182

    1. Initial program 39.7%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. difference-of-squares67.1%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x.re - x.im, x.re \cdot \left(x.re + x.im\right), \left(-\left(x.re \cdot x.im\right) \cdot 2\right) \cdot x.im\right)} \]
      5. +-commutative39.7%

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

        \[\leadsto \mathsf{fma}\left(x.re - x.im, x.re \cdot \left(x.im + x.re\right), \left(-\color{blue}{x.re \cdot \left(x.im \cdot 2\right)}\right) \cdot x.im\right) \]
    8. Applied egg-rr39.7%

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

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

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

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

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

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

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

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

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

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

    if 5.2000000000000005e108 < x.im < 1.42e147

    1. Initial program 85.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \log \left(e^{x.re \cdot \left(\color{blue}{\left(-1 + 1\right)} \cdot x.re\right)} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      10. distribute-rgt1-in31.0%

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

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

        \[\leadsto \log \left(e^{\color{blue}{-3 \cdot \left(x.im \cdot x.re\right) + x.re \cdot \left(x.re + -1 \cdot x.re\right)}}\right) \cdot x.im \]
      13. add-log-exp85.3%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4499999999999999e182 < x.im

    1. Initial program 41.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. Simplified28.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log \left(e^{-3 \cdot \left(x.im \cdot x.re\right)}\right)} \cdot x.im \]
      4. *-un-lft-identity58.4%

        \[\leadsto \log \color{blue}{\left(1 \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right)} \cdot x.im \]
      5. 1-exp58.4%

        \[\leadsto \log \left(\color{blue}{e^{0}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      6. mul0-lft58.4%

        \[\leadsto \log \left(e^{\color{blue}{0 \cdot x.re}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      7. *-commutative58.4%

        \[\leadsto \log \left(e^{\color{blue}{x.re \cdot 0}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      8. mul0-lft58.4%

        \[\leadsto \log \left(e^{x.re \cdot \color{blue}{\left(0 \cdot x.re\right)}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      9. metadata-eval58.4%

        \[\leadsto \log \left(e^{x.re \cdot \left(\color{blue}{\left(-1 + 1\right)} \cdot x.re\right)} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
      10. distribute-rgt1-in58.4%

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

        \[\leadsto \log \color{blue}{\left(e^{x.re \cdot \left(x.re + -1 \cdot x.re\right) + -3 \cdot \left(x.im \cdot x.re\right)}\right)} \cdot x.im \]
      12. +-commutative58.4%

        \[\leadsto \log \left(e^{\color{blue}{-3 \cdot \left(x.im \cdot x.re\right) + x.re \cdot \left(x.re + -1 \cdot x.re\right)}}\right) \cdot x.im \]
      13. add-log-exp86.6%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(-3 \cdot \left(x.im \cdot x.re\right), x.im, \left(x.re \cdot \left(x.re + -1 \cdot x.re\right)\right) \cdot x.im\right)} \]
    10. Applied egg-rr86.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(x.re \cdot \left(x.im \cdot -3\right)\right)} \cdot x.im \]
    12. Applied egg-rr86.6%

      \[\leadsto \color{blue}{\left(x.re \cdot \left(x.im \cdot -3\right)\right) \cdot x.im} \]
    13. Step-by-step derivation
      1. add-log-exp58.4%

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

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

        \[\leadsto \color{blue}{\left(\log 1 + \log \left(e^{x.re \cdot \left(x.im \cdot -3\right)}\right)\right)} \cdot x.im \]
      4. metadata-eval58.4%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq 5800000000:\\ \;\;\;\;\left(x.re - x.im\right) \cdot \left(x.re \cdot \left(x.re - x.im\right)\right)\\ \mathbf{elif}\;x.im \leq 2 \cdot 10^{+82}:\\ \;\;\;\;\left(x.re \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\ \mathbf{elif}\;x.im \leq 5.2 \cdot 10^{+108}:\\ \;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re - x.im\right)\right)\\ \mathbf{elif}\;x.im \leq 1.42 \cdot 10^{+147}:\\ \;\;\;\;x.im \cdot \left(x.re \cdot \left(x.im \cdot -3\right)\right)\\ \mathbf{elif}\;x.im \leq 1.05 \cdot 10^{+148}:\\ \;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re - x.im\right)\right)\\ \mathbf{elif}\;x.im \leq 9 \cdot 10^{+181}:\\ \;\;\;\;\left(x.re \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\ \mathbf{elif}\;x.im \leq 1.45 \cdot 10^{+182}:\\ \;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re - x.im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x.im \cdot \left(x.im \cdot \left(x.re \cdot -3\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 55.9% accurate, 2.7× speedup?

\[\begin{array}{l} x.re\_m = \left|x.re\right| \\ x.re\_s = \mathsf{copysign}\left(1, x.re\right) \\ x.re\_s \cdot \left(\left(x.re\_m \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\right) \end{array} \]
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
 :precision binary64
 (* x.re_s (* (* x.re_m x.im) (* x.im -3.0))))
x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
	return x_46_re_s * ((x_46_re_m * x_46_im) * (x_46_im * -3.0));
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
    real(8), intent (in) :: x_46re_s
    real(8), intent (in) :: x_46re_m
    real(8), intent (in) :: x_46im
    code = x_46re_s * ((x_46re_m * x_46im) * (x_46im * (-3.0d0)))
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
	return x_46_re_s * ((x_46_re_m * x_46_im) * (x_46_im * -3.0));
}
x.re\_m = math.fabs(x_46_re)
x.re\_s = math.copysign(1.0, x_46_re)
def code(x_46_re_s, x_46_re_m, x_46_im):
	return x_46_re_s * ((x_46_re_m * x_46_im) * (x_46_im * -3.0))
x.re\_m = abs(x_46_re)
x.re\_s = copysign(1.0, x_46_re)
function code(x_46_re_s, x_46_re_m, x_46_im)
	return Float64(x_46_re_s * Float64(Float64(x_46_re_m * x_46_im) * Float64(x_46_im * -3.0)))
end
x.re\_m = abs(x_46_re);
x.re\_s = sign(x_46_re) * abs(1.0);
function tmp = code(x_46_re_s, x_46_re_m, x_46_im)
	tmp = x_46_re_s * ((x_46_re_m * x_46_im) * (x_46_im * -3.0));
end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)

\\
x.re\_s \cdot \left(\left(x.re\_m \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\right)
\end{array}
Derivation
  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. Simplified73.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \log \left(e^{\color{blue}{x.re \cdot 0}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
    8. mul0-lft34.2%

      \[\leadsto \log \left(e^{x.re \cdot \color{blue}{\left(0 \cdot x.re\right)}} \cdot e^{-3 \cdot \left(x.im \cdot x.re\right)}\right) \cdot x.im \]
    9. metadata-eval34.2%

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

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

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

      \[\leadsto \log \left(e^{\color{blue}{-3 \cdot \left(x.im \cdot x.re\right) + x.re \cdot \left(x.re + -1 \cdot x.re\right)}}\right) \cdot x.im \]
    13. add-log-exp57.8%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \left(x.re \cdot x.im\right) \cdot \left(x.im \cdot -3\right) \]
  14. Add Preprocessing

Alternative 9: 55.9% accurate, 2.7× speedup?

\[\begin{array}{l} x.re\_m = \left|x.re\right| \\ x.re\_s = \mathsf{copysign}\left(1, x.re\right) \\ x.re\_s \cdot \left(-3 \cdot \left(x.im \cdot \left(x.re\_m \cdot x.im\right)\right)\right) \end{array} \]
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
 :precision binary64
 (* x.re_s (* -3.0 (* x.im (* x.re_m x.im)))))
x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
	return x_46_re_s * (-3.0 * (x_46_im * (x_46_re_m * x_46_im)));
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
    real(8), intent (in) :: x_46re_s
    real(8), intent (in) :: x_46re_m
    real(8), intent (in) :: x_46im
    code = x_46re_s * ((-3.0d0) * (x_46im * (x_46re_m * x_46im)))
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
	return x_46_re_s * (-3.0 * (x_46_im * (x_46_re_m * x_46_im)));
}
x.re\_m = math.fabs(x_46_re)
x.re\_s = math.copysign(1.0, x_46_re)
def code(x_46_re_s, x_46_re_m, x_46_im):
	return x_46_re_s * (-3.0 * (x_46_im * (x_46_re_m * x_46_im)))
x.re\_m = abs(x_46_re)
x.re\_s = copysign(1.0, x_46_re)
function code(x_46_re_s, x_46_re_m, x_46_im)
	return Float64(x_46_re_s * Float64(-3.0 * Float64(x_46_im * Float64(x_46_re_m * x_46_im))))
end
x.re\_m = abs(x_46_re);
x.re\_s = sign(x_46_re) * abs(1.0);
function tmp = code(x_46_re_s, x_46_re_m, x_46_im)
	tmp = x_46_re_s * (-3.0 * (x_46_im * (x_46_re_m * x_46_im)));
end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * N[(-3.0 * N[(x$46$im * N[(x$46$re$95$m * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)

\\
x.re\_s \cdot \left(-3 \cdot \left(x.im \cdot \left(x.re\_m \cdot x.im\right)\right)\right)
\end{array}
Derivation
  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. Simplified73.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto -3 \cdot \left(x.im \cdot \left(x.re \cdot x.im\right)\right) \]
  10. Add Preprocessing

Alternative 10: 3.6% accurate, 19.0× speedup?

\[\begin{array}{l} x.re\_m = \left|x.re\right| \\ x.re\_s = \mathsf{copysign}\left(1, x.re\right) \\ x.re\_s \cdot x.im \end{array} \]
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im) :precision binary64 (* x.re_s x.im))
x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
	return x_46_re_s * x_46_im;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
    real(8), intent (in) :: x_46re_s
    real(8), intent (in) :: x_46re_m
    real(8), intent (in) :: x_46im
    code = x_46re_s * x_46im
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
	return x_46_re_s * x_46_im;
}
x.re\_m = math.fabs(x_46_re)
x.re\_s = math.copysign(1.0, x_46_re)
def code(x_46_re_s, x_46_re_m, x_46_im):
	return x_46_re_s * x_46_im
x.re\_m = abs(x_46_re)
x.re\_s = copysign(1.0, x_46_re)
function code(x_46_re_s, x_46_re_m, x_46_im)
	return Float64(x_46_re_s * x_46_im)
end
x.re\_m = abs(x_46_re);
x.re\_s = sign(x_46_re) * abs(1.0);
function tmp = code(x_46_re_s, x_46_re_m, x_46_im)
	tmp = x_46_re_s * x_46_im;
end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * x$46$im), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)

\\
x.re\_s \cdot x.im
\end{array}
Derivation
  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. Add Preprocessing
  3. Step-by-step derivation
    1. difference-of-squares77.7%

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(x.re - x.im, \left(x.re + x.im\right) \cdot x.re, -\color{blue}{x.im \cdot \left(x.re \cdot x.im + x.im \cdot x.re\right)}\right) \]
    4. distribute-rgt-neg-in90.1%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(x.re - x.im, \left(x.re + x.im\right) \cdot x.re, x.im \cdot \frac{0}{0}\right)} \]
  7. Simplified64.1%

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

    \[\leadsto \color{blue}{x.im} \]
  9. Add Preprocessing

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

  :alt
  (+ (* (* 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)))