math.sin on complex, imaginary part

Percentage Accurate: 53.5% → 99.9%
Time: 19.9s
Alternatives: 19
Speedup: 20.6×

Specification

?
\[\begin{array}{l} \\ \left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \end{array} \]
(FPCore (re im)
 :precision binary64
 (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
	return (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im));
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    code = (0.5d0 * cos(re)) * (exp((0.0d0 - im)) - exp(im))
end function
public static double code(double re, double im) {
	return (0.5 * Math.cos(re)) * (Math.exp((0.0 - im)) - Math.exp(im));
}
def code(re, im):
	return (0.5 * math.cos(re)) * (math.exp((0.0 - im)) - math.exp(im))
function code(re, im)
	return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(0.0 - im)) - exp(im)))
end
function tmp = code(re, im)
	tmp = (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im));
end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)
\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 19 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: 53.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \end{array} \]
(FPCore (re im)
 :precision binary64
 (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
	return (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im));
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    code = (0.5d0 * cos(re)) * (exp((0.0d0 - im)) - exp(im))
end function
public static double code(double re, double im) {
	return (0.5 * Math.cos(re)) * (Math.exp((0.0 - im)) - Math.exp(im));
}
def code(re, im):
	return (0.5 * math.cos(re)) * (math.exp((0.0 - im)) - math.exp(im))
function code(re, im)
	return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(0.0 - im)) - exp(im)))
end
function tmp = code(re, im)
	tmp = (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im));
end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)
\end{array}

Alternative 1: 99.9% accurate, 0.6× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := e^{-im\_m} - e^{im\_m}\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq -0.4:\\ \;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;\cos re \cdot \left(im\_m \cdot \left(\left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im\_m \cdot im\_m\right) \cdot \left(im\_m \cdot im\_m\right)\right) \cdot \left(im\_m \cdot \left(im\_m \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right)\\ \end{array} \end{array} \end{array} \]
im\_m = (fabs.f64 im)
im\_s = (copysign.f64 #s(literal 1 binary64) im)
(FPCore (im_s re im_m)
 :precision binary64
 (let* ((t_0 (- (exp (- im_m)) (exp im_m))))
   (*
    im_s
    (if (<= t_0 -0.4)
      (* (* 0.5 (cos re)) t_0)
      (*
       (cos re)
       (*
        im_m
        (+
         (* (* im_m im_m) -0.16666666666666666)
         (+
          -1.0
          (*
           (* (* im_m im_m) (* im_m im_m))
           (+
            (* im_m (* im_m -0.0001984126984126984))
            -0.008333333333333333))))))))))
im\_m = fabs(im);
im\_s = copysign(1.0, im);
double code(double im_s, double re, double im_m) {
	double t_0 = exp(-im_m) - exp(im_m);
	double tmp;
	if (t_0 <= -0.4) {
		tmp = (0.5 * cos(re)) * t_0;
	} else {
		tmp = cos(re) * (im_m * (((im_m * im_m) * -0.16666666666666666) + (-1.0 + (((im_m * im_m) * (im_m * im_m)) * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333)))));
	}
	return im_s * tmp;
}
im\_m = abs(im)
im\_s = copysign(1.0d0, im)
real(8) function code(im_s, re, im_m)
    real(8), intent (in) :: im_s
    real(8), intent (in) :: re
    real(8), intent (in) :: im_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = exp(-im_m) - exp(im_m)
    if (t_0 <= (-0.4d0)) then
        tmp = (0.5d0 * cos(re)) * t_0
    else
        tmp = cos(re) * (im_m * (((im_m * im_m) * (-0.16666666666666666d0)) + ((-1.0d0) + (((im_m * im_m) * (im_m * im_m)) * ((im_m * (im_m * (-0.0001984126984126984d0))) + (-0.008333333333333333d0))))))
    end if
    code = im_s * tmp
end function
im\_m = Math.abs(im);
im\_s = Math.copySign(1.0, im);
public static double code(double im_s, double re, double im_m) {
	double t_0 = Math.exp(-im_m) - Math.exp(im_m);
	double tmp;
	if (t_0 <= -0.4) {
		tmp = (0.5 * Math.cos(re)) * t_0;
	} else {
		tmp = Math.cos(re) * (im_m * (((im_m * im_m) * -0.16666666666666666) + (-1.0 + (((im_m * im_m) * (im_m * im_m)) * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333)))));
	}
	return im_s * tmp;
}
im\_m = math.fabs(im)
im\_s = math.copysign(1.0, im)
def code(im_s, re, im_m):
	t_0 = math.exp(-im_m) - math.exp(im_m)
	tmp = 0
	if t_0 <= -0.4:
		tmp = (0.5 * math.cos(re)) * t_0
	else:
		tmp = math.cos(re) * (im_m * (((im_m * im_m) * -0.16666666666666666) + (-1.0 + (((im_m * im_m) * (im_m * im_m)) * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333)))))
	return im_s * tmp
im\_m = abs(im)
im\_s = copysign(1.0, im)
function code(im_s, re, im_m)
	t_0 = Float64(exp(Float64(-im_m)) - exp(im_m))
	tmp = 0.0
	if (t_0 <= -0.4)
		tmp = Float64(Float64(0.5 * cos(re)) * t_0);
	else
		tmp = Float64(cos(re) * Float64(im_m * Float64(Float64(Float64(im_m * im_m) * -0.16666666666666666) + Float64(-1.0 + Float64(Float64(Float64(im_m * im_m) * Float64(im_m * im_m)) * Float64(Float64(im_m * Float64(im_m * -0.0001984126984126984)) + -0.008333333333333333))))));
	end
	return Float64(im_s * tmp)
end
im\_m = abs(im);
im\_s = sign(im) * abs(1.0);
function tmp_2 = code(im_s, re, im_m)
	t_0 = exp(-im_m) - exp(im_m);
	tmp = 0.0;
	if (t_0 <= -0.4)
		tmp = (0.5 * cos(re)) * t_0;
	else
		tmp = cos(re) * (im_m * (((im_m * im_m) * -0.16666666666666666) + (-1.0 + (((im_m * im_m) * (im_m * im_m)) * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333)))));
	end
	tmp_2 = im_s * tmp;
end
im\_m = N[Abs[im], $MachinePrecision]
im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[im$95$s_, re_, im$95$m_] := Block[{t$95$0 = N[(N[Exp[(-im$95$m)], $MachinePrecision] - N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[t$95$0, -0.4], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(im$95$m * N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + N[(-1.0 + N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(im$95$m * N[(im$95$m * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision] + -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
im\_m = \left|im\right|
\\
im\_s = \mathsf{copysign}\left(1, im\right)

\\
\begin{array}{l}
t_0 := e^{-im\_m} - e^{im\_m}\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq -0.4:\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t\_0\\

\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(im\_m \cdot \left(\left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im\_m \cdot im\_m\right) \cdot \left(im\_m \cdot im\_m\right)\right) \cdot \left(im\_m \cdot \left(im\_m \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right)\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im)) < -0.40000000000000002

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing

    if -0.40000000000000002 < (-.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))

    1. Initial program 44.4%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub044.4%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified44.4%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 97.8%

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative97.8%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + -1 \cdot \cos re\right)} \]
      2. +-commutative97.8%

        \[\leadsto im \cdot \left({im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right) + -0.16666666666666666 \cdot \cos re\right)} + -1 \cdot \cos re\right) \]
      3. distribute-rgt-in97.8%

        \[\leadsto im \cdot \left(\color{blue}{\left(\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right)} + -1 \cdot \cos re\right) \]
      4. *-commutative97.8%

        \[\leadsto im \cdot \left(\left(\color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
      5. associate-+l+97.8%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2} + -1 \cdot \cos re\right)\right)} \]
    7. Simplified97.8%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right)} \]
    8. Step-by-step derivation
      1. *-commutative97.8%

        \[\leadsto im \cdot \color{blue}{\left(\left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot \cos re\right)} \]
      2. associate-*r*97.8%

        \[\leadsto \color{blue}{\left(im \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right) \cdot \cos re} \]
      3. +-commutative97.8%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)}\right) \cdot \cos re \]
      4. +-commutative97.8%

        \[\leadsto \left(im \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)} + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \cos re \]
      5. associate-+l+97.8%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)}\right) \cdot \cos re \]
      6. *-commutative97.8%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \color{blue}{\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)}\right)\right)\right) \cdot \cos re \]
      7. +-commutative97.8%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)}\right)\right)\right) \cdot \cos re \]
    9. Applied egg-rr97.8%

      \[\leadsto \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \cdot \cos re} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{-im} - e^{im} \leq -0.4:\\ \;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;\cos re \cdot \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 98.2% accurate, 1.4× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 0.88:\\ \;\;\;\;\cos re \cdot \left(im\_m \cdot \left(\left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im\_m \cdot im\_m\right) \cdot \left(im\_m \cdot im\_m\right)\right) \cdot \left(im\_m \cdot \left(im\_m \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right)\\ \mathbf{elif}\;im\_m \leq 3.6 \cdot 10^{+44}:\\ \;\;\;\;0.5 \cdot \left(e^{-im\_m} - e^{im\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;im\_m \cdot \left(\cos re \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + im\_m \cdot \left(im\_m \cdot \left(-0.008333333333333333 + \left(im\_m \cdot im\_m\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right)\\ \end{array} \end{array} \]
im\_m = (fabs.f64 im)
im\_s = (copysign.f64 #s(literal 1 binary64) im)
(FPCore (im_s re im_m)
 :precision binary64
 (*
  im_s
  (if (<= im_m 0.88)
    (*
     (cos re)
     (*
      im_m
      (+
       (* (* im_m im_m) -0.16666666666666666)
       (+
        -1.0
        (*
         (* (* im_m im_m) (* im_m im_m))
         (+
          (* im_m (* im_m -0.0001984126984126984))
          -0.008333333333333333))))))
    (if (<= im_m 3.6e+44)
      (* 0.5 (- (exp (- im_m)) (exp im_m)))
      (*
       im_m
       (*
        (cos re)
        (+
         -1.0
         (*
          (* im_m im_m)
          (+
           -0.16666666666666666
           (*
            im_m
            (*
             im_m
             (+
              -0.008333333333333333
              (* (* im_m im_m) -0.0001984126984126984)))))))))))))
im\_m = fabs(im);
im\_s = copysign(1.0, im);
double code(double im_s, double re, double im_m) {
	double tmp;
	if (im_m <= 0.88) {
		tmp = cos(re) * (im_m * (((im_m * im_m) * -0.16666666666666666) + (-1.0 + (((im_m * im_m) * (im_m * im_m)) * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333)))));
	} else if (im_m <= 3.6e+44) {
		tmp = 0.5 * (exp(-im_m) - exp(im_m));
	} else {
		tmp = im_m * (cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))))));
	}
	return im_s * tmp;
}
im\_m = abs(im)
im\_s = copysign(1.0d0, im)
real(8) function code(im_s, re, im_m)
    real(8), intent (in) :: im_s
    real(8), intent (in) :: re
    real(8), intent (in) :: im_m
    real(8) :: tmp
    if (im_m <= 0.88d0) then
        tmp = cos(re) * (im_m * (((im_m * im_m) * (-0.16666666666666666d0)) + ((-1.0d0) + (((im_m * im_m) * (im_m * im_m)) * ((im_m * (im_m * (-0.0001984126984126984d0))) + (-0.008333333333333333d0))))))
    else if (im_m <= 3.6d+44) then
        tmp = 0.5d0 * (exp(-im_m) - exp(im_m))
    else
        tmp = im_m * (cos(re) * ((-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + (im_m * (im_m * ((-0.008333333333333333d0) + ((im_m * im_m) * (-0.0001984126984126984d0)))))))))
    end if
    code = im_s * tmp
end function
im\_m = Math.abs(im);
im\_s = Math.copySign(1.0, im);
public static double code(double im_s, double re, double im_m) {
	double tmp;
	if (im_m <= 0.88) {
		tmp = Math.cos(re) * (im_m * (((im_m * im_m) * -0.16666666666666666) + (-1.0 + (((im_m * im_m) * (im_m * im_m)) * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333)))));
	} else if (im_m <= 3.6e+44) {
		tmp = 0.5 * (Math.exp(-im_m) - Math.exp(im_m));
	} else {
		tmp = im_m * (Math.cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))))));
	}
	return im_s * tmp;
}
im\_m = math.fabs(im)
im\_s = math.copysign(1.0, im)
def code(im_s, re, im_m):
	tmp = 0
	if im_m <= 0.88:
		tmp = math.cos(re) * (im_m * (((im_m * im_m) * -0.16666666666666666) + (-1.0 + (((im_m * im_m) * (im_m * im_m)) * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333)))))
	elif im_m <= 3.6e+44:
		tmp = 0.5 * (math.exp(-im_m) - math.exp(im_m))
	else:
		tmp = im_m * (math.cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))))))
	return im_s * tmp
im\_m = abs(im)
im\_s = copysign(1.0, im)
function code(im_s, re, im_m)
	tmp = 0.0
	if (im_m <= 0.88)
		tmp = Float64(cos(re) * Float64(im_m * Float64(Float64(Float64(im_m * im_m) * -0.16666666666666666) + Float64(-1.0 + Float64(Float64(Float64(im_m * im_m) * Float64(im_m * im_m)) * Float64(Float64(im_m * Float64(im_m * -0.0001984126984126984)) + -0.008333333333333333))))));
	elseif (im_m <= 3.6e+44)
		tmp = Float64(0.5 * Float64(exp(Float64(-im_m)) - exp(im_m)));
	else
		tmp = Float64(im_m * Float64(cos(re) * Float64(-1.0 + Float64(Float64(im_m * im_m) * Float64(-0.16666666666666666 + Float64(im_m * Float64(im_m * Float64(-0.008333333333333333 + Float64(Float64(im_m * im_m) * -0.0001984126984126984)))))))));
	end
	return Float64(im_s * tmp)
end
im\_m = abs(im);
im\_s = sign(im) * abs(1.0);
function tmp_2 = code(im_s, re, im_m)
	tmp = 0.0;
	if (im_m <= 0.88)
		tmp = cos(re) * (im_m * (((im_m * im_m) * -0.16666666666666666) + (-1.0 + (((im_m * im_m) * (im_m * im_m)) * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333)))));
	elseif (im_m <= 3.6e+44)
		tmp = 0.5 * (exp(-im_m) - exp(im_m));
	else
		tmp = im_m * (cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))))));
	end
	tmp_2 = im_s * tmp;
end
im\_m = N[Abs[im], $MachinePrecision]
im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[im$95$s_, re_, im$95$m_] := N[(im$95$s * If[LessEqual[im$95$m, 0.88], N[(N[Cos[re], $MachinePrecision] * N[(im$95$m * N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + N[(-1.0 + N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(im$95$m * N[(im$95$m * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision] + -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 3.6e+44], N[(0.5 * N[(N[Exp[(-im$95$m)], $MachinePrecision] - N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im$95$m * N[(N[Cos[re], $MachinePrecision] * N[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(-0.16666666666666666 + N[(im$95$m * N[(im$95$m * N[(-0.008333333333333333 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
im\_m = \left|im\right|
\\
im\_s = \mathsf{copysign}\left(1, im\right)

\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;im\_m \leq 0.88:\\
\;\;\;\;\cos re \cdot \left(im\_m \cdot \left(\left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im\_m \cdot im\_m\right) \cdot \left(im\_m \cdot im\_m\right)\right) \cdot \left(im\_m \cdot \left(im\_m \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right)\\

\mathbf{elif}\;im\_m \leq 3.6 \cdot 10^{+44}:\\
\;\;\;\;0.5 \cdot \left(e^{-im\_m} - e^{im\_m}\right)\\

\mathbf{else}:\\
\;\;\;\;im\_m \cdot \left(\cos re \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + im\_m \cdot \left(im\_m \cdot \left(-0.008333333333333333 + \left(im\_m \cdot im\_m\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right)\\


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

    1. Initial program 44.4%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub044.4%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified44.4%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 97.8%

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative97.8%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + -1 \cdot \cos re\right)} \]
      2. +-commutative97.8%

        \[\leadsto im \cdot \left({im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right) + -0.16666666666666666 \cdot \cos re\right)} + -1 \cdot \cos re\right) \]
      3. distribute-rgt-in97.8%

        \[\leadsto im \cdot \left(\color{blue}{\left(\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right)} + -1 \cdot \cos re\right) \]
      4. *-commutative97.8%

        \[\leadsto im \cdot \left(\left(\color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
      5. associate-+l+97.8%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2} + -1 \cdot \cos re\right)\right)} \]
    7. Simplified97.8%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right)} \]
    8. Step-by-step derivation
      1. *-commutative97.8%

        \[\leadsto im \cdot \color{blue}{\left(\left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot \cos re\right)} \]
      2. associate-*r*97.8%

        \[\leadsto \color{blue}{\left(im \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right) \cdot \cos re} \]
      3. +-commutative97.8%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)}\right) \cdot \cos re \]
      4. +-commutative97.8%

        \[\leadsto \left(im \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)} + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \cos re \]
      5. associate-+l+97.8%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)}\right) \cdot \cos re \]
      6. *-commutative97.8%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \color{blue}{\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)}\right)\right)\right) \cdot \cos re \]
      7. +-commutative97.8%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)}\right)\right)\right) \cdot \cos re \]
    9. Applied egg-rr97.8%

      \[\leadsto \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \cdot \cos re} \]

    if 0.880000000000000004 < im < 3.6e44

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in re around 0 74.9%

      \[\leadsto \color{blue}{0.5 \cdot \left(e^{-im} - e^{im}\right)} \]

    if 3.6e44 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 100.0%

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + -1 \cdot \cos re\right)} \]
      2. +-commutative100.0%

        \[\leadsto im \cdot \left({im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right) + -0.16666666666666666 \cdot \cos re\right)} + -1 \cdot \cos re\right) \]
      3. distribute-rgt-in100.0%

        \[\leadsto im \cdot \left(\color{blue}{\left(\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right)} + -1 \cdot \cos re\right) \]
      4. *-commutative100.0%

        \[\leadsto im \cdot \left(\left(\color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
      5. associate-+l+100.0%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2} + -1 \cdot \cos re\right)\right)} \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right)} \]
    8. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto im \cdot \color{blue}{\left(\left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot \cos re\right)} \]
      2. associate-*r*100.0%

        \[\leadsto \color{blue}{\left(im \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right) \cdot \cos re} \]
      3. +-commutative100.0%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)}\right) \cdot \cos re \]
      4. +-commutative100.0%

        \[\leadsto \left(im \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)} + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \cos re \]
      5. associate-+l+100.0%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)}\right) \cdot \cos re \]
      6. *-commutative100.0%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \color{blue}{\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)}\right)\right)\right) \cdot \cos re \]
      7. +-commutative100.0%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)}\right)\right)\right) \cdot \cos re \]
    9. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \cdot \cos re} \]
    10. Taylor expanded in re around inf 100.0%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)\right)} \]
    11. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto im \cdot \left(\cos re \cdot \color{blue}{\left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \left(-1\right)\right)}\right) \]
      2. metadata-eval100.0%

        \[\leadsto im \cdot \left(\cos re \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \color{blue}{-1}\right)\right) \]
      3. +-commutative100.0%

        \[\leadsto im \cdot \left(\cos re \cdot \color{blue}{\left(-1 + \left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right)}\right) \]
      4. *-commutative100.0%

        \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left(\color{blue}{{im}^{2} \cdot -0.16666666666666666} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right)\right) \]
      5. sub-neg100.0%

        \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \color{blue}{\left(-0.0001984126984126984 \cdot {im}^{2} + \left(-0.008333333333333333\right)\right)}\right)\right)\right) \]
      6. *-commutative100.0%

        \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{{im}^{2} \cdot -0.0001984126984126984} + \left(-0.008333333333333333\right)\right)\right)\right)\right) \]
      7. unpow2100.0%

        \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.0001984126984126984 + \left(-0.008333333333333333\right)\right)\right)\right)\right) \]
      8. associate-*r*100.0%

        \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{im \cdot \left(im \cdot -0.0001984126984126984\right)} + \left(-0.008333333333333333\right)\right)\right)\right)\right) \]
      9. metadata-eval100.0%

        \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + \color{blue}{-0.008333333333333333}\right)\right)\right)\right) \]
      10. metadata-eval100.0%

        \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{\color{blue}{\left(2 \cdot 2\right)}} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \]
      11. pow-sqr100.0%

        \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \]
      12. unpow2100.0%

        \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{\left(im \cdot im\right)}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \]
      13. unpow2100.0%

        \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{\left(im \cdot im\right)} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \]
      14. unpow2100.0%

        \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{2}} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \]
      15. unpow2100.0%

        \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \]
    12. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.88:\\ \;\;\;\;\cos re \cdot \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right)\\ \mathbf{elif}\;im \leq 3.6 \cdot 10^{+44}:\\ \;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(\cos re \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 93.4% accurate, 2.4× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \left(\cos re \cdot \left(im\_m \cdot \left(\left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im\_m \cdot im\_m\right) \cdot \left(im\_m \cdot im\_m\right)\right) \cdot \left(im\_m \cdot \left(im\_m \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right)\right) \end{array} \]
im\_m = (fabs.f64 im)
im\_s = (copysign.f64 #s(literal 1 binary64) im)
(FPCore (im_s re im_m)
 :precision binary64
 (*
  im_s
  (*
   (cos re)
   (*
    im_m
    (+
     (* (* im_m im_m) -0.16666666666666666)
     (+
      -1.0
      (*
       (* (* im_m im_m) (* im_m im_m))
       (+
        (* im_m (* im_m -0.0001984126984126984))
        -0.008333333333333333))))))))
im\_m = fabs(im);
im\_s = copysign(1.0, im);
double code(double im_s, double re, double im_m) {
	return im_s * (cos(re) * (im_m * (((im_m * im_m) * -0.16666666666666666) + (-1.0 + (((im_m * im_m) * (im_m * im_m)) * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333))))));
}
im\_m = abs(im)
im\_s = copysign(1.0d0, im)
real(8) function code(im_s, re, im_m)
    real(8), intent (in) :: im_s
    real(8), intent (in) :: re
    real(8), intent (in) :: im_m
    code = im_s * (cos(re) * (im_m * (((im_m * im_m) * (-0.16666666666666666d0)) + ((-1.0d0) + (((im_m * im_m) * (im_m * im_m)) * ((im_m * (im_m * (-0.0001984126984126984d0))) + (-0.008333333333333333d0)))))))
end function
im\_m = Math.abs(im);
im\_s = Math.copySign(1.0, im);
public static double code(double im_s, double re, double im_m) {
	return im_s * (Math.cos(re) * (im_m * (((im_m * im_m) * -0.16666666666666666) + (-1.0 + (((im_m * im_m) * (im_m * im_m)) * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333))))));
}
im\_m = math.fabs(im)
im\_s = math.copysign(1.0, im)
def code(im_s, re, im_m):
	return im_s * (math.cos(re) * (im_m * (((im_m * im_m) * -0.16666666666666666) + (-1.0 + (((im_m * im_m) * (im_m * im_m)) * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333))))))
im\_m = abs(im)
im\_s = copysign(1.0, im)
function code(im_s, re, im_m)
	return Float64(im_s * Float64(cos(re) * Float64(im_m * Float64(Float64(Float64(im_m * im_m) * -0.16666666666666666) + Float64(-1.0 + Float64(Float64(Float64(im_m * im_m) * Float64(im_m * im_m)) * Float64(Float64(im_m * Float64(im_m * -0.0001984126984126984)) + -0.008333333333333333)))))))
end
im\_m = abs(im);
im\_s = sign(im) * abs(1.0);
function tmp = code(im_s, re, im_m)
	tmp = im_s * (cos(re) * (im_m * (((im_m * im_m) * -0.16666666666666666) + (-1.0 + (((im_m * im_m) * (im_m * im_m)) * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333))))));
end
im\_m = N[Abs[im], $MachinePrecision]
im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[im$95$s_, re_, im$95$m_] := N[(im$95$s * N[(N[Cos[re], $MachinePrecision] * N[(im$95$m * N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + N[(-1.0 + N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(im$95$m * N[(im$95$m * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision] + -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
im\_m = \left|im\right|
\\
im\_s = \mathsf{copysign}\left(1, im\right)

\\
im\_s \cdot \left(\cos re \cdot \left(im\_m \cdot \left(\left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im\_m \cdot im\_m\right) \cdot \left(im\_m \cdot im\_m\right)\right) \cdot \left(im\_m \cdot \left(im\_m \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 58.5%

    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
  2. Step-by-step derivation
    1. neg-sub058.5%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
  3. Simplified58.5%

    \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in im around 0 94.3%

    \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
  6. Step-by-step derivation
    1. +-commutative94.3%

      \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + -1 \cdot \cos re\right)} \]
    2. +-commutative94.3%

      \[\leadsto im \cdot \left({im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right) + -0.16666666666666666 \cdot \cos re\right)} + -1 \cdot \cos re\right) \]
    3. distribute-rgt-in94.3%

      \[\leadsto im \cdot \left(\color{blue}{\left(\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right)} + -1 \cdot \cos re\right) \]
    4. *-commutative94.3%

      \[\leadsto im \cdot \left(\left(\color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
    5. associate-+l+94.3%

      \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2} + -1 \cdot \cos re\right)\right)} \]
  7. Simplified94.3%

    \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right)} \]
  8. Step-by-step derivation
    1. *-commutative94.3%

      \[\leadsto im \cdot \color{blue}{\left(\left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot \cos re\right)} \]
    2. associate-*r*94.3%

      \[\leadsto \color{blue}{\left(im \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right) \cdot \cos re} \]
    3. +-commutative94.3%

      \[\leadsto \left(im \cdot \color{blue}{\left(\left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)}\right) \cdot \cos re \]
    4. +-commutative94.3%

      \[\leadsto \left(im \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)} + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \cos re \]
    5. associate-+l+94.3%

      \[\leadsto \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)}\right) \cdot \cos re \]
    6. *-commutative94.3%

      \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \color{blue}{\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)}\right)\right)\right) \cdot \cos re \]
    7. +-commutative94.3%

      \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)}\right)\right)\right) \cdot \cos re \]
  9. Applied egg-rr94.3%

    \[\leadsto \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \cdot \cos re} \]
  10. Final simplification94.3%

    \[\leadsto \cos re \cdot \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \]
  11. Add Preprocessing

Alternative 4: 93.4% accurate, 2.4× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \left(im\_m \cdot \left(\cos re \cdot \left(\left(\left(im\_m \cdot im\_m\right) \cdot \left(im\_m \cdot im\_m\right)\right) \cdot \left(im\_m \cdot \left(im\_m \cdot -0.0001984126984126984\right) + -0.008333333333333333\right) + \left(\left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666 + -1\right)\right)\right)\right) \end{array} \]
im\_m = (fabs.f64 im)
im\_s = (copysign.f64 #s(literal 1 binary64) im)
(FPCore (im_s re im_m)
 :precision binary64
 (*
  im_s
  (*
   im_m
   (*
    (cos re)
    (+
     (*
      (* (* im_m im_m) (* im_m im_m))
      (+ (* im_m (* im_m -0.0001984126984126984)) -0.008333333333333333))
     (+ (* (* im_m im_m) -0.16666666666666666) -1.0))))))
im\_m = fabs(im);
im\_s = copysign(1.0, im);
double code(double im_s, double re, double im_m) {
	return im_s * (im_m * (cos(re) * ((((im_m * im_m) * (im_m * im_m)) * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333)) + (((im_m * im_m) * -0.16666666666666666) + -1.0))));
}
im\_m = abs(im)
im\_s = copysign(1.0d0, im)
real(8) function code(im_s, re, im_m)
    real(8), intent (in) :: im_s
    real(8), intent (in) :: re
    real(8), intent (in) :: im_m
    code = im_s * (im_m * (cos(re) * ((((im_m * im_m) * (im_m * im_m)) * ((im_m * (im_m * (-0.0001984126984126984d0))) + (-0.008333333333333333d0))) + (((im_m * im_m) * (-0.16666666666666666d0)) + (-1.0d0)))))
end function
im\_m = Math.abs(im);
im\_s = Math.copySign(1.0, im);
public static double code(double im_s, double re, double im_m) {
	return im_s * (im_m * (Math.cos(re) * ((((im_m * im_m) * (im_m * im_m)) * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333)) + (((im_m * im_m) * -0.16666666666666666) + -1.0))));
}
im\_m = math.fabs(im)
im\_s = math.copysign(1.0, im)
def code(im_s, re, im_m):
	return im_s * (im_m * (math.cos(re) * ((((im_m * im_m) * (im_m * im_m)) * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333)) + (((im_m * im_m) * -0.16666666666666666) + -1.0))))
im\_m = abs(im)
im\_s = copysign(1.0, im)
function code(im_s, re, im_m)
	return Float64(im_s * Float64(im_m * Float64(cos(re) * Float64(Float64(Float64(Float64(im_m * im_m) * Float64(im_m * im_m)) * Float64(Float64(im_m * Float64(im_m * -0.0001984126984126984)) + -0.008333333333333333)) + Float64(Float64(Float64(im_m * im_m) * -0.16666666666666666) + -1.0)))))
end
im\_m = abs(im);
im\_s = sign(im) * abs(1.0);
function tmp = code(im_s, re, im_m)
	tmp = im_s * (im_m * (cos(re) * ((((im_m * im_m) * (im_m * im_m)) * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333)) + (((im_m * im_m) * -0.16666666666666666) + -1.0))));
end
im\_m = N[Abs[im], $MachinePrecision]
im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[im$95$s_, re_, im$95$m_] := N[(im$95$s * N[(im$95$m * N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(im$95$m * N[(im$95$m * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision] + -0.008333333333333333), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
im\_m = \left|im\right|
\\
im\_s = \mathsf{copysign}\left(1, im\right)

\\
im\_s \cdot \left(im\_m \cdot \left(\cos re \cdot \left(\left(\left(im\_m \cdot im\_m\right) \cdot \left(im\_m \cdot im\_m\right)\right) \cdot \left(im\_m \cdot \left(im\_m \cdot -0.0001984126984126984\right) + -0.008333333333333333\right) + \left(\left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666 + -1\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 58.5%

    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
  2. Step-by-step derivation
    1. neg-sub058.5%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
  3. Simplified58.5%

    \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in im around 0 94.3%

    \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
  6. Step-by-step derivation
    1. +-commutative94.3%

      \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + -1 \cdot \cos re\right)} \]
    2. +-commutative94.3%

      \[\leadsto im \cdot \left({im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right) + -0.16666666666666666 \cdot \cos re\right)} + -1 \cdot \cos re\right) \]
    3. distribute-rgt-in94.3%

      \[\leadsto im \cdot \left(\color{blue}{\left(\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right)} + -1 \cdot \cos re\right) \]
    4. *-commutative94.3%

      \[\leadsto im \cdot \left(\left(\color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
    5. associate-+l+94.3%

      \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2} + -1 \cdot \cos re\right)\right)} \]
  7. Simplified94.3%

    \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right)} \]
  8. Final simplification94.3%

    \[\leadsto im \cdot \left(\cos re \cdot \left(\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right) + \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)\right)\right) \]
  9. Add Preprocessing

Alternative 5: 92.5% accurate, 2.5× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := im\_m \cdot \left(im\_m \cdot im\_m\right)\\ t_1 := -0.008333333333333333 + \left(im\_m \cdot im\_m\right) \cdot -0.0001984126984126984\\ t_2 := im\_m \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + im\_m \cdot \left(im\_m \cdot t\_1\right)\right)\right)\\ t_3 := -1 + im\_m \cdot \left(im\_m \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot t\_1\right)\right)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 5.8 \cdot 10^{+15}:\\ \;\;\;\;\cos re \cdot \left(im\_m \cdot \left(\left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666 + -1\right)\right)\\ \mathbf{elif}\;im\_m \leq 3.6 \cdot 10^{+44}:\\ \;\;\;\;t\_2 + \left(re \cdot re\right) \cdot \left(t\_2 \cdot -0.5 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot \left(0.041666666666666664 \cdot \left(im\_m \cdot \frac{t\_3}{re \cdot re}\right) + -0.001388888888888889 \cdot \left(im\_m \cdot t\_3\right)\right)\right)\right)\\ \mathbf{elif}\;im\_m \leq 5.5 \cdot 10^{+102}:\\ \;\;\;\;im\_m \cdot \left(-1 + -0.0001984126984126984 \cdot \left(t\_0 \cdot t\_0\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-0.16666666666666666 \cdot \left(\cos re \cdot t\_0\right)\\ \end{array} \end{array} \end{array} \]
im\_m = (fabs.f64 im)
im\_s = (copysign.f64 #s(literal 1 binary64) im)
(FPCore (im_s re im_m)
 :precision binary64
 (let* ((t_0 (* im_m (* im_m im_m)))
        (t_1
         (+ -0.008333333333333333 (* (* im_m im_m) -0.0001984126984126984)))
        (t_2
         (*
          im_m
          (+
           -1.0
           (* (* im_m im_m) (+ -0.16666666666666666 (* im_m (* im_m t_1)))))))
        (t_3
         (+
          -1.0
          (* im_m (* im_m (+ -0.16666666666666666 (* (* im_m im_m) t_1)))))))
   (*
    im_s
    (if (<= im_m 5.8e+15)
      (* (cos re) (* im_m (+ (* (* im_m im_m) -0.16666666666666666) -1.0)))
      (if (<= im_m 3.6e+44)
        (+
         t_2
         (*
          (* re re)
          (+
           (* t_2 -0.5)
           (*
            (* re re)
            (*
             (* re re)
             (+
              (* 0.041666666666666664 (* im_m (/ t_3 (* re re))))
              (* -0.001388888888888889 (* im_m t_3))))))))
        (if (<= im_m 5.5e+102)
          (* im_m (+ -1.0 (* -0.0001984126984126984 (* t_0 t_0))))
          (* -0.16666666666666666 (* (cos re) t_0))))))))
im\_m = fabs(im);
im\_s = copysign(1.0, im);
double code(double im_s, double re, double im_m) {
	double t_0 = im_m * (im_m * im_m);
	double t_1 = -0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984);
	double t_2 = im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * t_1)))));
	double t_3 = -1.0 + (im_m * (im_m * (-0.16666666666666666 + ((im_m * im_m) * t_1))));
	double tmp;
	if (im_m <= 5.8e+15) {
		tmp = cos(re) * (im_m * (((im_m * im_m) * -0.16666666666666666) + -1.0));
	} else if (im_m <= 3.6e+44) {
		tmp = t_2 + ((re * re) * ((t_2 * -0.5) + ((re * re) * ((re * re) * ((0.041666666666666664 * (im_m * (t_3 / (re * re)))) + (-0.001388888888888889 * (im_m * t_3)))))));
	} else if (im_m <= 5.5e+102) {
		tmp = im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0)));
	} else {
		tmp = -0.16666666666666666 * (cos(re) * t_0);
	}
	return im_s * tmp;
}
im\_m = abs(im)
im\_s = copysign(1.0d0, im)
real(8) function code(im_s, re, im_m)
    real(8), intent (in) :: im_s
    real(8), intent (in) :: re
    real(8), intent (in) :: im_m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = im_m * (im_m * im_m)
    t_1 = (-0.008333333333333333d0) + ((im_m * im_m) * (-0.0001984126984126984d0))
    t_2 = im_m * ((-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + (im_m * (im_m * t_1)))))
    t_3 = (-1.0d0) + (im_m * (im_m * ((-0.16666666666666666d0) + ((im_m * im_m) * t_1))))
    if (im_m <= 5.8d+15) then
        tmp = cos(re) * (im_m * (((im_m * im_m) * (-0.16666666666666666d0)) + (-1.0d0)))
    else if (im_m <= 3.6d+44) then
        tmp = t_2 + ((re * re) * ((t_2 * (-0.5d0)) + ((re * re) * ((re * re) * ((0.041666666666666664d0 * (im_m * (t_3 / (re * re)))) + ((-0.001388888888888889d0) * (im_m * t_3)))))))
    else if (im_m <= 5.5d+102) then
        tmp = im_m * ((-1.0d0) + ((-0.0001984126984126984d0) * (t_0 * t_0)))
    else
        tmp = (-0.16666666666666666d0) * (cos(re) * t_0)
    end if
    code = im_s * tmp
end function
im\_m = Math.abs(im);
im\_s = Math.copySign(1.0, im);
public static double code(double im_s, double re, double im_m) {
	double t_0 = im_m * (im_m * im_m);
	double t_1 = -0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984);
	double t_2 = im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * t_1)))));
	double t_3 = -1.0 + (im_m * (im_m * (-0.16666666666666666 + ((im_m * im_m) * t_1))));
	double tmp;
	if (im_m <= 5.8e+15) {
		tmp = Math.cos(re) * (im_m * (((im_m * im_m) * -0.16666666666666666) + -1.0));
	} else if (im_m <= 3.6e+44) {
		tmp = t_2 + ((re * re) * ((t_2 * -0.5) + ((re * re) * ((re * re) * ((0.041666666666666664 * (im_m * (t_3 / (re * re)))) + (-0.001388888888888889 * (im_m * t_3)))))));
	} else if (im_m <= 5.5e+102) {
		tmp = im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0)));
	} else {
		tmp = -0.16666666666666666 * (Math.cos(re) * t_0);
	}
	return im_s * tmp;
}
im\_m = math.fabs(im)
im\_s = math.copysign(1.0, im)
def code(im_s, re, im_m):
	t_0 = im_m * (im_m * im_m)
	t_1 = -0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)
	t_2 = im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * t_1)))))
	t_3 = -1.0 + (im_m * (im_m * (-0.16666666666666666 + ((im_m * im_m) * t_1))))
	tmp = 0
	if im_m <= 5.8e+15:
		tmp = math.cos(re) * (im_m * (((im_m * im_m) * -0.16666666666666666) + -1.0))
	elif im_m <= 3.6e+44:
		tmp = t_2 + ((re * re) * ((t_2 * -0.5) + ((re * re) * ((re * re) * ((0.041666666666666664 * (im_m * (t_3 / (re * re)))) + (-0.001388888888888889 * (im_m * t_3)))))))
	elif im_m <= 5.5e+102:
		tmp = im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0)))
	else:
		tmp = -0.16666666666666666 * (math.cos(re) * t_0)
	return im_s * tmp
im\_m = abs(im)
im\_s = copysign(1.0, im)
function code(im_s, re, im_m)
	t_0 = Float64(im_m * Float64(im_m * im_m))
	t_1 = Float64(-0.008333333333333333 + Float64(Float64(im_m * im_m) * -0.0001984126984126984))
	t_2 = Float64(im_m * Float64(-1.0 + Float64(Float64(im_m * im_m) * Float64(-0.16666666666666666 + Float64(im_m * Float64(im_m * t_1))))))
	t_3 = Float64(-1.0 + Float64(im_m * Float64(im_m * Float64(-0.16666666666666666 + Float64(Float64(im_m * im_m) * t_1)))))
	tmp = 0.0
	if (im_m <= 5.8e+15)
		tmp = Float64(cos(re) * Float64(im_m * Float64(Float64(Float64(im_m * im_m) * -0.16666666666666666) + -1.0)));
	elseif (im_m <= 3.6e+44)
		tmp = Float64(t_2 + Float64(Float64(re * re) * Float64(Float64(t_2 * -0.5) + Float64(Float64(re * re) * Float64(Float64(re * re) * Float64(Float64(0.041666666666666664 * Float64(im_m * Float64(t_3 / Float64(re * re)))) + Float64(-0.001388888888888889 * Float64(im_m * t_3))))))));
	elseif (im_m <= 5.5e+102)
		tmp = Float64(im_m * Float64(-1.0 + Float64(-0.0001984126984126984 * Float64(t_0 * t_0))));
	else
		tmp = Float64(-0.16666666666666666 * Float64(cos(re) * t_0));
	end
	return Float64(im_s * tmp)
end
im\_m = abs(im);
im\_s = sign(im) * abs(1.0);
function tmp_2 = code(im_s, re, im_m)
	t_0 = im_m * (im_m * im_m);
	t_1 = -0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984);
	t_2 = im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * t_1)))));
	t_3 = -1.0 + (im_m * (im_m * (-0.16666666666666666 + ((im_m * im_m) * t_1))));
	tmp = 0.0;
	if (im_m <= 5.8e+15)
		tmp = cos(re) * (im_m * (((im_m * im_m) * -0.16666666666666666) + -1.0));
	elseif (im_m <= 3.6e+44)
		tmp = t_2 + ((re * re) * ((t_2 * -0.5) + ((re * re) * ((re * re) * ((0.041666666666666664 * (im_m * (t_3 / (re * re)))) + (-0.001388888888888889 * (im_m * t_3)))))));
	elseif (im_m <= 5.5e+102)
		tmp = im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0)));
	else
		tmp = -0.16666666666666666 * (cos(re) * t_0);
	end
	tmp_2 = im_s * tmp;
end
im\_m = N[Abs[im], $MachinePrecision]
im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[im$95$s_, re_, im$95$m_] := Block[{t$95$0 = N[(im$95$m * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.008333333333333333 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(im$95$m * N[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(-0.16666666666666666 + N[(im$95$m * N[(im$95$m * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(-1.0 + N[(im$95$m * N[(im$95$m * N[(-0.16666666666666666 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[im$95$m, 5.8e+15], N[(N[Cos[re], $MachinePrecision] * N[(im$95$m * N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 3.6e+44], N[(t$95$2 + N[(N[(re * re), $MachinePrecision] * N[(N[(t$95$2 * -0.5), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * N[(N[(0.041666666666666664 * N[(im$95$m * N[(t$95$3 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.001388888888888889 * N[(im$95$m * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 5.5e+102], N[(im$95$m * N[(-1.0 + N[(-0.0001984126984126984 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.16666666666666666 * N[(N[Cos[re], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]]]]
\begin{array}{l}
im\_m = \left|im\right|
\\
im\_s = \mathsf{copysign}\left(1, im\right)

\\
\begin{array}{l}
t_0 := im\_m \cdot \left(im\_m \cdot im\_m\right)\\
t_1 := -0.008333333333333333 + \left(im\_m \cdot im\_m\right) \cdot -0.0001984126984126984\\
t_2 := im\_m \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + im\_m \cdot \left(im\_m \cdot t\_1\right)\right)\right)\\
t_3 := -1 + im\_m \cdot \left(im\_m \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot t\_1\right)\right)\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;im\_m \leq 5.8 \cdot 10^{+15}:\\
\;\;\;\;\cos re \cdot \left(im\_m \cdot \left(\left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666 + -1\right)\right)\\

\mathbf{elif}\;im\_m \leq 3.6 \cdot 10^{+44}:\\
\;\;\;\;t\_2 + \left(re \cdot re\right) \cdot \left(t\_2 \cdot -0.5 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot \left(0.041666666666666664 \cdot \left(im\_m \cdot \frac{t\_3}{re \cdot re}\right) + -0.001388888888888889 \cdot \left(im\_m \cdot t\_3\right)\right)\right)\right)\\

\mathbf{elif}\;im\_m \leq 5.5 \cdot 10^{+102}:\\
\;\;\;\;im\_m \cdot \left(-1 + -0.0001984126984126984 \cdot \left(t\_0 \cdot t\_0\right)\right)\\

\mathbf{else}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(\cos re \cdot t\_0\right)\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < 5.8e15

    1. Initial program 45.8%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub045.8%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified45.8%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 90.7%

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + -0.16666666666666666 \cdot \left({im}^{2} \cdot \cos re\right)\right)} \]
    6. Step-by-step derivation
      1. *-commutative90.7%

        \[\leadsto \color{blue}{\left(-1 \cdot \cos re + -0.16666666666666666 \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot im} \]
      2. +-commutative90.7%

        \[\leadsto \color{blue}{\left(-0.16666666666666666 \cdot \left({im}^{2} \cdot \cos re\right) + -1 \cdot \cos re\right)} \cdot im \]
      3. associate-*r*90.7%

        \[\leadsto \left(\color{blue}{\left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot \cos re} + -1 \cdot \cos re\right) \cdot im \]
      4. distribute-rgt-out90.7%

        \[\leadsto \color{blue}{\left(\cos re \cdot \left(-0.16666666666666666 \cdot {im}^{2} + -1\right)\right)} \cdot im \]
      5. associate-*l*90.7%

        \[\leadsto \color{blue}{\cos re \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + -1\right) \cdot im\right)} \]
      6. *-commutative90.7%

        \[\leadsto \cos re \cdot \color{blue}{\left(im \cdot \left(-0.16666666666666666 \cdot {im}^{2} + -1\right)\right)} \]
      7. +-commutative90.7%

        \[\leadsto \cos re \cdot \left(im \cdot \color{blue}{\left(-1 + -0.16666666666666666 \cdot {im}^{2}\right)}\right) \]
      8. *-commutative90.7%

        \[\leadsto \cos re \cdot \left(im \cdot \left(-1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right)\right) \]
      9. unpow290.7%

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

      \[\leadsto \color{blue}{\cos re \cdot \left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)} \]

    if 5.8e15 < im < 3.6e44

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 8.5%

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative8.5%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + -1 \cdot \cos re\right)} \]
      2. +-commutative8.5%

        \[\leadsto im \cdot \left({im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right) + -0.16666666666666666 \cdot \cos re\right)} + -1 \cdot \cos re\right) \]
      3. distribute-rgt-in8.5%

        \[\leadsto im \cdot \left(\color{blue}{\left(\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right)} + -1 \cdot \cos re\right) \]
      4. *-commutative8.5%

        \[\leadsto im \cdot \left(\left(\color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
      5. associate-+l+8.5%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2} + -1 \cdot \cos re\right)\right)} \]
    7. Simplified8.5%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right)} \]
    8. Step-by-step derivation
      1. *-commutative8.5%

        \[\leadsto im \cdot \color{blue}{\left(\left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot \cos re\right)} \]
      2. associate-*r*8.5%

        \[\leadsto \color{blue}{\left(im \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right) \cdot \cos re} \]
      3. +-commutative8.5%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)}\right) \cdot \cos re \]
      4. +-commutative8.5%

        \[\leadsto \left(im \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)} + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \cos re \]
      5. associate-+l+8.5%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)}\right) \cdot \cos re \]
      6. *-commutative8.5%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \color{blue}{\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)}\right)\right)\right) \cdot \cos re \]
      7. +-commutative8.5%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)}\right)\right)\right) \cdot \cos re \]
    9. Applied egg-rr8.5%

      \[\leadsto \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \cdot \cos re} \]
    10. Taylor expanded in re around 0 38.2%

      \[\leadsto \color{blue}{im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right) + {re}^{2} \cdot \left(-0.5 \cdot \left(im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)\right) + {re}^{2} \cdot \left(-0.001388888888888889 \cdot \left(im \cdot \left({re}^{2} \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)\right)\right) + 0.041666666666666664 \cdot \left(im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)\right)\right)\right)} \]
    11. Simplified38.2%

      \[\leadsto \color{blue}{im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right) + \left(re \cdot re\right) \cdot \left(\left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right) \cdot -0.5 + \left(re \cdot re\right) \cdot \left(\left(\left(re \cdot re\right) \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right) \cdot \left(im \cdot -0.001388888888888889\right) + \left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right) \cdot 0.041666666666666664\right)\right)} \]
    12. Taylor expanded in re around inf 66.7%

      \[\leadsto im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right) + \left(re \cdot re\right) \cdot \left(\left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right) \cdot -0.5 + \left(re \cdot re\right) \cdot \color{blue}{\left({re}^{2} \cdot \left(-0.001388888888888889 \cdot \left(im \cdot \left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right) - 0.16666666666666666\right) - 1\right)\right) + 0.041666666666666664 \cdot \frac{im \cdot \left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right) - 0.16666666666666666\right) - 1\right)}{{re}^{2}}\right)\right)}\right) \]
    13. Simplified66.7%

      \[\leadsto im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right) + \left(re \cdot re\right) \cdot \left(\left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right) \cdot -0.5 + \left(re \cdot re\right) \cdot \color{blue}{\left(\left(re \cdot re\right) \cdot \left(0.041666666666666664 \cdot \left(im \cdot \frac{-1 + im \cdot \left(im \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot \left(-0.008333333333333333 + -0.0001984126984126984 \cdot \left(im \cdot im\right)\right)\right)\right)}{re \cdot re}\right) + -0.001388888888888889 \cdot \left(im \cdot \left(-1 + im \cdot \left(im \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot \left(-0.008333333333333333 + -0.0001984126984126984 \cdot \left(im \cdot im\right)\right)\right)\right)\right)\right)\right)\right)}\right) \]

    if 3.6e44 < im < 5.49999999999999981e102

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 100.0%

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + -1 \cdot \cos re\right)} \]
      2. +-commutative100.0%

        \[\leadsto im \cdot \left({im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right) + -0.16666666666666666 \cdot \cos re\right)} + -1 \cdot \cos re\right) \]
      3. distribute-rgt-in100.0%

        \[\leadsto im \cdot \left(\color{blue}{\left(\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right)} + -1 \cdot \cos re\right) \]
      4. *-commutative100.0%

        \[\leadsto im \cdot \left(\left(\color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
      5. associate-+l+100.0%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2} + -1 \cdot \cos re\right)\right)} \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right)} \]
    8. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto im \cdot \color{blue}{\left(\left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot \cos re\right)} \]
      2. associate-*r*100.0%

        \[\leadsto \color{blue}{\left(im \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right) \cdot \cos re} \]
      3. +-commutative100.0%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)}\right) \cdot \cos re \]
      4. +-commutative100.0%

        \[\leadsto \left(im \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)} + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \cos re \]
      5. associate-+l+100.0%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)}\right) \cdot \cos re \]
      6. *-commutative100.0%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \color{blue}{\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)}\right)\right)\right) \cdot \cos re \]
      7. +-commutative100.0%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)}\right)\right)\right) \cdot \cos re \]
    9. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \cdot \cos re} \]
    10. Taylor expanded in re around 0 75.0%

      \[\leadsto \color{blue}{im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)} \]
    11. Step-by-step derivation
      1. sub-neg75.0%

        \[\leadsto im \cdot \color{blue}{\left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \left(-1\right)\right)} \]
      2. metadata-eval75.0%

        \[\leadsto im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \color{blue}{-1}\right) \]
      3. +-commutative75.0%

        \[\leadsto im \cdot \color{blue}{\left(-1 + \left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right)} \]
      4. *-commutative75.0%

        \[\leadsto im \cdot \left(-1 + \left(\color{blue}{{im}^{2} \cdot -0.16666666666666666} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right) \]
      5. sub-neg75.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \color{blue}{\left(-0.0001984126984126984 \cdot {im}^{2} + \left(-0.008333333333333333\right)\right)}\right)\right) \]
      6. *-commutative75.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{{im}^{2} \cdot -0.0001984126984126984} + \left(-0.008333333333333333\right)\right)\right)\right) \]
      7. unpow275.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.0001984126984126984 + \left(-0.008333333333333333\right)\right)\right)\right) \]
      8. associate-*r*75.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{im \cdot \left(im \cdot -0.0001984126984126984\right)} + \left(-0.008333333333333333\right)\right)\right)\right) \]
      9. metadata-eval75.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + \color{blue}{-0.008333333333333333}\right)\right)\right) \]
      10. metadata-eval75.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{\color{blue}{\left(2 \cdot 2\right)}} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      11. pow-sqr75.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      12. unpow275.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{\left(im \cdot im\right)}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      13. unpow275.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{\left(im \cdot im\right)} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      14. unpow275.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{2}} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      15. unpow275.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      16. associate-*r*75.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)}\right)\right) \]
    12. Simplified75.0%

      \[\leadsto \color{blue}{im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)} \]
    13. Taylor expanded in im around inf 75.0%

      \[\leadsto im \cdot \left(-1 + \color{blue}{-0.0001984126984126984 \cdot {im}^{6}}\right) \]
    14. Step-by-step derivation
      1. metadata-eval75.0%

        \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot {im}^{\color{blue}{\left(2 \cdot 3\right)}}\right) \]
      2. pow-sqr75.0%

        \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot \color{blue}{\left({im}^{3} \cdot {im}^{3}\right)}\right) \]
      3. cube-mult75.0%

        \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot {im}^{3}\right)\right) \]
      4. cube-mult75.0%

        \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)}\right)\right) \]
    15. Simplified75.0%

      \[\leadsto im \cdot \left(-1 + \color{blue}{-0.0001984126984126984 \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)}\right) \]

    if 5.49999999999999981e102 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} - 2\right)\right)} \]
    6. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{2} + \left(-2\right)\right)}\right) \]
      2. metadata-eval100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} + \color{blue}{-2}\right)\right) \]
      3. +-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-2 + -0.3333333333333333 \cdot {im}^{2}\right)}\right) \]
      4. *-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{{im}^{2} \cdot -0.3333333333333333}\right)\right) \]
      5. unpow2100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{\left(im \cdot im\right)} \cdot -0.3333333333333333\right)\right) \]
      6. associate-*l*100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{im \cdot \left(im \cdot -0.3333333333333333\right)}\right)\right) \]
    7. Simplified100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)} \]
    8. Taylor expanded in im around inf 100.0%

      \[\leadsto \color{blue}{-0.16666666666666666 \cdot \left({im}^{3} \cdot \cos re\right)} \]
    9. Step-by-step derivation
      1. cube-unmult100.0%

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

        \[\leadsto -0.16666666666666666 \cdot \color{blue}{\left(\cos re \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)} \]
    10. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 5.8 \cdot 10^{+15}:\\ \;\;\;\;\cos re \cdot \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)\right)\\ \mathbf{elif}\;im \leq 3.6 \cdot 10^{+44}:\\ \;\;\;\;im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right) + \left(re \cdot re\right) \cdot \left(\left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right) \cdot -0.5 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot \left(0.041666666666666664 \cdot \left(im \cdot \frac{-1 + im \cdot \left(im \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)}{re \cdot re}\right) + -0.001388888888888889 \cdot \left(im \cdot \left(-1 + im \cdot \left(im \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right)\right)\right)\right)\\ \mathbf{elif}\;im \leq 5.5 \cdot 10^{+102}:\\ \;\;\;\;im \cdot \left(-1 + -0.0001984126984126984 \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-0.16666666666666666 \cdot \left(\cos re \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 92.3% accurate, 2.5× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := im\_m \cdot \left(im\_m \cdot im\_m\right)\\ t_1 := -0.008333333333333333 + \left(im\_m \cdot im\_m\right) \cdot -0.0001984126984126984\\ t_2 := im\_m \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + im\_m \cdot \left(im\_m \cdot t\_1\right)\right)\right)\\ t_3 := -1 + im\_m \cdot \left(im\_m \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot t\_1\right)\right)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 5.8 \cdot 10^{+15}:\\ \;\;\;\;im\_m \cdot \left(-\cos re\right)\\ \mathbf{elif}\;im\_m \leq 3.6 \cdot 10^{+44}:\\ \;\;\;\;t\_2 + \left(re \cdot re\right) \cdot \left(t\_2 \cdot -0.5 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot \left(0.041666666666666664 \cdot \left(im\_m \cdot \frac{t\_3}{re \cdot re}\right) + -0.001388888888888889 \cdot \left(im\_m \cdot t\_3\right)\right)\right)\right)\\ \mathbf{elif}\;im\_m \leq 5.5 \cdot 10^{+102}:\\ \;\;\;\;im\_m \cdot \left(-1 + -0.0001984126984126984 \cdot \left(t\_0 \cdot t\_0\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-0.16666666666666666 \cdot \left(\cos re \cdot t\_0\right)\\ \end{array} \end{array} \end{array} \]
im\_m = (fabs.f64 im)
im\_s = (copysign.f64 #s(literal 1 binary64) im)
(FPCore (im_s re im_m)
 :precision binary64
 (let* ((t_0 (* im_m (* im_m im_m)))
        (t_1
         (+ -0.008333333333333333 (* (* im_m im_m) -0.0001984126984126984)))
        (t_2
         (*
          im_m
          (+
           -1.0
           (* (* im_m im_m) (+ -0.16666666666666666 (* im_m (* im_m t_1)))))))
        (t_3
         (+
          -1.0
          (* im_m (* im_m (+ -0.16666666666666666 (* (* im_m im_m) t_1)))))))
   (*
    im_s
    (if (<= im_m 5.8e+15)
      (* im_m (- (cos re)))
      (if (<= im_m 3.6e+44)
        (+
         t_2
         (*
          (* re re)
          (+
           (* t_2 -0.5)
           (*
            (* re re)
            (*
             (* re re)
             (+
              (* 0.041666666666666664 (* im_m (/ t_3 (* re re))))
              (* -0.001388888888888889 (* im_m t_3))))))))
        (if (<= im_m 5.5e+102)
          (* im_m (+ -1.0 (* -0.0001984126984126984 (* t_0 t_0))))
          (* -0.16666666666666666 (* (cos re) t_0))))))))
im\_m = fabs(im);
im\_s = copysign(1.0, im);
double code(double im_s, double re, double im_m) {
	double t_0 = im_m * (im_m * im_m);
	double t_1 = -0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984);
	double t_2 = im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * t_1)))));
	double t_3 = -1.0 + (im_m * (im_m * (-0.16666666666666666 + ((im_m * im_m) * t_1))));
	double tmp;
	if (im_m <= 5.8e+15) {
		tmp = im_m * -cos(re);
	} else if (im_m <= 3.6e+44) {
		tmp = t_2 + ((re * re) * ((t_2 * -0.5) + ((re * re) * ((re * re) * ((0.041666666666666664 * (im_m * (t_3 / (re * re)))) + (-0.001388888888888889 * (im_m * t_3)))))));
	} else if (im_m <= 5.5e+102) {
		tmp = im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0)));
	} else {
		tmp = -0.16666666666666666 * (cos(re) * t_0);
	}
	return im_s * tmp;
}
im\_m = abs(im)
im\_s = copysign(1.0d0, im)
real(8) function code(im_s, re, im_m)
    real(8), intent (in) :: im_s
    real(8), intent (in) :: re
    real(8), intent (in) :: im_m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = im_m * (im_m * im_m)
    t_1 = (-0.008333333333333333d0) + ((im_m * im_m) * (-0.0001984126984126984d0))
    t_2 = im_m * ((-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + (im_m * (im_m * t_1)))))
    t_3 = (-1.0d0) + (im_m * (im_m * ((-0.16666666666666666d0) + ((im_m * im_m) * t_1))))
    if (im_m <= 5.8d+15) then
        tmp = im_m * -cos(re)
    else if (im_m <= 3.6d+44) then
        tmp = t_2 + ((re * re) * ((t_2 * (-0.5d0)) + ((re * re) * ((re * re) * ((0.041666666666666664d0 * (im_m * (t_3 / (re * re)))) + ((-0.001388888888888889d0) * (im_m * t_3)))))))
    else if (im_m <= 5.5d+102) then
        tmp = im_m * ((-1.0d0) + ((-0.0001984126984126984d0) * (t_0 * t_0)))
    else
        tmp = (-0.16666666666666666d0) * (cos(re) * t_0)
    end if
    code = im_s * tmp
end function
im\_m = Math.abs(im);
im\_s = Math.copySign(1.0, im);
public static double code(double im_s, double re, double im_m) {
	double t_0 = im_m * (im_m * im_m);
	double t_1 = -0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984);
	double t_2 = im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * t_1)))));
	double t_3 = -1.0 + (im_m * (im_m * (-0.16666666666666666 + ((im_m * im_m) * t_1))));
	double tmp;
	if (im_m <= 5.8e+15) {
		tmp = im_m * -Math.cos(re);
	} else if (im_m <= 3.6e+44) {
		tmp = t_2 + ((re * re) * ((t_2 * -0.5) + ((re * re) * ((re * re) * ((0.041666666666666664 * (im_m * (t_3 / (re * re)))) + (-0.001388888888888889 * (im_m * t_3)))))));
	} else if (im_m <= 5.5e+102) {
		tmp = im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0)));
	} else {
		tmp = -0.16666666666666666 * (Math.cos(re) * t_0);
	}
	return im_s * tmp;
}
im\_m = math.fabs(im)
im\_s = math.copysign(1.0, im)
def code(im_s, re, im_m):
	t_0 = im_m * (im_m * im_m)
	t_1 = -0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)
	t_2 = im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * t_1)))))
	t_3 = -1.0 + (im_m * (im_m * (-0.16666666666666666 + ((im_m * im_m) * t_1))))
	tmp = 0
	if im_m <= 5.8e+15:
		tmp = im_m * -math.cos(re)
	elif im_m <= 3.6e+44:
		tmp = t_2 + ((re * re) * ((t_2 * -0.5) + ((re * re) * ((re * re) * ((0.041666666666666664 * (im_m * (t_3 / (re * re)))) + (-0.001388888888888889 * (im_m * t_3)))))))
	elif im_m <= 5.5e+102:
		tmp = im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0)))
	else:
		tmp = -0.16666666666666666 * (math.cos(re) * t_0)
	return im_s * tmp
im\_m = abs(im)
im\_s = copysign(1.0, im)
function code(im_s, re, im_m)
	t_0 = Float64(im_m * Float64(im_m * im_m))
	t_1 = Float64(-0.008333333333333333 + Float64(Float64(im_m * im_m) * -0.0001984126984126984))
	t_2 = Float64(im_m * Float64(-1.0 + Float64(Float64(im_m * im_m) * Float64(-0.16666666666666666 + Float64(im_m * Float64(im_m * t_1))))))
	t_3 = Float64(-1.0 + Float64(im_m * Float64(im_m * Float64(-0.16666666666666666 + Float64(Float64(im_m * im_m) * t_1)))))
	tmp = 0.0
	if (im_m <= 5.8e+15)
		tmp = Float64(im_m * Float64(-cos(re)));
	elseif (im_m <= 3.6e+44)
		tmp = Float64(t_2 + Float64(Float64(re * re) * Float64(Float64(t_2 * -0.5) + Float64(Float64(re * re) * Float64(Float64(re * re) * Float64(Float64(0.041666666666666664 * Float64(im_m * Float64(t_3 / Float64(re * re)))) + Float64(-0.001388888888888889 * Float64(im_m * t_3))))))));
	elseif (im_m <= 5.5e+102)
		tmp = Float64(im_m * Float64(-1.0 + Float64(-0.0001984126984126984 * Float64(t_0 * t_0))));
	else
		tmp = Float64(-0.16666666666666666 * Float64(cos(re) * t_0));
	end
	return Float64(im_s * tmp)
end
im\_m = abs(im);
im\_s = sign(im) * abs(1.0);
function tmp_2 = code(im_s, re, im_m)
	t_0 = im_m * (im_m * im_m);
	t_1 = -0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984);
	t_2 = im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * t_1)))));
	t_3 = -1.0 + (im_m * (im_m * (-0.16666666666666666 + ((im_m * im_m) * t_1))));
	tmp = 0.0;
	if (im_m <= 5.8e+15)
		tmp = im_m * -cos(re);
	elseif (im_m <= 3.6e+44)
		tmp = t_2 + ((re * re) * ((t_2 * -0.5) + ((re * re) * ((re * re) * ((0.041666666666666664 * (im_m * (t_3 / (re * re)))) + (-0.001388888888888889 * (im_m * t_3)))))));
	elseif (im_m <= 5.5e+102)
		tmp = im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0)));
	else
		tmp = -0.16666666666666666 * (cos(re) * t_0);
	end
	tmp_2 = im_s * tmp;
end
im\_m = N[Abs[im], $MachinePrecision]
im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[im$95$s_, re_, im$95$m_] := Block[{t$95$0 = N[(im$95$m * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.008333333333333333 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(im$95$m * N[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(-0.16666666666666666 + N[(im$95$m * N[(im$95$m * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(-1.0 + N[(im$95$m * N[(im$95$m * N[(-0.16666666666666666 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[im$95$m, 5.8e+15], N[(im$95$m * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im$95$m, 3.6e+44], N[(t$95$2 + N[(N[(re * re), $MachinePrecision] * N[(N[(t$95$2 * -0.5), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * N[(N[(0.041666666666666664 * N[(im$95$m * N[(t$95$3 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.001388888888888889 * N[(im$95$m * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 5.5e+102], N[(im$95$m * N[(-1.0 + N[(-0.0001984126984126984 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.16666666666666666 * N[(N[Cos[re], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]]]]
\begin{array}{l}
im\_m = \left|im\right|
\\
im\_s = \mathsf{copysign}\left(1, im\right)

\\
\begin{array}{l}
t_0 := im\_m \cdot \left(im\_m \cdot im\_m\right)\\
t_1 := -0.008333333333333333 + \left(im\_m \cdot im\_m\right) \cdot -0.0001984126984126984\\
t_2 := im\_m \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + im\_m \cdot \left(im\_m \cdot t\_1\right)\right)\right)\\
t_3 := -1 + im\_m \cdot \left(im\_m \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot t\_1\right)\right)\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;im\_m \leq 5.8 \cdot 10^{+15}:\\
\;\;\;\;im\_m \cdot \left(-\cos re\right)\\

\mathbf{elif}\;im\_m \leq 3.6 \cdot 10^{+44}:\\
\;\;\;\;t\_2 + \left(re \cdot re\right) \cdot \left(t\_2 \cdot -0.5 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot \left(0.041666666666666664 \cdot \left(im\_m \cdot \frac{t\_3}{re \cdot re}\right) + -0.001388888888888889 \cdot \left(im\_m \cdot t\_3\right)\right)\right)\right)\\

\mathbf{elif}\;im\_m \leq 5.5 \cdot 10^{+102}:\\
\;\;\;\;im\_m \cdot \left(-1 + -0.0001984126984126984 \cdot \left(t\_0 \cdot t\_0\right)\right)\\

\mathbf{else}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(\cos re \cdot t\_0\right)\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < 5.8e15

    1. Initial program 45.8%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub045.8%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified45.8%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 60.4%

      \[\leadsto \color{blue}{-1 \cdot \left(im \cdot \cos re\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg60.4%

        \[\leadsto \color{blue}{-im \cdot \cos re} \]
      2. neg-sub060.4%

        \[\leadsto \color{blue}{0 - im \cdot \cos re} \]
    7. Simplified60.4%

      \[\leadsto \color{blue}{0 - im \cdot \cos re} \]

    if 5.8e15 < im < 3.6e44

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 8.5%

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative8.5%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + -1 \cdot \cos re\right)} \]
      2. +-commutative8.5%

        \[\leadsto im \cdot \left({im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right) + -0.16666666666666666 \cdot \cos re\right)} + -1 \cdot \cos re\right) \]
      3. distribute-rgt-in8.5%

        \[\leadsto im \cdot \left(\color{blue}{\left(\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right)} + -1 \cdot \cos re\right) \]
      4. *-commutative8.5%

        \[\leadsto im \cdot \left(\left(\color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
      5. associate-+l+8.5%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2} + -1 \cdot \cos re\right)\right)} \]
    7. Simplified8.5%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right)} \]
    8. Step-by-step derivation
      1. *-commutative8.5%

        \[\leadsto im \cdot \color{blue}{\left(\left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot \cos re\right)} \]
      2. associate-*r*8.5%

        \[\leadsto \color{blue}{\left(im \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right) \cdot \cos re} \]
      3. +-commutative8.5%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)}\right) \cdot \cos re \]
      4. +-commutative8.5%

        \[\leadsto \left(im \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)} + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \cos re \]
      5. associate-+l+8.5%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)}\right) \cdot \cos re \]
      6. *-commutative8.5%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \color{blue}{\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)}\right)\right)\right) \cdot \cos re \]
      7. +-commutative8.5%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)}\right)\right)\right) \cdot \cos re \]
    9. Applied egg-rr8.5%

      \[\leadsto \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \cdot \cos re} \]
    10. Taylor expanded in re around 0 38.2%

      \[\leadsto \color{blue}{im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right) + {re}^{2} \cdot \left(-0.5 \cdot \left(im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)\right) + {re}^{2} \cdot \left(-0.001388888888888889 \cdot \left(im \cdot \left({re}^{2} \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)\right)\right) + 0.041666666666666664 \cdot \left(im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)\right)\right)\right)} \]
    11. Simplified38.2%

      \[\leadsto \color{blue}{im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right) + \left(re \cdot re\right) \cdot \left(\left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right) \cdot -0.5 + \left(re \cdot re\right) \cdot \left(\left(\left(re \cdot re\right) \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right) \cdot \left(im \cdot -0.001388888888888889\right) + \left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right) \cdot 0.041666666666666664\right)\right)} \]
    12. Taylor expanded in re around inf 66.7%

      \[\leadsto im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right) + \left(re \cdot re\right) \cdot \left(\left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right) \cdot -0.5 + \left(re \cdot re\right) \cdot \color{blue}{\left({re}^{2} \cdot \left(-0.001388888888888889 \cdot \left(im \cdot \left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right) - 0.16666666666666666\right) - 1\right)\right) + 0.041666666666666664 \cdot \frac{im \cdot \left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right) - 0.16666666666666666\right) - 1\right)}{{re}^{2}}\right)\right)}\right) \]
    13. Simplified66.7%

      \[\leadsto im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right) + \left(re \cdot re\right) \cdot \left(\left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right) \cdot -0.5 + \left(re \cdot re\right) \cdot \color{blue}{\left(\left(re \cdot re\right) \cdot \left(0.041666666666666664 \cdot \left(im \cdot \frac{-1 + im \cdot \left(im \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot \left(-0.008333333333333333 + -0.0001984126984126984 \cdot \left(im \cdot im\right)\right)\right)\right)}{re \cdot re}\right) + -0.001388888888888889 \cdot \left(im \cdot \left(-1 + im \cdot \left(im \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot \left(-0.008333333333333333 + -0.0001984126984126984 \cdot \left(im \cdot im\right)\right)\right)\right)\right)\right)\right)\right)}\right) \]

    if 3.6e44 < im < 5.49999999999999981e102

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 100.0%

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + -1 \cdot \cos re\right)} \]
      2. +-commutative100.0%

        \[\leadsto im \cdot \left({im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right) + -0.16666666666666666 \cdot \cos re\right)} + -1 \cdot \cos re\right) \]
      3. distribute-rgt-in100.0%

        \[\leadsto im \cdot \left(\color{blue}{\left(\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right)} + -1 \cdot \cos re\right) \]
      4. *-commutative100.0%

        \[\leadsto im \cdot \left(\left(\color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
      5. associate-+l+100.0%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2} + -1 \cdot \cos re\right)\right)} \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right)} \]
    8. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto im \cdot \color{blue}{\left(\left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot \cos re\right)} \]
      2. associate-*r*100.0%

        \[\leadsto \color{blue}{\left(im \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right) \cdot \cos re} \]
      3. +-commutative100.0%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)}\right) \cdot \cos re \]
      4. +-commutative100.0%

        \[\leadsto \left(im \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)} + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \cos re \]
      5. associate-+l+100.0%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)}\right) \cdot \cos re \]
      6. *-commutative100.0%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \color{blue}{\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)}\right)\right)\right) \cdot \cos re \]
      7. +-commutative100.0%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)}\right)\right)\right) \cdot \cos re \]
    9. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \cdot \cos re} \]
    10. Taylor expanded in re around 0 75.0%

      \[\leadsto \color{blue}{im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)} \]
    11. Step-by-step derivation
      1. sub-neg75.0%

        \[\leadsto im \cdot \color{blue}{\left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \left(-1\right)\right)} \]
      2. metadata-eval75.0%

        \[\leadsto im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \color{blue}{-1}\right) \]
      3. +-commutative75.0%

        \[\leadsto im \cdot \color{blue}{\left(-1 + \left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right)} \]
      4. *-commutative75.0%

        \[\leadsto im \cdot \left(-1 + \left(\color{blue}{{im}^{2} \cdot -0.16666666666666666} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right) \]
      5. sub-neg75.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \color{blue}{\left(-0.0001984126984126984 \cdot {im}^{2} + \left(-0.008333333333333333\right)\right)}\right)\right) \]
      6. *-commutative75.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{{im}^{2} \cdot -0.0001984126984126984} + \left(-0.008333333333333333\right)\right)\right)\right) \]
      7. unpow275.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.0001984126984126984 + \left(-0.008333333333333333\right)\right)\right)\right) \]
      8. associate-*r*75.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{im \cdot \left(im \cdot -0.0001984126984126984\right)} + \left(-0.008333333333333333\right)\right)\right)\right) \]
      9. metadata-eval75.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + \color{blue}{-0.008333333333333333}\right)\right)\right) \]
      10. metadata-eval75.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{\color{blue}{\left(2 \cdot 2\right)}} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      11. pow-sqr75.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      12. unpow275.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{\left(im \cdot im\right)}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      13. unpow275.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{\left(im \cdot im\right)} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      14. unpow275.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{2}} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      15. unpow275.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      16. associate-*r*75.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)}\right)\right) \]
    12. Simplified75.0%

      \[\leadsto \color{blue}{im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)} \]
    13. Taylor expanded in im around inf 75.0%

      \[\leadsto im \cdot \left(-1 + \color{blue}{-0.0001984126984126984 \cdot {im}^{6}}\right) \]
    14. Step-by-step derivation
      1. metadata-eval75.0%

        \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot {im}^{\color{blue}{\left(2 \cdot 3\right)}}\right) \]
      2. pow-sqr75.0%

        \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot \color{blue}{\left({im}^{3} \cdot {im}^{3}\right)}\right) \]
      3. cube-mult75.0%

        \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot {im}^{3}\right)\right) \]
      4. cube-mult75.0%

        \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)}\right)\right) \]
    15. Simplified75.0%

      \[\leadsto im \cdot \left(-1 + \color{blue}{-0.0001984126984126984 \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)}\right) \]

    if 5.49999999999999981e102 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} - 2\right)\right)} \]
    6. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{2} + \left(-2\right)\right)}\right) \]
      2. metadata-eval100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} + \color{blue}{-2}\right)\right) \]
      3. +-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-2 + -0.3333333333333333 \cdot {im}^{2}\right)}\right) \]
      4. *-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{{im}^{2} \cdot -0.3333333333333333}\right)\right) \]
      5. unpow2100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{\left(im \cdot im\right)} \cdot -0.3333333333333333\right)\right) \]
      6. associate-*l*100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{im \cdot \left(im \cdot -0.3333333333333333\right)}\right)\right) \]
    7. Simplified100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)} \]
    8. Taylor expanded in im around inf 100.0%

      \[\leadsto \color{blue}{-0.16666666666666666 \cdot \left({im}^{3} \cdot \cos re\right)} \]
    9. Step-by-step derivation
      1. cube-unmult100.0%

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

        \[\leadsto -0.16666666666666666 \cdot \color{blue}{\left(\cos re \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)} \]
    10. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 5.8 \cdot 10^{+15}:\\ \;\;\;\;im \cdot \left(-\cos re\right)\\ \mathbf{elif}\;im \leq 3.6 \cdot 10^{+44}:\\ \;\;\;\;im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right) + \left(re \cdot re\right) \cdot \left(\left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right) \cdot -0.5 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot \left(0.041666666666666664 \cdot \left(im \cdot \frac{-1 + im \cdot \left(im \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)}{re \cdot re}\right) + -0.001388888888888889 \cdot \left(im \cdot \left(-1 + im \cdot \left(im \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right)\right)\right)\right)\\ \mathbf{elif}\;im \leq 5.5 \cdot 10^{+102}:\\ \;\;\;\;im \cdot \left(-1 + -0.0001984126984126984 \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-0.16666666666666666 \cdot \left(\cos re \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 93.4% accurate, 2.5× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \left(im\_m \cdot \left(\cos re \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + im\_m \cdot \left(im\_m \cdot \left(-0.008333333333333333 + \left(im\_m \cdot im\_m\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right)\right) \end{array} \]
im\_m = (fabs.f64 im)
im\_s = (copysign.f64 #s(literal 1 binary64) im)
(FPCore (im_s re im_m)
 :precision binary64
 (*
  im_s
  (*
   im_m
   (*
    (cos re)
    (+
     -1.0
     (*
      (* im_m im_m)
      (+
       -0.16666666666666666
       (*
        im_m
        (*
         im_m
         (+
          -0.008333333333333333
          (* (* im_m im_m) -0.0001984126984126984)))))))))))
im\_m = fabs(im);
im\_s = copysign(1.0, im);
double code(double im_s, double re, double im_m) {
	return im_s * (im_m * (cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)))))))));
}
im\_m = abs(im)
im\_s = copysign(1.0d0, im)
real(8) function code(im_s, re, im_m)
    real(8), intent (in) :: im_s
    real(8), intent (in) :: re
    real(8), intent (in) :: im_m
    code = im_s * (im_m * (cos(re) * ((-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + (im_m * (im_m * ((-0.008333333333333333d0) + ((im_m * im_m) * (-0.0001984126984126984d0))))))))))
end function
im\_m = Math.abs(im);
im\_s = Math.copySign(1.0, im);
public static double code(double im_s, double re, double im_m) {
	return im_s * (im_m * (Math.cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)))))))));
}
im\_m = math.fabs(im)
im\_s = math.copysign(1.0, im)
def code(im_s, re, im_m):
	return im_s * (im_m * (math.cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)))))))))
im\_m = abs(im)
im\_s = copysign(1.0, im)
function code(im_s, re, im_m)
	return Float64(im_s * Float64(im_m * Float64(cos(re) * Float64(-1.0 + Float64(Float64(im_m * im_m) * Float64(-0.16666666666666666 + Float64(im_m * Float64(im_m * Float64(-0.008333333333333333 + Float64(Float64(im_m * im_m) * -0.0001984126984126984))))))))))
end
im\_m = abs(im);
im\_s = sign(im) * abs(1.0);
function tmp = code(im_s, re, im_m)
	tmp = im_s * (im_m * (cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)))))))));
end
im\_m = N[Abs[im], $MachinePrecision]
im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[im$95$s_, re_, im$95$m_] := N[(im$95$s * N[(im$95$m * N[(N[Cos[re], $MachinePrecision] * N[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(-0.16666666666666666 + N[(im$95$m * N[(im$95$m * N[(-0.008333333333333333 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
im\_m = \left|im\right|
\\
im\_s = \mathsf{copysign}\left(1, im\right)

\\
im\_s \cdot \left(im\_m \cdot \left(\cos re \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + im\_m \cdot \left(im\_m \cdot \left(-0.008333333333333333 + \left(im\_m \cdot im\_m\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 58.5%

    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
  2. Step-by-step derivation
    1. neg-sub058.5%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
  3. Simplified58.5%

    \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in im around 0 94.3%

    \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
  6. Step-by-step derivation
    1. +-commutative94.3%

      \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + -1 \cdot \cos re\right)} \]
    2. +-commutative94.3%

      \[\leadsto im \cdot \left({im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right) + -0.16666666666666666 \cdot \cos re\right)} + -1 \cdot \cos re\right) \]
    3. distribute-rgt-in94.3%

      \[\leadsto im \cdot \left(\color{blue}{\left(\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right)} + -1 \cdot \cos re\right) \]
    4. *-commutative94.3%

      \[\leadsto im \cdot \left(\left(\color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
    5. associate-+l+94.3%

      \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2} + -1 \cdot \cos re\right)\right)} \]
  7. Simplified94.3%

    \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right)} \]
  8. Step-by-step derivation
    1. *-commutative94.3%

      \[\leadsto im \cdot \color{blue}{\left(\left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot \cos re\right)} \]
    2. associate-*r*94.3%

      \[\leadsto \color{blue}{\left(im \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right) \cdot \cos re} \]
    3. +-commutative94.3%

      \[\leadsto \left(im \cdot \color{blue}{\left(\left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)}\right) \cdot \cos re \]
    4. +-commutative94.3%

      \[\leadsto \left(im \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)} + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \cos re \]
    5. associate-+l+94.3%

      \[\leadsto \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)}\right) \cdot \cos re \]
    6. *-commutative94.3%

      \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \color{blue}{\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)}\right)\right)\right) \cdot \cos re \]
    7. +-commutative94.3%

      \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)}\right)\right)\right) \cdot \cos re \]
  9. Applied egg-rr94.3%

    \[\leadsto \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \cdot \cos re} \]
  10. Taylor expanded in re around inf 94.3%

    \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)\right)} \]
  11. Step-by-step derivation
    1. sub-neg94.3%

      \[\leadsto im \cdot \left(\cos re \cdot \color{blue}{\left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \left(-1\right)\right)}\right) \]
    2. metadata-eval94.3%

      \[\leadsto im \cdot \left(\cos re \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \color{blue}{-1}\right)\right) \]
    3. +-commutative94.3%

      \[\leadsto im \cdot \left(\cos re \cdot \color{blue}{\left(-1 + \left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right)}\right) \]
    4. *-commutative94.3%

      \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left(\color{blue}{{im}^{2} \cdot -0.16666666666666666} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right)\right) \]
    5. sub-neg94.3%

      \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \color{blue}{\left(-0.0001984126984126984 \cdot {im}^{2} + \left(-0.008333333333333333\right)\right)}\right)\right)\right) \]
    6. *-commutative94.3%

      \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{{im}^{2} \cdot -0.0001984126984126984} + \left(-0.008333333333333333\right)\right)\right)\right)\right) \]
    7. unpow294.3%

      \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.0001984126984126984 + \left(-0.008333333333333333\right)\right)\right)\right)\right) \]
    8. associate-*r*94.3%

      \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{im \cdot \left(im \cdot -0.0001984126984126984\right)} + \left(-0.008333333333333333\right)\right)\right)\right)\right) \]
    9. metadata-eval94.3%

      \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + \color{blue}{-0.008333333333333333}\right)\right)\right)\right) \]
    10. metadata-eval94.3%

      \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{\color{blue}{\left(2 \cdot 2\right)}} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \]
    11. pow-sqr94.3%

      \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \]
    12. unpow294.3%

      \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{\left(im \cdot im\right)}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \]
    13. unpow294.3%

      \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{\left(im \cdot im\right)} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \]
    14. unpow294.3%

      \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{2}} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \]
    15. unpow294.3%

      \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \]
  12. Simplified94.3%

    \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right)} \]
  13. Add Preprocessing

Alternative 8: 90.7% accurate, 2.6× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := im\_m \cdot \left(im\_m \cdot im\_m\right)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 1.55 \cdot 10^{+27}:\\ \;\;\;\;im\_m \cdot \left(-\cos re\right)\\ \mathbf{elif}\;im\_m \leq 5.5 \cdot 10^{+102}:\\ \;\;\;\;im\_m \cdot \left(-1 + -0.0001984126984126984 \cdot \left(t\_0 \cdot t\_0\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-0.16666666666666666 \cdot \left(\cos re \cdot t\_0\right)\\ \end{array} \end{array} \end{array} \]
im\_m = (fabs.f64 im)
im\_s = (copysign.f64 #s(literal 1 binary64) im)
(FPCore (im_s re im_m)
 :precision binary64
 (let* ((t_0 (* im_m (* im_m im_m))))
   (*
    im_s
    (if (<= im_m 1.55e+27)
      (* im_m (- (cos re)))
      (if (<= im_m 5.5e+102)
        (* im_m (+ -1.0 (* -0.0001984126984126984 (* t_0 t_0))))
        (* -0.16666666666666666 (* (cos re) t_0)))))))
im\_m = fabs(im);
im\_s = copysign(1.0, im);
double code(double im_s, double re, double im_m) {
	double t_0 = im_m * (im_m * im_m);
	double tmp;
	if (im_m <= 1.55e+27) {
		tmp = im_m * -cos(re);
	} else if (im_m <= 5.5e+102) {
		tmp = im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0)));
	} else {
		tmp = -0.16666666666666666 * (cos(re) * t_0);
	}
	return im_s * tmp;
}
im\_m = abs(im)
im\_s = copysign(1.0d0, im)
real(8) function code(im_s, re, im_m)
    real(8), intent (in) :: im_s
    real(8), intent (in) :: re
    real(8), intent (in) :: im_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = im_m * (im_m * im_m)
    if (im_m <= 1.55d+27) then
        tmp = im_m * -cos(re)
    else if (im_m <= 5.5d+102) then
        tmp = im_m * ((-1.0d0) + ((-0.0001984126984126984d0) * (t_0 * t_0)))
    else
        tmp = (-0.16666666666666666d0) * (cos(re) * t_0)
    end if
    code = im_s * tmp
end function
im\_m = Math.abs(im);
im\_s = Math.copySign(1.0, im);
public static double code(double im_s, double re, double im_m) {
	double t_0 = im_m * (im_m * im_m);
	double tmp;
	if (im_m <= 1.55e+27) {
		tmp = im_m * -Math.cos(re);
	} else if (im_m <= 5.5e+102) {
		tmp = im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0)));
	} else {
		tmp = -0.16666666666666666 * (Math.cos(re) * t_0);
	}
	return im_s * tmp;
}
im\_m = math.fabs(im)
im\_s = math.copysign(1.0, im)
def code(im_s, re, im_m):
	t_0 = im_m * (im_m * im_m)
	tmp = 0
	if im_m <= 1.55e+27:
		tmp = im_m * -math.cos(re)
	elif im_m <= 5.5e+102:
		tmp = im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0)))
	else:
		tmp = -0.16666666666666666 * (math.cos(re) * t_0)
	return im_s * tmp
im\_m = abs(im)
im\_s = copysign(1.0, im)
function code(im_s, re, im_m)
	t_0 = Float64(im_m * Float64(im_m * im_m))
	tmp = 0.0
	if (im_m <= 1.55e+27)
		tmp = Float64(im_m * Float64(-cos(re)));
	elseif (im_m <= 5.5e+102)
		tmp = Float64(im_m * Float64(-1.0 + Float64(-0.0001984126984126984 * Float64(t_0 * t_0))));
	else
		tmp = Float64(-0.16666666666666666 * Float64(cos(re) * t_0));
	end
	return Float64(im_s * tmp)
end
im\_m = abs(im);
im\_s = sign(im) * abs(1.0);
function tmp_2 = code(im_s, re, im_m)
	t_0 = im_m * (im_m * im_m);
	tmp = 0.0;
	if (im_m <= 1.55e+27)
		tmp = im_m * -cos(re);
	elseif (im_m <= 5.5e+102)
		tmp = im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0)));
	else
		tmp = -0.16666666666666666 * (cos(re) * t_0);
	end
	tmp_2 = im_s * tmp;
end
im\_m = N[Abs[im], $MachinePrecision]
im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[im$95$s_, re_, im$95$m_] := Block[{t$95$0 = N[(im$95$m * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[im$95$m, 1.55e+27], N[(im$95$m * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im$95$m, 5.5e+102], N[(im$95$m * N[(-1.0 + N[(-0.0001984126984126984 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.16666666666666666 * N[(N[Cos[re], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
im\_m = \left|im\right|
\\
im\_s = \mathsf{copysign}\left(1, im\right)

\\
\begin{array}{l}
t_0 := im\_m \cdot \left(im\_m \cdot im\_m\right)\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;im\_m \leq 1.55 \cdot 10^{+27}:\\
\;\;\;\;im\_m \cdot \left(-\cos re\right)\\

\mathbf{elif}\;im\_m \leq 5.5 \cdot 10^{+102}:\\
\;\;\;\;im\_m \cdot \left(-1 + -0.0001984126984126984 \cdot \left(t\_0 \cdot t\_0\right)\right)\\

\mathbf{else}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(\cos re \cdot t\_0\right)\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < 1.54999999999999998e27

    1. Initial program 46.1%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub046.1%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified46.1%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 60.1%

      \[\leadsto \color{blue}{-1 \cdot \left(im \cdot \cos re\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg60.1%

        \[\leadsto \color{blue}{-im \cdot \cos re} \]
      2. neg-sub060.1%

        \[\leadsto \color{blue}{0 - im \cdot \cos re} \]
    7. Simplified60.1%

      \[\leadsto \color{blue}{0 - im \cdot \cos re} \]

    if 1.54999999999999998e27 < im < 5.49999999999999981e102

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 65.1%

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative65.1%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + -1 \cdot \cos re\right)} \]
      2. +-commutative65.1%

        \[\leadsto im \cdot \left({im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right) + -0.16666666666666666 \cdot \cos re\right)} + -1 \cdot \cos re\right) \]
      3. distribute-rgt-in65.1%

        \[\leadsto im \cdot \left(\color{blue}{\left(\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right)} + -1 \cdot \cos re\right) \]
      4. *-commutative65.1%

        \[\leadsto im \cdot \left(\left(\color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
      5. associate-+l+65.1%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2} + -1 \cdot \cos re\right)\right)} \]
    7. Simplified65.1%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right)} \]
    8. Step-by-step derivation
      1. *-commutative65.1%

        \[\leadsto im \cdot \color{blue}{\left(\left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot \cos re\right)} \]
      2. associate-*r*65.1%

        \[\leadsto \color{blue}{\left(im \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right) \cdot \cos re} \]
      3. +-commutative65.1%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)}\right) \cdot \cos re \]
      4. +-commutative65.1%

        \[\leadsto \left(im \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)} + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \cos re \]
      5. associate-+l+65.1%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)}\right) \cdot \cos re \]
      6. *-commutative65.1%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \color{blue}{\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)}\right)\right)\right) \cdot \cos re \]
      7. +-commutative65.1%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)}\right)\right)\right) \cdot \cos re \]
    9. Applied egg-rr65.1%

      \[\leadsto \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \cdot \cos re} \]
    10. Taylor expanded in re around 0 49.0%

      \[\leadsto \color{blue}{im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)} \]
    11. Step-by-step derivation
      1. sub-neg49.0%

        \[\leadsto im \cdot \color{blue}{\left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \left(-1\right)\right)} \]
      2. metadata-eval49.0%

        \[\leadsto im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \color{blue}{-1}\right) \]
      3. +-commutative49.0%

        \[\leadsto im \cdot \color{blue}{\left(-1 + \left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right)} \]
      4. *-commutative49.0%

        \[\leadsto im \cdot \left(-1 + \left(\color{blue}{{im}^{2} \cdot -0.16666666666666666} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right) \]
      5. sub-neg49.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \color{blue}{\left(-0.0001984126984126984 \cdot {im}^{2} + \left(-0.008333333333333333\right)\right)}\right)\right) \]
      6. *-commutative49.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{{im}^{2} \cdot -0.0001984126984126984} + \left(-0.008333333333333333\right)\right)\right)\right) \]
      7. unpow249.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.0001984126984126984 + \left(-0.008333333333333333\right)\right)\right)\right) \]
      8. associate-*r*49.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{im \cdot \left(im \cdot -0.0001984126984126984\right)} + \left(-0.008333333333333333\right)\right)\right)\right) \]
      9. metadata-eval49.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + \color{blue}{-0.008333333333333333}\right)\right)\right) \]
      10. metadata-eval49.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{\color{blue}{\left(2 \cdot 2\right)}} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      11. pow-sqr49.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      12. unpow249.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{\left(im \cdot im\right)}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      13. unpow249.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{\left(im \cdot im\right)} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      14. unpow249.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{2}} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      15. unpow249.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      16. associate-*r*49.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)}\right)\right) \]
    12. Simplified49.0%

      \[\leadsto \color{blue}{im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)} \]
    13. Taylor expanded in im around inf 49.0%

      \[\leadsto im \cdot \left(-1 + \color{blue}{-0.0001984126984126984 \cdot {im}^{6}}\right) \]
    14. Step-by-step derivation
      1. metadata-eval49.0%

        \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot {im}^{\color{blue}{\left(2 \cdot 3\right)}}\right) \]
      2. pow-sqr49.0%

        \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot \color{blue}{\left({im}^{3} \cdot {im}^{3}\right)}\right) \]
      3. cube-mult49.0%

        \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot {im}^{3}\right)\right) \]
      4. cube-mult49.0%

        \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)}\right)\right) \]
    15. Simplified49.0%

      \[\leadsto im \cdot \left(-1 + \color{blue}{-0.0001984126984126984 \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)}\right) \]

    if 5.49999999999999981e102 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} - 2\right)\right)} \]
    6. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{2} + \left(-2\right)\right)}\right) \]
      2. metadata-eval100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} + \color{blue}{-2}\right)\right) \]
      3. +-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-2 + -0.3333333333333333 \cdot {im}^{2}\right)}\right) \]
      4. *-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{{im}^{2} \cdot -0.3333333333333333}\right)\right) \]
      5. unpow2100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{\left(im \cdot im\right)} \cdot -0.3333333333333333\right)\right) \]
      6. associate-*l*100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{im \cdot \left(im \cdot -0.3333333333333333\right)}\right)\right) \]
    7. Simplified100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)} \]
    8. Taylor expanded in im around inf 100.0%

      \[\leadsto \color{blue}{-0.16666666666666666 \cdot \left({im}^{3} \cdot \cos re\right)} \]
    9. Step-by-step derivation
      1. cube-unmult100.0%

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

        \[\leadsto -0.16666666666666666 \cdot \color{blue}{\left(\cos re \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)} \]
    10. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 1.55 \cdot 10^{+27}:\\ \;\;\;\;im \cdot \left(-\cos re\right)\\ \mathbf{elif}\;im \leq 5.5 \cdot 10^{+102}:\\ \;\;\;\;im \cdot \left(-1 + -0.0001984126984126984 \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-0.16666666666666666 \cdot \left(\cos re \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 90.7% accurate, 2.6× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \left(im\_m \cdot \left(\cos re \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + im\_m \cdot \left(im\_m \cdot -0.008333333333333333\right)\right)\right)\right)\right) \end{array} \]
im\_m = (fabs.f64 im)
im\_s = (copysign.f64 #s(literal 1 binary64) im)
(FPCore (im_s re im_m)
 :precision binary64
 (*
  im_s
  (*
   im_m
   (*
    (cos re)
    (+
     -1.0
     (*
      (* im_m im_m)
      (+ -0.16666666666666666 (* im_m (* im_m -0.008333333333333333)))))))))
im\_m = fabs(im);
im\_s = copysign(1.0, im);
double code(double im_s, double re, double im_m) {
	return im_s * (im_m * (cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * -0.008333333333333333)))))));
}
im\_m = abs(im)
im\_s = copysign(1.0d0, im)
real(8) function code(im_s, re, im_m)
    real(8), intent (in) :: im_s
    real(8), intent (in) :: re
    real(8), intent (in) :: im_m
    code = im_s * (im_m * (cos(re) * ((-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + (im_m * (im_m * (-0.008333333333333333d0))))))))
end function
im\_m = Math.abs(im);
im\_s = Math.copySign(1.0, im);
public static double code(double im_s, double re, double im_m) {
	return im_s * (im_m * (Math.cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * -0.008333333333333333)))))));
}
im\_m = math.fabs(im)
im\_s = math.copysign(1.0, im)
def code(im_s, re, im_m):
	return im_s * (im_m * (math.cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * -0.008333333333333333)))))))
im\_m = abs(im)
im\_s = copysign(1.0, im)
function code(im_s, re, im_m)
	return Float64(im_s * Float64(im_m * Float64(cos(re) * Float64(-1.0 + Float64(Float64(im_m * im_m) * Float64(-0.16666666666666666 + Float64(im_m * Float64(im_m * -0.008333333333333333))))))))
end
im\_m = abs(im);
im\_s = sign(im) * abs(1.0);
function tmp = code(im_s, re, im_m)
	tmp = im_s * (im_m * (cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * -0.008333333333333333)))))));
end
im\_m = N[Abs[im], $MachinePrecision]
im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[im$95$s_, re_, im$95$m_] := N[(im$95$s * N[(im$95$m * N[(N[Cos[re], $MachinePrecision] * N[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(-0.16666666666666666 + N[(im$95$m * N[(im$95$m * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
im\_m = \left|im\right|
\\
im\_s = \mathsf{copysign}\left(1, im\right)

\\
im\_s \cdot \left(im\_m \cdot \left(\cos re \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + im\_m \cdot \left(im\_m \cdot -0.008333333333333333\right)\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 58.5%

    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
  2. Step-by-step derivation
    1. neg-sub058.5%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
  3. Simplified58.5%

    \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in im around 0 92.6%

    \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + -0.008333333333333333 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} \]
  6. Step-by-step derivation
    1. *-commutative92.6%

      \[\leadsto im \cdot \left(\color{blue}{\cos re \cdot -1} + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + -0.008333333333333333 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \]
    2. *-commutative92.6%

      \[\leadsto im \cdot \left(\cos re \cdot -1 + \color{blue}{\left(-0.16666666666666666 \cdot \cos re + -0.008333333333333333 \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2}}\right) \]
    3. associate-*r*92.6%

      \[\leadsto im \cdot \left(\cos re \cdot -1 + \left(-0.16666666666666666 \cdot \cos re + \color{blue}{\left(-0.008333333333333333 \cdot {im}^{2}\right) \cdot \cos re}\right) \cdot {im}^{2}\right) \]
    4. distribute-rgt-out92.6%

      \[\leadsto im \cdot \left(\cos re \cdot -1 + \color{blue}{\left(\cos re \cdot \left(-0.16666666666666666 + -0.008333333333333333 \cdot {im}^{2}\right)\right)} \cdot {im}^{2}\right) \]
    5. associate-*l*92.6%

      \[\leadsto im \cdot \left(\cos re \cdot -1 + \color{blue}{\cos re \cdot \left(\left(-0.16666666666666666 + -0.008333333333333333 \cdot {im}^{2}\right) \cdot {im}^{2}\right)}\right) \]
    6. distribute-lft-out92.6%

      \[\leadsto im \cdot \color{blue}{\left(\cos re \cdot \left(-1 + \left(-0.16666666666666666 + -0.008333333333333333 \cdot {im}^{2}\right) \cdot {im}^{2}\right)\right)} \]
    7. *-commutative92.6%

      \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \color{blue}{{im}^{2} \cdot \left(-0.16666666666666666 + -0.008333333333333333 \cdot {im}^{2}\right)}\right)\right) \]
    8. distribute-lft-out92.6%

      \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \color{blue}{\left({im}^{2} \cdot -0.16666666666666666 + {im}^{2} \cdot \left(-0.008333333333333333 \cdot {im}^{2}\right)\right)}\right)\right) \]
    9. *-commutative92.6%

      \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left(\color{blue}{-0.16666666666666666 \cdot {im}^{2}} + {im}^{2} \cdot \left(-0.008333333333333333 \cdot {im}^{2}\right)\right)\right)\right) \]
    10. *-commutative92.6%

      \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \left(\color{blue}{{im}^{2} \cdot -0.16666666666666666} + {im}^{2} \cdot \left(-0.008333333333333333 \cdot {im}^{2}\right)\right)\right)\right) \]
    11. distribute-lft-out92.6%

      \[\leadsto im \cdot \left(\cos re \cdot \left(-1 + \color{blue}{{im}^{2} \cdot \left(-0.16666666666666666 + -0.008333333333333333 \cdot {im}^{2}\right)}\right)\right) \]
  7. Simplified92.6%

    \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot -0.008333333333333333\right)\right)\right)\right)} \]
  8. Add Preprocessing

Alternative 10: 82.2% accurate, 2.8× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := im\_m \cdot \left(im\_m \cdot im\_m\right)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 8.5 \cdot 10^{+26}:\\ \;\;\;\;im\_m \cdot \left(-\cos re\right)\\ \mathbf{elif}\;im\_m \leq 1.6 \cdot 10^{+150}:\\ \;\;\;\;im\_m \cdot \left(-1 + -0.0001984126984126984 \cdot \left(t\_0 \cdot t\_0\right)\right)\\ \mathbf{elif}\;im\_m \leq 2 \cdot 10^{+278}:\\ \;\;\;\;im\_m \cdot \left(\left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot \left(0.08333333333333333 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot 0.0002314814814814815 + -0.006944444444444444\right)\right)\right) + \left(-1 + \left(re \cdot re\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot 0.001388888888888889 + -0.041666666666666664\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(t\_0 \cdot -0.3333333333333333\right)\\ \end{array} \end{array} \end{array} \]
im\_m = (fabs.f64 im)
im\_s = (copysign.f64 #s(literal 1 binary64) im)
(FPCore (im_s re im_m)
 :precision binary64
 (let* ((t_0 (* im_m (* im_m im_m))))
   (*
    im_s
    (if (<= im_m 8.5e+26)
      (* im_m (- (cos re)))
      (if (<= im_m 1.6e+150)
        (* im_m (+ -1.0 (* -0.0001984126984126984 (* t_0 t_0))))
        (if (<= im_m 2e+278)
          (*
           im_m
           (+
            (*
             (* im_m im_m)
             (+
              -0.16666666666666666
              (*
               (* re re)
               (+
                0.08333333333333333
                (*
                 (* re re)
                 (+
                  (* (* re re) 0.0002314814814814815)
                  -0.006944444444444444))))))
            (+
             -1.0
             (*
              (* re re)
              (+
               0.5
               (*
                (* re re)
                (+
                 (* (* re re) 0.001388888888888889)
                 -0.041666666666666664)))))))
          (* 0.5 (* t_0 -0.3333333333333333))))))))
im\_m = fabs(im);
im\_s = copysign(1.0, im);
double code(double im_s, double re, double im_m) {
	double t_0 = im_m * (im_m * im_m);
	double tmp;
	if (im_m <= 8.5e+26) {
		tmp = im_m * -cos(re);
	} else if (im_m <= 1.6e+150) {
		tmp = im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0)));
	} else if (im_m <= 2e+278) {
		tmp = im_m * (((im_m * im_m) * (-0.16666666666666666 + ((re * re) * (0.08333333333333333 + ((re * re) * (((re * re) * 0.0002314814814814815) + -0.006944444444444444)))))) + (-1.0 + ((re * re) * (0.5 + ((re * re) * (((re * re) * 0.001388888888888889) + -0.041666666666666664))))));
	} else {
		tmp = 0.5 * (t_0 * -0.3333333333333333);
	}
	return im_s * tmp;
}
im\_m = abs(im)
im\_s = copysign(1.0d0, im)
real(8) function code(im_s, re, im_m)
    real(8), intent (in) :: im_s
    real(8), intent (in) :: re
    real(8), intent (in) :: im_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = im_m * (im_m * im_m)
    if (im_m <= 8.5d+26) then
        tmp = im_m * -cos(re)
    else if (im_m <= 1.6d+150) then
        tmp = im_m * ((-1.0d0) + ((-0.0001984126984126984d0) * (t_0 * t_0)))
    else if (im_m <= 2d+278) then
        tmp = im_m * (((im_m * im_m) * ((-0.16666666666666666d0) + ((re * re) * (0.08333333333333333d0 + ((re * re) * (((re * re) * 0.0002314814814814815d0) + (-0.006944444444444444d0))))))) + ((-1.0d0) + ((re * re) * (0.5d0 + ((re * re) * (((re * re) * 0.001388888888888889d0) + (-0.041666666666666664d0)))))))
    else
        tmp = 0.5d0 * (t_0 * (-0.3333333333333333d0))
    end if
    code = im_s * tmp
end function
im\_m = Math.abs(im);
im\_s = Math.copySign(1.0, im);
public static double code(double im_s, double re, double im_m) {
	double t_0 = im_m * (im_m * im_m);
	double tmp;
	if (im_m <= 8.5e+26) {
		tmp = im_m * -Math.cos(re);
	} else if (im_m <= 1.6e+150) {
		tmp = im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0)));
	} else if (im_m <= 2e+278) {
		tmp = im_m * (((im_m * im_m) * (-0.16666666666666666 + ((re * re) * (0.08333333333333333 + ((re * re) * (((re * re) * 0.0002314814814814815) + -0.006944444444444444)))))) + (-1.0 + ((re * re) * (0.5 + ((re * re) * (((re * re) * 0.001388888888888889) + -0.041666666666666664))))));
	} else {
		tmp = 0.5 * (t_0 * -0.3333333333333333);
	}
	return im_s * tmp;
}
im\_m = math.fabs(im)
im\_s = math.copysign(1.0, im)
def code(im_s, re, im_m):
	t_0 = im_m * (im_m * im_m)
	tmp = 0
	if im_m <= 8.5e+26:
		tmp = im_m * -math.cos(re)
	elif im_m <= 1.6e+150:
		tmp = im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0)))
	elif im_m <= 2e+278:
		tmp = im_m * (((im_m * im_m) * (-0.16666666666666666 + ((re * re) * (0.08333333333333333 + ((re * re) * (((re * re) * 0.0002314814814814815) + -0.006944444444444444)))))) + (-1.0 + ((re * re) * (0.5 + ((re * re) * (((re * re) * 0.001388888888888889) + -0.041666666666666664))))))
	else:
		tmp = 0.5 * (t_0 * -0.3333333333333333)
	return im_s * tmp
im\_m = abs(im)
im\_s = copysign(1.0, im)
function code(im_s, re, im_m)
	t_0 = Float64(im_m * Float64(im_m * im_m))
	tmp = 0.0
	if (im_m <= 8.5e+26)
		tmp = Float64(im_m * Float64(-cos(re)));
	elseif (im_m <= 1.6e+150)
		tmp = Float64(im_m * Float64(-1.0 + Float64(-0.0001984126984126984 * Float64(t_0 * t_0))));
	elseif (im_m <= 2e+278)
		tmp = Float64(im_m * Float64(Float64(Float64(im_m * im_m) * Float64(-0.16666666666666666 + Float64(Float64(re * re) * Float64(0.08333333333333333 + Float64(Float64(re * re) * Float64(Float64(Float64(re * re) * 0.0002314814814814815) + -0.006944444444444444)))))) + Float64(-1.0 + Float64(Float64(re * re) * Float64(0.5 + Float64(Float64(re * re) * Float64(Float64(Float64(re * re) * 0.001388888888888889) + -0.041666666666666664)))))));
	else
		tmp = Float64(0.5 * Float64(t_0 * -0.3333333333333333));
	end
	return Float64(im_s * tmp)
end
im\_m = abs(im);
im\_s = sign(im) * abs(1.0);
function tmp_2 = code(im_s, re, im_m)
	t_0 = im_m * (im_m * im_m);
	tmp = 0.0;
	if (im_m <= 8.5e+26)
		tmp = im_m * -cos(re);
	elseif (im_m <= 1.6e+150)
		tmp = im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0)));
	elseif (im_m <= 2e+278)
		tmp = im_m * (((im_m * im_m) * (-0.16666666666666666 + ((re * re) * (0.08333333333333333 + ((re * re) * (((re * re) * 0.0002314814814814815) + -0.006944444444444444)))))) + (-1.0 + ((re * re) * (0.5 + ((re * re) * (((re * re) * 0.001388888888888889) + -0.041666666666666664))))));
	else
		tmp = 0.5 * (t_0 * -0.3333333333333333);
	end
	tmp_2 = im_s * tmp;
end
im\_m = N[Abs[im], $MachinePrecision]
im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[im$95$s_, re_, im$95$m_] := Block[{t$95$0 = N[(im$95$m * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[im$95$m, 8.5e+26], N[(im$95$m * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im$95$m, 1.6e+150], N[(im$95$m * N[(-1.0 + N[(-0.0001984126984126984 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 2e+278], N[(im$95$m * N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(-0.16666666666666666 + N[(N[(re * re), $MachinePrecision] * N[(0.08333333333333333 + N[(N[(re * re), $MachinePrecision] * N[(N[(N[(re * re), $MachinePrecision] * 0.0002314814814814815), $MachinePrecision] + -0.006944444444444444), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 + N[(N[(re * re), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * N[(N[(N[(re * re), $MachinePrecision] * 0.001388888888888889), $MachinePrecision] + -0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(t$95$0 * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]
\begin{array}{l}
im\_m = \left|im\right|
\\
im\_s = \mathsf{copysign}\left(1, im\right)

\\
\begin{array}{l}
t_0 := im\_m \cdot \left(im\_m \cdot im\_m\right)\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;im\_m \leq 8.5 \cdot 10^{+26}:\\
\;\;\;\;im\_m \cdot \left(-\cos re\right)\\

\mathbf{elif}\;im\_m \leq 1.6 \cdot 10^{+150}:\\
\;\;\;\;im\_m \cdot \left(-1 + -0.0001984126984126984 \cdot \left(t\_0 \cdot t\_0\right)\right)\\

\mathbf{elif}\;im\_m \leq 2 \cdot 10^{+278}:\\
\;\;\;\;im\_m \cdot \left(\left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot \left(0.08333333333333333 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot 0.0002314814814814815 + -0.006944444444444444\right)\right)\right) + \left(-1 + \left(re \cdot re\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot 0.001388888888888889 + -0.041666666666666664\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(t\_0 \cdot -0.3333333333333333\right)\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < 8.5e26

    1. Initial program 46.1%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub046.1%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified46.1%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 60.1%

      \[\leadsto \color{blue}{-1 \cdot \left(im \cdot \cos re\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg60.1%

        \[\leadsto \color{blue}{-im \cdot \cos re} \]
      2. neg-sub060.1%

        \[\leadsto \color{blue}{0 - im \cdot \cos re} \]
    7. Simplified60.1%

      \[\leadsto \color{blue}{0 - im \cdot \cos re} \]

    if 8.5e26 < im < 1.60000000000000008e150

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 78.4%

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative78.4%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + -1 \cdot \cos re\right)} \]
      2. +-commutative78.4%

        \[\leadsto im \cdot \left({im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right) + -0.16666666666666666 \cdot \cos re\right)} + -1 \cdot \cos re\right) \]
      3. distribute-rgt-in78.4%

        \[\leadsto im \cdot \left(\color{blue}{\left(\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right)} + -1 \cdot \cos re\right) \]
      4. *-commutative78.4%

        \[\leadsto im \cdot \left(\left(\color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
      5. associate-+l+78.4%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2} + -1 \cdot \cos re\right)\right)} \]
    7. Simplified78.4%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right)} \]
    8. Step-by-step derivation
      1. *-commutative78.4%

        \[\leadsto im \cdot \color{blue}{\left(\left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot \cos re\right)} \]
      2. associate-*r*78.4%

        \[\leadsto \color{blue}{\left(im \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right) \cdot \cos re} \]
      3. +-commutative78.4%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)}\right) \cdot \cos re \]
      4. +-commutative78.4%

        \[\leadsto \left(im \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)} + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \cos re \]
      5. associate-+l+78.4%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)}\right) \cdot \cos re \]
      6. *-commutative78.4%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \color{blue}{\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)}\right)\right)\right) \cdot \cos re \]
      7. +-commutative78.4%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)}\right)\right)\right) \cdot \cos re \]
    9. Applied egg-rr78.4%

      \[\leadsto \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \cdot \cos re} \]
    10. Taylor expanded in re around 0 63.7%

      \[\leadsto \color{blue}{im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)} \]
    11. Step-by-step derivation
      1. sub-neg63.7%

        \[\leadsto im \cdot \color{blue}{\left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \left(-1\right)\right)} \]
      2. metadata-eval63.7%

        \[\leadsto im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \color{blue}{-1}\right) \]
      3. +-commutative63.7%

        \[\leadsto im \cdot \color{blue}{\left(-1 + \left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right)} \]
      4. *-commutative63.7%

        \[\leadsto im \cdot \left(-1 + \left(\color{blue}{{im}^{2} \cdot -0.16666666666666666} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right) \]
      5. sub-neg63.7%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \color{blue}{\left(-0.0001984126984126984 \cdot {im}^{2} + \left(-0.008333333333333333\right)\right)}\right)\right) \]
      6. *-commutative63.7%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{{im}^{2} \cdot -0.0001984126984126984} + \left(-0.008333333333333333\right)\right)\right)\right) \]
      7. unpow263.7%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.0001984126984126984 + \left(-0.008333333333333333\right)\right)\right)\right) \]
      8. associate-*r*63.7%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{im \cdot \left(im \cdot -0.0001984126984126984\right)} + \left(-0.008333333333333333\right)\right)\right)\right) \]
      9. metadata-eval63.7%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + \color{blue}{-0.008333333333333333}\right)\right)\right) \]
      10. metadata-eval63.7%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{\color{blue}{\left(2 \cdot 2\right)}} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      11. pow-sqr63.7%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      12. unpow263.7%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{\left(im \cdot im\right)}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      13. unpow263.7%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{\left(im \cdot im\right)} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      14. unpow263.7%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{2}} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      15. unpow263.7%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      16. associate-*r*63.7%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)}\right)\right) \]
    12. Simplified63.7%

      \[\leadsto \color{blue}{im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)} \]
    13. Taylor expanded in im around inf 63.7%

      \[\leadsto im \cdot \left(-1 + \color{blue}{-0.0001984126984126984 \cdot {im}^{6}}\right) \]
    14. Step-by-step derivation
      1. metadata-eval63.7%

        \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot {im}^{\color{blue}{\left(2 \cdot 3\right)}}\right) \]
      2. pow-sqr63.7%

        \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot \color{blue}{\left({im}^{3} \cdot {im}^{3}\right)}\right) \]
      3. cube-mult63.7%

        \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot {im}^{3}\right)\right) \]
      4. cube-mult63.7%

        \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)}\right)\right) \]
    15. Simplified63.7%

      \[\leadsto im \cdot \left(-1 + \color{blue}{-0.0001984126984126984 \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)}\right) \]

    if 1.60000000000000008e150 < im < 1.99999999999999993e278

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 100.0%

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + -1 \cdot \cos re\right)} \]
      2. +-commutative100.0%

        \[\leadsto im \cdot \left({im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right) + -0.16666666666666666 \cdot \cos re\right)} + -1 \cdot \cos re\right) \]
      3. distribute-rgt-in100.0%

        \[\leadsto im \cdot \left(\color{blue}{\left(\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right)} + -1 \cdot \cos re\right) \]
      4. *-commutative100.0%

        \[\leadsto im \cdot \left(\left(\color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
      5. associate-+l+100.0%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2} + -1 \cdot \cos re\right)\right)} \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right)} \]
    8. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto im \cdot \color{blue}{\left(\left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot \cos re\right)} \]
      2. associate-*r*100.0%

        \[\leadsto \color{blue}{\left(im \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right) \cdot \cos re} \]
      3. +-commutative100.0%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)}\right) \cdot \cos re \]
      4. +-commutative100.0%

        \[\leadsto \left(im \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)} + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \cos re \]
      5. associate-+l+100.0%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)}\right) \cdot \cos re \]
      6. *-commutative100.0%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \color{blue}{\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)}\right)\right)\right) \cdot \cos re \]
      7. +-commutative100.0%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)}\right)\right)\right) \cdot \cos re \]
    9. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \cdot \cos re} \]
    10. Taylor expanded in re around 0 0.0%

      \[\leadsto \color{blue}{im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right) + {re}^{2} \cdot \left(-0.5 \cdot \left(im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)\right) + {re}^{2} \cdot \left(-0.001388888888888889 \cdot \left(im \cdot \left({re}^{2} \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)\right)\right) + 0.041666666666666664 \cdot \left(im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)\right)\right)\right)} \]
    11. Simplified0.0%

      \[\leadsto \color{blue}{im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right) + \left(re \cdot re\right) \cdot \left(\left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right) \cdot -0.5 + \left(re \cdot re\right) \cdot \left(\left(\left(re \cdot re\right) \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right) \cdot \left(im \cdot -0.001388888888888889\right) + \left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right) \cdot 0.041666666666666664\right)\right)} \]
    12. Taylor expanded in im around 0 85.7%

      \[\leadsto \color{blue}{im \cdot \left(\left({im}^{2} \cdot \left({re}^{2} \cdot \left(0.08333333333333333 + {re}^{2} \cdot \left(0.0002314814814814815 \cdot {re}^{2} - 0.006944444444444444\right)\right) - 0.16666666666666666\right) + {re}^{2} \cdot \left(0.5 + {re}^{2} \cdot \left(0.001388888888888889 \cdot {re}^{2} - 0.041666666666666664\right)\right)\right) - 1\right)} \]
    13. Step-by-step derivation
      1. associate--l+85.7%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({re}^{2} \cdot \left(0.08333333333333333 + {re}^{2} \cdot \left(0.0002314814814814815 \cdot {re}^{2} - 0.006944444444444444\right)\right) - 0.16666666666666666\right) + \left({re}^{2} \cdot \left(0.5 + {re}^{2} \cdot \left(0.001388888888888889 \cdot {re}^{2} - 0.041666666666666664\right)\right) - 1\right)\right)} \]
    14. Simplified85.7%

      \[\leadsto \color{blue}{im \cdot \left(\left(im \cdot im\right) \cdot \left(\left(re \cdot re\right) \cdot \left(0.08333333333333333 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot 0.0002314814814814815 + -0.006944444444444444\right)\right) + -0.16666666666666666\right) + \left(\left(re \cdot re\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot 0.001388888888888889 + -0.041666666666666664\right)\right) + -1\right)\right)} \]

    if 1.99999999999999993e278 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} - 2\right)\right)} \]
    6. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{2} + \left(-2\right)\right)}\right) \]
      2. metadata-eval100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} + \color{blue}{-2}\right)\right) \]
      3. +-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-2 + -0.3333333333333333 \cdot {im}^{2}\right)}\right) \]
      4. *-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{{im}^{2} \cdot -0.3333333333333333}\right)\right) \]
      5. unpow2100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{\left(im \cdot im\right)} \cdot -0.3333333333333333\right)\right) \]
      6. associate-*l*100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{im \cdot \left(im \cdot -0.3333333333333333\right)}\right)\right) \]
    7. Simplified100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)} \]
    8. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.3333333333333333\right) + -2\right)}\right) \]
      2. distribute-lft-in100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right) + im \cdot -2\right)} \]
    9. Applied egg-rr100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right) + im \cdot -2\right)} \]
    10. Taylor expanded in re around 0 66.7%

      \[\leadsto \color{blue}{0.5 \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right)} \]
    11. Step-by-step derivation
      1. +-commutative66.7%

        \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{3} + -2 \cdot im\right)} \]
      2. *-commutative66.7%

        \[\leadsto 0.5 \cdot \left(\color{blue}{{im}^{3} \cdot -0.3333333333333333} + -2 \cdot im\right) \]
      3. cube-unmult66.7%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333 + -2 \cdot im\right) \]
      4. unpow266.7%

        \[\leadsto 0.5 \cdot \left(\left(im \cdot \color{blue}{{im}^{2}}\right) \cdot -0.3333333333333333 + -2 \cdot im\right) \]
      5. associate-*r*66.7%

        \[\leadsto 0.5 \cdot \left(\color{blue}{im \cdot \left({im}^{2} \cdot -0.3333333333333333\right)} + -2 \cdot im\right) \]
      6. unpow266.7%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.3333333333333333\right) + -2 \cdot im\right) \]
      7. *-commutative66.7%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) + \color{blue}{im \cdot -2}\right) \]
      8. distribute-lft-in66.7%

        \[\leadsto 0.5 \cdot \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333 + -2\right)\right)} \]
      9. +-commutative66.7%

        \[\leadsto 0.5 \cdot \left(im \cdot \color{blue}{\left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)}\right) \]
    12. Simplified66.7%

      \[\leadsto \color{blue}{0.5 \cdot \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)} \]
    13. Taylor expanded in im around inf 66.7%

      \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{3}\right)} \]
    14. Step-by-step derivation
      1. *-commutative66.7%

        \[\leadsto 0.5 \cdot \color{blue}{\left({im}^{3} \cdot -0.3333333333333333\right)} \]
      2. cube-mult66.7%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right) \]
    15. Simplified66.7%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.3333333333333333\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification64.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 8.5 \cdot 10^{+26}:\\ \;\;\;\;im \cdot \left(-\cos re\right)\\ \mathbf{elif}\;im \leq 1.6 \cdot 10^{+150}:\\ \;\;\;\;im \cdot \left(-1 + -0.0001984126984126984 \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{elif}\;im \leq 2 \cdot 10^{+278}:\\ \;\;\;\;im \cdot \left(\left(im \cdot im\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot \left(0.08333333333333333 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot 0.0002314814814814815 + -0.006944444444444444\right)\right)\right) + \left(-1 + \left(re \cdot re\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot 0.001388888888888889 + -0.041666666666666664\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.3333333333333333\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 59.8% accurate, 5.6× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 4.9 \cdot 10^{+150}:\\ \;\;\;\;im\_m \cdot \left(-1 + im\_m \cdot \left(im\_m \cdot \left(-0.16666666666666666 + im\_m \cdot \left(im\_m \cdot \left(im\_m \cdot \left(im\_m \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right)\right)\\ \mathbf{elif}\;im\_m \leq 5 \cdot 10^{+277}:\\ \;\;\;\;im\_m \cdot \left(\left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot \left(0.08333333333333333 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot 0.0002314814814814815 + -0.006944444444444444\right)\right)\right) + \left(-1 + \left(re \cdot re\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot 0.001388888888888889 + -0.041666666666666664\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(im\_m \cdot \left(im\_m \cdot im\_m\right)\right) \cdot -0.3333333333333333\right)\\ \end{array} \end{array} \]
im\_m = (fabs.f64 im)
im\_s = (copysign.f64 #s(literal 1 binary64) im)
(FPCore (im_s re im_m)
 :precision binary64
 (*
  im_s
  (if (<= im_m 4.9e+150)
    (*
     im_m
     (+
      -1.0
      (*
       im_m
       (*
        im_m
        (+
         -0.16666666666666666
         (*
          im_m
          (*
           im_m
           (+
            (* im_m (* im_m -0.0001984126984126984))
            -0.008333333333333333))))))))
    (if (<= im_m 5e+277)
      (*
       im_m
       (+
        (*
         (* im_m im_m)
         (+
          -0.16666666666666666
          (*
           (* re re)
           (+
            0.08333333333333333
            (*
             (* re re)
             (+ (* (* re re) 0.0002314814814814815) -0.006944444444444444))))))
        (+
         -1.0
         (*
          (* re re)
          (+
           0.5
           (*
            (* re re)
            (+ (* (* re re) 0.001388888888888889) -0.041666666666666664)))))))
      (* 0.5 (* (* im_m (* im_m im_m)) -0.3333333333333333))))))
im\_m = fabs(im);
im\_s = copysign(1.0, im);
double code(double im_s, double re, double im_m) {
	double tmp;
	if (im_m <= 4.9e+150) {
		tmp = im_m * (-1.0 + (im_m * (im_m * (-0.16666666666666666 + (im_m * (im_m * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333)))))));
	} else if (im_m <= 5e+277) {
		tmp = im_m * (((im_m * im_m) * (-0.16666666666666666 + ((re * re) * (0.08333333333333333 + ((re * re) * (((re * re) * 0.0002314814814814815) + -0.006944444444444444)))))) + (-1.0 + ((re * re) * (0.5 + ((re * re) * (((re * re) * 0.001388888888888889) + -0.041666666666666664))))));
	} else {
		tmp = 0.5 * ((im_m * (im_m * im_m)) * -0.3333333333333333);
	}
	return im_s * tmp;
}
im\_m = abs(im)
im\_s = copysign(1.0d0, im)
real(8) function code(im_s, re, im_m)
    real(8), intent (in) :: im_s
    real(8), intent (in) :: re
    real(8), intent (in) :: im_m
    real(8) :: tmp
    if (im_m <= 4.9d+150) then
        tmp = im_m * ((-1.0d0) + (im_m * (im_m * ((-0.16666666666666666d0) + (im_m * (im_m * ((im_m * (im_m * (-0.0001984126984126984d0))) + (-0.008333333333333333d0))))))))
    else if (im_m <= 5d+277) then
        tmp = im_m * (((im_m * im_m) * ((-0.16666666666666666d0) + ((re * re) * (0.08333333333333333d0 + ((re * re) * (((re * re) * 0.0002314814814814815d0) + (-0.006944444444444444d0))))))) + ((-1.0d0) + ((re * re) * (0.5d0 + ((re * re) * (((re * re) * 0.001388888888888889d0) + (-0.041666666666666664d0)))))))
    else
        tmp = 0.5d0 * ((im_m * (im_m * im_m)) * (-0.3333333333333333d0))
    end if
    code = im_s * tmp
end function
im\_m = Math.abs(im);
im\_s = Math.copySign(1.0, im);
public static double code(double im_s, double re, double im_m) {
	double tmp;
	if (im_m <= 4.9e+150) {
		tmp = im_m * (-1.0 + (im_m * (im_m * (-0.16666666666666666 + (im_m * (im_m * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333)))))));
	} else if (im_m <= 5e+277) {
		tmp = im_m * (((im_m * im_m) * (-0.16666666666666666 + ((re * re) * (0.08333333333333333 + ((re * re) * (((re * re) * 0.0002314814814814815) + -0.006944444444444444)))))) + (-1.0 + ((re * re) * (0.5 + ((re * re) * (((re * re) * 0.001388888888888889) + -0.041666666666666664))))));
	} else {
		tmp = 0.5 * ((im_m * (im_m * im_m)) * -0.3333333333333333);
	}
	return im_s * tmp;
}
im\_m = math.fabs(im)
im\_s = math.copysign(1.0, im)
def code(im_s, re, im_m):
	tmp = 0
	if im_m <= 4.9e+150:
		tmp = im_m * (-1.0 + (im_m * (im_m * (-0.16666666666666666 + (im_m * (im_m * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333)))))))
	elif im_m <= 5e+277:
		tmp = im_m * (((im_m * im_m) * (-0.16666666666666666 + ((re * re) * (0.08333333333333333 + ((re * re) * (((re * re) * 0.0002314814814814815) + -0.006944444444444444)))))) + (-1.0 + ((re * re) * (0.5 + ((re * re) * (((re * re) * 0.001388888888888889) + -0.041666666666666664))))))
	else:
		tmp = 0.5 * ((im_m * (im_m * im_m)) * -0.3333333333333333)
	return im_s * tmp
im\_m = abs(im)
im\_s = copysign(1.0, im)
function code(im_s, re, im_m)
	tmp = 0.0
	if (im_m <= 4.9e+150)
		tmp = Float64(im_m * Float64(-1.0 + Float64(im_m * Float64(im_m * Float64(-0.16666666666666666 + Float64(im_m * Float64(im_m * Float64(Float64(im_m * Float64(im_m * -0.0001984126984126984)) + -0.008333333333333333))))))));
	elseif (im_m <= 5e+277)
		tmp = Float64(im_m * Float64(Float64(Float64(im_m * im_m) * Float64(-0.16666666666666666 + Float64(Float64(re * re) * Float64(0.08333333333333333 + Float64(Float64(re * re) * Float64(Float64(Float64(re * re) * 0.0002314814814814815) + -0.006944444444444444)))))) + Float64(-1.0 + Float64(Float64(re * re) * Float64(0.5 + Float64(Float64(re * re) * Float64(Float64(Float64(re * re) * 0.001388888888888889) + -0.041666666666666664)))))));
	else
		tmp = Float64(0.5 * Float64(Float64(im_m * Float64(im_m * im_m)) * -0.3333333333333333));
	end
	return Float64(im_s * tmp)
end
im\_m = abs(im);
im\_s = sign(im) * abs(1.0);
function tmp_2 = code(im_s, re, im_m)
	tmp = 0.0;
	if (im_m <= 4.9e+150)
		tmp = im_m * (-1.0 + (im_m * (im_m * (-0.16666666666666666 + (im_m * (im_m * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333)))))));
	elseif (im_m <= 5e+277)
		tmp = im_m * (((im_m * im_m) * (-0.16666666666666666 + ((re * re) * (0.08333333333333333 + ((re * re) * (((re * re) * 0.0002314814814814815) + -0.006944444444444444)))))) + (-1.0 + ((re * re) * (0.5 + ((re * re) * (((re * re) * 0.001388888888888889) + -0.041666666666666664))))));
	else
		tmp = 0.5 * ((im_m * (im_m * im_m)) * -0.3333333333333333);
	end
	tmp_2 = im_s * tmp;
end
im\_m = N[Abs[im], $MachinePrecision]
im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[im$95$s_, re_, im$95$m_] := N[(im$95$s * If[LessEqual[im$95$m, 4.9e+150], N[(im$95$m * N[(-1.0 + N[(im$95$m * N[(im$95$m * N[(-0.16666666666666666 + N[(im$95$m * N[(im$95$m * N[(N[(im$95$m * N[(im$95$m * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision] + -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 5e+277], N[(im$95$m * N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(-0.16666666666666666 + N[(N[(re * re), $MachinePrecision] * N[(0.08333333333333333 + N[(N[(re * re), $MachinePrecision] * N[(N[(N[(re * re), $MachinePrecision] * 0.0002314814814814815), $MachinePrecision] + -0.006944444444444444), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 + N[(N[(re * re), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * N[(N[(N[(re * re), $MachinePrecision] * 0.001388888888888889), $MachinePrecision] + -0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(im$95$m * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
im\_m = \left|im\right|
\\
im\_s = \mathsf{copysign}\left(1, im\right)

\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;im\_m \leq 4.9 \cdot 10^{+150}:\\
\;\;\;\;im\_m \cdot \left(-1 + im\_m \cdot \left(im\_m \cdot \left(-0.16666666666666666 + im\_m \cdot \left(im\_m \cdot \left(im\_m \cdot \left(im\_m \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right)\right)\\

\mathbf{elif}\;im\_m \leq 5 \cdot 10^{+277}:\\
\;\;\;\;im\_m \cdot \left(\left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot \left(0.08333333333333333 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot 0.0002314814814814815 + -0.006944444444444444\right)\right)\right) + \left(-1 + \left(re \cdot re\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot 0.001388888888888889 + -0.041666666666666664\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(im\_m \cdot \left(im\_m \cdot im\_m\right)\right) \cdot -0.3333333333333333\right)\\


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

    1. Initial program 51.3%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub051.3%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified51.3%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 93.3%

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative93.3%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + -1 \cdot \cos re\right)} \]
      2. +-commutative93.3%

        \[\leadsto im \cdot \left({im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right) + -0.16666666666666666 \cdot \cos re\right)} + -1 \cdot \cos re\right) \]
      3. distribute-rgt-in93.3%

        \[\leadsto im \cdot \left(\color{blue}{\left(\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right)} + -1 \cdot \cos re\right) \]
      4. *-commutative93.3%

        \[\leadsto im \cdot \left(\left(\color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
      5. associate-+l+93.3%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2} + -1 \cdot \cos re\right)\right)} \]
    7. Simplified93.3%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right)} \]
    8. Step-by-step derivation
      1. *-commutative93.3%

        \[\leadsto im \cdot \color{blue}{\left(\left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot \cos re\right)} \]
      2. associate-*r*93.3%

        \[\leadsto \color{blue}{\left(im \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right) \cdot \cos re} \]
      3. +-commutative93.3%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)}\right) \cdot \cos re \]
      4. +-commutative93.3%

        \[\leadsto \left(im \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)} + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \cos re \]
      5. associate-+l+93.3%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)}\right) \cdot \cos re \]
      6. *-commutative93.3%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \color{blue}{\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)}\right)\right)\right) \cdot \cos re \]
      7. +-commutative93.3%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)}\right)\right)\right) \cdot \cos re \]
    9. Applied egg-rr93.3%

      \[\leadsto \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \cdot \cos re} \]
    10. Taylor expanded in re around 0 60.0%

      \[\leadsto \color{blue}{im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)} \]
    11. Step-by-step derivation
      1. sub-neg60.0%

        \[\leadsto im \cdot \color{blue}{\left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \left(-1\right)\right)} \]
      2. metadata-eval60.0%

        \[\leadsto im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \color{blue}{-1}\right) \]
      3. +-commutative60.0%

        \[\leadsto im \cdot \color{blue}{\left(-1 + \left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right)} \]
      4. *-commutative60.0%

        \[\leadsto im \cdot \left(-1 + \left(\color{blue}{{im}^{2} \cdot -0.16666666666666666} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right) \]
      5. sub-neg60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \color{blue}{\left(-0.0001984126984126984 \cdot {im}^{2} + \left(-0.008333333333333333\right)\right)}\right)\right) \]
      6. *-commutative60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{{im}^{2} \cdot -0.0001984126984126984} + \left(-0.008333333333333333\right)\right)\right)\right) \]
      7. unpow260.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.0001984126984126984 + \left(-0.008333333333333333\right)\right)\right)\right) \]
      8. associate-*r*60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{im \cdot \left(im \cdot -0.0001984126984126984\right)} + \left(-0.008333333333333333\right)\right)\right)\right) \]
      9. metadata-eval60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + \color{blue}{-0.008333333333333333}\right)\right)\right) \]
      10. metadata-eval60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{\color{blue}{\left(2 \cdot 2\right)}} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      11. pow-sqr60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      12. unpow260.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{\left(im \cdot im\right)}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      13. unpow260.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{\left(im \cdot im\right)} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      14. unpow260.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{2}} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      15. unpow260.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      16. associate-*r*60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)}\right)\right) \]
    12. Simplified60.0%

      \[\leadsto \color{blue}{im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)} \]
    13. Step-by-step derivation
      1. associate-*l*60.0%

        \[\leadsto im \cdot \left(-1 + \color{blue}{im \cdot \left(im \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)}\right) \]
      2. +-commutative60.0%

        \[\leadsto im \cdot \left(-1 + im \cdot \left(im \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.0001984126984126984 + -0.008333333333333333\right)}\right)\right)\right)\right) \]
      3. associate-*l*60.0%

        \[\leadsto im \cdot \left(-1 + im \cdot \left(im \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(\color{blue}{im \cdot \left(im \cdot -0.0001984126984126984\right)} + -0.008333333333333333\right)\right)\right)\right)\right) \]
    14. Applied egg-rr60.0%

      \[\leadsto im \cdot \left(-1 + \color{blue}{im \cdot \left(im \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right)}\right) \]

    if 4.90000000000000007e150 < im < 4.99999999999999982e277

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 100.0%

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + -1 \cdot \cos re\right)} \]
      2. +-commutative100.0%

        \[\leadsto im \cdot \left({im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right) + -0.16666666666666666 \cdot \cos re\right)} + -1 \cdot \cos re\right) \]
      3. distribute-rgt-in100.0%

        \[\leadsto im \cdot \left(\color{blue}{\left(\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right)} + -1 \cdot \cos re\right) \]
      4. *-commutative100.0%

        \[\leadsto im \cdot \left(\left(\color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
      5. associate-+l+100.0%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2} + -1 \cdot \cos re\right)\right)} \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right)} \]
    8. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto im \cdot \color{blue}{\left(\left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot \cos re\right)} \]
      2. associate-*r*100.0%

        \[\leadsto \color{blue}{\left(im \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right) \cdot \cos re} \]
      3. +-commutative100.0%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)}\right) \cdot \cos re \]
      4. +-commutative100.0%

        \[\leadsto \left(im \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)} + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \cos re \]
      5. associate-+l+100.0%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)}\right) \cdot \cos re \]
      6. *-commutative100.0%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \color{blue}{\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)}\right)\right)\right) \cdot \cos re \]
      7. +-commutative100.0%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)}\right)\right)\right) \cdot \cos re \]
    9. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \cdot \cos re} \]
    10. Taylor expanded in re around 0 0.0%

      \[\leadsto \color{blue}{im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right) + {re}^{2} \cdot \left(-0.5 \cdot \left(im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)\right) + {re}^{2} \cdot \left(-0.001388888888888889 \cdot \left(im \cdot \left({re}^{2} \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)\right)\right) + 0.041666666666666664 \cdot \left(im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)\right)\right)\right)} \]
    11. Simplified0.0%

      \[\leadsto \color{blue}{im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right) + \left(re \cdot re\right) \cdot \left(\left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right) \cdot -0.5 + \left(re \cdot re\right) \cdot \left(\left(\left(re \cdot re\right) \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right) \cdot \left(im \cdot -0.001388888888888889\right) + \left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)\right) \cdot 0.041666666666666664\right)\right)} \]
    12. Taylor expanded in im around 0 85.7%

      \[\leadsto \color{blue}{im \cdot \left(\left({im}^{2} \cdot \left({re}^{2} \cdot \left(0.08333333333333333 + {re}^{2} \cdot \left(0.0002314814814814815 \cdot {re}^{2} - 0.006944444444444444\right)\right) - 0.16666666666666666\right) + {re}^{2} \cdot \left(0.5 + {re}^{2} \cdot \left(0.001388888888888889 \cdot {re}^{2} - 0.041666666666666664\right)\right)\right) - 1\right)} \]
    13. Step-by-step derivation
      1. associate--l+85.7%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({re}^{2} \cdot \left(0.08333333333333333 + {re}^{2} \cdot \left(0.0002314814814814815 \cdot {re}^{2} - 0.006944444444444444\right)\right) - 0.16666666666666666\right) + \left({re}^{2} \cdot \left(0.5 + {re}^{2} \cdot \left(0.001388888888888889 \cdot {re}^{2} - 0.041666666666666664\right)\right) - 1\right)\right)} \]
    14. Simplified85.7%

      \[\leadsto \color{blue}{im \cdot \left(\left(im \cdot im\right) \cdot \left(\left(re \cdot re\right) \cdot \left(0.08333333333333333 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot 0.0002314814814814815 + -0.006944444444444444\right)\right) + -0.16666666666666666\right) + \left(\left(re \cdot re\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot 0.001388888888888889 + -0.041666666666666664\right)\right) + -1\right)\right)} \]

    if 4.99999999999999982e277 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} - 2\right)\right)} \]
    6. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{2} + \left(-2\right)\right)}\right) \]
      2. metadata-eval100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} + \color{blue}{-2}\right)\right) \]
      3. +-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-2 + -0.3333333333333333 \cdot {im}^{2}\right)}\right) \]
      4. *-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{{im}^{2} \cdot -0.3333333333333333}\right)\right) \]
      5. unpow2100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{\left(im \cdot im\right)} \cdot -0.3333333333333333\right)\right) \]
      6. associate-*l*100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{im \cdot \left(im \cdot -0.3333333333333333\right)}\right)\right) \]
    7. Simplified100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)} \]
    8. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.3333333333333333\right) + -2\right)}\right) \]
      2. distribute-lft-in100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right) + im \cdot -2\right)} \]
    9. Applied egg-rr100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right) + im \cdot -2\right)} \]
    10. Taylor expanded in re around 0 66.7%

      \[\leadsto \color{blue}{0.5 \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right)} \]
    11. Step-by-step derivation
      1. +-commutative66.7%

        \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{3} + -2 \cdot im\right)} \]
      2. *-commutative66.7%

        \[\leadsto 0.5 \cdot \left(\color{blue}{{im}^{3} \cdot -0.3333333333333333} + -2 \cdot im\right) \]
      3. cube-unmult66.7%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333 + -2 \cdot im\right) \]
      4. unpow266.7%

        \[\leadsto 0.5 \cdot \left(\left(im \cdot \color{blue}{{im}^{2}}\right) \cdot -0.3333333333333333 + -2 \cdot im\right) \]
      5. associate-*r*66.7%

        \[\leadsto 0.5 \cdot \left(\color{blue}{im \cdot \left({im}^{2} \cdot -0.3333333333333333\right)} + -2 \cdot im\right) \]
      6. unpow266.7%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.3333333333333333\right) + -2 \cdot im\right) \]
      7. *-commutative66.7%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) + \color{blue}{im \cdot -2}\right) \]
      8. distribute-lft-in66.7%

        \[\leadsto 0.5 \cdot \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333 + -2\right)\right)} \]
      9. +-commutative66.7%

        \[\leadsto 0.5 \cdot \left(im \cdot \color{blue}{\left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)}\right) \]
    12. Simplified66.7%

      \[\leadsto \color{blue}{0.5 \cdot \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)} \]
    13. Taylor expanded in im around inf 66.7%

      \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{3}\right)} \]
    14. Step-by-step derivation
      1. *-commutative66.7%

        \[\leadsto 0.5 \cdot \color{blue}{\left({im}^{3} \cdot -0.3333333333333333\right)} \]
      2. cube-mult66.7%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right) \]
    15. Simplified66.7%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.3333333333333333\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification63.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 4.9 \cdot 10^{+150}:\\ \;\;\;\;im \cdot \left(-1 + im \cdot \left(im \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right)\right)\\ \mathbf{elif}\;im \leq 5 \cdot 10^{+277}:\\ \;\;\;\;im \cdot \left(\left(im \cdot im\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot \left(0.08333333333333333 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot 0.0002314814814814815 + -0.006944444444444444\right)\right)\right) + \left(-1 + \left(re \cdot re\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot \left(\left(re \cdot re\right) \cdot 0.001388888888888889 + -0.041666666666666664\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.3333333333333333\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 59.6% accurate, 11.4× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 4.5 \cdot 10^{+150}:\\ \;\;\;\;im\_m \cdot \left(-1 + im\_m \cdot \left(im\_m \cdot \left(-0.16666666666666666 + im\_m \cdot \left(im\_m \cdot \left(im\_m \cdot \left(im\_m \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right)\right)\\ \mathbf{elif}\;im\_m \leq 10^{+246}:\\ \;\;\;\;\left(im\_m \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot -0.3333333333333333\right)\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(im\_m \cdot \left(im\_m \cdot im\_m\right)\right) \cdot -0.3333333333333333\right)\\ \end{array} \end{array} \]
im\_m = (fabs.f64 im)
im\_s = (copysign.f64 #s(literal 1 binary64) im)
(FPCore (im_s re im_m)
 :precision binary64
 (*
  im_s
  (if (<= im_m 4.5e+150)
    (*
     im_m
     (+
      -1.0
      (*
       im_m
       (*
        im_m
        (+
         -0.16666666666666666
         (*
          im_m
          (*
           im_m
           (+
            (* im_m (* im_m -0.0001984126984126984))
            -0.008333333333333333))))))))
    (if (<= im_m 1e+246)
      (*
       (* im_m (+ -2.0 (* (* im_m im_m) -0.3333333333333333)))
       (+ 0.5 (* (* re re) -0.25)))
      (* 0.5 (* (* im_m (* im_m im_m)) -0.3333333333333333))))))
im\_m = fabs(im);
im\_s = copysign(1.0, im);
double code(double im_s, double re, double im_m) {
	double tmp;
	if (im_m <= 4.5e+150) {
		tmp = im_m * (-1.0 + (im_m * (im_m * (-0.16666666666666666 + (im_m * (im_m * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333)))))));
	} else if (im_m <= 1e+246) {
		tmp = (im_m * (-2.0 + ((im_m * im_m) * -0.3333333333333333))) * (0.5 + ((re * re) * -0.25));
	} else {
		tmp = 0.5 * ((im_m * (im_m * im_m)) * -0.3333333333333333);
	}
	return im_s * tmp;
}
im\_m = abs(im)
im\_s = copysign(1.0d0, im)
real(8) function code(im_s, re, im_m)
    real(8), intent (in) :: im_s
    real(8), intent (in) :: re
    real(8), intent (in) :: im_m
    real(8) :: tmp
    if (im_m <= 4.5d+150) then
        tmp = im_m * ((-1.0d0) + (im_m * (im_m * ((-0.16666666666666666d0) + (im_m * (im_m * ((im_m * (im_m * (-0.0001984126984126984d0))) + (-0.008333333333333333d0))))))))
    else if (im_m <= 1d+246) then
        tmp = (im_m * ((-2.0d0) + ((im_m * im_m) * (-0.3333333333333333d0)))) * (0.5d0 + ((re * re) * (-0.25d0)))
    else
        tmp = 0.5d0 * ((im_m * (im_m * im_m)) * (-0.3333333333333333d0))
    end if
    code = im_s * tmp
end function
im\_m = Math.abs(im);
im\_s = Math.copySign(1.0, im);
public static double code(double im_s, double re, double im_m) {
	double tmp;
	if (im_m <= 4.5e+150) {
		tmp = im_m * (-1.0 + (im_m * (im_m * (-0.16666666666666666 + (im_m * (im_m * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333)))))));
	} else if (im_m <= 1e+246) {
		tmp = (im_m * (-2.0 + ((im_m * im_m) * -0.3333333333333333))) * (0.5 + ((re * re) * -0.25));
	} else {
		tmp = 0.5 * ((im_m * (im_m * im_m)) * -0.3333333333333333);
	}
	return im_s * tmp;
}
im\_m = math.fabs(im)
im\_s = math.copysign(1.0, im)
def code(im_s, re, im_m):
	tmp = 0
	if im_m <= 4.5e+150:
		tmp = im_m * (-1.0 + (im_m * (im_m * (-0.16666666666666666 + (im_m * (im_m * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333)))))))
	elif im_m <= 1e+246:
		tmp = (im_m * (-2.0 + ((im_m * im_m) * -0.3333333333333333))) * (0.5 + ((re * re) * -0.25))
	else:
		tmp = 0.5 * ((im_m * (im_m * im_m)) * -0.3333333333333333)
	return im_s * tmp
im\_m = abs(im)
im\_s = copysign(1.0, im)
function code(im_s, re, im_m)
	tmp = 0.0
	if (im_m <= 4.5e+150)
		tmp = Float64(im_m * Float64(-1.0 + Float64(im_m * Float64(im_m * Float64(-0.16666666666666666 + Float64(im_m * Float64(im_m * Float64(Float64(im_m * Float64(im_m * -0.0001984126984126984)) + -0.008333333333333333))))))));
	elseif (im_m <= 1e+246)
		tmp = Float64(Float64(im_m * Float64(-2.0 + Float64(Float64(im_m * im_m) * -0.3333333333333333))) * Float64(0.5 + Float64(Float64(re * re) * -0.25)));
	else
		tmp = Float64(0.5 * Float64(Float64(im_m * Float64(im_m * im_m)) * -0.3333333333333333));
	end
	return Float64(im_s * tmp)
end
im\_m = abs(im);
im\_s = sign(im) * abs(1.0);
function tmp_2 = code(im_s, re, im_m)
	tmp = 0.0;
	if (im_m <= 4.5e+150)
		tmp = im_m * (-1.0 + (im_m * (im_m * (-0.16666666666666666 + (im_m * (im_m * ((im_m * (im_m * -0.0001984126984126984)) + -0.008333333333333333)))))));
	elseif (im_m <= 1e+246)
		tmp = (im_m * (-2.0 + ((im_m * im_m) * -0.3333333333333333))) * (0.5 + ((re * re) * -0.25));
	else
		tmp = 0.5 * ((im_m * (im_m * im_m)) * -0.3333333333333333);
	end
	tmp_2 = im_s * tmp;
end
im\_m = N[Abs[im], $MachinePrecision]
im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[im$95$s_, re_, im$95$m_] := N[(im$95$s * If[LessEqual[im$95$m, 4.5e+150], N[(im$95$m * N[(-1.0 + N[(im$95$m * N[(im$95$m * N[(-0.16666666666666666 + N[(im$95$m * N[(im$95$m * N[(N[(im$95$m * N[(im$95$m * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision] + -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 1e+246], N[(N[(im$95$m * N[(-2.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(im$95$m * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
im\_m = \left|im\right|
\\
im\_s = \mathsf{copysign}\left(1, im\right)

\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;im\_m \leq 4.5 \cdot 10^{+150}:\\
\;\;\;\;im\_m \cdot \left(-1 + im\_m \cdot \left(im\_m \cdot \left(-0.16666666666666666 + im\_m \cdot \left(im\_m \cdot \left(im\_m \cdot \left(im\_m \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right)\right)\\

\mathbf{elif}\;im\_m \leq 10^{+246}:\\
\;\;\;\;\left(im\_m \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot -0.3333333333333333\right)\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(im\_m \cdot \left(im\_m \cdot im\_m\right)\right) \cdot -0.3333333333333333\right)\\


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

    1. Initial program 51.3%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub051.3%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified51.3%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 93.3%

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative93.3%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + -1 \cdot \cos re\right)} \]
      2. +-commutative93.3%

        \[\leadsto im \cdot \left({im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right) + -0.16666666666666666 \cdot \cos re\right)} + -1 \cdot \cos re\right) \]
      3. distribute-rgt-in93.3%

        \[\leadsto im \cdot \left(\color{blue}{\left(\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right)} + -1 \cdot \cos re\right) \]
      4. *-commutative93.3%

        \[\leadsto im \cdot \left(\left(\color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
      5. associate-+l+93.3%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2} + -1 \cdot \cos re\right)\right)} \]
    7. Simplified93.3%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right)} \]
    8. Step-by-step derivation
      1. *-commutative93.3%

        \[\leadsto im \cdot \color{blue}{\left(\left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot \cos re\right)} \]
      2. associate-*r*93.3%

        \[\leadsto \color{blue}{\left(im \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right) \cdot \cos re} \]
      3. +-commutative93.3%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)}\right) \cdot \cos re \]
      4. +-commutative93.3%

        \[\leadsto \left(im \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)} + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \cos re \]
      5. associate-+l+93.3%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)}\right) \cdot \cos re \]
      6. *-commutative93.3%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \color{blue}{\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)}\right)\right)\right) \cdot \cos re \]
      7. +-commutative93.3%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)}\right)\right)\right) \cdot \cos re \]
    9. Applied egg-rr93.3%

      \[\leadsto \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \cdot \cos re} \]
    10. Taylor expanded in re around 0 60.0%

      \[\leadsto \color{blue}{im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)} \]
    11. Step-by-step derivation
      1. sub-neg60.0%

        \[\leadsto im \cdot \color{blue}{\left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \left(-1\right)\right)} \]
      2. metadata-eval60.0%

        \[\leadsto im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \color{blue}{-1}\right) \]
      3. +-commutative60.0%

        \[\leadsto im \cdot \color{blue}{\left(-1 + \left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right)} \]
      4. *-commutative60.0%

        \[\leadsto im \cdot \left(-1 + \left(\color{blue}{{im}^{2} \cdot -0.16666666666666666} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right) \]
      5. sub-neg60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \color{blue}{\left(-0.0001984126984126984 \cdot {im}^{2} + \left(-0.008333333333333333\right)\right)}\right)\right) \]
      6. *-commutative60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{{im}^{2} \cdot -0.0001984126984126984} + \left(-0.008333333333333333\right)\right)\right)\right) \]
      7. unpow260.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.0001984126984126984 + \left(-0.008333333333333333\right)\right)\right)\right) \]
      8. associate-*r*60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{im \cdot \left(im \cdot -0.0001984126984126984\right)} + \left(-0.008333333333333333\right)\right)\right)\right) \]
      9. metadata-eval60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + \color{blue}{-0.008333333333333333}\right)\right)\right) \]
      10. metadata-eval60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{\color{blue}{\left(2 \cdot 2\right)}} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      11. pow-sqr60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      12. unpow260.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{\left(im \cdot im\right)}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      13. unpow260.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{\left(im \cdot im\right)} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      14. unpow260.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{2}} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      15. unpow260.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      16. associate-*r*60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)}\right)\right) \]
    12. Simplified60.0%

      \[\leadsto \color{blue}{im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)} \]
    13. Step-by-step derivation
      1. associate-*l*60.0%

        \[\leadsto im \cdot \left(-1 + \color{blue}{im \cdot \left(im \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)}\right) \]
      2. +-commutative60.0%

        \[\leadsto im \cdot \left(-1 + im \cdot \left(im \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.0001984126984126984 + -0.008333333333333333\right)}\right)\right)\right)\right) \]
      3. associate-*l*60.0%

        \[\leadsto im \cdot \left(-1 + im \cdot \left(im \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(\color{blue}{im \cdot \left(im \cdot -0.0001984126984126984\right)} + -0.008333333333333333\right)\right)\right)\right)\right) \]
    14. Applied egg-rr60.0%

      \[\leadsto im \cdot \left(-1 + \color{blue}{im \cdot \left(im \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right)}\right) \]

    if 4.5e150 < im < 1.00000000000000007e246

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} - 2\right)\right)} \]
    6. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{2} + \left(-2\right)\right)}\right) \]
      2. metadata-eval100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} + \color{blue}{-2}\right)\right) \]
      3. +-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-2 + -0.3333333333333333 \cdot {im}^{2}\right)}\right) \]
      4. *-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{{im}^{2} \cdot -0.3333333333333333}\right)\right) \]
      5. unpow2100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{\left(im \cdot im\right)} \cdot -0.3333333333333333\right)\right) \]
      6. associate-*l*100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{im \cdot \left(im \cdot -0.3333333333333333\right)}\right)\right) \]
    7. Simplified100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)} \]
    8. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.3333333333333333\right) + -2\right)}\right) \]
      2. distribute-lft-in100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right) + im \cdot -2\right)} \]
    9. Applied egg-rr100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right) + im \cdot -2\right)} \]
    10. Taylor expanded in re around 0 0.0%

      \[\leadsto \color{blue}{-0.25 \cdot \left({re}^{2} \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right)\right) + 0.5 \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right)} \]
    11. Step-by-step derivation
      1. +-commutative0.0%

        \[\leadsto \color{blue}{0.5 \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right) + -0.25 \cdot \left({re}^{2} \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right)\right)} \]
      2. associate-*r*0.0%

        \[\leadsto 0.5 \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right) + \color{blue}{\left(-0.25 \cdot {re}^{2}\right) \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right)} \]
      3. distribute-rgt-out88.9%

        \[\leadsto \color{blue}{\left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right)} \]
      4. *-commutative88.9%

        \[\leadsto \left(-2 \cdot im + \color{blue}{{im}^{3} \cdot -0.3333333333333333}\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right) \]
      5. cube-unmult88.9%

        \[\leadsto \left(-2 \cdot im + \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right) \]
      6. unpow288.9%

        \[\leadsto \left(-2 \cdot im + \left(im \cdot \color{blue}{{im}^{2}}\right) \cdot -0.3333333333333333\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right) \]
      7. associate-*r*88.9%

        \[\leadsto \left(-2 \cdot im + \color{blue}{im \cdot \left({im}^{2} \cdot -0.3333333333333333\right)}\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right) \]
      8. unpow288.9%

        \[\leadsto \left(-2 \cdot im + im \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.3333333333333333\right)\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right) \]
      9. *-commutative88.9%

        \[\leadsto \left(-2 \cdot im + \color{blue}{\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right) \]
      10. distribute-rgt-in88.9%

        \[\leadsto \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)} \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right) \]
      11. *-commutative88.9%

        \[\leadsto \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right) \cdot \left(0.5 + \color{blue}{{re}^{2} \cdot -0.25}\right) \]
      12. unpow288.9%

        \[\leadsto \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right) \cdot \left(0.5 + \color{blue}{\left(re \cdot re\right)} \cdot -0.25\right) \]
    12. Simplified88.9%

      \[\leadsto \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)} \]

    if 1.00000000000000007e246 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} - 2\right)\right)} \]
    6. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{2} + \left(-2\right)\right)}\right) \]
      2. metadata-eval100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} + \color{blue}{-2}\right)\right) \]
      3. +-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-2 + -0.3333333333333333 \cdot {im}^{2}\right)}\right) \]
      4. *-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{{im}^{2} \cdot -0.3333333333333333}\right)\right) \]
      5. unpow2100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{\left(im \cdot im\right)} \cdot -0.3333333333333333\right)\right) \]
      6. associate-*l*100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{im \cdot \left(im \cdot -0.3333333333333333\right)}\right)\right) \]
    7. Simplified100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)} \]
    8. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.3333333333333333\right) + -2\right)}\right) \]
      2. distribute-lft-in100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right) + im \cdot -2\right)} \]
    9. Applied egg-rr100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right) + im \cdot -2\right)} \]
    10. Taylor expanded in re around 0 81.8%

      \[\leadsto \color{blue}{0.5 \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right)} \]
    11. Step-by-step derivation
      1. +-commutative81.8%

        \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{3} + -2 \cdot im\right)} \]
      2. *-commutative81.8%

        \[\leadsto 0.5 \cdot \left(\color{blue}{{im}^{3} \cdot -0.3333333333333333} + -2 \cdot im\right) \]
      3. cube-unmult81.8%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333 + -2 \cdot im\right) \]
      4. unpow281.8%

        \[\leadsto 0.5 \cdot \left(\left(im \cdot \color{blue}{{im}^{2}}\right) \cdot -0.3333333333333333 + -2 \cdot im\right) \]
      5. associate-*r*81.8%

        \[\leadsto 0.5 \cdot \left(\color{blue}{im \cdot \left({im}^{2} \cdot -0.3333333333333333\right)} + -2 \cdot im\right) \]
      6. unpow281.8%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.3333333333333333\right) + -2 \cdot im\right) \]
      7. *-commutative81.8%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) + \color{blue}{im \cdot -2}\right) \]
      8. distribute-lft-in81.8%

        \[\leadsto 0.5 \cdot \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333 + -2\right)\right)} \]
      9. +-commutative81.8%

        \[\leadsto 0.5 \cdot \left(im \cdot \color{blue}{\left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)}\right) \]
    12. Simplified81.8%

      \[\leadsto \color{blue}{0.5 \cdot \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)} \]
    13. Taylor expanded in im around inf 81.8%

      \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{3}\right)} \]
    14. Step-by-step derivation
      1. *-commutative81.8%

        \[\leadsto 0.5 \cdot \color{blue}{\left({im}^{3} \cdot -0.3333333333333333\right)} \]
      2. cube-mult81.8%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right) \]
    15. Simplified81.8%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.3333333333333333\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 13: 59.5% accurate, 11.4× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := im\_m \cdot \left(im\_m \cdot im\_m\right)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 2 \cdot 10^{+148}:\\ \;\;\;\;im\_m \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + im\_m \cdot \left(-0.0001984126984126984 \cdot t\_0\right)\right)\right)\\ \mathbf{elif}\;im\_m \leq 5 \cdot 10^{+243}:\\ \;\;\;\;\left(im\_m \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot -0.3333333333333333\right)\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(t\_0 \cdot -0.3333333333333333\right)\\ \end{array} \end{array} \end{array} \]
im\_m = (fabs.f64 im)
im\_s = (copysign.f64 #s(literal 1 binary64) im)
(FPCore (im_s re im_m)
 :precision binary64
 (let* ((t_0 (* im_m (* im_m im_m))))
   (*
    im_s
    (if (<= im_m 2e+148)
      (*
       im_m
       (+
        -1.0
        (*
         (* im_m im_m)
         (+ -0.16666666666666666 (* im_m (* -0.0001984126984126984 t_0))))))
      (if (<= im_m 5e+243)
        (*
         (* im_m (+ -2.0 (* (* im_m im_m) -0.3333333333333333)))
         (+ 0.5 (* (* re re) -0.25)))
        (* 0.5 (* t_0 -0.3333333333333333)))))))
im\_m = fabs(im);
im\_s = copysign(1.0, im);
double code(double im_s, double re, double im_m) {
	double t_0 = im_m * (im_m * im_m);
	double tmp;
	if (im_m <= 2e+148) {
		tmp = im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (-0.0001984126984126984 * t_0)))));
	} else if (im_m <= 5e+243) {
		tmp = (im_m * (-2.0 + ((im_m * im_m) * -0.3333333333333333))) * (0.5 + ((re * re) * -0.25));
	} else {
		tmp = 0.5 * (t_0 * -0.3333333333333333);
	}
	return im_s * tmp;
}
im\_m = abs(im)
im\_s = copysign(1.0d0, im)
real(8) function code(im_s, re, im_m)
    real(8), intent (in) :: im_s
    real(8), intent (in) :: re
    real(8), intent (in) :: im_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = im_m * (im_m * im_m)
    if (im_m <= 2d+148) then
        tmp = im_m * ((-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + (im_m * ((-0.0001984126984126984d0) * t_0)))))
    else if (im_m <= 5d+243) then
        tmp = (im_m * ((-2.0d0) + ((im_m * im_m) * (-0.3333333333333333d0)))) * (0.5d0 + ((re * re) * (-0.25d0)))
    else
        tmp = 0.5d0 * (t_0 * (-0.3333333333333333d0))
    end if
    code = im_s * tmp
end function
im\_m = Math.abs(im);
im\_s = Math.copySign(1.0, im);
public static double code(double im_s, double re, double im_m) {
	double t_0 = im_m * (im_m * im_m);
	double tmp;
	if (im_m <= 2e+148) {
		tmp = im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (-0.0001984126984126984 * t_0)))));
	} else if (im_m <= 5e+243) {
		tmp = (im_m * (-2.0 + ((im_m * im_m) * -0.3333333333333333))) * (0.5 + ((re * re) * -0.25));
	} else {
		tmp = 0.5 * (t_0 * -0.3333333333333333);
	}
	return im_s * tmp;
}
im\_m = math.fabs(im)
im\_s = math.copysign(1.0, im)
def code(im_s, re, im_m):
	t_0 = im_m * (im_m * im_m)
	tmp = 0
	if im_m <= 2e+148:
		tmp = im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (-0.0001984126984126984 * t_0)))))
	elif im_m <= 5e+243:
		tmp = (im_m * (-2.0 + ((im_m * im_m) * -0.3333333333333333))) * (0.5 + ((re * re) * -0.25))
	else:
		tmp = 0.5 * (t_0 * -0.3333333333333333)
	return im_s * tmp
im\_m = abs(im)
im\_s = copysign(1.0, im)
function code(im_s, re, im_m)
	t_0 = Float64(im_m * Float64(im_m * im_m))
	tmp = 0.0
	if (im_m <= 2e+148)
		tmp = Float64(im_m * Float64(-1.0 + Float64(Float64(im_m * im_m) * Float64(-0.16666666666666666 + Float64(im_m * Float64(-0.0001984126984126984 * t_0))))));
	elseif (im_m <= 5e+243)
		tmp = Float64(Float64(im_m * Float64(-2.0 + Float64(Float64(im_m * im_m) * -0.3333333333333333))) * Float64(0.5 + Float64(Float64(re * re) * -0.25)));
	else
		tmp = Float64(0.5 * Float64(t_0 * -0.3333333333333333));
	end
	return Float64(im_s * tmp)
end
im\_m = abs(im);
im\_s = sign(im) * abs(1.0);
function tmp_2 = code(im_s, re, im_m)
	t_0 = im_m * (im_m * im_m);
	tmp = 0.0;
	if (im_m <= 2e+148)
		tmp = im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (-0.0001984126984126984 * t_0)))));
	elseif (im_m <= 5e+243)
		tmp = (im_m * (-2.0 + ((im_m * im_m) * -0.3333333333333333))) * (0.5 + ((re * re) * -0.25));
	else
		tmp = 0.5 * (t_0 * -0.3333333333333333);
	end
	tmp_2 = im_s * tmp;
end
im\_m = N[Abs[im], $MachinePrecision]
im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[im$95$s_, re_, im$95$m_] := Block[{t$95$0 = N[(im$95$m * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[im$95$m, 2e+148], N[(im$95$m * N[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(-0.16666666666666666 + N[(im$95$m * N[(-0.0001984126984126984 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 5e+243], N[(N[(im$95$m * N[(-2.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(t$95$0 * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
im\_m = \left|im\right|
\\
im\_s = \mathsf{copysign}\left(1, im\right)

\\
\begin{array}{l}
t_0 := im\_m \cdot \left(im\_m \cdot im\_m\right)\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;im\_m \leq 2 \cdot 10^{+148}:\\
\;\;\;\;im\_m \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + im\_m \cdot \left(-0.0001984126984126984 \cdot t\_0\right)\right)\right)\\

\mathbf{elif}\;im\_m \leq 5 \cdot 10^{+243}:\\
\;\;\;\;\left(im\_m \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot -0.3333333333333333\right)\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(t\_0 \cdot -0.3333333333333333\right)\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < 2.0000000000000001e148

    1. Initial program 51.3%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub051.3%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified51.3%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 93.3%

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative93.3%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + -1 \cdot \cos re\right)} \]
      2. +-commutative93.3%

        \[\leadsto im \cdot \left({im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right) + -0.16666666666666666 \cdot \cos re\right)} + -1 \cdot \cos re\right) \]
      3. distribute-rgt-in93.3%

        \[\leadsto im \cdot \left(\color{blue}{\left(\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right)} + -1 \cdot \cos re\right) \]
      4. *-commutative93.3%

        \[\leadsto im \cdot \left(\left(\color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
      5. associate-+l+93.3%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2} + -1 \cdot \cos re\right)\right)} \]
    7. Simplified93.3%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right)} \]
    8. Step-by-step derivation
      1. *-commutative93.3%

        \[\leadsto im \cdot \color{blue}{\left(\left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot \cos re\right)} \]
      2. associate-*r*93.3%

        \[\leadsto \color{blue}{\left(im \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right) \cdot \cos re} \]
      3. +-commutative93.3%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)}\right) \cdot \cos re \]
      4. +-commutative93.3%

        \[\leadsto \left(im \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)} + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \cos re \]
      5. associate-+l+93.3%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)}\right) \cdot \cos re \]
      6. *-commutative93.3%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \color{blue}{\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)}\right)\right)\right) \cdot \cos re \]
      7. +-commutative93.3%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)}\right)\right)\right) \cdot \cos re \]
    9. Applied egg-rr93.3%

      \[\leadsto \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \cdot \cos re} \]
    10. Taylor expanded in re around 0 60.0%

      \[\leadsto \color{blue}{im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)} \]
    11. Step-by-step derivation
      1. sub-neg60.0%

        \[\leadsto im \cdot \color{blue}{\left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \left(-1\right)\right)} \]
      2. metadata-eval60.0%

        \[\leadsto im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \color{blue}{-1}\right) \]
      3. +-commutative60.0%

        \[\leadsto im \cdot \color{blue}{\left(-1 + \left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right)} \]
      4. *-commutative60.0%

        \[\leadsto im \cdot \left(-1 + \left(\color{blue}{{im}^{2} \cdot -0.16666666666666666} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right) \]
      5. sub-neg60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \color{blue}{\left(-0.0001984126984126984 \cdot {im}^{2} + \left(-0.008333333333333333\right)\right)}\right)\right) \]
      6. *-commutative60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{{im}^{2} \cdot -0.0001984126984126984} + \left(-0.008333333333333333\right)\right)\right)\right) \]
      7. unpow260.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.0001984126984126984 + \left(-0.008333333333333333\right)\right)\right)\right) \]
      8. associate-*r*60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{im \cdot \left(im \cdot -0.0001984126984126984\right)} + \left(-0.008333333333333333\right)\right)\right)\right) \]
      9. metadata-eval60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + \color{blue}{-0.008333333333333333}\right)\right)\right) \]
      10. metadata-eval60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{\color{blue}{\left(2 \cdot 2\right)}} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      11. pow-sqr60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      12. unpow260.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{\left(im \cdot im\right)}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      13. unpow260.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{\left(im \cdot im\right)} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      14. unpow260.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{2}} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      15. unpow260.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      16. associate-*r*60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)}\right)\right) \]
    12. Simplified60.0%

      \[\leadsto \color{blue}{im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)} \]
    13. Taylor expanded in im around inf 59.9%

      \[\leadsto im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \color{blue}{\left(-0.0001984126984126984 \cdot {im}^{3}\right)}\right)\right) \]
    14. Step-by-step derivation
      1. cube-mult59.9%

        \[\leadsto im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(-0.0001984126984126984 \cdot \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)}\right)\right)\right) \]
    15. Simplified59.9%

      \[\leadsto im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \color{blue}{\left(-0.0001984126984126984 \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)}\right)\right) \]

    if 2.0000000000000001e148 < im < 5.00000000000000037e243

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} - 2\right)\right)} \]
    6. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{2} + \left(-2\right)\right)}\right) \]
      2. metadata-eval100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} + \color{blue}{-2}\right)\right) \]
      3. +-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-2 + -0.3333333333333333 \cdot {im}^{2}\right)}\right) \]
      4. *-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{{im}^{2} \cdot -0.3333333333333333}\right)\right) \]
      5. unpow2100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{\left(im \cdot im\right)} \cdot -0.3333333333333333\right)\right) \]
      6. associate-*l*100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{im \cdot \left(im \cdot -0.3333333333333333\right)}\right)\right) \]
    7. Simplified100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)} \]
    8. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.3333333333333333\right) + -2\right)}\right) \]
      2. distribute-lft-in100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right) + im \cdot -2\right)} \]
    9. Applied egg-rr100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right) + im \cdot -2\right)} \]
    10. Taylor expanded in re around 0 0.0%

      \[\leadsto \color{blue}{-0.25 \cdot \left({re}^{2} \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right)\right) + 0.5 \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right)} \]
    11. Step-by-step derivation
      1. +-commutative0.0%

        \[\leadsto \color{blue}{0.5 \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right) + -0.25 \cdot \left({re}^{2} \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right)\right)} \]
      2. associate-*r*0.0%

        \[\leadsto 0.5 \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right) + \color{blue}{\left(-0.25 \cdot {re}^{2}\right) \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right)} \]
      3. distribute-rgt-out88.9%

        \[\leadsto \color{blue}{\left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right)} \]
      4. *-commutative88.9%

        \[\leadsto \left(-2 \cdot im + \color{blue}{{im}^{3} \cdot -0.3333333333333333}\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right) \]
      5. cube-unmult88.9%

        \[\leadsto \left(-2 \cdot im + \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right) \]
      6. unpow288.9%

        \[\leadsto \left(-2 \cdot im + \left(im \cdot \color{blue}{{im}^{2}}\right) \cdot -0.3333333333333333\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right) \]
      7. associate-*r*88.9%

        \[\leadsto \left(-2 \cdot im + \color{blue}{im \cdot \left({im}^{2} \cdot -0.3333333333333333\right)}\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right) \]
      8. unpow288.9%

        \[\leadsto \left(-2 \cdot im + im \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.3333333333333333\right)\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right) \]
      9. *-commutative88.9%

        \[\leadsto \left(-2 \cdot im + \color{blue}{\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right) \]
      10. distribute-rgt-in88.9%

        \[\leadsto \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)} \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right) \]
      11. *-commutative88.9%

        \[\leadsto \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right) \cdot \left(0.5 + \color{blue}{{re}^{2} \cdot -0.25}\right) \]
      12. unpow288.9%

        \[\leadsto \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right) \cdot \left(0.5 + \color{blue}{\left(re \cdot re\right)} \cdot -0.25\right) \]
    12. Simplified88.9%

      \[\leadsto \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)} \]

    if 5.00000000000000037e243 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} - 2\right)\right)} \]
    6. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{2} + \left(-2\right)\right)}\right) \]
      2. metadata-eval100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} + \color{blue}{-2}\right)\right) \]
      3. +-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-2 + -0.3333333333333333 \cdot {im}^{2}\right)}\right) \]
      4. *-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{{im}^{2} \cdot -0.3333333333333333}\right)\right) \]
      5. unpow2100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{\left(im \cdot im\right)} \cdot -0.3333333333333333\right)\right) \]
      6. associate-*l*100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{im \cdot \left(im \cdot -0.3333333333333333\right)}\right)\right) \]
    7. Simplified100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)} \]
    8. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.3333333333333333\right) + -2\right)}\right) \]
      2. distribute-lft-in100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right) + im \cdot -2\right)} \]
    9. Applied egg-rr100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right) + im \cdot -2\right)} \]
    10. Taylor expanded in re around 0 81.8%

      \[\leadsto \color{blue}{0.5 \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right)} \]
    11. Step-by-step derivation
      1. +-commutative81.8%

        \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{3} + -2 \cdot im\right)} \]
      2. *-commutative81.8%

        \[\leadsto 0.5 \cdot \left(\color{blue}{{im}^{3} \cdot -0.3333333333333333} + -2 \cdot im\right) \]
      3. cube-unmult81.8%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333 + -2 \cdot im\right) \]
      4. unpow281.8%

        \[\leadsto 0.5 \cdot \left(\left(im \cdot \color{blue}{{im}^{2}}\right) \cdot -0.3333333333333333 + -2 \cdot im\right) \]
      5. associate-*r*81.8%

        \[\leadsto 0.5 \cdot \left(\color{blue}{im \cdot \left({im}^{2} \cdot -0.3333333333333333\right)} + -2 \cdot im\right) \]
      6. unpow281.8%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.3333333333333333\right) + -2 \cdot im\right) \]
      7. *-commutative81.8%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) + \color{blue}{im \cdot -2}\right) \]
      8. distribute-lft-in81.8%

        \[\leadsto 0.5 \cdot \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333 + -2\right)\right)} \]
      9. +-commutative81.8%

        \[\leadsto 0.5 \cdot \left(im \cdot \color{blue}{\left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)}\right) \]
    12. Simplified81.8%

      \[\leadsto \color{blue}{0.5 \cdot \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)} \]
    13. Taylor expanded in im around inf 81.8%

      \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{3}\right)} \]
    14. Step-by-step derivation
      1. *-commutative81.8%

        \[\leadsto 0.5 \cdot \color{blue}{\left({im}^{3} \cdot -0.3333333333333333\right)} \]
      2. cube-mult81.8%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right) \]
    15. Simplified81.8%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.3333333333333333\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 14: 59.5% accurate, 11.4× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := im\_m \cdot \left(im\_m \cdot im\_m\right)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 9 \cdot 10^{+149}:\\ \;\;\;\;im\_m \cdot \left(-1 + -0.0001984126984126984 \cdot \left(t\_0 \cdot t\_0\right)\right)\\ \mathbf{elif}\;im\_m \leq 3.2 \cdot 10^{+247}:\\ \;\;\;\;\left(im\_m \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot -0.3333333333333333\right)\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(t\_0 \cdot -0.3333333333333333\right)\\ \end{array} \end{array} \end{array} \]
im\_m = (fabs.f64 im)
im\_s = (copysign.f64 #s(literal 1 binary64) im)
(FPCore (im_s re im_m)
 :precision binary64
 (let* ((t_0 (* im_m (* im_m im_m))))
   (*
    im_s
    (if (<= im_m 9e+149)
      (* im_m (+ -1.0 (* -0.0001984126984126984 (* t_0 t_0))))
      (if (<= im_m 3.2e+247)
        (*
         (* im_m (+ -2.0 (* (* im_m im_m) -0.3333333333333333)))
         (+ 0.5 (* (* re re) -0.25)))
        (* 0.5 (* t_0 -0.3333333333333333)))))))
im\_m = fabs(im);
im\_s = copysign(1.0, im);
double code(double im_s, double re, double im_m) {
	double t_0 = im_m * (im_m * im_m);
	double tmp;
	if (im_m <= 9e+149) {
		tmp = im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0)));
	} else if (im_m <= 3.2e+247) {
		tmp = (im_m * (-2.0 + ((im_m * im_m) * -0.3333333333333333))) * (0.5 + ((re * re) * -0.25));
	} else {
		tmp = 0.5 * (t_0 * -0.3333333333333333);
	}
	return im_s * tmp;
}
im\_m = abs(im)
im\_s = copysign(1.0d0, im)
real(8) function code(im_s, re, im_m)
    real(8), intent (in) :: im_s
    real(8), intent (in) :: re
    real(8), intent (in) :: im_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = im_m * (im_m * im_m)
    if (im_m <= 9d+149) then
        tmp = im_m * ((-1.0d0) + ((-0.0001984126984126984d0) * (t_0 * t_0)))
    else if (im_m <= 3.2d+247) then
        tmp = (im_m * ((-2.0d0) + ((im_m * im_m) * (-0.3333333333333333d0)))) * (0.5d0 + ((re * re) * (-0.25d0)))
    else
        tmp = 0.5d0 * (t_0 * (-0.3333333333333333d0))
    end if
    code = im_s * tmp
end function
im\_m = Math.abs(im);
im\_s = Math.copySign(1.0, im);
public static double code(double im_s, double re, double im_m) {
	double t_0 = im_m * (im_m * im_m);
	double tmp;
	if (im_m <= 9e+149) {
		tmp = im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0)));
	} else if (im_m <= 3.2e+247) {
		tmp = (im_m * (-2.0 + ((im_m * im_m) * -0.3333333333333333))) * (0.5 + ((re * re) * -0.25));
	} else {
		tmp = 0.5 * (t_0 * -0.3333333333333333);
	}
	return im_s * tmp;
}
im\_m = math.fabs(im)
im\_s = math.copysign(1.0, im)
def code(im_s, re, im_m):
	t_0 = im_m * (im_m * im_m)
	tmp = 0
	if im_m <= 9e+149:
		tmp = im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0)))
	elif im_m <= 3.2e+247:
		tmp = (im_m * (-2.0 + ((im_m * im_m) * -0.3333333333333333))) * (0.5 + ((re * re) * -0.25))
	else:
		tmp = 0.5 * (t_0 * -0.3333333333333333)
	return im_s * tmp
im\_m = abs(im)
im\_s = copysign(1.0, im)
function code(im_s, re, im_m)
	t_0 = Float64(im_m * Float64(im_m * im_m))
	tmp = 0.0
	if (im_m <= 9e+149)
		tmp = Float64(im_m * Float64(-1.0 + Float64(-0.0001984126984126984 * Float64(t_0 * t_0))));
	elseif (im_m <= 3.2e+247)
		tmp = Float64(Float64(im_m * Float64(-2.0 + Float64(Float64(im_m * im_m) * -0.3333333333333333))) * Float64(0.5 + Float64(Float64(re * re) * -0.25)));
	else
		tmp = Float64(0.5 * Float64(t_0 * -0.3333333333333333));
	end
	return Float64(im_s * tmp)
end
im\_m = abs(im);
im\_s = sign(im) * abs(1.0);
function tmp_2 = code(im_s, re, im_m)
	t_0 = im_m * (im_m * im_m);
	tmp = 0.0;
	if (im_m <= 9e+149)
		tmp = im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0)));
	elseif (im_m <= 3.2e+247)
		tmp = (im_m * (-2.0 + ((im_m * im_m) * -0.3333333333333333))) * (0.5 + ((re * re) * -0.25));
	else
		tmp = 0.5 * (t_0 * -0.3333333333333333);
	end
	tmp_2 = im_s * tmp;
end
im\_m = N[Abs[im], $MachinePrecision]
im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[im$95$s_, re_, im$95$m_] := Block[{t$95$0 = N[(im$95$m * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[im$95$m, 9e+149], N[(im$95$m * N[(-1.0 + N[(-0.0001984126984126984 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 3.2e+247], N[(N[(im$95$m * N[(-2.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(t$95$0 * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
im\_m = \left|im\right|
\\
im\_s = \mathsf{copysign}\left(1, im\right)

\\
\begin{array}{l}
t_0 := im\_m \cdot \left(im\_m \cdot im\_m\right)\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;im\_m \leq 9 \cdot 10^{+149}:\\
\;\;\;\;im\_m \cdot \left(-1 + -0.0001984126984126984 \cdot \left(t\_0 \cdot t\_0\right)\right)\\

\mathbf{elif}\;im\_m \leq 3.2 \cdot 10^{+247}:\\
\;\;\;\;\left(im\_m \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot -0.3333333333333333\right)\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(t\_0 \cdot -0.3333333333333333\right)\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < 8.99999999999999965e149

    1. Initial program 51.3%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub051.3%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified51.3%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 93.3%

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative93.3%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + -1 \cdot \cos re\right)} \]
      2. +-commutative93.3%

        \[\leadsto im \cdot \left({im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right) + -0.16666666666666666 \cdot \cos re\right)} + -1 \cdot \cos re\right) \]
      3. distribute-rgt-in93.3%

        \[\leadsto im \cdot \left(\color{blue}{\left(\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right)} + -1 \cdot \cos re\right) \]
      4. *-commutative93.3%

        \[\leadsto im \cdot \left(\left(\color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
      5. associate-+l+93.3%

        \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2} + -1 \cdot \cos re\right)\right)} \]
    7. Simplified93.3%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right)} \]
    8. Step-by-step derivation
      1. *-commutative93.3%

        \[\leadsto im \cdot \color{blue}{\left(\left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot \cos re\right)} \]
      2. associate-*r*93.3%

        \[\leadsto \color{blue}{\left(im \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right) \cdot \cos re} \]
      3. +-commutative93.3%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)}\right) \cdot \cos re \]
      4. +-commutative93.3%

        \[\leadsto \left(im \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)} + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \cos re \]
      5. associate-+l+93.3%

        \[\leadsto \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)}\right) \cdot \cos re \]
      6. *-commutative93.3%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \color{blue}{\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)}\right)\right)\right) \cdot \cos re \]
      7. +-commutative93.3%

        \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)}\right)\right)\right) \cdot \cos re \]
    9. Applied egg-rr93.3%

      \[\leadsto \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \cdot \cos re} \]
    10. Taylor expanded in re around 0 60.0%

      \[\leadsto \color{blue}{im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)} \]
    11. Step-by-step derivation
      1. sub-neg60.0%

        \[\leadsto im \cdot \color{blue}{\left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \left(-1\right)\right)} \]
      2. metadata-eval60.0%

        \[\leadsto im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \color{blue}{-1}\right) \]
      3. +-commutative60.0%

        \[\leadsto im \cdot \color{blue}{\left(-1 + \left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right)} \]
      4. *-commutative60.0%

        \[\leadsto im \cdot \left(-1 + \left(\color{blue}{{im}^{2} \cdot -0.16666666666666666} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right) \]
      5. sub-neg60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \color{blue}{\left(-0.0001984126984126984 \cdot {im}^{2} + \left(-0.008333333333333333\right)\right)}\right)\right) \]
      6. *-commutative60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{{im}^{2} \cdot -0.0001984126984126984} + \left(-0.008333333333333333\right)\right)\right)\right) \]
      7. unpow260.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.0001984126984126984 + \left(-0.008333333333333333\right)\right)\right)\right) \]
      8. associate-*r*60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{im \cdot \left(im \cdot -0.0001984126984126984\right)} + \left(-0.008333333333333333\right)\right)\right)\right) \]
      9. metadata-eval60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + \color{blue}{-0.008333333333333333}\right)\right)\right) \]
      10. metadata-eval60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{\color{blue}{\left(2 \cdot 2\right)}} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      11. pow-sqr60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      12. unpow260.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{\left(im \cdot im\right)}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      13. unpow260.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{\left(im \cdot im\right)} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      14. unpow260.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{2}} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      15. unpow260.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
      16. associate-*r*60.0%

        \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)}\right)\right) \]
    12. Simplified60.0%

      \[\leadsto \color{blue}{im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)} \]
    13. Taylor expanded in im around inf 59.7%

      \[\leadsto im \cdot \left(-1 + \color{blue}{-0.0001984126984126984 \cdot {im}^{6}}\right) \]
    14. Step-by-step derivation
      1. metadata-eval59.7%

        \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot {im}^{\color{blue}{\left(2 \cdot 3\right)}}\right) \]
      2. pow-sqr59.7%

        \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot \color{blue}{\left({im}^{3} \cdot {im}^{3}\right)}\right) \]
      3. cube-mult59.7%

        \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot {im}^{3}\right)\right) \]
      4. cube-mult59.7%

        \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)}\right)\right) \]
    15. Simplified59.7%

      \[\leadsto im \cdot \left(-1 + \color{blue}{-0.0001984126984126984 \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)}\right) \]

    if 8.99999999999999965e149 < im < 3.20000000000000022e247

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} - 2\right)\right)} \]
    6. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{2} + \left(-2\right)\right)}\right) \]
      2. metadata-eval100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} + \color{blue}{-2}\right)\right) \]
      3. +-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-2 + -0.3333333333333333 \cdot {im}^{2}\right)}\right) \]
      4. *-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{{im}^{2} \cdot -0.3333333333333333}\right)\right) \]
      5. unpow2100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{\left(im \cdot im\right)} \cdot -0.3333333333333333\right)\right) \]
      6. associate-*l*100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{im \cdot \left(im \cdot -0.3333333333333333\right)}\right)\right) \]
    7. Simplified100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)} \]
    8. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.3333333333333333\right) + -2\right)}\right) \]
      2. distribute-lft-in100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right) + im \cdot -2\right)} \]
    9. Applied egg-rr100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right) + im \cdot -2\right)} \]
    10. Taylor expanded in re around 0 0.0%

      \[\leadsto \color{blue}{-0.25 \cdot \left({re}^{2} \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right)\right) + 0.5 \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right)} \]
    11. Step-by-step derivation
      1. +-commutative0.0%

        \[\leadsto \color{blue}{0.5 \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right) + -0.25 \cdot \left({re}^{2} \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right)\right)} \]
      2. associate-*r*0.0%

        \[\leadsto 0.5 \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right) + \color{blue}{\left(-0.25 \cdot {re}^{2}\right) \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right)} \]
      3. distribute-rgt-out88.9%

        \[\leadsto \color{blue}{\left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right)} \]
      4. *-commutative88.9%

        \[\leadsto \left(-2 \cdot im + \color{blue}{{im}^{3} \cdot -0.3333333333333333}\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right) \]
      5. cube-unmult88.9%

        \[\leadsto \left(-2 \cdot im + \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right) \]
      6. unpow288.9%

        \[\leadsto \left(-2 \cdot im + \left(im \cdot \color{blue}{{im}^{2}}\right) \cdot -0.3333333333333333\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right) \]
      7. associate-*r*88.9%

        \[\leadsto \left(-2 \cdot im + \color{blue}{im \cdot \left({im}^{2} \cdot -0.3333333333333333\right)}\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right) \]
      8. unpow288.9%

        \[\leadsto \left(-2 \cdot im + im \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.3333333333333333\right)\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right) \]
      9. *-commutative88.9%

        \[\leadsto \left(-2 \cdot im + \color{blue}{\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right) \]
      10. distribute-rgt-in88.9%

        \[\leadsto \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)} \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right) \]
      11. *-commutative88.9%

        \[\leadsto \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right) \cdot \left(0.5 + \color{blue}{{re}^{2} \cdot -0.25}\right) \]
      12. unpow288.9%

        \[\leadsto \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right) \cdot \left(0.5 + \color{blue}{\left(re \cdot re\right)} \cdot -0.25\right) \]
    12. Simplified88.9%

      \[\leadsto \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)} \]

    if 3.20000000000000022e247 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} - 2\right)\right)} \]
    6. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{2} + \left(-2\right)\right)}\right) \]
      2. metadata-eval100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} + \color{blue}{-2}\right)\right) \]
      3. +-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-2 + -0.3333333333333333 \cdot {im}^{2}\right)}\right) \]
      4. *-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{{im}^{2} \cdot -0.3333333333333333}\right)\right) \]
      5. unpow2100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{\left(im \cdot im\right)} \cdot -0.3333333333333333\right)\right) \]
      6. associate-*l*100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{im \cdot \left(im \cdot -0.3333333333333333\right)}\right)\right) \]
    7. Simplified100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)} \]
    8. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.3333333333333333\right) + -2\right)}\right) \]
      2. distribute-lft-in100.0%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right) + im \cdot -2\right)} \]
    9. Applied egg-rr100.0%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right) + im \cdot -2\right)} \]
    10. Taylor expanded in re around 0 81.8%

      \[\leadsto \color{blue}{0.5 \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right)} \]
    11. Step-by-step derivation
      1. +-commutative81.8%

        \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{3} + -2 \cdot im\right)} \]
      2. *-commutative81.8%

        \[\leadsto 0.5 \cdot \left(\color{blue}{{im}^{3} \cdot -0.3333333333333333} + -2 \cdot im\right) \]
      3. cube-unmult81.8%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333 + -2 \cdot im\right) \]
      4. unpow281.8%

        \[\leadsto 0.5 \cdot \left(\left(im \cdot \color{blue}{{im}^{2}}\right) \cdot -0.3333333333333333 + -2 \cdot im\right) \]
      5. associate-*r*81.8%

        \[\leadsto 0.5 \cdot \left(\color{blue}{im \cdot \left({im}^{2} \cdot -0.3333333333333333\right)} + -2 \cdot im\right) \]
      6. unpow281.8%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.3333333333333333\right) + -2 \cdot im\right) \]
      7. *-commutative81.8%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) + \color{blue}{im \cdot -2}\right) \]
      8. distribute-lft-in81.8%

        \[\leadsto 0.5 \cdot \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333 + -2\right)\right)} \]
      9. +-commutative81.8%

        \[\leadsto 0.5 \cdot \left(im \cdot \color{blue}{\left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)}\right) \]
    12. Simplified81.8%

      \[\leadsto \color{blue}{0.5 \cdot \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)} \]
    13. Taylor expanded in im around inf 81.8%

      \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{3}\right)} \]
    14. Step-by-step derivation
      1. *-commutative81.8%

        \[\leadsto 0.5 \cdot \color{blue}{\left({im}^{3} \cdot -0.3333333333333333\right)} \]
      2. cube-mult81.8%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right) \]
    15. Simplified81.8%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.3333333333333333\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 15: 59.8% accurate, 18.2× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := im\_m \cdot \left(im\_m \cdot im\_m\right)\\ im\_s \cdot \left(im\_m \cdot \left(-1 + -0.0001984126984126984 \cdot \left(t\_0 \cdot t\_0\right)\right)\right) \end{array} \end{array} \]
im\_m = (fabs.f64 im)
im\_s = (copysign.f64 #s(literal 1 binary64) im)
(FPCore (im_s re im_m)
 :precision binary64
 (let* ((t_0 (* im_m (* im_m im_m))))
   (* im_s (* im_m (+ -1.0 (* -0.0001984126984126984 (* t_0 t_0)))))))
im\_m = fabs(im);
im\_s = copysign(1.0, im);
double code(double im_s, double re, double im_m) {
	double t_0 = im_m * (im_m * im_m);
	return im_s * (im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0))));
}
im\_m = abs(im)
im\_s = copysign(1.0d0, im)
real(8) function code(im_s, re, im_m)
    real(8), intent (in) :: im_s
    real(8), intent (in) :: re
    real(8), intent (in) :: im_m
    real(8) :: t_0
    t_0 = im_m * (im_m * im_m)
    code = im_s * (im_m * ((-1.0d0) + ((-0.0001984126984126984d0) * (t_0 * t_0))))
end function
im\_m = Math.abs(im);
im\_s = Math.copySign(1.0, im);
public static double code(double im_s, double re, double im_m) {
	double t_0 = im_m * (im_m * im_m);
	return im_s * (im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0))));
}
im\_m = math.fabs(im)
im\_s = math.copysign(1.0, im)
def code(im_s, re, im_m):
	t_0 = im_m * (im_m * im_m)
	return im_s * (im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0))))
im\_m = abs(im)
im\_s = copysign(1.0, im)
function code(im_s, re, im_m)
	t_0 = Float64(im_m * Float64(im_m * im_m))
	return Float64(im_s * Float64(im_m * Float64(-1.0 + Float64(-0.0001984126984126984 * Float64(t_0 * t_0)))))
end
im\_m = abs(im);
im\_s = sign(im) * abs(1.0);
function tmp = code(im_s, re, im_m)
	t_0 = im_m * (im_m * im_m);
	tmp = im_s * (im_m * (-1.0 + (-0.0001984126984126984 * (t_0 * t_0))));
end
im\_m = N[Abs[im], $MachinePrecision]
im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[im$95$s_, re_, im$95$m_] := Block[{t$95$0 = N[(im$95$m * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * N[(im$95$m * N[(-1.0 + N[(-0.0001984126984126984 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
im\_m = \left|im\right|
\\
im\_s = \mathsf{copysign}\left(1, im\right)

\\
\begin{array}{l}
t_0 := im\_m \cdot \left(im\_m \cdot im\_m\right)\\
im\_s \cdot \left(im\_m \cdot \left(-1 + -0.0001984126984126984 \cdot \left(t\_0 \cdot t\_0\right)\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 58.5%

    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
  2. Step-by-step derivation
    1. neg-sub058.5%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
  3. Simplified58.5%

    \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in im around 0 94.3%

    \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
  6. Step-by-step derivation
    1. +-commutative94.3%

      \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + -1 \cdot \cos re\right)} \]
    2. +-commutative94.3%

      \[\leadsto im \cdot \left({im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right) + -0.16666666666666666 \cdot \cos re\right)} + -1 \cdot \cos re\right) \]
    3. distribute-rgt-in94.3%

      \[\leadsto im \cdot \left(\color{blue}{\left(\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right)} + -1 \cdot \cos re\right) \]
    4. *-commutative94.3%

      \[\leadsto im \cdot \left(\left(\color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
    5. associate-+l+94.3%

      \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2} + -1 \cdot \cos re\right)\right)} \]
  7. Simplified94.3%

    \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right)} \]
  8. Step-by-step derivation
    1. *-commutative94.3%

      \[\leadsto im \cdot \color{blue}{\left(\left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot \cos re\right)} \]
    2. associate-*r*94.3%

      \[\leadsto \color{blue}{\left(im \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right) \cdot \cos re} \]
    3. +-commutative94.3%

      \[\leadsto \left(im \cdot \color{blue}{\left(\left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)}\right) \cdot \cos re \]
    4. +-commutative94.3%

      \[\leadsto \left(im \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)} + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \cos re \]
    5. associate-+l+94.3%

      \[\leadsto \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)}\right) \cdot \cos re \]
    6. *-commutative94.3%

      \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \color{blue}{\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)}\right)\right)\right) \cdot \cos re \]
    7. +-commutative94.3%

      \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)}\right)\right)\right) \cdot \cos re \]
  9. Applied egg-rr94.3%

    \[\leadsto \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \cdot \cos re} \]
  10. Taylor expanded in re around 0 60.8%

    \[\leadsto \color{blue}{im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)} \]
  11. Step-by-step derivation
    1. sub-neg60.8%

      \[\leadsto im \cdot \color{blue}{\left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \left(-1\right)\right)} \]
    2. metadata-eval60.8%

      \[\leadsto im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \color{blue}{-1}\right) \]
    3. +-commutative60.8%

      \[\leadsto im \cdot \color{blue}{\left(-1 + \left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right)} \]
    4. *-commutative60.8%

      \[\leadsto im \cdot \left(-1 + \left(\color{blue}{{im}^{2} \cdot -0.16666666666666666} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right) \]
    5. sub-neg60.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \color{blue}{\left(-0.0001984126984126984 \cdot {im}^{2} + \left(-0.008333333333333333\right)\right)}\right)\right) \]
    6. *-commutative60.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{{im}^{2} \cdot -0.0001984126984126984} + \left(-0.008333333333333333\right)\right)\right)\right) \]
    7. unpow260.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.0001984126984126984 + \left(-0.008333333333333333\right)\right)\right)\right) \]
    8. associate-*r*60.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{im \cdot \left(im \cdot -0.0001984126984126984\right)} + \left(-0.008333333333333333\right)\right)\right)\right) \]
    9. metadata-eval60.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + \color{blue}{-0.008333333333333333}\right)\right)\right) \]
    10. metadata-eval60.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{\color{blue}{\left(2 \cdot 2\right)}} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
    11. pow-sqr60.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
    12. unpow260.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{\left(im \cdot im\right)}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
    13. unpow260.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{\left(im \cdot im\right)} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
    14. unpow260.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{2}} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
    15. unpow260.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
    16. associate-*r*60.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)}\right)\right) \]
  12. Simplified60.8%

    \[\leadsto \color{blue}{im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)} \]
  13. Taylor expanded in im around inf 60.6%

    \[\leadsto im \cdot \left(-1 + \color{blue}{-0.0001984126984126984 \cdot {im}^{6}}\right) \]
  14. Step-by-step derivation
    1. metadata-eval60.6%

      \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot {im}^{\color{blue}{\left(2 \cdot 3\right)}}\right) \]
    2. pow-sqr60.6%

      \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot \color{blue}{\left({im}^{3} \cdot {im}^{3}\right)}\right) \]
    3. cube-mult60.6%

      \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot {im}^{3}\right)\right) \]
    4. cube-mult60.6%

      \[\leadsto im \cdot \left(-1 + -0.0001984126984126984 \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)}\right)\right) \]
  15. Simplified60.6%

    \[\leadsto im \cdot \left(-1 + \color{blue}{-0.0001984126984126984 \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)}\right) \]
  16. Add Preprocessing

Alternative 16: 57.8% accurate, 20.6× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \left(im\_m \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + im\_m \cdot \left(im\_m \cdot -0.008333333333333333\right)\right)\right)\right) \end{array} \]
im\_m = (fabs.f64 im)
im\_s = (copysign.f64 #s(literal 1 binary64) im)
(FPCore (im_s re im_m)
 :precision binary64
 (*
  im_s
  (*
   im_m
   (+
    -1.0
    (*
     (* im_m im_m)
     (+ -0.16666666666666666 (* im_m (* im_m -0.008333333333333333))))))))
im\_m = fabs(im);
im\_s = copysign(1.0, im);
double code(double im_s, double re, double im_m) {
	return im_s * (im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * -0.008333333333333333))))));
}
im\_m = abs(im)
im\_s = copysign(1.0d0, im)
real(8) function code(im_s, re, im_m)
    real(8), intent (in) :: im_s
    real(8), intent (in) :: re
    real(8), intent (in) :: im_m
    code = im_s * (im_m * ((-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + (im_m * (im_m * (-0.008333333333333333d0)))))))
end function
im\_m = Math.abs(im);
im\_s = Math.copySign(1.0, im);
public static double code(double im_s, double re, double im_m) {
	return im_s * (im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * -0.008333333333333333))))));
}
im\_m = math.fabs(im)
im\_s = math.copysign(1.0, im)
def code(im_s, re, im_m):
	return im_s * (im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * -0.008333333333333333))))))
im\_m = abs(im)
im\_s = copysign(1.0, im)
function code(im_s, re, im_m)
	return Float64(im_s * Float64(im_m * Float64(-1.0 + Float64(Float64(im_m * im_m) * Float64(-0.16666666666666666 + Float64(im_m * Float64(im_m * -0.008333333333333333)))))))
end
im\_m = abs(im);
im\_s = sign(im) * abs(1.0);
function tmp = code(im_s, re, im_m)
	tmp = im_s * (im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * -0.008333333333333333))))));
end
im\_m = N[Abs[im], $MachinePrecision]
im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[im$95$s_, re_, im$95$m_] := N[(im$95$s * N[(im$95$m * N[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(-0.16666666666666666 + N[(im$95$m * N[(im$95$m * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
im\_m = \left|im\right|
\\
im\_s = \mathsf{copysign}\left(1, im\right)

\\
im\_s \cdot \left(im\_m \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + im\_m \cdot \left(im\_m \cdot -0.008333333333333333\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 58.5%

    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
  2. Step-by-step derivation
    1. neg-sub058.5%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
  3. Simplified58.5%

    \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in im around 0 94.3%

    \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
  6. Step-by-step derivation
    1. +-commutative94.3%

      \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + -1 \cdot \cos re\right)} \]
    2. +-commutative94.3%

      \[\leadsto im \cdot \left({im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right) + -0.16666666666666666 \cdot \cos re\right)} + -1 \cdot \cos re\right) \]
    3. distribute-rgt-in94.3%

      \[\leadsto im \cdot \left(\color{blue}{\left(\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right)} + -1 \cdot \cos re\right) \]
    4. *-commutative94.3%

      \[\leadsto im \cdot \left(\left(\color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
    5. associate-+l+94.3%

      \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2} + -1 \cdot \cos re\right)\right)} \]
  7. Simplified94.3%

    \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right)} \]
  8. Step-by-step derivation
    1. *-commutative94.3%

      \[\leadsto im \cdot \color{blue}{\left(\left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot \cos re\right)} \]
    2. associate-*r*94.3%

      \[\leadsto \color{blue}{\left(im \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right) \cdot \cos re} \]
    3. +-commutative94.3%

      \[\leadsto \left(im \cdot \color{blue}{\left(\left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)}\right) \cdot \cos re \]
    4. +-commutative94.3%

      \[\leadsto \left(im \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)} + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \cos re \]
    5. associate-+l+94.3%

      \[\leadsto \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)}\right) \cdot \cos re \]
    6. *-commutative94.3%

      \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \color{blue}{\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)}\right)\right)\right) \cdot \cos re \]
    7. +-commutative94.3%

      \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)}\right)\right)\right) \cdot \cos re \]
  9. Applied egg-rr94.3%

    \[\leadsto \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \cdot \cos re} \]
  10. Taylor expanded in re around 0 60.8%

    \[\leadsto \color{blue}{im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)} \]
  11. Step-by-step derivation
    1. sub-neg60.8%

      \[\leadsto im \cdot \color{blue}{\left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \left(-1\right)\right)} \]
    2. metadata-eval60.8%

      \[\leadsto im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \color{blue}{-1}\right) \]
    3. +-commutative60.8%

      \[\leadsto im \cdot \color{blue}{\left(-1 + \left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right)} \]
    4. *-commutative60.8%

      \[\leadsto im \cdot \left(-1 + \left(\color{blue}{{im}^{2} \cdot -0.16666666666666666} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right) \]
    5. sub-neg60.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \color{blue}{\left(-0.0001984126984126984 \cdot {im}^{2} + \left(-0.008333333333333333\right)\right)}\right)\right) \]
    6. *-commutative60.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{{im}^{2} \cdot -0.0001984126984126984} + \left(-0.008333333333333333\right)\right)\right)\right) \]
    7. unpow260.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.0001984126984126984 + \left(-0.008333333333333333\right)\right)\right)\right) \]
    8. associate-*r*60.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{im \cdot \left(im \cdot -0.0001984126984126984\right)} + \left(-0.008333333333333333\right)\right)\right)\right) \]
    9. metadata-eval60.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + \color{blue}{-0.008333333333333333}\right)\right)\right) \]
    10. metadata-eval60.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{\color{blue}{\left(2 \cdot 2\right)}} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
    11. pow-sqr60.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
    12. unpow260.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{\left(im \cdot im\right)}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
    13. unpow260.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{\left(im \cdot im\right)} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
    14. unpow260.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{2}} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
    15. unpow260.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
    16. associate-*r*60.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)}\right)\right) \]
  12. Simplified60.8%

    \[\leadsto \color{blue}{im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)} \]
  13. Taylor expanded in im around 0 59.7%

    \[\leadsto im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \color{blue}{\left(-0.008333333333333333 \cdot im\right)}\right)\right) \]
  14. Step-by-step derivation
    1. *-commutative59.7%

      \[\leadsto im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \color{blue}{\left(im \cdot -0.008333333333333333\right)}\right)\right) \]
  15. Simplified59.7%

    \[\leadsto im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \color{blue}{\left(im \cdot -0.008333333333333333\right)}\right)\right) \]
  16. Add Preprocessing

Alternative 17: 53.0% accurate, 22.0× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 0.056:\\ \;\;\;\;-im\_m\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(im\_m \cdot \left(im\_m \cdot im\_m\right)\right) \cdot -0.3333333333333333\right)\\ \end{array} \end{array} \]
im\_m = (fabs.f64 im)
im\_s = (copysign.f64 #s(literal 1 binary64) im)
(FPCore (im_s re im_m)
 :precision binary64
 (*
  im_s
  (if (<= im_m 0.056)
    (- im_m)
    (* 0.5 (* (* im_m (* im_m im_m)) -0.3333333333333333)))))
im\_m = fabs(im);
im\_s = copysign(1.0, im);
double code(double im_s, double re, double im_m) {
	double tmp;
	if (im_m <= 0.056) {
		tmp = -im_m;
	} else {
		tmp = 0.5 * ((im_m * (im_m * im_m)) * -0.3333333333333333);
	}
	return im_s * tmp;
}
im\_m = abs(im)
im\_s = copysign(1.0d0, im)
real(8) function code(im_s, re, im_m)
    real(8), intent (in) :: im_s
    real(8), intent (in) :: re
    real(8), intent (in) :: im_m
    real(8) :: tmp
    if (im_m <= 0.056d0) then
        tmp = -im_m
    else
        tmp = 0.5d0 * ((im_m * (im_m * im_m)) * (-0.3333333333333333d0))
    end if
    code = im_s * tmp
end function
im\_m = Math.abs(im);
im\_s = Math.copySign(1.0, im);
public static double code(double im_s, double re, double im_m) {
	double tmp;
	if (im_m <= 0.056) {
		tmp = -im_m;
	} else {
		tmp = 0.5 * ((im_m * (im_m * im_m)) * -0.3333333333333333);
	}
	return im_s * tmp;
}
im\_m = math.fabs(im)
im\_s = math.copysign(1.0, im)
def code(im_s, re, im_m):
	tmp = 0
	if im_m <= 0.056:
		tmp = -im_m
	else:
		tmp = 0.5 * ((im_m * (im_m * im_m)) * -0.3333333333333333)
	return im_s * tmp
im\_m = abs(im)
im\_s = copysign(1.0, im)
function code(im_s, re, im_m)
	tmp = 0.0
	if (im_m <= 0.056)
		tmp = Float64(-im_m);
	else
		tmp = Float64(0.5 * Float64(Float64(im_m * Float64(im_m * im_m)) * -0.3333333333333333));
	end
	return Float64(im_s * tmp)
end
im\_m = abs(im);
im\_s = sign(im) * abs(1.0);
function tmp_2 = code(im_s, re, im_m)
	tmp = 0.0;
	if (im_m <= 0.056)
		tmp = -im_m;
	else
		tmp = 0.5 * ((im_m * (im_m * im_m)) * -0.3333333333333333);
	end
	tmp_2 = im_s * tmp;
end
im\_m = N[Abs[im], $MachinePrecision]
im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[im$95$s_, re_, im$95$m_] := N[(im$95$s * If[LessEqual[im$95$m, 0.056], (-im$95$m), N[(0.5 * N[(N[(im$95$m * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
im\_m = \left|im\right|
\\
im\_s = \mathsf{copysign}\left(1, im\right)

\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;im\_m \leq 0.056:\\
\;\;\;\;-im\_m\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(im\_m \cdot \left(im\_m \cdot im\_m\right)\right) \cdot -0.3333333333333333\right)\\


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

    1. Initial program 44.1%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub044.1%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified44.1%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 62.1%

      \[\leadsto \color{blue}{-1 \cdot \left(im \cdot \cos re\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg62.1%

        \[\leadsto \color{blue}{-im \cdot \cos re} \]
      2. neg-sub062.1%

        \[\leadsto \color{blue}{0 - im \cdot \cos re} \]
    7. Simplified62.1%

      \[\leadsto \color{blue}{0 - im \cdot \cos re} \]
    8. Taylor expanded in re around 0 34.7%

      \[\leadsto 0 - \color{blue}{im} \]

    if 0.0560000000000000012 < im

    1. Initial program 99.9%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. neg-sub099.9%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 71.9%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} - 2\right)\right)} \]
    6. Step-by-step derivation
      1. sub-neg71.9%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{2} + \left(-2\right)\right)}\right) \]
      2. metadata-eval71.9%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-0.3333333333333333 \cdot {im}^{2} + \color{blue}{-2}\right)\right) \]
      3. +-commutative71.9%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(-2 + -0.3333333333333333 \cdot {im}^{2}\right)}\right) \]
      4. *-commutative71.9%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{{im}^{2} \cdot -0.3333333333333333}\right)\right) \]
      5. unpow271.9%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{\left(im \cdot im\right)} \cdot -0.3333333333333333\right)\right) \]
      6. associate-*l*71.9%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(-2 + \color{blue}{im \cdot \left(im \cdot -0.3333333333333333\right)}\right)\right) \]
    7. Simplified71.9%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)} \]
    8. Step-by-step derivation
      1. +-commutative71.9%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.3333333333333333\right) + -2\right)}\right) \]
      2. distribute-lft-in71.9%

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right) + im \cdot -2\right)} \]
    9. Applied egg-rr71.9%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right) + im \cdot -2\right)} \]
    10. Taylor expanded in re around 0 49.6%

      \[\leadsto \color{blue}{0.5 \cdot \left(-2 \cdot im + -0.3333333333333333 \cdot {im}^{3}\right)} \]
    11. Step-by-step derivation
      1. +-commutative49.6%

        \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{3} + -2 \cdot im\right)} \]
      2. *-commutative49.6%

        \[\leadsto 0.5 \cdot \left(\color{blue}{{im}^{3} \cdot -0.3333333333333333} + -2 \cdot im\right) \]
      3. cube-unmult49.6%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333 + -2 \cdot im\right) \]
      4. unpow249.6%

        \[\leadsto 0.5 \cdot \left(\left(im \cdot \color{blue}{{im}^{2}}\right) \cdot -0.3333333333333333 + -2 \cdot im\right) \]
      5. associate-*r*49.6%

        \[\leadsto 0.5 \cdot \left(\color{blue}{im \cdot \left({im}^{2} \cdot -0.3333333333333333\right)} + -2 \cdot im\right) \]
      6. unpow249.6%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.3333333333333333\right) + -2 \cdot im\right) \]
      7. *-commutative49.6%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) + \color{blue}{im \cdot -2}\right) \]
      8. distribute-lft-in49.6%

        \[\leadsto 0.5 \cdot \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333 + -2\right)\right)} \]
      9. +-commutative49.6%

        \[\leadsto 0.5 \cdot \left(im \cdot \color{blue}{\left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)}\right) \]
    12. Simplified49.6%

      \[\leadsto \color{blue}{0.5 \cdot \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)} \]
    13. Taylor expanded in im around inf 49.6%

      \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot {im}^{3}\right)} \]
    14. Step-by-step derivation
      1. *-commutative49.6%

        \[\leadsto 0.5 \cdot \color{blue}{\left({im}^{3} \cdot -0.3333333333333333\right)} \]
      2. cube-mult49.6%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right) \]
    15. Simplified49.6%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.3333333333333333\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification38.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.056:\\ \;\;\;\;-im\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.3333333333333333\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 53.1% accurate, 34.3× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \left(im\_m \cdot \left(-1 + im\_m \cdot \left(im\_m \cdot -0.16666666666666666\right)\right)\right) \end{array} \]
im\_m = (fabs.f64 im)
im\_s = (copysign.f64 #s(literal 1 binary64) im)
(FPCore (im_s re im_m)
 :precision binary64
 (* im_s (* im_m (+ -1.0 (* im_m (* im_m -0.16666666666666666))))))
im\_m = fabs(im);
im\_s = copysign(1.0, im);
double code(double im_s, double re, double im_m) {
	return im_s * (im_m * (-1.0 + (im_m * (im_m * -0.16666666666666666))));
}
im\_m = abs(im)
im\_s = copysign(1.0d0, im)
real(8) function code(im_s, re, im_m)
    real(8), intent (in) :: im_s
    real(8), intent (in) :: re
    real(8), intent (in) :: im_m
    code = im_s * (im_m * ((-1.0d0) + (im_m * (im_m * (-0.16666666666666666d0)))))
end function
im\_m = Math.abs(im);
im\_s = Math.copySign(1.0, im);
public static double code(double im_s, double re, double im_m) {
	return im_s * (im_m * (-1.0 + (im_m * (im_m * -0.16666666666666666))));
}
im\_m = math.fabs(im)
im\_s = math.copysign(1.0, im)
def code(im_s, re, im_m):
	return im_s * (im_m * (-1.0 + (im_m * (im_m * -0.16666666666666666))))
im\_m = abs(im)
im\_s = copysign(1.0, im)
function code(im_s, re, im_m)
	return Float64(im_s * Float64(im_m * Float64(-1.0 + Float64(im_m * Float64(im_m * -0.16666666666666666)))))
end
im\_m = abs(im);
im\_s = sign(im) * abs(1.0);
function tmp = code(im_s, re, im_m)
	tmp = im_s * (im_m * (-1.0 + (im_m * (im_m * -0.16666666666666666))));
end
im\_m = N[Abs[im], $MachinePrecision]
im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[im$95$s_, re_, im$95$m_] := N[(im$95$s * N[(im$95$m * N[(-1.0 + N[(im$95$m * N[(im$95$m * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
im\_m = \left|im\right|
\\
im\_s = \mathsf{copysign}\left(1, im\right)

\\
im\_s \cdot \left(im\_m \cdot \left(-1 + im\_m \cdot \left(im\_m \cdot -0.16666666666666666\right)\right)\right)
\end{array}
Derivation
  1. Initial program 58.5%

    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
  2. Step-by-step derivation
    1. neg-sub058.5%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
  3. Simplified58.5%

    \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in im around 0 94.3%

    \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
  6. Step-by-step derivation
    1. +-commutative94.3%

      \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.16666666666666666 \cdot \cos re + {im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + -1 \cdot \cos re\right)} \]
    2. +-commutative94.3%

      \[\leadsto im \cdot \left({im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right) + -0.16666666666666666 \cdot \cos re\right)} + -1 \cdot \cos re\right) \]
    3. distribute-rgt-in94.3%

      \[\leadsto im \cdot \left(\color{blue}{\left(\left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right)} + -1 \cdot \cos re\right) \]
    4. *-commutative94.3%

      \[\leadsto im \cdot \left(\left(\color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} + \left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
    5. associate-+l+94.3%

      \[\leadsto im \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(-0.008333333333333333 \cdot \cos re + -0.0001984126984126984 \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(-0.16666666666666666 \cdot \cos re\right) \cdot {im}^{2} + -1 \cdot \cos re\right)\right)} \]
  7. Simplified94.3%

    \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right)} \]
  8. Step-by-step derivation
    1. *-commutative94.3%

      \[\leadsto im \cdot \color{blue}{\left(\left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot \cos re\right)} \]
    2. associate-*r*94.3%

      \[\leadsto \color{blue}{\left(im \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) + \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\right) \cdot \cos re} \]
    3. +-commutative94.3%

      \[\leadsto \left(im \cdot \color{blue}{\left(\left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)}\right) \cdot \cos re \]
    4. +-commutative94.3%

      \[\leadsto \left(im \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + -1\right)} + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \cos re \]
    5. associate-+l+94.3%

      \[\leadsto \left(im \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)}\right) \cdot \cos re \]
    6. *-commutative94.3%

      \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \color{blue}{\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)}\right)\right)\right) \cdot \cos re \]
    7. +-commutative94.3%

      \[\leadsto \left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)}\right)\right)\right) \cdot \cos re \]
  9. Applied egg-rr94.3%

    \[\leadsto \color{blue}{\left(im \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 + \left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right)\right) \cdot \cos re} \]
  10. Taylor expanded in re around 0 60.8%

    \[\leadsto \color{blue}{im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) - 1\right)} \]
  11. Step-by-step derivation
    1. sub-neg60.8%

      \[\leadsto im \cdot \color{blue}{\left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \left(-1\right)\right)} \]
    2. metadata-eval60.8%

      \[\leadsto im \cdot \left(\left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right) + \color{blue}{-1}\right) \]
    3. +-commutative60.8%

      \[\leadsto im \cdot \color{blue}{\left(-1 + \left(-0.16666666666666666 \cdot {im}^{2} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right)} \]
    4. *-commutative60.8%

      \[\leadsto im \cdot \left(-1 + \left(\color{blue}{{im}^{2} \cdot -0.16666666666666666} + {im}^{4} \cdot \left(-0.0001984126984126984 \cdot {im}^{2} - 0.008333333333333333\right)\right)\right) \]
    5. sub-neg60.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \color{blue}{\left(-0.0001984126984126984 \cdot {im}^{2} + \left(-0.008333333333333333\right)\right)}\right)\right) \]
    6. *-commutative60.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{{im}^{2} \cdot -0.0001984126984126984} + \left(-0.008333333333333333\right)\right)\right)\right) \]
    7. unpow260.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.0001984126984126984 + \left(-0.008333333333333333\right)\right)\right)\right) \]
    8. associate-*r*60.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(\color{blue}{im \cdot \left(im \cdot -0.0001984126984126984\right)} + \left(-0.008333333333333333\right)\right)\right)\right) \]
    9. metadata-eval60.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{4} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + \color{blue}{-0.008333333333333333}\right)\right)\right) \]
    10. metadata-eval60.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + {im}^{\color{blue}{\left(2 \cdot 2\right)}} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
    11. pow-sqr60.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
    12. unpow260.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{\left(im \cdot im\right)}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
    13. unpow260.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{\left(im \cdot im\right)} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
    14. unpow260.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{2}} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
    15. unpow260.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right) \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)\right) \]
    16. associate-*r*60.8%

      \[\leadsto im \cdot \left(-1 + \left({im}^{2} \cdot -0.16666666666666666 + \color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right) + -0.008333333333333333\right)\right)}\right)\right) \]
  12. Simplified60.8%

    \[\leadsto \color{blue}{im \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right)\right)\right)\right)} \]
  13. Taylor expanded in im around 0 55.6%

    \[\leadsto im \cdot \left(-1 + \color{blue}{-0.16666666666666666 \cdot {im}^{2}}\right) \]
  14. Step-by-step derivation
    1. *-commutative55.6%

      \[\leadsto im \cdot \left(-1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right) \]
    2. unpow255.6%

      \[\leadsto im \cdot \left(-1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right) \]
    3. associate-*l*55.6%

      \[\leadsto im \cdot \left(-1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right) \]
  15. Simplified55.6%

    \[\leadsto im \cdot \left(-1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right) \]
  16. Add Preprocessing

Alternative 19: 29.7% accurate, 154.5× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \left(-im\_m\right) \end{array} \]
im\_m = (fabs.f64 im)
im\_s = (copysign.f64 #s(literal 1 binary64) im)
(FPCore (im_s re im_m) :precision binary64 (* im_s (- im_m)))
im\_m = fabs(im);
im\_s = copysign(1.0, im);
double code(double im_s, double re, double im_m) {
	return im_s * -im_m;
}
im\_m = abs(im)
im\_s = copysign(1.0d0, im)
real(8) function code(im_s, re, im_m)
    real(8), intent (in) :: im_s
    real(8), intent (in) :: re
    real(8), intent (in) :: im_m
    code = im_s * -im_m
end function
im\_m = Math.abs(im);
im\_s = Math.copySign(1.0, im);
public static double code(double im_s, double re, double im_m) {
	return im_s * -im_m;
}
im\_m = math.fabs(im)
im\_s = math.copysign(1.0, im)
def code(im_s, re, im_m):
	return im_s * -im_m
im\_m = abs(im)
im\_s = copysign(1.0, im)
function code(im_s, re, im_m)
	return Float64(im_s * Float64(-im_m))
end
im\_m = abs(im);
im\_s = sign(im) * abs(1.0);
function tmp = code(im_s, re, im_m)
	tmp = im_s * -im_m;
end
im\_m = N[Abs[im], $MachinePrecision]
im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[im$95$s_, re_, im$95$m_] := N[(im$95$s * (-im$95$m)), $MachinePrecision]
\begin{array}{l}
im\_m = \left|im\right|
\\
im\_s = \mathsf{copysign}\left(1, im\right)

\\
im\_s \cdot \left(-im\_m\right)
\end{array}
Derivation
  1. Initial program 58.5%

    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
  2. Step-by-step derivation
    1. neg-sub058.5%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \left(e^{\color{blue}{-im}} - e^{im}\right) \]
  3. Simplified58.5%

    \[\leadsto \color{blue}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} - e^{im}\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in im around 0 47.5%

    \[\leadsto \color{blue}{-1 \cdot \left(im \cdot \cos re\right)} \]
  6. Step-by-step derivation
    1. mul-1-neg47.5%

      \[\leadsto \color{blue}{-im \cdot \cos re} \]
    2. neg-sub047.5%

      \[\leadsto \color{blue}{0 - im \cdot \cos re} \]
  7. Simplified47.5%

    \[\leadsto \color{blue}{0 - im \cdot \cos re} \]
  8. Taylor expanded in re around 0 26.7%

    \[\leadsto 0 - \color{blue}{im} \]
  9. Final simplification26.7%

    \[\leadsto -im \]
  10. Add Preprocessing

Developer target: 99.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|im\right| < 1:\\ \;\;\;\;-\cos re \cdot \left(\left(im + \left(\left(0.16666666666666666 \cdot im\right) \cdot im\right) \cdot im\right) + \left(\left(\left(\left(0.008333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (< (fabs im) 1.0)
   (-
    (*
     (cos re)
     (+
      (+ im (* (* (* 0.16666666666666666 im) im) im))
      (* (* (* (* (* 0.008333333333333333 im) im) im) im) im))))
   (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im)))))
double code(double re, double im) {
	double tmp;
	if (fabs(im) < 1.0) {
		tmp = -(cos(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
	} else {
		tmp = (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (abs(im) < 1.0d0) then
        tmp = -(cos(re) * ((im + (((0.16666666666666666d0 * im) * im) * im)) + (((((0.008333333333333333d0 * im) * im) * im) * im) * im)))
    else
        tmp = (0.5d0 * cos(re)) * (exp((0.0d0 - im)) - exp(im))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (Math.abs(im) < 1.0) {
		tmp = -(Math.cos(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
	} else {
		tmp = (0.5 * Math.cos(re)) * (Math.exp((0.0 - im)) - Math.exp(im));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if math.fabs(im) < 1.0:
		tmp = -(math.cos(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)))
	else:
		tmp = (0.5 * math.cos(re)) * (math.exp((0.0 - im)) - math.exp(im))
	return tmp
function code(re, im)
	tmp = 0.0
	if (abs(im) < 1.0)
		tmp = Float64(-Float64(cos(re) * Float64(Float64(im + Float64(Float64(Float64(0.16666666666666666 * im) * im) * im)) + Float64(Float64(Float64(Float64(Float64(0.008333333333333333 * im) * im) * im) * im) * im))));
	else
		tmp = Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(0.0 - im)) - exp(im)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (abs(im) < 1.0)
		tmp = -(cos(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
	else
		tmp = (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[Less[N[Abs[im], $MachinePrecision], 1.0], (-N[(N[Cos[re], $MachinePrecision] * N[(N[(im + N[(N[(N[(0.16666666666666666 * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(N[(0.008333333333333333 * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left|im\right| < 1:\\
\;\;\;\;-\cos re \cdot \left(\left(im + \left(\left(0.16666666666666666 \cdot im\right) \cdot im\right) \cdot im\right) + \left(\left(\left(\left(0.008333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right)\\

\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)\\


\end{array}
\end{array}

Reproduce

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

  :alt
  (if (< (fabs im) 1.0) (- (* (cos re) (+ (+ im (* (* (* 0.16666666666666666 im) im) im)) (* (* (* (* (* 0.008333333333333333 im) im) im) im) im)))) (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))

  (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))