math.sin on complex, imaginary part

Percentage Accurate: 54.5% → 99.9%
Time: 15.7s
Alternatives: 28
Speedup: 12.3×

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 28 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: 54.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^{0 - im\_m} - e^{im\_m}\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq -0.2:\\ \;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \frac{1}{\frac{1}{t\_0}}\\ \mathbf{else}:\\ \;\;\;\;\left(im\_m \cdot \cos re\right) \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.008333333333333333\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 (- 0.0 im_m)) (exp im_m))))
   (*
    im_s
    (if (<= t_0 -0.2)
      (* (* 0.5 (cos re)) (/ 1.0 (/ 1.0 t_0)))
      (*
       (* 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) {
	double t_0 = exp((0.0 - im_m)) - exp(im_m);
	double tmp;
	if (t_0 <= -0.2) {
		tmp = (0.5 * cos(re)) * (1.0 / (1.0 / t_0));
	} else {
		tmp = (im_m * cos(re)) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -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((0.0d0 - im_m)) - exp(im_m)
    if (t_0 <= (-0.2d0)) then
        tmp = (0.5d0 * cos(re)) * (1.0d0 / (1.0d0 / t_0))
    else
        tmp = (im_m * cos(re)) * ((-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + ((im_m * im_m) * (-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((0.0 - im_m)) - Math.exp(im_m);
	double tmp;
	if (t_0 <= -0.2) {
		tmp = (0.5 * Math.cos(re)) * (1.0 / (1.0 / t_0));
	} else {
		tmp = (im_m * Math.cos(re)) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -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((0.0 - im_m)) - math.exp(im_m)
	tmp = 0
	if t_0 <= -0.2:
		tmp = (0.5 * math.cos(re)) * (1.0 / (1.0 / t_0))
	else:
		tmp = (im_m * math.cos(re)) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -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(0.0 - im_m)) - exp(im_m))
	tmp = 0.0
	if (t_0 <= -0.2)
		tmp = Float64(Float64(0.5 * cos(re)) * Float64(1.0 / Float64(1.0 / t_0)));
	else
		tmp = Float64(Float64(im_m * cos(re)) * Float64(-1.0 + Float64(Float64(im_m * im_m) * Float64(-0.16666666666666666 + Float64(Float64(im_m * im_m) * -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((0.0 - im_m)) - exp(im_m);
	tmp = 0.0;
	if (t_0 <= -0.2)
		tmp = (0.5 * cos(re)) * (1.0 / (1.0 / t_0));
	else
		tmp = (im_m * cos(re)) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -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[N[(0.0 - im$95$m), $MachinePrecision]], $MachinePrecision] - N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[t$95$0, -0.2], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(im$95$m * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(-0.16666666666666666 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.008333333333333333), $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^{0 - im\_m} - e^{im\_m}\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq -0.2:\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \frac{1}{\frac{1}{t\_0}}\\

\mathbf{else}:\\
\;\;\;\;\left(im\_m \cdot \cos re\right) \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.008333333333333333\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.20000000000000001

    1. Initial program 99.9%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip--N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \left(\frac{e^{0 - im} \cdot e^{0 - im} - e^{im} \cdot e^{im}}{\color{blue}{e^{0 - im} + e^{im}}}\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \left(\frac{1}{\color{blue}{\frac{e^{0 - im} + e^{im}}{e^{0 - im} \cdot e^{0 - im} - e^{im} \cdot e^{im}}}}\right)\right) \]
      3. exp-0N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \left(\frac{e^{0}}{\frac{\color{blue}{e^{0 - im} + e^{im}}}{e^{0 - im} \cdot e^{0 - im} - e^{im} \cdot e^{im}}}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{/.f64}\left(\left(e^{0}\right), \color{blue}{\left(\frac{e^{0 - im} + e^{im}}{e^{0 - im} \cdot e^{0 - im} - e^{im} \cdot e^{im}}\right)}\right)\right) \]
      5. exp-0N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{/.f64}\left(1, \left(\frac{\color{blue}{e^{0 - im} + e^{im}}}{e^{0 - im} \cdot e^{0 - im} - e^{im} \cdot e^{im}}\right)\right)\right) \]
      6. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{/.f64}\left(1, \left(\frac{1}{\color{blue}{\frac{e^{0 - im} \cdot e^{0 - im} - e^{im} \cdot e^{im}}{e^{0 - im} + e^{im}}}}\right)\right)\right) \]
      7. exp-0N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{/.f64}\left(1, \left(\frac{e^{0}}{\frac{\color{blue}{e^{0 - im} \cdot e^{0 - im} - e^{im} \cdot e^{im}}}{e^{0 - im} + e^{im}}}\right)\right)\right) \]
      8. flip--N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{/.f64}\left(1, \left(\frac{e^{0}}{e^{0 - im} - \color{blue}{e^{im}}}\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(e^{0}\right), \color{blue}{\left(e^{0 - im} - e^{im}\right)}\right)\right)\right) \]
      10. exp-0N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \left(\color{blue}{e^{0 - im}} - e^{im}\right)\right)\right)\right) \]
      11. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\left(e^{0 - im}\right), \color{blue}{\left(e^{im}\right)}\right)\right)\right)\right) \]
      12. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(0 - im\right)\right), \left(e^{\color{blue}{im}}\right)\right)\right)\right)\right) \]
      13. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, im\right)\right), \left(e^{im}\right)\right)\right)\right)\right) \]
      14. exp-lowering-exp.f6499.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, im\right)\right), \mathsf{exp.f64}\left(im\right)\right)\right)\right)\right) \]
    4. Applied egg-rr99.9%

      \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\frac{1}{\frac{1}{e^{0 - im} - e^{im}}}} \]

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

    1. Initial program 45.6%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

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

        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right) + \color{blue}{\frac{-1}{6} \cdot \cos re}\right)\right)\right) \]
      4. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re\right)}\right)\right)\right) \]
      5. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\left(\frac{-1}{120} \cdot {im}^{2}\right) \cdot \cos re\right) + {im}^{\color{blue}{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left({im}^{2} \cdot \frac{-1}{6}\right) \cdot \color{blue}{\cos re}\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \cos \color{blue}{re}\right)\right)\right) \]
      9. distribute-rgt-outN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \cos re \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)}\right)\right) \]
      10. distribute-lft-outN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\cos re, \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
      12. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(\color{blue}{-1} + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)\right)\right) \]
    5. Simplified90.5%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot -0.008333333333333333\right)\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left(\frac{-1}{6} + \left(im \cdot im\right) \cdot \frac{-1}{120}\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{6} + \left(im \cdot im\right) \cdot \frac{-1}{120}\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\left(im \cdot im\right) \cdot \frac{-1}{120}\right)\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\frac{-1}{120} \cdot \left(im \cdot im\right)\right)\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
      9. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \color{blue}{\cos re}\right)\right) \]
      12. cos-lowering-cos.f6490.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
    7. Applied egg-rr90.5%

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

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

Alternative 2: 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^{0 - im\_m} - e^{im\_m}\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq -0.2:\\ \;\;\;\;t\_0 \cdot \left(0.5 \cdot \cos re\right)\\ \mathbf{else}:\\ \;\;\;\;\left(im\_m \cdot \cos re\right) \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.008333333333333333\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 (- 0.0 im_m)) (exp im_m))))
   (*
    im_s
    (if (<= t_0 -0.2)
      (* t_0 (* 0.5 (cos re)))
      (*
       (* 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) {
	double t_0 = exp((0.0 - im_m)) - exp(im_m);
	double tmp;
	if (t_0 <= -0.2) {
		tmp = t_0 * (0.5 * cos(re));
	} else {
		tmp = (im_m * cos(re)) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -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((0.0d0 - im_m)) - exp(im_m)
    if (t_0 <= (-0.2d0)) then
        tmp = t_0 * (0.5d0 * cos(re))
    else
        tmp = (im_m * cos(re)) * ((-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + ((im_m * im_m) * (-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((0.0 - im_m)) - Math.exp(im_m);
	double tmp;
	if (t_0 <= -0.2) {
		tmp = t_0 * (0.5 * Math.cos(re));
	} else {
		tmp = (im_m * Math.cos(re)) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -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((0.0 - im_m)) - math.exp(im_m)
	tmp = 0
	if t_0 <= -0.2:
		tmp = t_0 * (0.5 * math.cos(re))
	else:
		tmp = (im_m * math.cos(re)) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -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(0.0 - im_m)) - exp(im_m))
	tmp = 0.0
	if (t_0 <= -0.2)
		tmp = Float64(t_0 * Float64(0.5 * cos(re)));
	else
		tmp = Float64(Float64(im_m * cos(re)) * Float64(-1.0 + Float64(Float64(im_m * im_m) * Float64(-0.16666666666666666 + Float64(Float64(im_m * im_m) * -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((0.0 - im_m)) - exp(im_m);
	tmp = 0.0;
	if (t_0 <= -0.2)
		tmp = t_0 * (0.5 * cos(re));
	else
		tmp = (im_m * cos(re)) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -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[N[(0.0 - im$95$m), $MachinePrecision]], $MachinePrecision] - N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[t$95$0, -0.2], N[(t$95$0 * N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(im$95$m * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(-0.16666666666666666 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.008333333333333333), $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^{0 - im\_m} - e^{im\_m}\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq -0.2:\\
\;\;\;\;t\_0 \cdot \left(0.5 \cdot \cos re\right)\\

\mathbf{else}:\\
\;\;\;\;\left(im\_m \cdot \cos re\right) \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.008333333333333333\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.20000000000000001

    1. Initial program 99.9%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing

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

    1. Initial program 45.6%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

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

        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right) + \color{blue}{\frac{-1}{6} \cdot \cos re}\right)\right)\right) \]
      4. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re\right)}\right)\right)\right) \]
      5. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\left(\frac{-1}{120} \cdot {im}^{2}\right) \cdot \cos re\right) + {im}^{\color{blue}{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left({im}^{2} \cdot \frac{-1}{6}\right) \cdot \color{blue}{\cos re}\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \cos \color{blue}{re}\right)\right)\right) \]
      9. distribute-rgt-outN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \cos re \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)}\right)\right) \]
      10. distribute-lft-outN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\cos re, \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
      12. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(\color{blue}{-1} + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)\right)\right) \]
    5. Simplified90.5%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot -0.008333333333333333\right)\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left(\frac{-1}{6} + \left(im \cdot im\right) \cdot \frac{-1}{120}\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{6} + \left(im \cdot im\right) \cdot \frac{-1}{120}\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\left(im \cdot im\right) \cdot \frac{-1}{120}\right)\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\frac{-1}{120} \cdot \left(im \cdot im\right)\right)\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
      9. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \color{blue}{\cos re}\right)\right) \]
      12. cos-lowering-cos.f6490.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
    7. Applied egg-rr90.5%

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

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

Alternative 3: 98.7% accurate, 1.4× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := -0.16666666666666666 + im\_m \cdot \left(im\_m \cdot \left(-0.008333333333333333 + im\_m \cdot \left(im\_m \cdot -0.0001984126984126984\right)\right)\right)\\ t_1 := im\_m \cdot \left(im\_m \cdot t\_0\right)\\ t_2 := -0.008333333333333333 + \left(im\_m \cdot im\_m\right) \cdot 0.0001984126984126984\\ t_3 := \left(im\_m \cdot im\_m\right) \cdot \left(im\_m \cdot im\_m\right)\\ t_4 := 1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + -0.16666666666666666 \cdot \left(im\_m \cdot \left(im\_m \cdot -0.16666666666666666\right)\right)\right)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 1:\\ \;\;\;\;\left(im\_m \cdot \cos re\right) \cdot \frac{-1 + t\_1 \cdot \left(t\_3 \cdot \left(t\_0 \cdot t\_0\right)\right)}{1 + t\_1 \cdot \left(t\_1 - -1\right)}\\ \mathbf{elif}\;im\_m \leq 2.5 \cdot 10^{+24}:\\ \;\;\;\;e^{im\_m} \cdot -0.5 + \frac{0.5}{e^{im\_m}}\\ \mathbf{elif}\;im\_m \leq 4.6 \cdot 10^{+44}:\\ \;\;\;\;\frac{im\_m \cdot \left(\cos re \cdot \left(\left(-1 + t\_3 \cdot \left(\left(im\_m \cdot im\_m\right) \cdot -0.004629629629629629\right)\right) \cdot t\_2 + t\_3 \cdot \left(t\_4 \cdot \left(6.944444444444444 \cdot 10^{-5} + t\_3 \cdot -3.936759889140842 \cdot 10^{-8}\right)\right)\right)\right)}{t\_2 \cdot t\_4}\\ \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} \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
         (+
          -0.16666666666666666
          (*
           im_m
           (*
            im_m
            (+
             -0.008333333333333333
             (* im_m (* im_m -0.0001984126984126984)))))))
        (t_1 (* im_m (* im_m t_0)))
        (t_2 (+ -0.008333333333333333 (* (* im_m im_m) 0.0001984126984126984)))
        (t_3 (* (* im_m im_m) (* im_m im_m)))
        (t_4
         (+
          1.0
          (*
           (* im_m im_m)
           (+
            -0.16666666666666666
            (*
             -0.16666666666666666
             (* im_m (* im_m -0.16666666666666666))))))))
   (*
    im_s
    (if (<= im_m 1.0)
      (*
       (* im_m (cos re))
       (/ (+ -1.0 (* t_1 (* t_3 (* t_0 t_0)))) (+ 1.0 (* t_1 (- t_1 -1.0)))))
      (if (<= im_m 2.5e+24)
        (+ (* (exp im_m) -0.5) (/ 0.5 (exp im_m)))
        (if (<= im_m 4.6e+44)
          (/
           (*
            im_m
            (*
             (cos re)
             (+
              (* (+ -1.0 (* t_3 (* (* im_m im_m) -0.004629629629629629))) t_2)
              (*
               t_3
               (*
                t_4
                (+ 6.944444444444444e-5 (* t_3 -3.936759889140842e-8)))))))
           (* t_2 t_4))
          (*
           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 t_0 = -0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + (im_m * (im_m * -0.0001984126984126984)))));
	double t_1 = im_m * (im_m * t_0);
	double t_2 = -0.008333333333333333 + ((im_m * im_m) * 0.0001984126984126984);
	double t_3 = (im_m * im_m) * (im_m * im_m);
	double t_4 = 1.0 + ((im_m * im_m) * (-0.16666666666666666 + (-0.16666666666666666 * (im_m * (im_m * -0.16666666666666666)))));
	double tmp;
	if (im_m <= 1.0) {
		tmp = (im_m * cos(re)) * ((-1.0 + (t_1 * (t_3 * (t_0 * t_0)))) / (1.0 + (t_1 * (t_1 - -1.0))));
	} else if (im_m <= 2.5e+24) {
		tmp = (exp(im_m) * -0.5) + (0.5 / exp(im_m));
	} else if (im_m <= 4.6e+44) {
		tmp = (im_m * (cos(re) * (((-1.0 + (t_3 * ((im_m * im_m) * -0.004629629629629629))) * t_2) + (t_3 * (t_4 * (6.944444444444444e-5 + (t_3 * -3.936759889140842e-8))))))) / (t_2 * t_4);
	} 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) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_0 = (-0.16666666666666666d0) + (im_m * (im_m * ((-0.008333333333333333d0) + (im_m * (im_m * (-0.0001984126984126984d0))))))
    t_1 = im_m * (im_m * t_0)
    t_2 = (-0.008333333333333333d0) + ((im_m * im_m) * 0.0001984126984126984d0)
    t_3 = (im_m * im_m) * (im_m * im_m)
    t_4 = 1.0d0 + ((im_m * im_m) * ((-0.16666666666666666d0) + ((-0.16666666666666666d0) * (im_m * (im_m * (-0.16666666666666666d0))))))
    if (im_m <= 1.0d0) then
        tmp = (im_m * cos(re)) * (((-1.0d0) + (t_1 * (t_3 * (t_0 * t_0)))) / (1.0d0 + (t_1 * (t_1 - (-1.0d0)))))
    else if (im_m <= 2.5d+24) then
        tmp = (exp(im_m) * (-0.5d0)) + (0.5d0 / exp(im_m))
    else if (im_m <= 4.6d+44) then
        tmp = (im_m * (cos(re) * ((((-1.0d0) + (t_3 * ((im_m * im_m) * (-0.004629629629629629d0)))) * t_2) + (t_3 * (t_4 * (6.944444444444444d-5 + (t_3 * (-3.936759889140842d-8)))))))) / (t_2 * t_4)
    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 t_0 = -0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + (im_m * (im_m * -0.0001984126984126984)))));
	double t_1 = im_m * (im_m * t_0);
	double t_2 = -0.008333333333333333 + ((im_m * im_m) * 0.0001984126984126984);
	double t_3 = (im_m * im_m) * (im_m * im_m);
	double t_4 = 1.0 + ((im_m * im_m) * (-0.16666666666666666 + (-0.16666666666666666 * (im_m * (im_m * -0.16666666666666666)))));
	double tmp;
	if (im_m <= 1.0) {
		tmp = (im_m * Math.cos(re)) * ((-1.0 + (t_1 * (t_3 * (t_0 * t_0)))) / (1.0 + (t_1 * (t_1 - -1.0))));
	} else if (im_m <= 2.5e+24) {
		tmp = (Math.exp(im_m) * -0.5) + (0.5 / Math.exp(im_m));
	} else if (im_m <= 4.6e+44) {
		tmp = (im_m * (Math.cos(re) * (((-1.0 + (t_3 * ((im_m * im_m) * -0.004629629629629629))) * t_2) + (t_3 * (t_4 * (6.944444444444444e-5 + (t_3 * -3.936759889140842e-8))))))) / (t_2 * t_4);
	} 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):
	t_0 = -0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + (im_m * (im_m * -0.0001984126984126984)))))
	t_1 = im_m * (im_m * t_0)
	t_2 = -0.008333333333333333 + ((im_m * im_m) * 0.0001984126984126984)
	t_3 = (im_m * im_m) * (im_m * im_m)
	t_4 = 1.0 + ((im_m * im_m) * (-0.16666666666666666 + (-0.16666666666666666 * (im_m * (im_m * -0.16666666666666666)))))
	tmp = 0
	if im_m <= 1.0:
		tmp = (im_m * math.cos(re)) * ((-1.0 + (t_1 * (t_3 * (t_0 * t_0)))) / (1.0 + (t_1 * (t_1 - -1.0))))
	elif im_m <= 2.5e+24:
		tmp = (math.exp(im_m) * -0.5) + (0.5 / math.exp(im_m))
	elif im_m <= 4.6e+44:
		tmp = (im_m * (math.cos(re) * (((-1.0 + (t_3 * ((im_m * im_m) * -0.004629629629629629))) * t_2) + (t_3 * (t_4 * (6.944444444444444e-5 + (t_3 * -3.936759889140842e-8))))))) / (t_2 * t_4)
	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)
	t_0 = Float64(-0.16666666666666666 + Float64(im_m * Float64(im_m * Float64(-0.008333333333333333 + Float64(im_m * Float64(im_m * -0.0001984126984126984))))))
	t_1 = Float64(im_m * Float64(im_m * t_0))
	t_2 = Float64(-0.008333333333333333 + Float64(Float64(im_m * im_m) * 0.0001984126984126984))
	t_3 = Float64(Float64(im_m * im_m) * Float64(im_m * im_m))
	t_4 = Float64(1.0 + Float64(Float64(im_m * im_m) * Float64(-0.16666666666666666 + Float64(-0.16666666666666666 * Float64(im_m * Float64(im_m * -0.16666666666666666))))))
	tmp = 0.0
	if (im_m <= 1.0)
		tmp = Float64(Float64(im_m * cos(re)) * Float64(Float64(-1.0 + Float64(t_1 * Float64(t_3 * Float64(t_0 * t_0)))) / Float64(1.0 + Float64(t_1 * Float64(t_1 - -1.0)))));
	elseif (im_m <= 2.5e+24)
		tmp = Float64(Float64(exp(im_m) * -0.5) + Float64(0.5 / exp(im_m)));
	elseif (im_m <= 4.6e+44)
		tmp = Float64(Float64(im_m * Float64(cos(re) * Float64(Float64(Float64(-1.0 + Float64(t_3 * Float64(Float64(im_m * im_m) * -0.004629629629629629))) * t_2) + Float64(t_3 * Float64(t_4 * Float64(6.944444444444444e-5 + Float64(t_3 * -3.936759889140842e-8))))))) / Float64(t_2 * t_4));
	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)
	t_0 = -0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + (im_m * (im_m * -0.0001984126984126984)))));
	t_1 = im_m * (im_m * t_0);
	t_2 = -0.008333333333333333 + ((im_m * im_m) * 0.0001984126984126984);
	t_3 = (im_m * im_m) * (im_m * im_m);
	t_4 = 1.0 + ((im_m * im_m) * (-0.16666666666666666 + (-0.16666666666666666 * (im_m * (im_m * -0.16666666666666666)))));
	tmp = 0.0;
	if (im_m <= 1.0)
		tmp = (im_m * cos(re)) * ((-1.0 + (t_1 * (t_3 * (t_0 * t_0)))) / (1.0 + (t_1 * (t_1 - -1.0))));
	elseif (im_m <= 2.5e+24)
		tmp = (exp(im_m) * -0.5) + (0.5 / exp(im_m));
	elseif (im_m <= 4.6e+44)
		tmp = (im_m * (cos(re) * (((-1.0 + (t_3 * ((im_m * im_m) * -0.004629629629629629))) * t_2) + (t_3 * (t_4 * (6.944444444444444e-5 + (t_3 * -3.936759889140842e-8))))))) / (t_2 * t_4);
	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_] := Block[{t$95$0 = N[(-0.16666666666666666 + N[(im$95$m * N[(im$95$m * N[(-0.008333333333333333 + N[(im$95$m * N[(im$95$m * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(im$95$m * N[(im$95$m * t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-0.008333333333333333 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * 0.0001984126984126984), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(-0.16666666666666666 + N[(-0.16666666666666666 * N[(im$95$m * N[(im$95$m * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[im$95$m, 1.0], N[(N[(im$95$m * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[(-1.0 + N[(t$95$1 * N[(t$95$3 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(t$95$1 * N[(t$95$1 - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 2.5e+24], N[(N[(N[Exp[im$95$m], $MachinePrecision] * -0.5), $MachinePrecision] + N[(0.5 / N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 4.6e+44], N[(N[(im$95$m * N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(-1.0 + N[(t$95$3 * N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.004629629629629629), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] + N[(t$95$3 * N[(t$95$4 * N[(6.944444444444444e-5 + N[(t$95$3 * -3.936759889140842e-8), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$2 * t$95$4), $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)

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

\mathbf{elif}\;im\_m \leq 2.5 \cdot 10^{+24}:\\
\;\;\;\;e^{im\_m} \cdot -0.5 + \frac{0.5}{e^{im\_m}}\\

\mathbf{elif}\;im\_m \leq 4.6 \cdot 10^{+44}:\\
\;\;\;\;\frac{im\_m \cdot \left(\cos re \cdot \left(\left(-1 + t\_3 \cdot \left(\left(im\_m \cdot im\_m\right) \cdot -0.004629629629629629\right)\right) \cdot t\_2 + t\_3 \cdot \left(t\_4 \cdot \left(6.944444444444444 \cdot 10^{-5} + t\_3 \cdot -3.936759889140842 \cdot 10^{-8}\right)\right)\right)\right)}{t\_2 \cdot t\_4}\\

\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}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < 1

    1. Initial program 46.4%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
      2. distribute-rgt-inN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
      3. associate-+r+N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
    5. Simplified92.8%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + -0.16666666666666666 \cdot \left(im \cdot im\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(im \cdot \cos re\right) \cdot \color{blue}{\left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)\right)} \]
      2. *-commutativeN/A

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

        \[\leadsto \mathsf{*.f64}\left(\left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)\right), \color{blue}{\left(im \cdot \cos re\right)}\right) \]
    7. Applied egg-rr92.8%

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

      \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) - 1\right)}, \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
    9. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + \left(\mathsf{neg}\left(1\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + -1\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\left(-1 + {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left({im}^{2}\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \frac{-1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{6} + {im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\left(im \cdot im\right) \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      13. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(im \cdot \left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \left(\mathsf{neg}\left(\frac{1}{120}\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      17. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \frac{-1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      18. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{120} + \frac{-1}{5040} \cdot {im}^{2}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      19. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \left(\frac{-1}{5040} \cdot {im}^{2}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      20. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \left({im}^{2} \cdot \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      21. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left({im}^{2}\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      22. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      23. *-lowering-*.f6492.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
    10. Simplified92.8%

      \[\leadsto \color{blue}{\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)} \cdot \left(im \cdot \cos re\right) \]
    11. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{{-1}^{3} + {\left(\left(im \cdot im\right) \cdot \left(\frac{-1}{6} + im \cdot \left(im \cdot \left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right)\right)\right)\right)}^{3}}{-1 \cdot -1 + \left(\left(\left(im \cdot im\right) \cdot \left(\frac{-1}{6} + im \cdot \left(im \cdot \left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right)\right)\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(\frac{-1}{6} + im \cdot \left(im \cdot \left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right)\right)\right)\right) - -1 \cdot \left(\left(im \cdot im\right) \cdot \left(\frac{-1}{6} + im \cdot \left(im \cdot \left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right)\right)\right)\right)\right)}\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left({-1}^{3} + {\left(\left(im \cdot im\right) \cdot \left(\frac{-1}{6} + im \cdot \left(im \cdot \left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right)\right)\right)\right)}^{3}\right), \left(-1 \cdot -1 + \left(\left(\left(im \cdot im\right) \cdot \left(\frac{-1}{6} + im \cdot \left(im \cdot \left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right)\right)\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(\frac{-1}{6} + im \cdot \left(im \cdot \left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right)\right)\right)\right) - -1 \cdot \left(\left(im \cdot im\right) \cdot \left(\frac{-1}{6} + im \cdot \left(im \cdot \left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
    12. Applied egg-rr61.6%

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

    if 1 < im < 2.50000000000000023e24

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
    4. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} + \color{blue}{\left(\mathsf{neg}\left(e^{im}\right)\right)}\right) \]
      2. +-commutativeN/A

        \[\leadsto \frac{1}{2} \cdot \left(\left(\mathsf{neg}\left(e^{im}\right)\right) + \color{blue}{e^{\mathsf{neg}\left(im\right)}}\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \left(\mathsf{neg}\left(e^{im}\right)\right) \cdot \frac{1}{2} + \color{blue}{e^{\mathsf{neg}\left(im\right)} \cdot \frac{1}{2}} \]
      4. *-commutativeN/A

        \[\leadsto \frac{1}{2} \cdot \left(\mathsf{neg}\left(e^{im}\right)\right) + \color{blue}{e^{\mathsf{neg}\left(im\right)}} \cdot \frac{1}{2} \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1}{2} \cdot \left(\mathsf{neg}\left(e^{im}\right)\right)\right), \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} \cdot \frac{1}{2}\right)}\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\mathsf{neg}\left(e^{im}\right)\right) \cdot \frac{1}{2}\right), \left(\color{blue}{e^{\mathsf{neg}\left(im\right)}} \cdot \frac{1}{2}\right)\right) \]
      7. distribute-lft-neg-outN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(e^{im} \cdot \frac{1}{2}\right)\right), \left(\color{blue}{e^{\mathsf{neg}\left(im\right)}} \cdot \frac{1}{2}\right)\right) \]
      8. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{+.f64}\left(\left(e^{im} \cdot \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right), \left(\color{blue}{e^{\mathsf{neg}\left(im\right)}} \cdot \frac{1}{2}\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(e^{im} \cdot \frac{-1}{2}\right), \left(e^{\mathsf{neg}\left(im\right)} \cdot \frac{1}{2}\right)\right) \]
      10. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{exp.f64}\left(im\right), \frac{-1}{2}\right), \left(e^{\color{blue}{\mathsf{neg}\left(im\right)}} \cdot \frac{1}{2}\right)\right) \]
      12. exp-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{exp.f64}\left(im\right), \frac{-1}{2}\right), \left(\frac{1}{e^{im}} \cdot \frac{1}{2}\right)\right) \]
      13. associate-*l/N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{exp.f64}\left(im\right), \frac{-1}{2}\right), \left(\frac{1 \cdot \frac{1}{2}}{\color{blue}{e^{im}}}\right)\right) \]
      14. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{exp.f64}\left(im\right), \frac{-1}{2}\right), \left(\frac{\frac{1}{2}}{e^{\color{blue}{im}}}\right)\right) \]
      15. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{exp.f64}\left(im\right), \frac{-1}{2}\right), \mathsf{/.f64}\left(\frac{1}{2}, \color{blue}{\left(e^{im}\right)}\right)\right) \]
      16. exp-lowering-exp.f64100.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{exp.f64}\left(im\right), \frac{-1}{2}\right), \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{exp.f64}\left(im\right)\right)\right) \]
    5. Simplified100.0%

      \[\leadsto \color{blue}{e^{im} \cdot -0.5 + \frac{0.5}{e^{im}}} \]

    if 2.50000000000000023e24 < im < 4.60000000000000009e44

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
      2. distribute-rgt-inN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
      3. associate-+r+N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
    5. Simplified7.0%

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

      \[\leadsto im \cdot \left(\cos re \cdot \color{blue}{\frac{\left(-1 + \left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.004629629629629629\right)\right) \cdot \left(-0.008333333333333333 - \left(im \cdot im\right) \cdot -0.0001984126984126984\right) + \left(1 + \left(\left(im \cdot im\right) \cdot -0.16666666666666666\right) \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 - -1\right)\right) \cdot \left(\left(6.944444444444444 \cdot 10^{-5} - \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot 3.936759889140842 \cdot 10^{-8}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)}{\left(1 + \left(\left(im \cdot im\right) \cdot -0.16666666666666666\right) \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 - -1\right)\right) \cdot \left(-0.008333333333333333 - \left(im \cdot im\right) \cdot -0.0001984126984126984\right)}}\right) \]
    7. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\left(\cos re \cdot \left(\left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(\left(im \cdot im\right) \cdot -0.004629629629629629\right)\right) \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot 0.0001984126984126984\right) + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(\left(1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 \cdot \left(im \cdot \left(im \cdot -0.16666666666666666\right)\right) + -0.16666666666666666\right)\right) \cdot \left(6.944444444444444 \cdot 10^{-5} + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot -3.936759889140842 \cdot 10^{-8}\right)\right)\right)\right) \cdot im}{\left(-0.008333333333333333 + \left(im \cdot im\right) \cdot 0.0001984126984126984\right) \cdot \left(1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 \cdot \left(im \cdot \left(im \cdot -0.16666666666666666\right)\right) + -0.16666666666666666\right)\right)}} \]

    if 4.60000000000000009e44 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
      2. distribute-rgt-inN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
      3. associate-+r+N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
    5. Simplified100.0%

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

      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) - 1\right)}\right)\right) \]
    7. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + -1\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(-1 + \color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)}\right)\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)}\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)}\right)\right)\right)\right) \]
      6. unpow2N/A

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

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{{im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)} - \frac{1}{6}\right)\right)\right)\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}\right)\right)\right)\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \frac{-1}{6}\right)\right)\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{6} + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)}\right)\right)\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\left(im \cdot im\right) \cdot \left(\color{blue}{\frac{-1}{5040} \cdot {im}^{2}} - \frac{1}{120}\right)\right)\right)\right)\right)\right)\right) \]
      13. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(im \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \color{blue}{\left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)}\right)\right)\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{120}\right)\right)}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \frac{-1}{120}\right)\right)\right)\right)\right)\right)\right)\right) \]
      18. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{120} + \color{blue}{\frac{-1}{5040} \cdot {im}^{2}}\right)\right)\right)\right)\right)\right)\right)\right) \]
      19. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \color{blue}{\left(\frac{-1}{5040} \cdot {im}^{2}\right)}\right)\right)\right)\right)\right)\right)\right)\right) \]
      20. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \left({im}^{2} \cdot \color{blue}{\frac{-1}{5040}}\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
      21. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\frac{-1}{5040}}\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
      22. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
      23. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
    8. Simplified100.0%

      \[\leadsto im \cdot \left(\cos re \cdot \color{blue}{\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 4 regimes into one program.
  4. Final simplification70.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 1:\\ \;\;\;\;\left(im \cdot \cos re\right) \cdot \frac{-1 + \left(im \cdot \left(im \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)\right)\right)\right)\right) \cdot \left(\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(\left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)\right)\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)\right)\right)\right)\right)}{1 + \left(im \cdot \left(im \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)\right)\right)\right)\right) \cdot \left(im \cdot \left(im \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)\right)\right)\right) - -1\right)}\\ \mathbf{elif}\;im \leq 2.5 \cdot 10^{+24}:\\ \;\;\;\;e^{im} \cdot -0.5 + \frac{0.5}{e^{im}}\\ \mathbf{elif}\;im \leq 4.6 \cdot 10^{+44}:\\ \;\;\;\;\frac{im \cdot \left(\cos re \cdot \left(\left(-1 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(\left(im \cdot im\right) \cdot -0.004629629629629629\right)\right) \cdot \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot 0.0001984126984126984\right) + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(\left(1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + -0.16666666666666666 \cdot \left(im \cdot \left(im \cdot -0.16666666666666666\right)\right)\right)\right) \cdot \left(6.944444444444444 \cdot 10^{-5} + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot -3.936759889140842 \cdot 10^{-8}\right)\right)\right)\right)}{\left(-0.008333333333333333 + \left(im \cdot im\right) \cdot 0.0001984126984126984\right) \cdot \left(1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + -0.16666666666666666 \cdot \left(im \cdot \left(im \cdot -0.16666666666666666\right)\right)\right)\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 4: 96.3% accurate, 1.5× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := -0.16666666666666666 + im\_m \cdot \left(im\_m \cdot \left(-0.008333333333333333 + im\_m \cdot \left(im\_m \cdot -0.0001984126984126984\right)\right)\right)\\ t_1 := \left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666 - -1\\ t_2 := im\_m \cdot \left(im\_m \cdot \left(im\_m \cdot im\_m\right)\right)\\ t_3 := im\_m \cdot \left(im\_m \cdot t\_0\right)\\ t_4 := -0.008333333333333333 - \left(im\_m \cdot im\_m\right) \cdot -0.0001984126984126984\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 2.05 \cdot 10^{+26}:\\ \;\;\;\;\left(im\_m \cdot \cos re\right) \cdot \frac{-1 + t\_3 \cdot \left(\left(\left(im\_m \cdot im\_m\right) \cdot \left(im\_m \cdot im\_m\right)\right) \cdot \left(t\_0 \cdot t\_0\right)\right)}{1 + t\_3 \cdot \left(t\_3 - -1\right)}\\ \mathbf{elif}\;im\_m \leq 1.3 \cdot 10^{+62}:\\ \;\;\;\;im\_m \cdot \left(\cos re \cdot \frac{\left(-1 + t\_2 \cdot 0.027777777777777776\right) \cdot t\_4 + t\_1 \cdot \left(t\_2 \cdot \left(6.944444444444444 \cdot 10^{-5} - t\_2 \cdot 3.936759889140842 \cdot 10^{-8}\right)\right)}{t\_4 \cdot t\_1}\right)\\ \mathbf{else}:\\ \;\;\;\;im\_m \cdot \left(\cos re \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.008333333333333333\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
         (+
          -0.16666666666666666
          (*
           im_m
           (*
            im_m
            (+
             -0.008333333333333333
             (* im_m (* im_m -0.0001984126984126984)))))))
        (t_1 (- (* (* im_m im_m) -0.16666666666666666) -1.0))
        (t_2 (* im_m (* im_m (* im_m im_m))))
        (t_3 (* im_m (* im_m t_0)))
        (t_4
         (- -0.008333333333333333 (* (* im_m im_m) -0.0001984126984126984))))
   (*
    im_s
    (if (<= im_m 2.05e+26)
      (*
       (* im_m (cos re))
       (/
        (+ -1.0 (* t_3 (* (* (* im_m im_m) (* im_m im_m)) (* t_0 t_0))))
        (+ 1.0 (* t_3 (- t_3 -1.0)))))
      (if (<= im_m 1.3e+62)
        (*
         im_m
         (*
          (cos re)
          (/
           (+
            (* (+ -1.0 (* t_2 0.027777777777777776)) t_4)
            (*
             t_1
             (* t_2 (- 6.944444444444444e-5 (* t_2 3.936759889140842e-8)))))
           (* t_4 t_1))))
        (*
         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) {
	double t_0 = -0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + (im_m * (im_m * -0.0001984126984126984)))));
	double t_1 = ((im_m * im_m) * -0.16666666666666666) - -1.0;
	double t_2 = im_m * (im_m * (im_m * im_m));
	double t_3 = im_m * (im_m * t_0);
	double t_4 = -0.008333333333333333 - ((im_m * im_m) * -0.0001984126984126984);
	double tmp;
	if (im_m <= 2.05e+26) {
		tmp = (im_m * cos(re)) * ((-1.0 + (t_3 * (((im_m * im_m) * (im_m * im_m)) * (t_0 * t_0)))) / (1.0 + (t_3 * (t_3 - -1.0))));
	} else if (im_m <= 1.3e+62) {
		tmp = im_m * (cos(re) * ((((-1.0 + (t_2 * 0.027777777777777776)) * t_4) + (t_1 * (t_2 * (6.944444444444444e-5 - (t_2 * 3.936759889140842e-8))))) / (t_4 * t_1)));
	} else {
		tmp = im_m * (cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -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) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_0 = (-0.16666666666666666d0) + (im_m * (im_m * ((-0.008333333333333333d0) + (im_m * (im_m * (-0.0001984126984126984d0))))))
    t_1 = ((im_m * im_m) * (-0.16666666666666666d0)) - (-1.0d0)
    t_2 = im_m * (im_m * (im_m * im_m))
    t_3 = im_m * (im_m * t_0)
    t_4 = (-0.008333333333333333d0) - ((im_m * im_m) * (-0.0001984126984126984d0))
    if (im_m <= 2.05d+26) then
        tmp = (im_m * cos(re)) * (((-1.0d0) + (t_3 * (((im_m * im_m) * (im_m * im_m)) * (t_0 * t_0)))) / (1.0d0 + (t_3 * (t_3 - (-1.0d0)))))
    else if (im_m <= 1.3d+62) then
        tmp = im_m * (cos(re) * (((((-1.0d0) + (t_2 * 0.027777777777777776d0)) * t_4) + (t_1 * (t_2 * (6.944444444444444d-5 - (t_2 * 3.936759889140842d-8))))) / (t_4 * t_1)))
    else
        tmp = im_m * (cos(re) * ((-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + ((im_m * im_m) * (-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 = -0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + (im_m * (im_m * -0.0001984126984126984)))));
	double t_1 = ((im_m * im_m) * -0.16666666666666666) - -1.0;
	double t_2 = im_m * (im_m * (im_m * im_m));
	double t_3 = im_m * (im_m * t_0);
	double t_4 = -0.008333333333333333 - ((im_m * im_m) * -0.0001984126984126984);
	double tmp;
	if (im_m <= 2.05e+26) {
		tmp = (im_m * Math.cos(re)) * ((-1.0 + (t_3 * (((im_m * im_m) * (im_m * im_m)) * (t_0 * t_0)))) / (1.0 + (t_3 * (t_3 - -1.0))));
	} else if (im_m <= 1.3e+62) {
		tmp = im_m * (Math.cos(re) * ((((-1.0 + (t_2 * 0.027777777777777776)) * t_4) + (t_1 * (t_2 * (6.944444444444444e-5 - (t_2 * 3.936759889140842e-8))))) / (t_4 * t_1)));
	} else {
		tmp = im_m * (Math.cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -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 = -0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + (im_m * (im_m * -0.0001984126984126984)))))
	t_1 = ((im_m * im_m) * -0.16666666666666666) - -1.0
	t_2 = im_m * (im_m * (im_m * im_m))
	t_3 = im_m * (im_m * t_0)
	t_4 = -0.008333333333333333 - ((im_m * im_m) * -0.0001984126984126984)
	tmp = 0
	if im_m <= 2.05e+26:
		tmp = (im_m * math.cos(re)) * ((-1.0 + (t_3 * (((im_m * im_m) * (im_m * im_m)) * (t_0 * t_0)))) / (1.0 + (t_3 * (t_3 - -1.0))))
	elif im_m <= 1.3e+62:
		tmp = im_m * (math.cos(re) * ((((-1.0 + (t_2 * 0.027777777777777776)) * t_4) + (t_1 * (t_2 * (6.944444444444444e-5 - (t_2 * 3.936759889140842e-8))))) / (t_4 * t_1)))
	else:
		tmp = im_m * (math.cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -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(-0.16666666666666666 + Float64(im_m * Float64(im_m * Float64(-0.008333333333333333 + Float64(im_m * Float64(im_m * -0.0001984126984126984))))))
	t_1 = Float64(Float64(Float64(im_m * im_m) * -0.16666666666666666) - -1.0)
	t_2 = Float64(im_m * Float64(im_m * Float64(im_m * im_m)))
	t_3 = Float64(im_m * Float64(im_m * t_0))
	t_4 = Float64(-0.008333333333333333 - Float64(Float64(im_m * im_m) * -0.0001984126984126984))
	tmp = 0.0
	if (im_m <= 2.05e+26)
		tmp = Float64(Float64(im_m * cos(re)) * Float64(Float64(-1.0 + Float64(t_3 * Float64(Float64(Float64(im_m * im_m) * Float64(im_m * im_m)) * Float64(t_0 * t_0)))) / Float64(1.0 + Float64(t_3 * Float64(t_3 - -1.0)))));
	elseif (im_m <= 1.3e+62)
		tmp = Float64(im_m * Float64(cos(re) * Float64(Float64(Float64(Float64(-1.0 + Float64(t_2 * 0.027777777777777776)) * t_4) + Float64(t_1 * Float64(t_2 * Float64(6.944444444444444e-5 - Float64(t_2 * 3.936759889140842e-8))))) / Float64(t_4 * t_1))));
	else
		tmp = Float64(im_m * Float64(cos(re) * Float64(-1.0 + Float64(Float64(im_m * im_m) * Float64(-0.16666666666666666 + Float64(Float64(im_m * im_m) * -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 = -0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + (im_m * (im_m * -0.0001984126984126984)))));
	t_1 = ((im_m * im_m) * -0.16666666666666666) - -1.0;
	t_2 = im_m * (im_m * (im_m * im_m));
	t_3 = im_m * (im_m * t_0);
	t_4 = -0.008333333333333333 - ((im_m * im_m) * -0.0001984126984126984);
	tmp = 0.0;
	if (im_m <= 2.05e+26)
		tmp = (im_m * cos(re)) * ((-1.0 + (t_3 * (((im_m * im_m) * (im_m * im_m)) * (t_0 * t_0)))) / (1.0 + (t_3 * (t_3 - -1.0))));
	elseif (im_m <= 1.3e+62)
		tmp = im_m * (cos(re) * ((((-1.0 + (t_2 * 0.027777777777777776)) * t_4) + (t_1 * (t_2 * (6.944444444444444e-5 - (t_2 * 3.936759889140842e-8))))) / (t_4 * t_1)));
	else
		tmp = im_m * (cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -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[(-0.16666666666666666 + N[(im$95$m * N[(im$95$m * N[(-0.008333333333333333 + N[(im$95$m * N[(im$95$m * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - -1.0), $MachinePrecision]}, Block[{t$95$2 = N[(im$95$m * N[(im$95$m * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(im$95$m * N[(im$95$m * t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(-0.008333333333333333 - N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[im$95$m, 2.05e+26], N[(N[(im$95$m * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[(-1.0 + N[(t$95$3 * N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(t$95$3 * N[(t$95$3 - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 1.3e+62], N[(im$95$m * N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(N[(-1.0 + N[(t$95$2 * 0.027777777777777776), $MachinePrecision]), $MachinePrecision] * t$95$4), $MachinePrecision] + N[(t$95$1 * N[(t$95$2 * N[(6.944444444444444e-5 - N[(t$95$2 * 3.936759889140842e-8), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$4 * t$95$1), $MachinePrecision]), $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[(N[(im$95$m * im$95$m), $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 := -0.16666666666666666 + im\_m \cdot \left(im\_m \cdot \left(-0.008333333333333333 + im\_m \cdot \left(im\_m \cdot -0.0001984126984126984\right)\right)\right)\\
t_1 := \left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666 - -1\\
t_2 := im\_m \cdot \left(im\_m \cdot \left(im\_m \cdot im\_m\right)\right)\\
t_3 := im\_m \cdot \left(im\_m \cdot t\_0\right)\\
t_4 := -0.008333333333333333 - \left(im\_m \cdot im\_m\right) \cdot -0.0001984126984126984\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;im\_m \leq 2.05 \cdot 10^{+26}:\\
\;\;\;\;\left(im\_m \cdot \cos re\right) \cdot \frac{-1 + t\_3 \cdot \left(\left(\left(im\_m \cdot im\_m\right) \cdot \left(im\_m \cdot im\_m\right)\right) \cdot \left(t\_0 \cdot t\_0\right)\right)}{1 + t\_3 \cdot \left(t\_3 - -1\right)}\\

\mathbf{elif}\;im\_m \leq 1.3 \cdot 10^{+62}:\\
\;\;\;\;im\_m \cdot \left(\cos re \cdot \frac{\left(-1 + t\_2 \cdot 0.027777777777777776\right) \cdot t\_4 + t\_1 \cdot \left(t\_2 \cdot \left(6.944444444444444 \cdot 10^{-5} - t\_2 \cdot 3.936759889140842 \cdot 10^{-8}\right)\right)}{t\_4 \cdot t\_1}\right)\\

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


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

    1. Initial program 48.8%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
      2. distribute-rgt-inN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
      3. associate-+r+N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
    5. Simplified88.9%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + -0.16666666666666666 \cdot \left(im \cdot im\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(im \cdot \cos re\right) \cdot \color{blue}{\left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)\right)} \]
      2. *-commutativeN/A

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

        \[\leadsto \mathsf{*.f64}\left(\left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)\right), \color{blue}{\left(im \cdot \cos re\right)}\right) \]
    7. Applied egg-rr88.9%

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

      \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) - 1\right)}, \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
    9. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + \left(\mathsf{neg}\left(1\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + -1\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\left(-1 + {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left({im}^{2}\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \frac{-1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{6} + {im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\left(im \cdot im\right) \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      13. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(im \cdot \left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \left(\mathsf{neg}\left(\frac{1}{120}\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      17. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \frac{-1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      18. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{120} + \frac{-1}{5040} \cdot {im}^{2}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      19. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \left(\frac{-1}{5040} \cdot {im}^{2}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      20. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \left({im}^{2} \cdot \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      21. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left({im}^{2}\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      22. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      23. *-lowering-*.f6488.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
    10. Simplified88.9%

      \[\leadsto \color{blue}{\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)} \cdot \left(im \cdot \cos re\right) \]
    11. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{{-1}^{3} + {\left(\left(im \cdot im\right) \cdot \left(\frac{-1}{6} + im \cdot \left(im \cdot \left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right)\right)\right)\right)}^{3}}{-1 \cdot -1 + \left(\left(\left(im \cdot im\right) \cdot \left(\frac{-1}{6} + im \cdot \left(im \cdot \left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right)\right)\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(\frac{-1}{6} + im \cdot \left(im \cdot \left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right)\right)\right)\right) - -1 \cdot \left(\left(im \cdot im\right) \cdot \left(\frac{-1}{6} + im \cdot \left(im \cdot \left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right)\right)\right)\right)\right)}\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left({-1}^{3} + {\left(\left(im \cdot im\right) \cdot \left(\frac{-1}{6} + im \cdot \left(im \cdot \left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right)\right)\right)\right)}^{3}\right), \left(-1 \cdot -1 + \left(\left(\left(im \cdot im\right) \cdot \left(\frac{-1}{6} + im \cdot \left(im \cdot \left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right)\right)\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(\frac{-1}{6} + im \cdot \left(im \cdot \left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right)\right)\right)\right) - -1 \cdot \left(\left(im \cdot im\right) \cdot \left(\frac{-1}{6} + im \cdot \left(im \cdot \left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
    12. Applied egg-rr62.0%

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

    if 2.04999999999999992e26 < im < 1.29999999999999992e62

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
      2. distribute-rgt-inN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
      3. associate-+r+N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
    5. Simplified58.9%

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

      \[\leadsto im \cdot \left(\cos re \cdot \color{blue}{\frac{\left(\left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot 0.027777777777777776 - 1\right) \cdot \left(-0.008333333333333333 - \left(im \cdot im\right) \cdot -0.0001984126984126984\right) + \left(\left(im \cdot im\right) \cdot -0.16666666666666666 - -1\right) \cdot \left(\left(6.944444444444444 \cdot 10^{-5} - \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot 3.936759889140842 \cdot 10^{-8}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)}{\left(\left(im \cdot im\right) \cdot -0.16666666666666666 - -1\right) \cdot \left(-0.008333333333333333 - \left(im \cdot im\right) \cdot -0.0001984126984126984\right)}}\right) \]

    if 1.29999999999999992e62 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

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

        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right) + \color{blue}{\frac{-1}{6} \cdot \cos re}\right)\right)\right) \]
      4. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re\right)}\right)\right)\right) \]
      5. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\left(\frac{-1}{120} \cdot {im}^{2}\right) \cdot \cos re\right) + {im}^{\color{blue}{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left({im}^{2} \cdot \frac{-1}{6}\right) \cdot \color{blue}{\cos re}\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \cos \color{blue}{re}\right)\right)\right) \]
      9. distribute-rgt-outN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \cos re \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)}\right)\right) \]
      10. distribute-lft-outN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\cos re, \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
      12. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(\color{blue}{-1} + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)\right)\right) \]
    5. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 2.05 \cdot 10^{+26}:\\ \;\;\;\;\left(im \cdot \cos re\right) \cdot \frac{-1 + \left(im \cdot \left(im \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)\right)\right)\right)\right) \cdot \left(\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(\left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)\right)\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)\right)\right)\right)\right)}{1 + \left(im \cdot \left(im \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)\right)\right)\right)\right) \cdot \left(im \cdot \left(im \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)\right)\right)\right) - -1\right)}\\ \mathbf{elif}\;im \leq 1.3 \cdot 10^{+62}:\\ \;\;\;\;im \cdot \left(\cos re \cdot \frac{\left(-1 + \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot 0.027777777777777776\right) \cdot \left(-0.008333333333333333 - \left(im \cdot im\right) \cdot -0.0001984126984126984\right) + \left(\left(im \cdot im\right) \cdot -0.16666666666666666 - -1\right) \cdot \left(\left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot \left(6.944444444444444 \cdot 10^{-5} - \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot 3.936759889140842 \cdot 10^{-8}\right)\right)}{\left(-0.008333333333333333 - \left(im \cdot im\right) \cdot -0.0001984126984126984\right) \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 - -1\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(\cos re \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot -0.008333333333333333\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 97.9% accurate, 2.3× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := -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)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 5.2:\\ \;\;\;\;\left(im\_m \cdot \cos re\right) \cdot t\_0\\ \mathbf{elif}\;im\_m \leq 4 \cdot 10^{+44}:\\ \;\;\;\;\left(\frac{1}{1 + im\_m \cdot \left(1 + im\_m \cdot \left(0.5 + im\_m \cdot 0.16666666666666666\right)\right)} - e^{im\_m}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)\\ \mathbf{else}:\\ \;\;\;\;im\_m \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
         (+
          -1.0
          (*
           (* im_m im_m)
           (+
            -0.16666666666666666
            (*
             im_m
             (*
              im_m
              (+
               -0.008333333333333333
               (* (* im_m im_m) -0.0001984126984126984)))))))))
   (*
    im_s
    (if (<= im_m 5.2)
      (* (* im_m (cos re)) t_0)
      (if (<= im_m 4e+44)
        (*
         (-
          (/
           1.0
           (+
            1.0
            (* im_m (+ 1.0 (* im_m (+ 0.5 (* im_m 0.16666666666666666)))))))
          (exp im_m))
         (+ 0.5 (* -0.25 (* re re))))
        (* im_m (* (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 = -1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))));
	double tmp;
	if (im_m <= 5.2) {
		tmp = (im_m * cos(re)) * t_0;
	} else if (im_m <= 4e+44) {
		tmp = ((1.0 / (1.0 + (im_m * (1.0 + (im_m * (0.5 + (im_m * 0.16666666666666666))))))) - exp(im_m)) * (0.5 + (-0.25 * (re * re)));
	} else {
		tmp = im_m * (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 = (-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + (im_m * (im_m * ((-0.008333333333333333d0) + ((im_m * im_m) * (-0.0001984126984126984d0)))))))
    if (im_m <= 5.2d0) then
        tmp = (im_m * cos(re)) * t_0
    else if (im_m <= 4d+44) then
        tmp = ((1.0d0 / (1.0d0 + (im_m * (1.0d0 + (im_m * (0.5d0 + (im_m * 0.16666666666666666d0))))))) - exp(im_m)) * (0.5d0 + ((-0.25d0) * (re * re)))
    else
        tmp = im_m * (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 = -1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))));
	double tmp;
	if (im_m <= 5.2) {
		tmp = (im_m * Math.cos(re)) * t_0;
	} else if (im_m <= 4e+44) {
		tmp = ((1.0 / (1.0 + (im_m * (1.0 + (im_m * (0.5 + (im_m * 0.16666666666666666))))))) - Math.exp(im_m)) * (0.5 + (-0.25 * (re * re)));
	} else {
		tmp = im_m * (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 = -1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))))
	tmp = 0
	if im_m <= 5.2:
		tmp = (im_m * math.cos(re)) * t_0
	elif im_m <= 4e+44:
		tmp = ((1.0 / (1.0 + (im_m * (1.0 + (im_m * (0.5 + (im_m * 0.16666666666666666))))))) - math.exp(im_m)) * (0.5 + (-0.25 * (re * re)))
	else:
		tmp = im_m * (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(-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)))))))
	tmp = 0.0
	if (im_m <= 5.2)
		tmp = Float64(Float64(im_m * cos(re)) * t_0);
	elseif (im_m <= 4e+44)
		tmp = Float64(Float64(Float64(1.0 / Float64(1.0 + Float64(im_m * Float64(1.0 + Float64(im_m * Float64(0.5 + Float64(im_m * 0.16666666666666666))))))) - exp(im_m)) * Float64(0.5 + Float64(-0.25 * Float64(re * re))));
	else
		tmp = Float64(im_m * 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 = -1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))));
	tmp = 0.0;
	if (im_m <= 5.2)
		tmp = (im_m * cos(re)) * t_0;
	elseif (im_m <= 4e+44)
		tmp = ((1.0 / (1.0 + (im_m * (1.0 + (im_m * (0.5 + (im_m * 0.16666666666666666))))))) - exp(im_m)) * (0.5 + (-0.25 * (re * re)));
	else
		tmp = im_m * (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[(-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]}, N[(im$95$s * If[LessEqual[im$95$m, 5.2], N[(N[(im$95$m * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[im$95$m, 4e+44], N[(N[(N[(1.0 / N[(1.0 + N[(im$95$m * N[(1.0 + N[(im$95$m * N[(0.5 + N[(im$95$m * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im$95$m * 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 := -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)\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;im\_m \leq 5.2:\\
\;\;\;\;\left(im\_m \cdot \cos re\right) \cdot t\_0\\

\mathbf{elif}\;im\_m \leq 4 \cdot 10^{+44}:\\
\;\;\;\;\left(\frac{1}{1 + im\_m \cdot \left(1 + im\_m \cdot \left(0.5 + im\_m \cdot 0.16666666666666666\right)\right)} - e^{im\_m}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)\\

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


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

    1. Initial program 46.4%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
      2. distribute-rgt-inN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
      3. associate-+r+N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
    5. Simplified92.8%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + -0.16666666666666666 \cdot \left(im \cdot im\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(im \cdot \cos re\right) \cdot \color{blue}{\left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)\right)} \]
      2. *-commutativeN/A

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

        \[\leadsto \mathsf{*.f64}\left(\left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)\right), \color{blue}{\left(im \cdot \cos re\right)}\right) \]
    7. Applied egg-rr92.8%

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

      \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) - 1\right)}, \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
    9. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + \left(\mathsf{neg}\left(1\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + -1\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\left(-1 + {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left({im}^{2}\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \frac{-1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{6} + {im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\left(im \cdot im\right) \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      13. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(im \cdot \left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \left(\mathsf{neg}\left(\frac{1}{120}\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      17. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \frac{-1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      18. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{120} + \frac{-1}{5040} \cdot {im}^{2}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      19. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \left(\frac{-1}{5040} \cdot {im}^{2}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      20. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \left({im}^{2} \cdot \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      21. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left({im}^{2}\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      22. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      23. *-lowering-*.f6492.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
    10. Simplified92.8%

      \[\leadsto \color{blue}{\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)} \cdot \left(im \cdot \cos re\right) \]

    if 5.20000000000000018 < im < 4.0000000000000004e44

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \left(\frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
      3. distribute-rgt-outN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(e^{\mathsf{neg}\left(im\right)}\right), \left(e^{im}\right)\right), \left(\color{blue}{\frac{1}{2}} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      6. exp-negN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(e^{im}\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      8. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      9. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      10. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right) \]
      13. *-lowering-*.f6461.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right) \]
    5. Simplified61.5%

      \[\leadsto \color{blue}{\left(\frac{1}{e^{im}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)} \]
    6. Taylor expanded in im around 0

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \color{blue}{\left(1 + im \cdot \left(1 + im \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot im\right)\right)\right)}\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
    7. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left(im \cdot \left(1 + im \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot im\right)\right)\right)\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
      2. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \left(im \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot im\right)\right)\right)\right)\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \left(\frac{1}{2} + \frac{1}{6} \cdot im\right)\right)\right)\right)\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
      5. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{2}, \left(im \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
      7. *-lowering-*.f6461.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \frac{1}{6}\right)\right)\right)\right)\right)\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
    8. Simplified61.5%

      \[\leadsto \left(\frac{1}{\color{blue}{1 + im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right)}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \]

    if 4.0000000000000004e44 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
      2. distribute-rgt-inN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
      3. associate-+r+N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
    5. Simplified100.0%

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

      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) - 1\right)}\right)\right) \]
    7. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + -1\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(-1 + \color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)}\right)\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)}\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)}\right)\right)\right)\right) \]
      6. unpow2N/A

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

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{{im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)} - \frac{1}{6}\right)\right)\right)\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}\right)\right)\right)\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \frac{-1}{6}\right)\right)\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{6} + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)}\right)\right)\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\left(im \cdot im\right) \cdot \left(\color{blue}{\frac{-1}{5040} \cdot {im}^{2}} - \frac{1}{120}\right)\right)\right)\right)\right)\right)\right) \]
      13. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(im \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \color{blue}{\left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)}\right)\right)\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{120}\right)\right)}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \frac{-1}{120}\right)\right)\right)\right)\right)\right)\right)\right) \]
      18. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{120} + \color{blue}{\frac{-1}{5040} \cdot {im}^{2}}\right)\right)\right)\right)\right)\right)\right)\right) \]
      19. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \color{blue}{\left(\frac{-1}{5040} \cdot {im}^{2}\right)}\right)\right)\right)\right)\right)\right)\right)\right) \]
      20. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \left({im}^{2} \cdot \color{blue}{\frac{-1}{5040}}\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
      21. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\frac{-1}{5040}}\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
      22. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
      23. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
    8. Simplified100.0%

      \[\leadsto im \cdot \left(\cos re \cdot \color{blue}{\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 simplification92.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 5.2:\\ \;\;\;\;\left(im \cdot \cos 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)\\ \mathbf{elif}\;im \leq 4 \cdot 10^{+44}:\\ \;\;\;\;\left(\frac{1}{1 + im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right)} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\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 6: 97.9% accurate, 2.3× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := -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)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 5.4:\\ \;\;\;\;\left(im\_m \cdot \cos re\right) \cdot t\_0\\ \mathbf{elif}\;im\_m \leq 3.8 \cdot 10^{+44}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(\frac{1}{1 + im\_m \cdot \left(1 + im\_m \cdot 0.5\right)} - e^{im\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;im\_m \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
         (+
          -1.0
          (*
           (* im_m im_m)
           (+
            -0.16666666666666666
            (*
             im_m
             (*
              im_m
              (+
               -0.008333333333333333
               (* (* im_m im_m) -0.0001984126984126984)))))))))
   (*
    im_s
    (if (<= im_m 5.4)
      (* (* im_m (cos re)) t_0)
      (if (<= im_m 3.8e+44)
        (*
         (+ 0.5 (* -0.25 (* re re)))
         (- (/ 1.0 (+ 1.0 (* im_m (+ 1.0 (* im_m 0.5))))) (exp im_m)))
        (* im_m (* (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 = -1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))));
	double tmp;
	if (im_m <= 5.4) {
		tmp = (im_m * cos(re)) * t_0;
	} else if (im_m <= 3.8e+44) {
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (1.0 + (im_m * (1.0 + (im_m * 0.5))))) - exp(im_m));
	} else {
		tmp = im_m * (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 = (-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + (im_m * (im_m * ((-0.008333333333333333d0) + ((im_m * im_m) * (-0.0001984126984126984d0)))))))
    if (im_m <= 5.4d0) then
        tmp = (im_m * cos(re)) * t_0
    else if (im_m <= 3.8d+44) then
        tmp = (0.5d0 + ((-0.25d0) * (re * re))) * ((1.0d0 / (1.0d0 + (im_m * (1.0d0 + (im_m * 0.5d0))))) - exp(im_m))
    else
        tmp = im_m * (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 = -1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))));
	double tmp;
	if (im_m <= 5.4) {
		tmp = (im_m * Math.cos(re)) * t_0;
	} else if (im_m <= 3.8e+44) {
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (1.0 + (im_m * (1.0 + (im_m * 0.5))))) - Math.exp(im_m));
	} else {
		tmp = im_m * (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 = -1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))))
	tmp = 0
	if im_m <= 5.4:
		tmp = (im_m * math.cos(re)) * t_0
	elif im_m <= 3.8e+44:
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (1.0 + (im_m * (1.0 + (im_m * 0.5))))) - math.exp(im_m))
	else:
		tmp = im_m * (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(-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)))))))
	tmp = 0.0
	if (im_m <= 5.4)
		tmp = Float64(Float64(im_m * cos(re)) * t_0);
	elseif (im_m <= 3.8e+44)
		tmp = Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * Float64(Float64(1.0 / Float64(1.0 + Float64(im_m * Float64(1.0 + Float64(im_m * 0.5))))) - exp(im_m)));
	else
		tmp = Float64(im_m * 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 = -1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))));
	tmp = 0.0;
	if (im_m <= 5.4)
		tmp = (im_m * cos(re)) * t_0;
	elseif (im_m <= 3.8e+44)
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (1.0 + (im_m * (1.0 + (im_m * 0.5))))) - exp(im_m));
	else
		tmp = im_m * (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[(-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]}, N[(im$95$s * If[LessEqual[im$95$m, 5.4], N[(N[(im$95$m * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[im$95$m, 3.8e+44], N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[(1.0 + N[(im$95$m * N[(1.0 + N[(im$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im$95$m * 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 := -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)\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;im\_m \leq 5.4:\\
\;\;\;\;\left(im\_m \cdot \cos re\right) \cdot t\_0\\

\mathbf{elif}\;im\_m \leq 3.8 \cdot 10^{+44}:\\
\;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(\frac{1}{1 + im\_m \cdot \left(1 + im\_m \cdot 0.5\right)} - e^{im\_m}\right)\\

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


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

    1. Initial program 46.4%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
      2. distribute-rgt-inN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
      3. associate-+r+N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
    5. Simplified92.8%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + -0.16666666666666666 \cdot \left(im \cdot im\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(im \cdot \cos re\right) \cdot \color{blue}{\left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)\right)} \]
      2. *-commutativeN/A

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

        \[\leadsto \mathsf{*.f64}\left(\left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)\right), \color{blue}{\left(im \cdot \cos re\right)}\right) \]
    7. Applied egg-rr92.8%

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

      \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) - 1\right)}, \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
    9. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + \left(\mathsf{neg}\left(1\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + -1\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\left(-1 + {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left({im}^{2}\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \frac{-1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{6} + {im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\left(im \cdot im\right) \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      13. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(im \cdot \left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \left(\mathsf{neg}\left(\frac{1}{120}\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      17. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \frac{-1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      18. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{120} + \frac{-1}{5040} \cdot {im}^{2}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      19. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \left(\frac{-1}{5040} \cdot {im}^{2}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      20. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \left({im}^{2} \cdot \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      21. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left({im}^{2}\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      22. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      23. *-lowering-*.f6492.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
    10. Simplified92.8%

      \[\leadsto \color{blue}{\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)} \cdot \left(im \cdot \cos re\right) \]

    if 5.4000000000000004 < im < 3.8000000000000002e44

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \left(\frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
      3. distribute-rgt-outN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(e^{\mathsf{neg}\left(im\right)}\right), \left(e^{im}\right)\right), \left(\color{blue}{\frac{1}{2}} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      6. exp-negN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(e^{im}\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      8. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      9. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      10. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right) \]
      13. *-lowering-*.f6461.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right) \]
    5. Simplified61.5%

      \[\leadsto \color{blue}{\left(\frac{1}{e^{im}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)} \]
    6. Taylor expanded in im around 0

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \color{blue}{\left(1 + im \cdot \left(1 + \frac{1}{2} \cdot im\right)\right)}\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
    7. Step-by-step derivation
      1. +-lowering-+.f64N/A

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \left(im \cdot \frac{1}{2}\right)\right)\right)\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
      5. *-lowering-*.f6461.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \frac{1}{2}\right)\right)\right)\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
    8. Simplified61.2%

      \[\leadsto \left(\frac{1}{\color{blue}{1 + im \cdot \left(1 + im \cdot 0.5\right)}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \]

    if 3.8000000000000002e44 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
      2. distribute-rgt-inN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
      3. associate-+r+N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
    5. Simplified100.0%

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

      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) - 1\right)}\right)\right) \]
    7. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + -1\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(-1 + \color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)}\right)\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)}\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)}\right)\right)\right)\right) \]
      6. unpow2N/A

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

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{{im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)} - \frac{1}{6}\right)\right)\right)\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}\right)\right)\right)\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \frac{-1}{6}\right)\right)\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{6} + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)}\right)\right)\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\left(im \cdot im\right) \cdot \left(\color{blue}{\frac{-1}{5040} \cdot {im}^{2}} - \frac{1}{120}\right)\right)\right)\right)\right)\right)\right) \]
      13. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(im \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \color{blue}{\left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)}\right)\right)\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{120}\right)\right)}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \frac{-1}{120}\right)\right)\right)\right)\right)\right)\right)\right) \]
      18. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{120} + \color{blue}{\frac{-1}{5040} \cdot {im}^{2}}\right)\right)\right)\right)\right)\right)\right)\right) \]
      19. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \color{blue}{\left(\frac{-1}{5040} \cdot {im}^{2}\right)}\right)\right)\right)\right)\right)\right)\right)\right) \]
      20. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \left({im}^{2} \cdot \color{blue}{\frac{-1}{5040}}\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
      21. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\frac{-1}{5040}}\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
      22. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
      23. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
    8. Simplified100.0%

      \[\leadsto im \cdot \left(\cos re \cdot \color{blue}{\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 simplification92.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 5.4:\\ \;\;\;\;\left(im \cdot \cos 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)\\ \mathbf{elif}\;im \leq 3.8 \cdot 10^{+44}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(\frac{1}{1 + im \cdot \left(1 + im \cdot 0.5\right)} - 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 7: 97.9% accurate, 2.3× 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(\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)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 5.2:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;im\_m \leq 3.6 \cdot 10^{+44}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(\frac{1}{1 + im\_m \cdot \left(1 + im\_m \cdot 0.5\right)} - e^{im\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \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
          (*
           (cos re)
           (+
            -1.0
            (*
             (* im_m im_m)
             (+
              -0.16666666666666666
              (*
               im_m
               (*
                im_m
                (+
                 -0.008333333333333333
                 (* (* im_m im_m) -0.0001984126984126984)))))))))))
   (*
    im_s
    (if (<= im_m 5.2)
      t_0
      (if (<= im_m 3.6e+44)
        (*
         (+ 0.5 (* -0.25 (* re re)))
         (- (/ 1.0 (+ 1.0 (* im_m (+ 1.0 (* im_m 0.5))))) (exp im_m)))
        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 * (cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))))));
	double tmp;
	if (im_m <= 5.2) {
		tmp = t_0;
	} else if (im_m <= 3.6e+44) {
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (1.0 + (im_m * (1.0 + (im_m * 0.5))))) - exp(im_m));
	} else {
		tmp = 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 * (cos(re) * ((-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + (im_m * (im_m * ((-0.008333333333333333d0) + ((im_m * im_m) * (-0.0001984126984126984d0)))))))))
    if (im_m <= 5.2d0) then
        tmp = t_0
    else if (im_m <= 3.6d+44) then
        tmp = (0.5d0 + ((-0.25d0) * (re * re))) * ((1.0d0 / (1.0d0 + (im_m * (1.0d0 + (im_m * 0.5d0))))) - exp(im_m))
    else
        tmp = 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 * (Math.cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))))));
	double tmp;
	if (im_m <= 5.2) {
		tmp = t_0;
	} else if (im_m <= 3.6e+44) {
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (1.0 + (im_m * (1.0 + (im_m * 0.5))))) - Math.exp(im_m));
	} else {
		tmp = 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 * (math.cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))))))
	tmp = 0
	if im_m <= 5.2:
		tmp = t_0
	elif im_m <= 3.6e+44:
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (1.0 + (im_m * (1.0 + (im_m * 0.5))))) - math.exp(im_m))
	else:
		tmp = 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(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)))))))))
	tmp = 0.0
	if (im_m <= 5.2)
		tmp = t_0;
	elseif (im_m <= 3.6e+44)
		tmp = Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * Float64(Float64(1.0 / Float64(1.0 + Float64(im_m * Float64(1.0 + Float64(im_m * 0.5))))) - exp(im_m)));
	else
		tmp = 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 * (cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))))));
	tmp = 0.0;
	if (im_m <= 5.2)
		tmp = t_0;
	elseif (im_m <= 3.6e+44)
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (1.0 + (im_m * (1.0 + (im_m * 0.5))))) - exp(im_m));
	else
		tmp = 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[(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]}, N[(im$95$s * If[LessEqual[im$95$m, 5.2], t$95$0, If[LessEqual[im$95$m, 3.6e+44], N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[(1.0 + N[(im$95$m * N[(1.0 + N[(im$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]), $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(\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)\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;im\_m \leq 5.2:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 5.20000000000000018 or 3.6e44 < im

    1. Initial program 57.2%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
      2. distribute-rgt-inN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
      3. associate-+r+N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
    5. Simplified94.3%

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

      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) - 1\right)}\right)\right) \]
    7. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + -1\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(-1 + \color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)}\right)\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)}\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)}\right)\right)\right)\right) \]
      6. unpow2N/A

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

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{{im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)} - \frac{1}{6}\right)\right)\right)\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}\right)\right)\right)\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \frac{-1}{6}\right)\right)\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{6} + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)}\right)\right)\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\left(im \cdot im\right) \cdot \left(\color{blue}{\frac{-1}{5040} \cdot {im}^{2}} - \frac{1}{120}\right)\right)\right)\right)\right)\right)\right) \]
      13. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(im \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \color{blue}{\left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)}\right)\right)\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{120}\right)\right)}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \frac{-1}{120}\right)\right)\right)\right)\right)\right)\right)\right) \]
      18. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{120} + \color{blue}{\frac{-1}{5040} \cdot {im}^{2}}\right)\right)\right)\right)\right)\right)\right)\right) \]
      19. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \color{blue}{\left(\frac{-1}{5040} \cdot {im}^{2}\right)}\right)\right)\right)\right)\right)\right)\right)\right) \]
      20. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \left({im}^{2} \cdot \color{blue}{\frac{-1}{5040}}\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
      21. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\frac{-1}{5040}}\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
      22. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
      23. *-lowering-*.f6494.3%

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
    8. Simplified94.3%

      \[\leadsto im \cdot \left(\cos re \cdot \color{blue}{\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) \]

    if 5.20000000000000018 < im < 3.6e44

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \left(\frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
      3. distribute-rgt-outN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(e^{\mathsf{neg}\left(im\right)}\right), \left(e^{im}\right)\right), \left(\color{blue}{\frac{1}{2}} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      6. exp-negN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(e^{im}\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      8. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      9. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      10. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right) \]
      13. *-lowering-*.f6461.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right) \]
    5. Simplified61.5%

      \[\leadsto \color{blue}{\left(\frac{1}{e^{im}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)} \]
    6. Taylor expanded in im around 0

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \color{blue}{\left(1 + im \cdot \left(1 + \frac{1}{2} \cdot im\right)\right)}\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
    7. Step-by-step derivation
      1. +-lowering-+.f64N/A

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \left(im \cdot \frac{1}{2}\right)\right)\right)\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
      5. *-lowering-*.f6461.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \frac{1}{2}\right)\right)\right)\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
    8. Simplified61.2%

      \[\leadsto \left(\frac{1}{\color{blue}{1 + im \cdot \left(1 + im \cdot 0.5\right)}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification92.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 5.2:\\ \;\;\;\;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)\\ \mathbf{elif}\;im \leq 3.6 \cdot 10^{+44}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(\frac{1}{1 + im \cdot \left(1 + im \cdot 0.5\right)} - 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 8: 97.0% accurate, 2.4× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := -1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.008333333333333333\right)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 5.8:\\ \;\;\;\;\left(im\_m \cdot \cos re\right) \cdot t\_0\\ \mathbf{elif}\;im\_m \leq 9 \cdot 10^{+59}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(\frac{1}{1 + im\_m \cdot \left(1 + im\_m \cdot 0.5\right)} - e^{im\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;im\_m \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
         (+
          -1.0
          (*
           (* im_m im_m)
           (+ -0.16666666666666666 (* (* im_m im_m) -0.008333333333333333))))))
   (*
    im_s
    (if (<= im_m 5.8)
      (* (* im_m (cos re)) t_0)
      (if (<= im_m 9e+59)
        (*
         (+ 0.5 (* -0.25 (* re re)))
         (- (/ 1.0 (+ 1.0 (* im_m (+ 1.0 (* im_m 0.5))))) (exp im_m)))
        (* im_m (* (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 = -1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)));
	double tmp;
	if (im_m <= 5.8) {
		tmp = (im_m * cos(re)) * t_0;
	} else if (im_m <= 9e+59) {
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (1.0 + (im_m * (1.0 + (im_m * 0.5))))) - exp(im_m));
	} else {
		tmp = im_m * (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 = (-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + ((im_m * im_m) * (-0.008333333333333333d0))))
    if (im_m <= 5.8d0) then
        tmp = (im_m * cos(re)) * t_0
    else if (im_m <= 9d+59) then
        tmp = (0.5d0 + ((-0.25d0) * (re * re))) * ((1.0d0 / (1.0d0 + (im_m * (1.0d0 + (im_m * 0.5d0))))) - exp(im_m))
    else
        tmp = im_m * (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 = -1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)));
	double tmp;
	if (im_m <= 5.8) {
		tmp = (im_m * Math.cos(re)) * t_0;
	} else if (im_m <= 9e+59) {
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (1.0 + (im_m * (1.0 + (im_m * 0.5))))) - Math.exp(im_m));
	} else {
		tmp = im_m * (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 = -1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))
	tmp = 0
	if im_m <= 5.8:
		tmp = (im_m * math.cos(re)) * t_0
	elif im_m <= 9e+59:
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (1.0 + (im_m * (1.0 + (im_m * 0.5))))) - math.exp(im_m))
	else:
		tmp = im_m * (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(-1.0 + Float64(Float64(im_m * im_m) * Float64(-0.16666666666666666 + Float64(Float64(im_m * im_m) * -0.008333333333333333))))
	tmp = 0.0
	if (im_m <= 5.8)
		tmp = Float64(Float64(im_m * cos(re)) * t_0);
	elseif (im_m <= 9e+59)
		tmp = Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * Float64(Float64(1.0 / Float64(1.0 + Float64(im_m * Float64(1.0 + Float64(im_m * 0.5))))) - exp(im_m)));
	else
		tmp = Float64(im_m * 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 = -1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)));
	tmp = 0.0;
	if (im_m <= 5.8)
		tmp = (im_m * cos(re)) * t_0;
	elseif (im_m <= 9e+59)
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (1.0 + (im_m * (1.0 + (im_m * 0.5))))) - exp(im_m));
	else
		tmp = im_m * (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[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(-0.16666666666666666 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[im$95$m, 5.8], N[(N[(im$95$m * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[im$95$m, 9e+59], N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[(1.0 + N[(im$95$m * N[(1.0 + N[(im$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im$95$m * 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 := -1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.008333333333333333\right)\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;im\_m \leq 5.8:\\
\;\;\;\;\left(im\_m \cdot \cos re\right) \cdot t\_0\\

\mathbf{elif}\;im\_m \leq 9 \cdot 10^{+59}:\\
\;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(\frac{1}{1 + im\_m \cdot \left(1 + im\_m \cdot 0.5\right)} - e^{im\_m}\right)\\

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


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

    1. Initial program 46.4%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

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

        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right) + \color{blue}{\frac{-1}{6} \cdot \cos re}\right)\right)\right) \]
      4. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re\right)}\right)\right)\right) \]
      5. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\left(\frac{-1}{120} \cdot {im}^{2}\right) \cdot \cos re\right) + {im}^{\color{blue}{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left({im}^{2} \cdot \frac{-1}{6}\right) \cdot \color{blue}{\cos re}\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \cos \color{blue}{re}\right)\right)\right) \]
      9. distribute-rgt-outN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \cos re \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)}\right)\right) \]
      10. distribute-lft-outN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\cos re, \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
      12. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(\color{blue}{-1} + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)\right)\right) \]
    5. Simplified90.0%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot -0.008333333333333333\right)\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left(\frac{-1}{6} + \left(im \cdot im\right) \cdot \frac{-1}{120}\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{6} + \left(im \cdot im\right) \cdot \frac{-1}{120}\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\left(im \cdot im\right) \cdot \frac{-1}{120}\right)\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\frac{-1}{120} \cdot \left(im \cdot im\right)\right)\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
      9. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \color{blue}{\cos re}\right)\right) \]
      12. cos-lowering-cos.f6490.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
    7. Applied egg-rr90.0%

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

    if 5.79999999999999982 < im < 8.99999999999999919e59

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \left(\frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
      3. distribute-rgt-outN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(e^{\mathsf{neg}\left(im\right)}\right), \left(e^{im}\right)\right), \left(\color{blue}{\frac{1}{2}} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      6. exp-negN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(e^{im}\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      8. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      9. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      10. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right) \]
      13. *-lowering-*.f6466.7%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right) \]
    5. Simplified66.7%

      \[\leadsto \color{blue}{\left(\frac{1}{e^{im}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)} \]
    6. Taylor expanded in im around 0

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \color{blue}{\left(1 + im \cdot \left(1 + \frac{1}{2} \cdot im\right)\right)}\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
    7. Step-by-step derivation
      1. +-lowering-+.f64N/A

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \left(im \cdot \frac{1}{2}\right)\right)\right)\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
      5. *-lowering-*.f6466.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \frac{1}{2}\right)\right)\right)\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
    8. Simplified66.4%

      \[\leadsto \left(\frac{1}{\color{blue}{1 + im \cdot \left(1 + im \cdot 0.5\right)}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \]

    if 8.99999999999999919e59 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

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

        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right) + \color{blue}{\frac{-1}{6} \cdot \cos re}\right)\right)\right) \]
      4. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re\right)}\right)\right)\right) \]
      5. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\left(\frac{-1}{120} \cdot {im}^{2}\right) \cdot \cos re\right) + {im}^{\color{blue}{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left({im}^{2} \cdot \frac{-1}{6}\right) \cdot \color{blue}{\cos re}\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \cos \color{blue}{re}\right)\right)\right) \]
      9. distribute-rgt-outN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \cos re \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)}\right)\right) \]
      10. distribute-lft-outN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\cos re, \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
      12. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(\color{blue}{-1} + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)\right)\right) \]
    5. Simplified100.0%

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

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

Alternative 9: 97.0% accurate, 2.4× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := -1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.008333333333333333\right)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 5.5:\\ \;\;\;\;\left(im\_m \cdot \cos re\right) \cdot t\_0\\ \mathbf{elif}\;im\_m \leq 9 \cdot 10^{+59}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(\frac{1}{im\_m + 1} - e^{im\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;im\_m \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
         (+
          -1.0
          (*
           (* im_m im_m)
           (+ -0.16666666666666666 (* (* im_m im_m) -0.008333333333333333))))))
   (*
    im_s
    (if (<= im_m 5.5)
      (* (* im_m (cos re)) t_0)
      (if (<= im_m 9e+59)
        (* (+ 0.5 (* -0.25 (* re re))) (- (/ 1.0 (+ im_m 1.0)) (exp im_m)))
        (* im_m (* (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 = -1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)));
	double tmp;
	if (im_m <= 5.5) {
		tmp = (im_m * cos(re)) * t_0;
	} else if (im_m <= 9e+59) {
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (im_m + 1.0)) - exp(im_m));
	} else {
		tmp = im_m * (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 = (-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + ((im_m * im_m) * (-0.008333333333333333d0))))
    if (im_m <= 5.5d0) then
        tmp = (im_m * cos(re)) * t_0
    else if (im_m <= 9d+59) then
        tmp = (0.5d0 + ((-0.25d0) * (re * re))) * ((1.0d0 / (im_m + 1.0d0)) - exp(im_m))
    else
        tmp = im_m * (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 = -1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)));
	double tmp;
	if (im_m <= 5.5) {
		tmp = (im_m * Math.cos(re)) * t_0;
	} else if (im_m <= 9e+59) {
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (im_m + 1.0)) - Math.exp(im_m));
	} else {
		tmp = im_m * (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 = -1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))
	tmp = 0
	if im_m <= 5.5:
		tmp = (im_m * math.cos(re)) * t_0
	elif im_m <= 9e+59:
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (im_m + 1.0)) - math.exp(im_m))
	else:
		tmp = im_m * (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(-1.0 + Float64(Float64(im_m * im_m) * Float64(-0.16666666666666666 + Float64(Float64(im_m * im_m) * -0.008333333333333333))))
	tmp = 0.0
	if (im_m <= 5.5)
		tmp = Float64(Float64(im_m * cos(re)) * t_0);
	elseif (im_m <= 9e+59)
		tmp = Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * Float64(Float64(1.0 / Float64(im_m + 1.0)) - exp(im_m)));
	else
		tmp = Float64(im_m * 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 = -1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)));
	tmp = 0.0;
	if (im_m <= 5.5)
		tmp = (im_m * cos(re)) * t_0;
	elseif (im_m <= 9e+59)
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (im_m + 1.0)) - exp(im_m));
	else
		tmp = im_m * (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[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(-0.16666666666666666 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[im$95$m, 5.5], N[(N[(im$95$m * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[im$95$m, 9e+59], N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[(im$95$m + 1.0), $MachinePrecision]), $MachinePrecision] - N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im$95$m * 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 := -1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.008333333333333333\right)\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;im\_m \leq 5.5:\\
\;\;\;\;\left(im\_m \cdot \cos re\right) \cdot t\_0\\

\mathbf{elif}\;im\_m \leq 9 \cdot 10^{+59}:\\
\;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(\frac{1}{im\_m + 1} - e^{im\_m}\right)\\

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


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

    1. Initial program 46.4%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

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

        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right) + \color{blue}{\frac{-1}{6} \cdot \cos re}\right)\right)\right) \]
      4. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re\right)}\right)\right)\right) \]
      5. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\left(\frac{-1}{120} \cdot {im}^{2}\right) \cdot \cos re\right) + {im}^{\color{blue}{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left({im}^{2} \cdot \frac{-1}{6}\right) \cdot \color{blue}{\cos re}\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \cos \color{blue}{re}\right)\right)\right) \]
      9. distribute-rgt-outN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \cos re \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)}\right)\right) \]
      10. distribute-lft-outN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\cos re, \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
      12. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(\color{blue}{-1} + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)\right)\right) \]
    5. Simplified90.0%

      \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot -0.008333333333333333\right)\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left(\frac{-1}{6} + \left(im \cdot im\right) \cdot \frac{-1}{120}\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{6} + \left(im \cdot im\right) \cdot \frac{-1}{120}\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\left(im \cdot im\right) \cdot \frac{-1}{120}\right)\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\frac{-1}{120} \cdot \left(im \cdot im\right)\right)\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
      9. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \color{blue}{\cos re}\right)\right) \]
      12. cos-lowering-cos.f6490.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
    7. Applied egg-rr90.0%

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

    if 5.5 < im < 8.99999999999999919e59

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \left(\frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
      3. distribute-rgt-outN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(e^{\mathsf{neg}\left(im\right)}\right), \left(e^{im}\right)\right), \left(\color{blue}{\frac{1}{2}} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      6. exp-negN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(e^{im}\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      8. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      9. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      10. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right) \]
      13. *-lowering-*.f6466.7%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right) \]
    5. Simplified66.7%

      \[\leadsto \color{blue}{\left(\frac{1}{e^{im}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)} \]
    6. Taylor expanded in im around 0

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \color{blue}{\left(1 + im\right)}\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(im, 1\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
    8. Simplified66.1%

      \[\leadsto \left(\frac{1}{\color{blue}{im + 1}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \]

    if 8.99999999999999919e59 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

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

        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right) + \color{blue}{\frac{-1}{6} \cdot \cos re}\right)\right)\right) \]
      4. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re\right)}\right)\right)\right) \]
      5. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\left(\frac{-1}{120} \cdot {im}^{2}\right) \cdot \cos re\right) + {im}^{\color{blue}{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left({im}^{2} \cdot \frac{-1}{6}\right) \cdot \color{blue}{\cos re}\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \cos \color{blue}{re}\right)\right)\right) \]
      9. distribute-rgt-outN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \cos re \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)}\right)\right) \]
      10. distribute-lft-outN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\cos re, \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
      12. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(\color{blue}{-1} + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)\right)\right) \]
    5. Simplified100.0%

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

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

Alternative 10: 97.0% accurate, 2.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(\cos re \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.008333333333333333\right)\right)\right)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 5.2:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;im\_m \leq 9 \cdot 10^{+59}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(\frac{1}{im\_m + 1} - e^{im\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \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
          (*
           (cos re)
           (+
            -1.0
            (*
             (* im_m im_m)
             (+
              -0.16666666666666666
              (* (* im_m im_m) -0.008333333333333333))))))))
   (*
    im_s
    (if (<= im_m 5.2)
      t_0
      (if (<= im_m 9e+59)
        (* (+ 0.5 (* -0.25 (* re re))) (- (/ 1.0 (+ im_m 1.0)) (exp im_m)))
        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 * (cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))));
	double tmp;
	if (im_m <= 5.2) {
		tmp = t_0;
	} else if (im_m <= 9e+59) {
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (im_m + 1.0)) - exp(im_m));
	} else {
		tmp = 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 * (cos(re) * ((-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + ((im_m * im_m) * (-0.008333333333333333d0))))))
    if (im_m <= 5.2d0) then
        tmp = t_0
    else if (im_m <= 9d+59) then
        tmp = (0.5d0 + ((-0.25d0) * (re * re))) * ((1.0d0 / (im_m + 1.0d0)) - exp(im_m))
    else
        tmp = 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 * (Math.cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))));
	double tmp;
	if (im_m <= 5.2) {
		tmp = t_0;
	} else if (im_m <= 9e+59) {
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (im_m + 1.0)) - Math.exp(im_m));
	} else {
		tmp = 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 * (math.cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))))
	tmp = 0
	if im_m <= 5.2:
		tmp = t_0
	elif im_m <= 9e+59:
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (im_m + 1.0)) - math.exp(im_m))
	else:
		tmp = 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(cos(re) * Float64(-1.0 + Float64(Float64(im_m * im_m) * Float64(-0.16666666666666666 + Float64(Float64(im_m * im_m) * -0.008333333333333333))))))
	tmp = 0.0
	if (im_m <= 5.2)
		tmp = t_0;
	elseif (im_m <= 9e+59)
		tmp = Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * Float64(Float64(1.0 / Float64(im_m + 1.0)) - exp(im_m)));
	else
		tmp = 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 * (cos(re) * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))));
	tmp = 0.0;
	if (im_m <= 5.2)
		tmp = t_0;
	elseif (im_m <= 9e+59)
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (im_m + 1.0)) - exp(im_m));
	else
		tmp = 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[(N[Cos[re], $MachinePrecision] * N[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(-0.16666666666666666 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[im$95$m, 5.2], t$95$0, If[LessEqual[im$95$m, 9e+59], N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[(im$95$m + 1.0), $MachinePrecision]), $MachinePrecision] - N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]), $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(\cos re \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.008333333333333333\right)\right)\right)\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;im\_m \leq 5.2:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;im\_m \leq 9 \cdot 10^{+59}:\\
\;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(\frac{1}{im\_m + 1} - e^{im\_m}\right)\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 5.20000000000000018 or 8.99999999999999919e59 < im

    1. Initial program 56.3%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

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

        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right) + \color{blue}{\frac{-1}{6} \cdot \cos re}\right)\right)\right) \]
      4. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re\right)}\right)\right)\right) \]
      5. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\left(\frac{-1}{120} \cdot {im}^{2}\right) \cdot \cos re\right) + {im}^{\color{blue}{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left({im}^{2} \cdot \frac{-1}{6}\right) \cdot \color{blue}{\cos re}\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \cos \color{blue}{re}\right)\right)\right) \]
      9. distribute-rgt-outN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \cos re \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)}\right)\right) \]
      10. distribute-lft-outN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\cos re, \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
      12. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(\color{blue}{-1} + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)\right)\right) \]
    5. Simplified91.8%

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

    if 5.20000000000000018 < im < 8.99999999999999919e59

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \left(\frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
      3. distribute-rgt-outN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(e^{\mathsf{neg}\left(im\right)}\right), \left(e^{im}\right)\right), \left(\color{blue}{\frac{1}{2}} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      6. exp-negN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(e^{im}\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      8. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      9. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      10. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right) \]
      13. *-lowering-*.f6466.7%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right) \]
    5. Simplified66.7%

      \[\leadsto \color{blue}{\left(\frac{1}{e^{im}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)} \]
    6. Taylor expanded in im around 0

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \color{blue}{\left(1 + im\right)}\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(im, 1\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
    8. Simplified66.1%

      \[\leadsto \left(\frac{1}{\color{blue}{im + 1}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification90.0%

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

Alternative 11: 95.1% 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 := -1 + \left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 3.45:\\ \;\;\;\;\cos re \cdot \left(im\_m \cdot t\_0\right)\\ \mathbf{elif}\;im\_m \leq 1.15 \cdot 10^{+103}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(\frac{1}{im\_m + 1} - e^{im\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;im\_m \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 (+ -1.0 (* (* im_m im_m) -0.16666666666666666))))
   (*
    im_s
    (if (<= im_m 3.45)
      (* (cos re) (* im_m t_0))
      (if (<= im_m 1.15e+103)
        (* (+ 0.5 (* -0.25 (* re re))) (- (/ 1.0 (+ im_m 1.0)) (exp im_m)))
        (* im_m (* (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 = -1.0 + ((im_m * im_m) * -0.16666666666666666);
	double tmp;
	if (im_m <= 3.45) {
		tmp = cos(re) * (im_m * t_0);
	} else if (im_m <= 1.15e+103) {
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (im_m + 1.0)) - exp(im_m));
	} else {
		tmp = im_m * (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 = (-1.0d0) + ((im_m * im_m) * (-0.16666666666666666d0))
    if (im_m <= 3.45d0) then
        tmp = cos(re) * (im_m * t_0)
    else if (im_m <= 1.15d+103) then
        tmp = (0.5d0 + ((-0.25d0) * (re * re))) * ((1.0d0 / (im_m + 1.0d0)) - exp(im_m))
    else
        tmp = im_m * (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 = -1.0 + ((im_m * im_m) * -0.16666666666666666);
	double tmp;
	if (im_m <= 3.45) {
		tmp = Math.cos(re) * (im_m * t_0);
	} else if (im_m <= 1.15e+103) {
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (im_m + 1.0)) - Math.exp(im_m));
	} else {
		tmp = im_m * (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 = -1.0 + ((im_m * im_m) * -0.16666666666666666)
	tmp = 0
	if im_m <= 3.45:
		tmp = math.cos(re) * (im_m * t_0)
	elif im_m <= 1.15e+103:
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (im_m + 1.0)) - math.exp(im_m))
	else:
		tmp = im_m * (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(-1.0 + Float64(Float64(im_m * im_m) * -0.16666666666666666))
	tmp = 0.0
	if (im_m <= 3.45)
		tmp = Float64(cos(re) * Float64(im_m * t_0));
	elseif (im_m <= 1.15e+103)
		tmp = Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * Float64(Float64(1.0 / Float64(im_m + 1.0)) - exp(im_m)));
	else
		tmp = Float64(im_m * 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 = -1.0 + ((im_m * im_m) * -0.16666666666666666);
	tmp = 0.0;
	if (im_m <= 3.45)
		tmp = cos(re) * (im_m * t_0);
	elseif (im_m <= 1.15e+103)
		tmp = (0.5 + (-0.25 * (re * re))) * ((1.0 / (im_m + 1.0)) - exp(im_m));
	else
		tmp = im_m * (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[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[im$95$m, 3.45], N[(N[Cos[re], $MachinePrecision] * N[(im$95$m * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 1.15e+103], N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[(im$95$m + 1.0), $MachinePrecision]), $MachinePrecision] - N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im$95$m * 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 := -1 + \left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;im\_m \leq 3.45:\\
\;\;\;\;\cos re \cdot \left(im\_m \cdot t\_0\right)\\

\mathbf{elif}\;im\_m \leq 1.15 \cdot 10^{+103}:\\
\;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(\frac{1}{im\_m + 1} - e^{im\_m}\right)\\

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


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

    1. Initial program 46.4%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + \frac{-1}{6} \cdot \left({im}^{2} \cdot \cos re\right)\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left({im}^{2} \cdot \cos re\right) + \color{blue}{-1 \cdot \cos re}\right) \]
      2. mul-1-negN/A

        \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left({im}^{2} \cdot \cos re\right) + \left(\mathsf{neg}\left(\cos re\right)\right)\right) \]
      3. unsub-negN/A

        \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left({im}^{2} \cdot \cos re\right) - \color{blue}{\cos re}\right) \]
      4. *-commutativeN/A

        \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left(\cos re \cdot {im}^{2}\right) - \cos re\right) \]
      5. associate-*r*N/A

        \[\leadsto im \cdot \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} - \cos \color{blue}{re}\right) \]
      6. distribute-lft-out--N/A

        \[\leadsto im \cdot \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) - \color{blue}{im \cdot \cos re} \]
      7. associate-*r*N/A

        \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left(\cos re \cdot {im}^{2}\right)\right) - im \cdot \cos re \]
      8. *-commutativeN/A

        \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left({im}^{2} \cdot \cos re\right)\right) - im \cdot \cos re \]
      9. associate-*r*N/A

        \[\leadsto im \cdot \left(\left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \cos re\right) - im \cdot \cos re \]
      10. associate-*r*N/A

        \[\leadsto \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right)\right) \cdot \cos re - \color{blue}{im} \cdot \cos re \]
      11. distribute-rgt-out--N/A

        \[\leadsto \cos re \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) - im\right)} \]
      12. unsub-negN/A

        \[\leadsto \cos re \cdot \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + \color{blue}{\left(\mathsf{neg}\left(im\right)\right)}\right) \]
      13. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(\color{blue}{im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right)} + \left(\mathsf{neg}\left(im\right)\right)\right)\right) \]
      15. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + -1 \cdot \color{blue}{im}\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + im \cdot \color{blue}{-1}\right)\right) \]
    5. Simplified86.4%

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

    if 3.4500000000000002 < im < 1.15000000000000004e103

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \left(\frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
      3. distribute-rgt-outN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(e^{\mathsf{neg}\left(im\right)}\right), \left(e^{im}\right)\right), \left(\color{blue}{\frac{1}{2}} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      6. exp-negN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(e^{im}\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      8. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      9. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      10. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right) \]
      13. *-lowering-*.f6476.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right) \]
    5. Simplified76.0%

      \[\leadsto \color{blue}{\left(\frac{1}{e^{im}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)} \]
    6. Taylor expanded in im around 0

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \color{blue}{\left(1 + im\right)}\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(im, 1\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
    8. Simplified75.6%

      \[\leadsto \left(\frac{1}{\color{blue}{im + 1}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \]

    if 1.15000000000000004e103 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
      2. distribute-rgt-inN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
      3. associate-+r+N/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
    5. Simplified100.0%

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

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + \frac{-1}{6} \cdot \left({im}^{2} \cdot \cos re\right)\right)} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

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

        \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left(\cos re \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
      3. associate-*r*N/A

        \[\leadsto im \cdot \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1} \cdot \cos re\right) \]
      4. *-commutativeN/A

        \[\leadsto im \cdot \left(\left(\cos re \cdot \frac{-1}{6}\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
      5. metadata-evalN/A

        \[\leadsto im \cdot \left(\left(\cos re \cdot \left(\frac{-2}{3} \cdot \frac{1}{4}\right)\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
      6. metadata-evalN/A

        \[\leadsto im \cdot \left(\left(\cos re \cdot \left(\left(\frac{-8}{3} - -2\right) \cdot \frac{1}{4}\right)\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
      7. associate-*l*N/A

        \[\leadsto im \cdot \left(\left(\left(\cos re \cdot \left(\frac{-8}{3} - -2\right)\right) \cdot \frac{1}{4}\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
      8. distribute-rgt-out--N/A

        \[\leadsto im \cdot \left(\left(\left(\frac{-8}{3} \cdot \cos re - -2 \cdot \cos re\right) \cdot \frac{1}{4}\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
      9. *-commutativeN/A

        \[\leadsto im \cdot \left(\left(\frac{1}{4} \cdot \left(\frac{-8}{3} \cdot \cos re - -2 \cdot \cos re\right)\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
      10. +-commutativeN/A

        \[\leadsto im \cdot \left(-1 \cdot \cos re + \color{blue}{\left(\frac{1}{4} \cdot \left(\frac{-8}{3} \cdot \cos re - -2 \cdot \cos re\right)\right) \cdot {im}^{2}}\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + \left(\frac{1}{4} \cdot \left(\frac{-8}{3} \cdot \cos re - -2 \cdot \cos re\right)\right) \cdot {im}^{2}\right)}\right) \]
    8. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 3.45:\\ \;\;\;\;\cos re \cdot \left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\\ \mathbf{elif}\;im \leq 1.15 \cdot 10^{+103}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(\frac{1}{im + 1} - e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(\cos re \cdot \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 95.1% 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 := -1 + \left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 4.7:\\ \;\;\;\;\cos re \cdot \left(im\_m \cdot t\_0\right)\\ \mathbf{elif}\;im\_m \leq 1.1 \cdot 10^{+103}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(1 - e^{im\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;im\_m \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 (+ -1.0 (* (* im_m im_m) -0.16666666666666666))))
   (*
    im_s
    (if (<= im_m 4.7)
      (* (cos re) (* im_m t_0))
      (if (<= im_m 1.1e+103)
        (* (+ 0.5 (* -0.25 (* re re))) (- 1.0 (exp im_m)))
        (* im_m (* (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 = -1.0 + ((im_m * im_m) * -0.16666666666666666);
	double tmp;
	if (im_m <= 4.7) {
		tmp = cos(re) * (im_m * t_0);
	} else if (im_m <= 1.1e+103) {
		tmp = (0.5 + (-0.25 * (re * re))) * (1.0 - exp(im_m));
	} else {
		tmp = im_m * (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 = (-1.0d0) + ((im_m * im_m) * (-0.16666666666666666d0))
    if (im_m <= 4.7d0) then
        tmp = cos(re) * (im_m * t_0)
    else if (im_m <= 1.1d+103) then
        tmp = (0.5d0 + ((-0.25d0) * (re * re))) * (1.0d0 - exp(im_m))
    else
        tmp = im_m * (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 = -1.0 + ((im_m * im_m) * -0.16666666666666666);
	double tmp;
	if (im_m <= 4.7) {
		tmp = Math.cos(re) * (im_m * t_0);
	} else if (im_m <= 1.1e+103) {
		tmp = (0.5 + (-0.25 * (re * re))) * (1.0 - Math.exp(im_m));
	} else {
		tmp = im_m * (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 = -1.0 + ((im_m * im_m) * -0.16666666666666666)
	tmp = 0
	if im_m <= 4.7:
		tmp = math.cos(re) * (im_m * t_0)
	elif im_m <= 1.1e+103:
		tmp = (0.5 + (-0.25 * (re * re))) * (1.0 - math.exp(im_m))
	else:
		tmp = im_m * (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(-1.0 + Float64(Float64(im_m * im_m) * -0.16666666666666666))
	tmp = 0.0
	if (im_m <= 4.7)
		tmp = Float64(cos(re) * Float64(im_m * t_0));
	elseif (im_m <= 1.1e+103)
		tmp = Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * Float64(1.0 - exp(im_m)));
	else
		tmp = Float64(im_m * 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 = -1.0 + ((im_m * im_m) * -0.16666666666666666);
	tmp = 0.0;
	if (im_m <= 4.7)
		tmp = cos(re) * (im_m * t_0);
	elseif (im_m <= 1.1e+103)
		tmp = (0.5 + (-0.25 * (re * re))) * (1.0 - exp(im_m));
	else
		tmp = im_m * (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[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[im$95$m, 4.7], N[(N[Cos[re], $MachinePrecision] * N[(im$95$m * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 1.1e+103], N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im$95$m * 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 := -1 + \left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666\\
im\_s \cdot \begin{array}{l}
\mathbf{if}\;im\_m \leq 4.7:\\
\;\;\;\;\cos re \cdot \left(im\_m \cdot t\_0\right)\\

\mathbf{elif}\;im\_m \leq 1.1 \cdot 10^{+103}:\\
\;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(1 - e^{im\_m}\right)\\

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


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

    1. Initial program 46.4%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + \frac{-1}{6} \cdot \left({im}^{2} \cdot \cos re\right)\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left({im}^{2} \cdot \cos re\right) + \color{blue}{-1 \cdot \cos re}\right) \]
      2. mul-1-negN/A

        \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left({im}^{2} \cdot \cos re\right) + \left(\mathsf{neg}\left(\cos re\right)\right)\right) \]
      3. unsub-negN/A

        \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left({im}^{2} \cdot \cos re\right) - \color{blue}{\cos re}\right) \]
      4. *-commutativeN/A

        \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left(\cos re \cdot {im}^{2}\right) - \cos re\right) \]
      5. associate-*r*N/A

        \[\leadsto im \cdot \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} - \cos \color{blue}{re}\right) \]
      6. distribute-lft-out--N/A

        \[\leadsto im \cdot \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) - \color{blue}{im \cdot \cos re} \]
      7. associate-*r*N/A

        \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left(\cos re \cdot {im}^{2}\right)\right) - im \cdot \cos re \]
      8. *-commutativeN/A

        \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left({im}^{2} \cdot \cos re\right)\right) - im \cdot \cos re \]
      9. associate-*r*N/A

        \[\leadsto im \cdot \left(\left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \cos re\right) - im \cdot \cos re \]
      10. associate-*r*N/A

        \[\leadsto \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right)\right) \cdot \cos re - \color{blue}{im} \cdot \cos re \]
      11. distribute-rgt-out--N/A

        \[\leadsto \cos re \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) - im\right)} \]
      12. unsub-negN/A

        \[\leadsto \cos re \cdot \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + \color{blue}{\left(\mathsf{neg}\left(im\right)\right)}\right) \]
      13. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(\color{blue}{im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right)} + \left(\mathsf{neg}\left(im\right)\right)\right)\right) \]
      15. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + -1 \cdot \color{blue}{im}\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + im \cdot \color{blue}{-1}\right)\right) \]
    5. Simplified86.4%

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

    if 4.70000000000000018 < im < 1.09999999999999996e103

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \left(\frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
      3. distribute-rgt-outN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(e^{\mathsf{neg}\left(im\right)}\right), \left(e^{im}\right)\right), \left(\color{blue}{\frac{1}{2}} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      6. exp-negN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(e^{im}\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      8. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      9. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
      10. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right) \]
      13. *-lowering-*.f6476.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right) \]
    5. Simplified76.0%

      \[\leadsto \color{blue}{\left(\frac{1}{e^{im}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)} \]
    6. Taylor expanded in im around 0

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\color{blue}{1}, \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
    7. Step-by-step derivation
      1. Simplified75.3%

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

      if 1.09999999999999996e103 < im

      1. Initial program 100.0%

        \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
      2. Add Preprocessing
      3. Taylor expanded in im around 0

        \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
      4. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
        2. distribute-rgt-inN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
        3. associate-+r+N/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
        4. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
        5. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
        6. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
      5. Simplified100.0%

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

        \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + \frac{-1}{6} \cdot \left({im}^{2} \cdot \cos re\right)\right)} \]
      7. Step-by-step derivation
        1. +-commutativeN/A

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

          \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left(\cos re \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
        3. associate-*r*N/A

          \[\leadsto im \cdot \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1} \cdot \cos re\right) \]
        4. *-commutativeN/A

          \[\leadsto im \cdot \left(\left(\cos re \cdot \frac{-1}{6}\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
        5. metadata-evalN/A

          \[\leadsto im \cdot \left(\left(\cos re \cdot \left(\frac{-2}{3} \cdot \frac{1}{4}\right)\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
        6. metadata-evalN/A

          \[\leadsto im \cdot \left(\left(\cos re \cdot \left(\left(\frac{-8}{3} - -2\right) \cdot \frac{1}{4}\right)\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
        7. associate-*l*N/A

          \[\leadsto im \cdot \left(\left(\left(\cos re \cdot \left(\frac{-8}{3} - -2\right)\right) \cdot \frac{1}{4}\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
        8. distribute-rgt-out--N/A

          \[\leadsto im \cdot \left(\left(\left(\frac{-8}{3} \cdot \cos re - -2 \cdot \cos re\right) \cdot \frac{1}{4}\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
        9. *-commutativeN/A

          \[\leadsto im \cdot \left(\left(\frac{1}{4} \cdot \left(\frac{-8}{3} \cdot \cos re - -2 \cdot \cos re\right)\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
        10. +-commutativeN/A

          \[\leadsto im \cdot \left(-1 \cdot \cos re + \color{blue}{\left(\frac{1}{4} \cdot \left(\frac{-8}{3} \cdot \cos re - -2 \cdot \cos re\right)\right) \cdot {im}^{2}}\right) \]
        11. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + \left(\frac{1}{4} \cdot \left(\frac{-8}{3} \cdot \cos re - -2 \cdot \cos re\right)\right) \cdot {im}^{2}\right)}\right) \]
      8. Simplified100.0%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 4.7:\\ \;\;\;\;\cos re \cdot \left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\\ \mathbf{elif}\;im \leq 1.1 \cdot 10^{+103}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(1 - e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(\cos re \cdot \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\\ \end{array} \]
    10. Add Preprocessing

    Alternative 13: 91.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 := -1 + \left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 580:\\ \;\;\;\;\cos re \cdot \left(im\_m \cdot t\_0\right)\\ \mathbf{elif}\;im\_m \leq 1.25 \cdot 10^{+103}:\\ \;\;\;\;\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) \cdot \left(im\_m + \left(re \cdot re\right) \cdot \left(im\_m \cdot -0.5 + 0.041666666666666664 \cdot \left(im\_m \cdot \left(re \cdot re\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;im\_m \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 (+ -1.0 (* (* im_m im_m) -0.16666666666666666))))
       (*
        im_s
        (if (<= im_m 580.0)
          (* (cos re) (* im_m t_0))
          (if (<= im_m 1.25e+103)
            (*
             (+
              -1.0
              (*
               (* im_m im_m)
               (+
                -0.16666666666666666
                (*
                 im_m
                 (*
                  im_m
                  (+
                   -0.008333333333333333
                   (* (* im_m im_m) -0.0001984126984126984)))))))
             (+
              im_m
              (*
               (* re re)
               (+ (* im_m -0.5) (* 0.041666666666666664 (* im_m (* re re)))))))
            (* im_m (* (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 = -1.0 + ((im_m * im_m) * -0.16666666666666666);
    	double tmp;
    	if (im_m <= 580.0) {
    		tmp = cos(re) * (im_m * t_0);
    	} else if (im_m <= 1.25e+103) {
    		tmp = (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))))) * (im_m + ((re * re) * ((im_m * -0.5) + (0.041666666666666664 * (im_m * (re * re))))));
    	} else {
    		tmp = im_m * (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 = (-1.0d0) + ((im_m * im_m) * (-0.16666666666666666d0))
        if (im_m <= 580.0d0) then
            tmp = cos(re) * (im_m * t_0)
        else if (im_m <= 1.25d+103) then
            tmp = ((-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + (im_m * (im_m * ((-0.008333333333333333d0) + ((im_m * im_m) * (-0.0001984126984126984d0)))))))) * (im_m + ((re * re) * ((im_m * (-0.5d0)) + (0.041666666666666664d0 * (im_m * (re * re))))))
        else
            tmp = im_m * (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 = -1.0 + ((im_m * im_m) * -0.16666666666666666);
    	double tmp;
    	if (im_m <= 580.0) {
    		tmp = Math.cos(re) * (im_m * t_0);
    	} else if (im_m <= 1.25e+103) {
    		tmp = (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))))) * (im_m + ((re * re) * ((im_m * -0.5) + (0.041666666666666664 * (im_m * (re * re))))));
    	} else {
    		tmp = im_m * (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 = -1.0 + ((im_m * im_m) * -0.16666666666666666)
    	tmp = 0
    	if im_m <= 580.0:
    		tmp = math.cos(re) * (im_m * t_0)
    	elif im_m <= 1.25e+103:
    		tmp = (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))))) * (im_m + ((re * re) * ((im_m * -0.5) + (0.041666666666666664 * (im_m * (re * re))))))
    	else:
    		tmp = im_m * (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(-1.0 + Float64(Float64(im_m * im_m) * -0.16666666666666666))
    	tmp = 0.0
    	if (im_m <= 580.0)
    		tmp = Float64(cos(re) * Float64(im_m * t_0));
    	elseif (im_m <= 1.25e+103)
    		tmp = Float64(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))))))) * Float64(im_m + Float64(Float64(re * re) * Float64(Float64(im_m * -0.5) + Float64(0.041666666666666664 * Float64(im_m * Float64(re * re)))))));
    	else
    		tmp = Float64(im_m * 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 = -1.0 + ((im_m * im_m) * -0.16666666666666666);
    	tmp = 0.0;
    	if (im_m <= 580.0)
    		tmp = cos(re) * (im_m * t_0);
    	elseif (im_m <= 1.25e+103)
    		tmp = (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))))) * (im_m + ((re * re) * ((im_m * -0.5) + (0.041666666666666664 * (im_m * (re * re))))));
    	else
    		tmp = im_m * (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[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[im$95$m, 580.0], N[(N[Cos[re], $MachinePrecision] * N[(im$95$m * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 1.25e+103], N[(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] * N[(im$95$m + N[(N[(re * re), $MachinePrecision] * N[(N[(im$95$m * -0.5), $MachinePrecision] + N[(0.041666666666666664 * N[(im$95$m * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im$95$m * 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 := -1 + \left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666\\
    im\_s \cdot \begin{array}{l}
    \mathbf{if}\;im\_m \leq 580:\\
    \;\;\;\;\cos re \cdot \left(im\_m \cdot t\_0\right)\\
    
    \mathbf{elif}\;im\_m \leq 1.25 \cdot 10^{+103}:\\
    \;\;\;\;\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) \cdot \left(im\_m + \left(re \cdot re\right) \cdot \left(im\_m \cdot -0.5 + 0.041666666666666664 \cdot \left(im\_m \cdot \left(re \cdot re\right)\right)\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;im\_m \cdot \left(\cos re \cdot t\_0\right)\\
    
    
    \end{array}
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if im < 580

      1. Initial program 46.7%

        \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
      2. Add Preprocessing
      3. Taylor expanded in im around 0

        \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + \frac{-1}{6} \cdot \left({im}^{2} \cdot \cos re\right)\right)} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left({im}^{2} \cdot \cos re\right) + \color{blue}{-1 \cdot \cos re}\right) \]
        2. mul-1-negN/A

          \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left({im}^{2} \cdot \cos re\right) + \left(\mathsf{neg}\left(\cos re\right)\right)\right) \]
        3. unsub-negN/A

          \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left({im}^{2} \cdot \cos re\right) - \color{blue}{\cos re}\right) \]
        4. *-commutativeN/A

          \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left(\cos re \cdot {im}^{2}\right) - \cos re\right) \]
        5. associate-*r*N/A

          \[\leadsto im \cdot \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} - \cos \color{blue}{re}\right) \]
        6. distribute-lft-out--N/A

          \[\leadsto im \cdot \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) - \color{blue}{im \cdot \cos re} \]
        7. associate-*r*N/A

          \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left(\cos re \cdot {im}^{2}\right)\right) - im \cdot \cos re \]
        8. *-commutativeN/A

          \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left({im}^{2} \cdot \cos re\right)\right) - im \cdot \cos re \]
        9. associate-*r*N/A

          \[\leadsto im \cdot \left(\left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \cos re\right) - im \cdot \cos re \]
        10. associate-*r*N/A

          \[\leadsto \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right)\right) \cdot \cos re - \color{blue}{im} \cdot \cos re \]
        11. distribute-rgt-out--N/A

          \[\leadsto \cos re \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) - im\right)} \]
        12. unsub-negN/A

          \[\leadsto \cos re \cdot \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + \color{blue}{\left(\mathsf{neg}\left(im\right)\right)}\right) \]
        13. *-lowering-*.f64N/A

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(\color{blue}{im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right)} + \left(\mathsf{neg}\left(im\right)\right)\right)\right) \]
        15. neg-mul-1N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + -1 \cdot \color{blue}{im}\right)\right) \]
        16. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + im \cdot \color{blue}{-1}\right)\right) \]
      5. Simplified86.0%

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

      if 580 < im < 1.25e103

      1. Initial program 100.0%

        \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
      2. Add Preprocessing
      3. Taylor expanded in im around 0

        \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
      4. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
        2. distribute-rgt-inN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
        3. associate-+r+N/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
        4. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
        5. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
        6. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
      5. Simplified52.7%

        \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + -0.16666666666666666 \cdot \left(im \cdot im\right)\right)\right)\right)} \]
      6. Step-by-step derivation
        1. associate-*r*N/A

          \[\leadsto \left(im \cdot \cos re\right) \cdot \color{blue}{\left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)\right)} \]
        2. *-commutativeN/A

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

          \[\leadsto \mathsf{*.f64}\left(\left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)\right), \color{blue}{\left(im \cdot \cos re\right)}\right) \]
      7. Applied egg-rr52.7%

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

        \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) - 1\right)}, \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      9. Step-by-step derivation
        1. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + \left(\mathsf{neg}\left(1\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        2. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + -1\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        3. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\left(-1 + {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        4. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        5. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left({im}^{2}\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        6. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        7. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        8. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        9. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \frac{-1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        10. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{6} + {im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        11. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        12. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\left(im \cdot im\right) \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        13. associate-*l*N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(im \cdot \left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        15. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        16. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \left(\mathsf{neg}\left(\frac{1}{120}\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        17. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \frac{-1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        18. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{120} + \frac{-1}{5040} \cdot {im}^{2}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        19. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \left(\frac{-1}{5040} \cdot {im}^{2}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        20. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \left({im}^{2} \cdot \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        21. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left({im}^{2}\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        22. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        23. *-lowering-*.f6452.7%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      10. Simplified52.7%

        \[\leadsto \color{blue}{\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)} \cdot \left(im \cdot \cos re\right) \]
      11. Taylor expanded in re around 0

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \color{blue}{\left(im + {re}^{2} \cdot \left(\frac{-1}{2} \cdot im + \frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)\right)}\right) \]
      12. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \color{blue}{\left({re}^{2} \cdot \left(\frac{-1}{2} \cdot im + \frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)\right)}\right)\right) \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\left({re}^{2}\right), \color{blue}{\left(\frac{-1}{2} \cdot im + \frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)}\right)\right)\right) \]
        3. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\left(re \cdot re\right), \left(\color{blue}{\frac{-1}{2} \cdot im} + \frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)\right)\right)\right) \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \left(\color{blue}{\frac{-1}{2} \cdot im} + \frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)\right)\right)\right) \]
        5. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\left(\frac{-1}{2} \cdot im\right), \color{blue}{\left(\frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)}\right)\right)\right)\right) \]
        6. *-commutativeN/A

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(im, \frac{-1}{2}\right), \left(\color{blue}{\frac{1}{24}} \cdot \left(im \cdot {re}^{2}\right)\right)\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(im, \frac{-1}{2}\right), \mathsf{*.f64}\left(\frac{1}{24}, \color{blue}{\left(im \cdot {re}^{2}\right)}\right)\right)\right)\right)\right) \]
        9. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(im, \frac{-1}{2}\right), \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, \color{blue}{\left({re}^{2}\right)}\right)\right)\right)\right)\right)\right) \]
        10. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(im, \frac{-1}{2}\right), \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, \left(re \cdot \color{blue}{re}\right)\right)\right)\right)\right)\right)\right) \]
        11. *-lowering-*.f6459.3%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(im, \frac{-1}{2}\right), \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right)\right)\right)\right) \]
      13. Simplified59.3%

        \[\leadsto \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) \cdot \color{blue}{\left(im + \left(re \cdot re\right) \cdot \left(im \cdot -0.5 + 0.041666666666666664 \cdot \left(im \cdot \left(re \cdot re\right)\right)\right)\right)} \]

      if 1.25e103 < im

      1. Initial program 100.0%

        \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
      2. Add Preprocessing
      3. Taylor expanded in im around 0

        \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
      4. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
        2. distribute-rgt-inN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
        3. associate-+r+N/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
        4. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
        5. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
        6. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
      5. Simplified100.0%

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

        \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + \frac{-1}{6} \cdot \left({im}^{2} \cdot \cos re\right)\right)} \]
      7. Step-by-step derivation
        1. +-commutativeN/A

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

          \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left(\cos re \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
        3. associate-*r*N/A

          \[\leadsto im \cdot \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1} \cdot \cos re\right) \]
        4. *-commutativeN/A

          \[\leadsto im \cdot \left(\left(\cos re \cdot \frac{-1}{6}\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
        5. metadata-evalN/A

          \[\leadsto im \cdot \left(\left(\cos re \cdot \left(\frac{-2}{3} \cdot \frac{1}{4}\right)\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
        6. metadata-evalN/A

          \[\leadsto im \cdot \left(\left(\cos re \cdot \left(\left(\frac{-8}{3} - -2\right) \cdot \frac{1}{4}\right)\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
        7. associate-*l*N/A

          \[\leadsto im \cdot \left(\left(\left(\cos re \cdot \left(\frac{-8}{3} - -2\right)\right) \cdot \frac{1}{4}\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
        8. distribute-rgt-out--N/A

          \[\leadsto im \cdot \left(\left(\left(\frac{-8}{3} \cdot \cos re - -2 \cdot \cos re\right) \cdot \frac{1}{4}\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
        9. *-commutativeN/A

          \[\leadsto im \cdot \left(\left(\frac{1}{4} \cdot \left(\frac{-8}{3} \cdot \cos re - -2 \cdot \cos re\right)\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
        10. +-commutativeN/A

          \[\leadsto im \cdot \left(-1 \cdot \cos re + \color{blue}{\left(\frac{1}{4} \cdot \left(\frac{-8}{3} \cdot \cos re - -2 \cdot \cos re\right)\right) \cdot {im}^{2}}\right) \]
        11. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + \left(\frac{1}{4} \cdot \left(\frac{-8}{3} \cdot \cos re - -2 \cdot \cos re\right)\right) \cdot {im}^{2}\right)}\right) \]
      8. Simplified100.0%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 580:\\ \;\;\;\;\cos re \cdot \left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\\ \mathbf{elif}\;im \leq 1.25 \cdot 10^{+103}:\\ \;\;\;\;\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) \cdot \left(im + \left(re \cdot re\right) \cdot \left(im \cdot -0.5 + 0.041666666666666664 \cdot \left(im \cdot \left(re \cdot re\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(\cos re \cdot \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\\ \end{array} \]
    5. Add Preprocessing

    Alternative 14: 91.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(\cos re \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666\right)\right)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 460:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;im\_m \leq 1.4 \cdot 10^{+103}:\\ \;\;\;\;\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) \cdot \left(im\_m + \left(re \cdot re\right) \cdot \left(im\_m \cdot -0.5 + 0.041666666666666664 \cdot \left(im\_m \cdot \left(re \cdot re\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \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
              (* (cos re) (+ -1.0 (* (* im_m im_m) -0.16666666666666666))))))
       (*
        im_s
        (if (<= im_m 460.0)
          t_0
          (if (<= im_m 1.4e+103)
            (*
             (+
              -1.0
              (*
               (* im_m im_m)
               (+
                -0.16666666666666666
                (*
                 im_m
                 (*
                  im_m
                  (+
                   -0.008333333333333333
                   (* (* im_m im_m) -0.0001984126984126984)))))))
             (+
              im_m
              (*
               (* re re)
               (+ (* im_m -0.5) (* 0.041666666666666664 (* im_m (* re 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 * (cos(re) * (-1.0 + ((im_m * im_m) * -0.16666666666666666)));
    	double tmp;
    	if (im_m <= 460.0) {
    		tmp = t_0;
    	} else if (im_m <= 1.4e+103) {
    		tmp = (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))))) * (im_m + ((re * re) * ((im_m * -0.5) + (0.041666666666666664 * (im_m * (re * re))))));
    	} else {
    		tmp = 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 * (cos(re) * ((-1.0d0) + ((im_m * im_m) * (-0.16666666666666666d0))))
        if (im_m <= 460.0d0) then
            tmp = t_0
        else if (im_m <= 1.4d+103) then
            tmp = ((-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + (im_m * (im_m * ((-0.008333333333333333d0) + ((im_m * im_m) * (-0.0001984126984126984d0)))))))) * (im_m + ((re * re) * ((im_m * (-0.5d0)) + (0.041666666666666664d0 * (im_m * (re * re))))))
        else
            tmp = 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 * (Math.cos(re) * (-1.0 + ((im_m * im_m) * -0.16666666666666666)));
    	double tmp;
    	if (im_m <= 460.0) {
    		tmp = t_0;
    	} else if (im_m <= 1.4e+103) {
    		tmp = (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))))) * (im_m + ((re * re) * ((im_m * -0.5) + (0.041666666666666664 * (im_m * (re * re))))));
    	} else {
    		tmp = 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 * (math.cos(re) * (-1.0 + ((im_m * im_m) * -0.16666666666666666)))
    	tmp = 0
    	if im_m <= 460.0:
    		tmp = t_0
    	elif im_m <= 1.4e+103:
    		tmp = (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))))) * (im_m + ((re * re) * ((im_m * -0.5) + (0.041666666666666664 * (im_m * (re * re))))))
    	else:
    		tmp = 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(cos(re) * Float64(-1.0 + Float64(Float64(im_m * im_m) * -0.16666666666666666))))
    	tmp = 0.0
    	if (im_m <= 460.0)
    		tmp = t_0;
    	elseif (im_m <= 1.4e+103)
    		tmp = Float64(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))))))) * Float64(im_m + Float64(Float64(re * re) * Float64(Float64(im_m * -0.5) + Float64(0.041666666666666664 * Float64(im_m * Float64(re * re)))))));
    	else
    		tmp = 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 * (cos(re) * (-1.0 + ((im_m * im_m) * -0.16666666666666666)));
    	tmp = 0.0;
    	if (im_m <= 460.0)
    		tmp = t_0;
    	elseif (im_m <= 1.4e+103)
    		tmp = (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))))) * (im_m + ((re * re) * ((im_m * -0.5) + (0.041666666666666664 * (im_m * (re * re))))));
    	else
    		tmp = 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[(N[Cos[re], $MachinePrecision] * N[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[im$95$m, 460.0], t$95$0, If[LessEqual[im$95$m, 1.4e+103], N[(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] * N[(im$95$m + N[(N[(re * re), $MachinePrecision] * N[(N[(im$95$m * -0.5), $MachinePrecision] + N[(0.041666666666666664 * N[(im$95$m * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]), $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(\cos re \cdot \left(-1 + \left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666\right)\right)\\
    im\_s \cdot \begin{array}{l}
    \mathbf{if}\;im\_m \leq 460:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;im\_m \leq 1.4 \cdot 10^{+103}:\\
    \;\;\;\;\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) \cdot \left(im\_m + \left(re \cdot re\right) \cdot \left(im\_m \cdot -0.5 + 0.041666666666666664 \cdot \left(im\_m \cdot \left(re \cdot re\right)\right)\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if im < 460 or 1.40000000000000004e103 < im

      1. Initial program 55.2%

        \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
      2. Add Preprocessing
      3. Taylor expanded in im around 0

        \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
      4. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
        2. distribute-rgt-inN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
        3. associate-+r+N/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
        4. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
        5. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
        6. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
      5. Simplified93.6%

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

        \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + \frac{-1}{6} \cdot \left({im}^{2} \cdot \cos re\right)\right)} \]
      7. Step-by-step derivation
        1. +-commutativeN/A

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

          \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left(\cos re \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
        3. associate-*r*N/A

          \[\leadsto im \cdot \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1} \cdot \cos re\right) \]
        4. *-commutativeN/A

          \[\leadsto im \cdot \left(\left(\cos re \cdot \frac{-1}{6}\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
        5. metadata-evalN/A

          \[\leadsto im \cdot \left(\left(\cos re \cdot \left(\frac{-2}{3} \cdot \frac{1}{4}\right)\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
        6. metadata-evalN/A

          \[\leadsto im \cdot \left(\left(\cos re \cdot \left(\left(\frac{-8}{3} - -2\right) \cdot \frac{1}{4}\right)\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
        7. associate-*l*N/A

          \[\leadsto im \cdot \left(\left(\left(\cos re \cdot \left(\frac{-8}{3} - -2\right)\right) \cdot \frac{1}{4}\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
        8. distribute-rgt-out--N/A

          \[\leadsto im \cdot \left(\left(\left(\frac{-8}{3} \cdot \cos re - -2 \cdot \cos re\right) \cdot \frac{1}{4}\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
        9. *-commutativeN/A

          \[\leadsto im \cdot \left(\left(\frac{1}{4} \cdot \left(\frac{-8}{3} \cdot \cos re - -2 \cdot \cos re\right)\right) \cdot {im}^{2} + -1 \cdot \cos re\right) \]
        10. +-commutativeN/A

          \[\leadsto im \cdot \left(-1 \cdot \cos re + \color{blue}{\left(\frac{1}{4} \cdot \left(\frac{-8}{3} \cdot \cos re - -2 \cdot \cos re\right)\right) \cdot {im}^{2}}\right) \]
        11. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + \left(\frac{1}{4} \cdot \left(\frac{-8}{3} \cdot \cos re - -2 \cdot \cos re\right)\right) \cdot {im}^{2}\right)}\right) \]
      8. Simplified88.3%

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

      if 460 < im < 1.40000000000000004e103

      1. Initial program 100.0%

        \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
      2. Add Preprocessing
      3. Taylor expanded in im around 0

        \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
      4. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
        2. distribute-rgt-inN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
        3. associate-+r+N/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
        4. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
        5. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
        6. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
      5. Simplified52.7%

        \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + -0.16666666666666666 \cdot \left(im \cdot im\right)\right)\right)\right)} \]
      6. Step-by-step derivation
        1. associate-*r*N/A

          \[\leadsto \left(im \cdot \cos re\right) \cdot \color{blue}{\left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)\right)} \]
        2. *-commutativeN/A

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

          \[\leadsto \mathsf{*.f64}\left(\left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)\right), \color{blue}{\left(im \cdot \cos re\right)}\right) \]
      7. Applied egg-rr52.7%

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

        \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) - 1\right)}, \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      9. Step-by-step derivation
        1. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + \left(\mathsf{neg}\left(1\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        2. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + -1\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        3. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\left(-1 + {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        4. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        5. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left({im}^{2}\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        6. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        7. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        8. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        9. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \frac{-1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        10. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{6} + {im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        11. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        12. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\left(im \cdot im\right) \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        13. associate-*l*N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(im \cdot \left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        15. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        16. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \left(\mathsf{neg}\left(\frac{1}{120}\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        17. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \frac{-1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        18. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{120} + \frac{-1}{5040} \cdot {im}^{2}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        19. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \left(\frac{-1}{5040} \cdot {im}^{2}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        20. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \left({im}^{2} \cdot \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        21. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left({im}^{2}\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        22. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
        23. *-lowering-*.f6452.7%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      10. Simplified52.7%

        \[\leadsto \color{blue}{\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)} \cdot \left(im \cdot \cos re\right) \]
      11. Taylor expanded in re around 0

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \color{blue}{\left(im + {re}^{2} \cdot \left(\frac{-1}{2} \cdot im + \frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)\right)}\right) \]
      12. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \color{blue}{\left({re}^{2} \cdot \left(\frac{-1}{2} \cdot im + \frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)\right)}\right)\right) \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\left({re}^{2}\right), \color{blue}{\left(\frac{-1}{2} \cdot im + \frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)}\right)\right)\right) \]
        3. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\left(re \cdot re\right), \left(\color{blue}{\frac{-1}{2} \cdot im} + \frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)\right)\right)\right) \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \left(\color{blue}{\frac{-1}{2} \cdot im} + \frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)\right)\right)\right) \]
        5. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\left(\frac{-1}{2} \cdot im\right), \color{blue}{\left(\frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)}\right)\right)\right)\right) \]
        6. *-commutativeN/A

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(im, \frac{-1}{2}\right), \left(\color{blue}{\frac{1}{24}} \cdot \left(im \cdot {re}^{2}\right)\right)\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(im, \frac{-1}{2}\right), \mathsf{*.f64}\left(\frac{1}{24}, \color{blue}{\left(im \cdot {re}^{2}\right)}\right)\right)\right)\right)\right) \]
        9. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(im, \frac{-1}{2}\right), \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, \color{blue}{\left({re}^{2}\right)}\right)\right)\right)\right)\right)\right) \]
        10. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(im, \frac{-1}{2}\right), \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, \left(re \cdot \color{blue}{re}\right)\right)\right)\right)\right)\right)\right) \]
        11. *-lowering-*.f6459.3%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(im, \frac{-1}{2}\right), \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right)\right)\right)\right) \]
      13. Simplified59.3%

        \[\leadsto \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) \cdot \color{blue}{\left(im + \left(re \cdot re\right) \cdot \left(im \cdot -0.5 + 0.041666666666666664 \cdot \left(im \cdot \left(re \cdot re\right)\right)\right)\right)} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification85.5%

      \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 460:\\ \;\;\;\;im \cdot \left(\cos re \cdot \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\\ \mathbf{elif}\;im \leq 1.4 \cdot 10^{+103}:\\ \;\;\;\;\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) \cdot \left(im + \left(re \cdot re\right) \cdot \left(im \cdot -0.5 + 0.041666666666666664 \cdot \left(im \cdot \left(re \cdot re\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(\cos re \cdot \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\\ \end{array} \]
    5. Add Preprocessing

    Alternative 15: 83.2% accurate, 2.8× 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 600:\\ \;\;\;\;\cos re \cdot \left(0 - im\_m\right)\\ \mathbf{elif}\;im\_m \leq 5 \cdot 10^{+121}:\\ \;\;\;\;im\_m \cdot \left(\left(1 + re \cdot \left(re \cdot \left(-0.5 + \left(re \cdot re\right) \cdot 0.041666666666666664\right)\right)\right) \cdot \left(\left(-1 + \left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + \left(im\_m \cdot im\_m\right) \cdot -0.0001984126984126984\right) \cdot \left(im\_m \cdot \left(im\_m \cdot \left(im\_m \cdot im\_m\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;im\_m \cdot \left(\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot -0.3333333333333333\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 600.0)
        (* (cos re) (- 0.0 im_m))
        (if (<= im_m 5e+121)
          (*
           im_m
           (*
            (+ 1.0 (* re (* re (+ -0.5 (* (* re re) 0.041666666666666664)))))
            (+
             (+ -1.0 (* (* im_m im_m) -0.16666666666666666))
             (*
              (+ -0.008333333333333333 (* (* im_m im_m) -0.0001984126984126984))
              (* im_m (* im_m (* im_m im_m)))))))
          (*
           im_m
           (*
            (+ 0.5 (* -0.25 (* re re)))
            (+ -2.0 (* (* 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 <= 600.0) {
    		tmp = cos(re) * (0.0 - im_m);
    	} else if (im_m <= 5e+121) {
    		tmp = im_m * ((1.0 + (re * (re * (-0.5 + ((re * re) * 0.041666666666666664))))) * ((-1.0 + ((im_m * im_m) * -0.16666666666666666)) + ((-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)) * (im_m * (im_m * (im_m * im_m))))));
    	} else {
    		tmp = im_m * ((0.5 + (-0.25 * (re * re))) * (-2.0 + ((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 <= 600.0d0) then
            tmp = cos(re) * (0.0d0 - im_m)
        else if (im_m <= 5d+121) then
            tmp = im_m * ((1.0d0 + (re * (re * ((-0.5d0) + ((re * re) * 0.041666666666666664d0))))) * (((-1.0d0) + ((im_m * im_m) * (-0.16666666666666666d0))) + (((-0.008333333333333333d0) + ((im_m * im_m) * (-0.0001984126984126984d0))) * (im_m * (im_m * (im_m * im_m))))))
        else
            tmp = im_m * ((0.5d0 + ((-0.25d0) * (re * re))) * ((-2.0d0) + ((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 <= 600.0) {
    		tmp = Math.cos(re) * (0.0 - im_m);
    	} else if (im_m <= 5e+121) {
    		tmp = im_m * ((1.0 + (re * (re * (-0.5 + ((re * re) * 0.041666666666666664))))) * ((-1.0 + ((im_m * im_m) * -0.16666666666666666)) + ((-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)) * (im_m * (im_m * (im_m * im_m))))));
    	} else {
    		tmp = im_m * ((0.5 + (-0.25 * (re * re))) * (-2.0 + ((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 <= 600.0:
    		tmp = math.cos(re) * (0.0 - im_m)
    	elif im_m <= 5e+121:
    		tmp = im_m * ((1.0 + (re * (re * (-0.5 + ((re * re) * 0.041666666666666664))))) * ((-1.0 + ((im_m * im_m) * -0.16666666666666666)) + ((-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)) * (im_m * (im_m * (im_m * im_m))))))
    	else:
    		tmp = im_m * ((0.5 + (-0.25 * (re * re))) * (-2.0 + ((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 <= 600.0)
    		tmp = Float64(cos(re) * Float64(0.0 - im_m));
    	elseif (im_m <= 5e+121)
    		tmp = Float64(im_m * Float64(Float64(1.0 + Float64(re * Float64(re * Float64(-0.5 + Float64(Float64(re * re) * 0.041666666666666664))))) * Float64(Float64(-1.0 + Float64(Float64(im_m * im_m) * -0.16666666666666666)) + Float64(Float64(-0.008333333333333333 + Float64(Float64(im_m * im_m) * -0.0001984126984126984)) * Float64(im_m * Float64(im_m * Float64(im_m * im_m)))))));
    	else
    		tmp = Float64(im_m * Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * Float64(-2.0 + Float64(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 <= 600.0)
    		tmp = cos(re) * (0.0 - im_m);
    	elseif (im_m <= 5e+121)
    		tmp = im_m * ((1.0 + (re * (re * (-0.5 + ((re * re) * 0.041666666666666664))))) * ((-1.0 + ((im_m * im_m) * -0.16666666666666666)) + ((-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)) * (im_m * (im_m * (im_m * im_m))))));
    	else
    		tmp = im_m * ((0.5 + (-0.25 * (re * re))) * (-2.0 + ((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, 600.0], N[(N[Cos[re], $MachinePrecision] * N[(0.0 - im$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 5e+121], N[(im$95$m * N[(N[(1.0 + N[(re * N[(re * N[(-0.5 + N[(N[(re * re), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.008333333333333333 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision] * N[(im$95$m * N[(im$95$m * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im$95$m * N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-2.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.3333333333333333), $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 600:\\
    \;\;\;\;\cos re \cdot \left(0 - im\_m\right)\\
    
    \mathbf{elif}\;im\_m \leq 5 \cdot 10^{+121}:\\
    \;\;\;\;im\_m \cdot \left(\left(1 + re \cdot \left(re \cdot \left(-0.5 + \left(re \cdot re\right) \cdot 0.041666666666666664\right)\right)\right) \cdot \left(\left(-1 + \left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + \left(im\_m \cdot im\_m\right) \cdot -0.0001984126984126984\right) \cdot \left(im\_m \cdot \left(im\_m \cdot \left(im\_m \cdot im\_m\right)\right)\right)\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;im\_m \cdot \left(\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot -0.3333333333333333\right)\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if im < 600

      1. Initial program 46.7%

        \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
      2. Add Preprocessing
      3. Taylor expanded in im around 0

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

          \[\leadsto \mathsf{neg}\left(im \cdot \cos re\right) \]
        2. neg-sub0N/A

          \[\leadsto 0 - \color{blue}{im \cdot \cos re} \]
        3. --lowering--.f64N/A

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

          \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \color{blue}{\cos re}\right)\right) \]
        5. cos-lowering-cos.f6460.8%

          \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      5. Simplified60.8%

        \[\leadsto \color{blue}{0 - im \cdot \cos re} \]
      6. Step-by-step derivation
        1. sub0-negN/A

          \[\leadsto \mathsf{neg}\left(im \cdot \cos re\right) \]
        2. neg-lowering-neg.f64N/A

          \[\leadsto \mathsf{neg.f64}\left(\left(im \cdot \cos re\right)\right) \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(im, \cos re\right)\right) \]
        4. cos-lowering-cos.f6460.8%

          \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
      7. Applied egg-rr60.8%

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

      if 600 < im < 5.00000000000000007e121

      1. Initial program 100.0%

        \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
      2. Add Preprocessing
      3. Taylor expanded in im around 0

        \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
      4. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
        2. distribute-rgt-inN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
        3. associate-+r+N/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
        4. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
        5. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
        6. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
      5. Simplified62.2%

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

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\color{blue}{\left(1 + {re}^{2} \cdot \left(\frac{1}{24} \cdot {re}^{2} - \frac{1}{2}\right)\right)}, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
      7. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left({re}^{2} \cdot \left(\frac{1}{24} \cdot {re}^{2} - \frac{1}{2}\right)\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)}, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        2. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(\left(re \cdot re\right) \cdot \left(\frac{1}{24} \cdot {re}^{2} - \frac{1}{2}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        3. associate-*l*N/A

          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(re \cdot \left(re \cdot \left(\frac{1}{24} \cdot {re}^{2} - \frac{1}{2}\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \color{blue}{\mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, im\right)\right)\right)}\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \left(re \cdot \left(\frac{1}{24} \cdot {re}^{2} - \frac{1}{2}\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \color{blue}{\mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, im\right)\right)\right)}\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        5. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \left(\frac{1}{24} \cdot {re}^{2} - \frac{1}{2}\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \mathsf{*.f64}\left(im, \color{blue}{\mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        6. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \left(\frac{1}{24} \cdot {re}^{2} + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\mathsf{*.f64}\left(im, im\right)}\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        7. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \left(\frac{1}{24} \cdot {re}^{2} + \frac{-1}{2}\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        8. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \left(\frac{-1}{2} + \frac{1}{24} \cdot {re}^{2}\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\mathsf{*.f64}\left(im, im\right)}\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        9. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{-1}{2}, \left(\frac{1}{24} \cdot {re}^{2}\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\mathsf{*.f64}\left(im, im\right)}\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        10. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{-1}{2}, \left({re}^{2} \cdot \frac{1}{24}\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        11. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\left({re}^{2}\right), \frac{1}{24}\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        12. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\left(re \cdot re\right), \frac{1}{24}\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        13. *-lowering-*.f6467.5%

          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \frac{1}{24}\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
      8. Simplified67.5%

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

      if 5.00000000000000007e121 < im

      1. Initial program 100.0%

        \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
      2. Add Preprocessing
      3. Taylor expanded in re around 0

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right)} \]
        2. associate-*r*N/A

          \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \left(\frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
        3. distribute-rgt-outN/A

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(e^{\mathsf{neg}\left(im\right)}\right), \left(e^{im}\right)\right), \left(\color{blue}{\frac{1}{2}} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
        6. exp-negN/A

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(e^{im}\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
        8. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
        9. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
        10. +-lowering-+.f64N/A

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right) \]
        12. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right) \]
        13. *-lowering-*.f6480.6%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right) \]
      5. Simplified80.6%

        \[\leadsto \color{blue}{\left(\frac{1}{e^{im}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)} \]
      6. Taylor expanded in im around 0

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

          \[\leadsto im \cdot \left(-2 \cdot \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right) + \left({im}^{2} \cdot \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \cdot \color{blue}{\frac{-1}{3}}\right) \]
        2. associate-*r*N/A

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

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(im, \left(\left(\frac{-1}{3} \cdot {im}^{2}\right) \cdot \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right) + -2 \cdot \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right)\right) \]
        8. distribute-rgt-outN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(\frac{-1}{3} \cdot {im}^{2} + -2\right)}\right)\right) \]
        9. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right) \cdot \left(\frac{-1}{3} \cdot {im}^{2} + \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right) \]
        10. sub-negN/A

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

          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right), \color{blue}{\left(\frac{-1}{3} \cdot {im}^{2} - 2\right)}\right)\right) \]
      8. Simplified80.6%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 600:\\ \;\;\;\;\cos re \cdot \left(0 - im\right)\\ \mathbf{elif}\;im \leq 5 \cdot 10^{+121}:\\ \;\;\;\;im \cdot \left(\left(1 + re \cdot \left(re \cdot \left(-0.5 + \left(re \cdot re\right) \cdot 0.041666666666666664\right)\right)\right) \cdot \left(\left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) + \left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)\\ \end{array} \]
    5. Add Preprocessing

    Alternative 16: 61.8% accurate, 3.0× speedup?

    \[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := -0.16666666666666666 + im\_m \cdot \left(im\_m \cdot \left(-0.008333333333333333 + im\_m \cdot \left(im\_m \cdot -0.0001984126984126984\right)\right)\right)\\ t_1 := im\_m \cdot \left(im\_m \cdot t\_0\right)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 3.4 \cdot 10^{+24}:\\ \;\;\;\;\frac{im\_m \cdot \left(-1 + t\_1 \cdot \left(\left(\left(im\_m \cdot im\_m\right) \cdot \left(im\_m \cdot im\_m\right)\right) \cdot \left(t\_0 \cdot t\_0\right)\right)\right)}{1 + t\_1 \cdot \left(t\_1 - -1\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(im\_m \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.3333333333333333 + im\_m \cdot \left(im\_m \cdot \left(-0.016666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.0003968253968253968\right)\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
             (+
              -0.16666666666666666
              (*
               im_m
               (*
                im_m
                (+
                 -0.008333333333333333
                 (* im_m (* im_m -0.0001984126984126984)))))))
            (t_1 (* im_m (* im_m t_0))))
       (*
        im_s
        (if (<= im_m 3.4e+24)
          (/
           (*
            im_m
            (+ -1.0 (* t_1 (* (* (* im_m im_m) (* im_m im_m)) (* t_0 t_0)))))
           (+ 1.0 (* t_1 (- t_1 -1.0))))
          (*
           (+ 0.5 (* -0.25 (* re re)))
           (*
            im_m
            (+
             -2.0
             (*
              (* im_m im_m)
              (+
               -0.3333333333333333
               (*
                im_m
                (*
                 im_m
                 (+
                  -0.016666666666666666
                  (* (* im_m im_m) -0.0003968253968253968)))))))))))))
    im\_m = fabs(im);
    im\_s = copysign(1.0, im);
    double code(double im_s, double re, double im_m) {
    	double t_0 = -0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + (im_m * (im_m * -0.0001984126984126984)))));
    	double t_1 = im_m * (im_m * t_0);
    	double tmp;
    	if (im_m <= 3.4e+24) {
    		tmp = (im_m * (-1.0 + (t_1 * (((im_m * im_m) * (im_m * im_m)) * (t_0 * t_0))))) / (1.0 + (t_1 * (t_1 - -1.0)));
    	} else {
    		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * (-2.0 + ((im_m * im_m) * (-0.3333333333333333 + (im_m * (im_m * (-0.016666666666666666 + ((im_m * im_m) * -0.0003968253968253968))))))));
    	}
    	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) :: tmp
        t_0 = (-0.16666666666666666d0) + (im_m * (im_m * ((-0.008333333333333333d0) + (im_m * (im_m * (-0.0001984126984126984d0))))))
        t_1 = im_m * (im_m * t_0)
        if (im_m <= 3.4d+24) then
            tmp = (im_m * ((-1.0d0) + (t_1 * (((im_m * im_m) * (im_m * im_m)) * (t_0 * t_0))))) / (1.0d0 + (t_1 * (t_1 - (-1.0d0))))
        else
            tmp = (0.5d0 + ((-0.25d0) * (re * re))) * (im_m * ((-2.0d0) + ((im_m * im_m) * ((-0.3333333333333333d0) + (im_m * (im_m * ((-0.016666666666666666d0) + ((im_m * im_m) * (-0.0003968253968253968d0)))))))))
        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 = -0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + (im_m * (im_m * -0.0001984126984126984)))));
    	double t_1 = im_m * (im_m * t_0);
    	double tmp;
    	if (im_m <= 3.4e+24) {
    		tmp = (im_m * (-1.0 + (t_1 * (((im_m * im_m) * (im_m * im_m)) * (t_0 * t_0))))) / (1.0 + (t_1 * (t_1 - -1.0)));
    	} else {
    		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * (-2.0 + ((im_m * im_m) * (-0.3333333333333333 + (im_m * (im_m * (-0.016666666666666666 + ((im_m * im_m) * -0.0003968253968253968))))))));
    	}
    	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 = -0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + (im_m * (im_m * -0.0001984126984126984)))))
    	t_1 = im_m * (im_m * t_0)
    	tmp = 0
    	if im_m <= 3.4e+24:
    		tmp = (im_m * (-1.0 + (t_1 * (((im_m * im_m) * (im_m * im_m)) * (t_0 * t_0))))) / (1.0 + (t_1 * (t_1 - -1.0)))
    	else:
    		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * (-2.0 + ((im_m * im_m) * (-0.3333333333333333 + (im_m * (im_m * (-0.016666666666666666 + ((im_m * im_m) * -0.0003968253968253968))))))))
    	return im_s * tmp
    
    im\_m = abs(im)
    im\_s = copysign(1.0, im)
    function code(im_s, re, im_m)
    	t_0 = Float64(-0.16666666666666666 + Float64(im_m * Float64(im_m * Float64(-0.008333333333333333 + Float64(im_m * Float64(im_m * -0.0001984126984126984))))))
    	t_1 = Float64(im_m * Float64(im_m * t_0))
    	tmp = 0.0
    	if (im_m <= 3.4e+24)
    		tmp = Float64(Float64(im_m * Float64(-1.0 + Float64(t_1 * Float64(Float64(Float64(im_m * im_m) * Float64(im_m * im_m)) * Float64(t_0 * t_0))))) / Float64(1.0 + Float64(t_1 * Float64(t_1 - -1.0))));
    	else
    		tmp = Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * Float64(im_m * Float64(-2.0 + Float64(Float64(im_m * im_m) * Float64(-0.3333333333333333 + Float64(im_m * Float64(im_m * Float64(-0.016666666666666666 + Float64(Float64(im_m * im_m) * -0.0003968253968253968)))))))));
    	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 = -0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + (im_m * (im_m * -0.0001984126984126984)))));
    	t_1 = im_m * (im_m * t_0);
    	tmp = 0.0;
    	if (im_m <= 3.4e+24)
    		tmp = (im_m * (-1.0 + (t_1 * (((im_m * im_m) * (im_m * im_m)) * (t_0 * t_0))))) / (1.0 + (t_1 * (t_1 - -1.0)));
    	else
    		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * (-2.0 + ((im_m * im_m) * (-0.3333333333333333 + (im_m * (im_m * (-0.016666666666666666 + ((im_m * im_m) * -0.0003968253968253968))))))));
    	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[(-0.16666666666666666 + N[(im$95$m * N[(im$95$m * N[(-0.008333333333333333 + N[(im$95$m * N[(im$95$m * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(im$95$m * N[(im$95$m * t$95$0), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[im$95$m, 3.4e+24], N[(N[(im$95$m * N[(-1.0 + N[(t$95$1 * N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(t$95$1 * N[(t$95$1 - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(im$95$m * N[(-2.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(-0.3333333333333333 + N[(im$95$m * N[(im$95$m * N[(-0.016666666666666666 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.0003968253968253968), $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)
    
    \\
    \begin{array}{l}
    t_0 := -0.16666666666666666 + im\_m \cdot \left(im\_m \cdot \left(-0.008333333333333333 + im\_m \cdot \left(im\_m \cdot -0.0001984126984126984\right)\right)\right)\\
    t_1 := im\_m \cdot \left(im\_m \cdot t\_0\right)\\
    im\_s \cdot \begin{array}{l}
    \mathbf{if}\;im\_m \leq 3.4 \cdot 10^{+24}:\\
    \;\;\;\;\frac{im\_m \cdot \left(-1 + t\_1 \cdot \left(\left(\left(im\_m \cdot im\_m\right) \cdot \left(im\_m \cdot im\_m\right)\right) \cdot \left(t\_0 \cdot t\_0\right)\right)\right)}{1 + t\_1 \cdot \left(t\_1 - -1\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(im\_m \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.3333333333333333 + im\_m \cdot \left(im\_m \cdot \left(-0.016666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.0003968253968253968\right)\right)\right)\right)\right)\\
    
    
    \end{array}
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if im < 3.4000000000000001e24

      1. Initial program 48.5%

        \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
      2. Add Preprocessing
      3. Taylor expanded in im around 0

        \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
      4. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
        2. distribute-rgt-inN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
        3. associate-+r+N/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
        4. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
        5. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
        6. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
      5. Simplified89.3%

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

        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\color{blue}{1}, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
      7. Step-by-step derivation
        1. Simplified58.3%

          \[\leadsto im \cdot \left(\color{blue}{1} \cdot \left(\left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + -0.16666666666666666 \cdot \left(im \cdot im\right)\right)\right)\right) \]
        2. Step-by-step derivation
          1. *-lft-identityN/A

            \[\leadsto \mathsf{*.f64}\left(im, \left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \color{blue}{\left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)}\right)\right) \]
          2. flip-+N/A

            \[\leadsto \mathsf{*.f64}\left(im, \left(\frac{\left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right) - \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right) \cdot \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)}{\color{blue}{\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) - \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)}}\right)\right) \]
          3. div-subN/A

            \[\leadsto \mathsf{*.f64}\left(im, \left(\frac{\left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)}{\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) - \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)} - \color{blue}{\frac{\left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right) \cdot \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)}{\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) - \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)}}\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{*.f64}\left(im, \mathsf{\_.f64}\left(\left(\frac{\left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)}{\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) - \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)}\right), \color{blue}{\left(\frac{\left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right) \cdot \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)}{\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) - \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)}\right)}\right)\right) \]
        3. Applied egg-rr36.4%

          \[\leadsto im \cdot \color{blue}{\left(\frac{\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(\left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot \left(\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)\right)}{\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) - \left(-1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right)} - \frac{\left(-1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) \cdot \left(-1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right)}{\left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) - \left(-1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right)}\right)} \]
        4. Applied egg-rr36.3%

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

        if 3.4000000000000001e24 < im

        1. Initial program 100.0%

          \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
        2. Add Preprocessing
        3. Taylor expanded in re around 0

          \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
        4. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right)} \]
          2. associate-*r*N/A

            \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \left(\frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
          3. distribute-rgt-outN/A

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

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(e^{\mathsf{neg}\left(im\right)}\right), \left(e^{im}\right)\right), \left(\color{blue}{\frac{1}{2}} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
          6. exp-negN/A

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(e^{im}\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
          8. exp-lowering-exp.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
          9. exp-lowering-exp.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
          10. +-lowering-+.f64N/A

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right) \]
          12. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right) \]
          13. *-lowering-*.f6477.8%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right) \]
        5. Simplified77.8%

          \[\leadsto \color{blue}{\left(\frac{1}{e^{im}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)} \]
        6. Taylor expanded in im around 0

          \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(im \cdot \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right)\right)}, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
        7. Step-by-step derivation
          1. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right)\right), \mathsf{+.f64}\left(\color{blue}{\frac{1}{2}}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
          2. sub-negN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) + \left(\mathsf{neg}\left(2\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
          3. metadata-evalN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) + -2\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
          4. +-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \left(-2 + {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
          5. +-lowering-+.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
          6. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\left({im}^{2}\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
          7. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\left(im \cdot im\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
          8. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
          9. sub-negN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
          10. metadata-evalN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) + \frac{-1}{3}\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
          11. +-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{3} + {im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
          12. +-lowering-+.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
          13. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \left(\left(im \cdot im\right) \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
          14. associate-*l*N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \left(im \cdot \left(im \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
          15. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \left(im \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
          17. sub-negN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{2520} \cdot {im}^{2} + \left(\mathsf{neg}\left(\frac{1}{60}\right)\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
          18. metadata-evalN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{2520} \cdot {im}^{2} + \frac{-1}{60}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
          19. +-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{60} + \frac{-1}{2520} \cdot {im}^{2}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
          20. +-lowering-+.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{60}, \left(\frac{-1}{2520} \cdot {im}^{2}\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
        8. Simplified76.0%

          \[\leadsto \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot \left(-0.3333333333333333 + im \cdot \left(im \cdot \left(-0.016666666666666666 + \left(im \cdot im\right) \cdot -0.0003968253968253968\right)\right)\right)\right)\right)} \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \]
      8. Recombined 2 regimes into one program.
      9. Final simplification44.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 3.4 \cdot 10^{+24}:\\ \;\;\;\;\frac{im \cdot \left(-1 + \left(im \cdot \left(im \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)\right)\right)\right)\right) \cdot \left(\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(\left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)\right)\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)\right)\right)\right)\right)\right)}{1 + \left(im \cdot \left(im \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)\right)\right)\right)\right) \cdot \left(im \cdot \left(im \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)\right)\right)\right) - -1\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot \left(-0.3333333333333333 + im \cdot \left(im \cdot \left(-0.016666666666666666 + \left(im \cdot im\right) \cdot -0.0003968253968253968\right)\right)\right)\right)\right)\\ \end{array} \]
      10. Add Preprocessing

      Alternative 17: 62.5% accurate, 4.8× speedup?

      \[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := -0.16666666666666666 + im\_m \cdot \left(im\_m \cdot \left(-0.008333333333333333 + im\_m \cdot \left(im\_m \cdot -0.0001984126984126984\right)\right)\right)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 3.4 \cdot 10^{+39}:\\ \;\;\;\;\frac{im\_m \cdot \left(1 - \left(\left(im\_m \cdot im\_m\right) \cdot \left(im\_m \cdot im\_m\right)\right) \cdot \left(t\_0 \cdot t\_0\right)\right)}{-1 - im\_m \cdot \left(im\_m \cdot t\_0\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(im\_m \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.3333333333333333 + im\_m \cdot \left(im\_m \cdot \left(-0.016666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.0003968253968253968\right)\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
               (+
                -0.16666666666666666
                (*
                 im_m
                 (*
                  im_m
                  (+
                   -0.008333333333333333
                   (* im_m (* im_m -0.0001984126984126984))))))))
         (*
          im_s
          (if (<= im_m 3.4e+39)
            (/
             (* im_m (- 1.0 (* (* (* im_m im_m) (* im_m im_m)) (* t_0 t_0))))
             (- -1.0 (* im_m (* im_m t_0))))
            (*
             (+ 0.5 (* -0.25 (* re re)))
             (*
              im_m
              (+
               -2.0
               (*
                (* im_m im_m)
                (+
                 -0.3333333333333333
                 (*
                  im_m
                  (*
                   im_m
                   (+
                    -0.016666666666666666
                    (* (* im_m im_m) -0.0003968253968253968)))))))))))))
      im\_m = fabs(im);
      im\_s = copysign(1.0, im);
      double code(double im_s, double re, double im_m) {
      	double t_0 = -0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + (im_m * (im_m * -0.0001984126984126984)))));
      	double tmp;
      	if (im_m <= 3.4e+39) {
      		tmp = (im_m * (1.0 - (((im_m * im_m) * (im_m * im_m)) * (t_0 * t_0)))) / (-1.0 - (im_m * (im_m * t_0)));
      	} else {
      		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * (-2.0 + ((im_m * im_m) * (-0.3333333333333333 + (im_m * (im_m * (-0.016666666666666666 + ((im_m * im_m) * -0.0003968253968253968))))))));
      	}
      	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 = (-0.16666666666666666d0) + (im_m * (im_m * ((-0.008333333333333333d0) + (im_m * (im_m * (-0.0001984126984126984d0))))))
          if (im_m <= 3.4d+39) then
              tmp = (im_m * (1.0d0 - (((im_m * im_m) * (im_m * im_m)) * (t_0 * t_0)))) / ((-1.0d0) - (im_m * (im_m * t_0)))
          else
              tmp = (0.5d0 + ((-0.25d0) * (re * re))) * (im_m * ((-2.0d0) + ((im_m * im_m) * ((-0.3333333333333333d0) + (im_m * (im_m * ((-0.016666666666666666d0) + ((im_m * im_m) * (-0.0003968253968253968d0)))))))))
          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 = -0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + (im_m * (im_m * -0.0001984126984126984)))));
      	double tmp;
      	if (im_m <= 3.4e+39) {
      		tmp = (im_m * (1.0 - (((im_m * im_m) * (im_m * im_m)) * (t_0 * t_0)))) / (-1.0 - (im_m * (im_m * t_0)));
      	} else {
      		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * (-2.0 + ((im_m * im_m) * (-0.3333333333333333 + (im_m * (im_m * (-0.016666666666666666 + ((im_m * im_m) * -0.0003968253968253968))))))));
      	}
      	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 = -0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + (im_m * (im_m * -0.0001984126984126984)))))
      	tmp = 0
      	if im_m <= 3.4e+39:
      		tmp = (im_m * (1.0 - (((im_m * im_m) * (im_m * im_m)) * (t_0 * t_0)))) / (-1.0 - (im_m * (im_m * t_0)))
      	else:
      		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * (-2.0 + ((im_m * im_m) * (-0.3333333333333333 + (im_m * (im_m * (-0.016666666666666666 + ((im_m * im_m) * -0.0003968253968253968))))))))
      	return im_s * tmp
      
      im\_m = abs(im)
      im\_s = copysign(1.0, im)
      function code(im_s, re, im_m)
      	t_0 = Float64(-0.16666666666666666 + Float64(im_m * Float64(im_m * Float64(-0.008333333333333333 + Float64(im_m * Float64(im_m * -0.0001984126984126984))))))
      	tmp = 0.0
      	if (im_m <= 3.4e+39)
      		tmp = Float64(Float64(im_m * Float64(1.0 - Float64(Float64(Float64(im_m * im_m) * Float64(im_m * im_m)) * Float64(t_0 * t_0)))) / Float64(-1.0 - Float64(im_m * Float64(im_m * t_0))));
      	else
      		tmp = Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * Float64(im_m * Float64(-2.0 + Float64(Float64(im_m * im_m) * Float64(-0.3333333333333333 + Float64(im_m * Float64(im_m * Float64(-0.016666666666666666 + Float64(Float64(im_m * im_m) * -0.0003968253968253968)))))))));
      	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 = -0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + (im_m * (im_m * -0.0001984126984126984)))));
      	tmp = 0.0;
      	if (im_m <= 3.4e+39)
      		tmp = (im_m * (1.0 - (((im_m * im_m) * (im_m * im_m)) * (t_0 * t_0)))) / (-1.0 - (im_m * (im_m * t_0)));
      	else
      		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * (-2.0 + ((im_m * im_m) * (-0.3333333333333333 + (im_m * (im_m * (-0.016666666666666666 + ((im_m * im_m) * -0.0003968253968253968))))))));
      	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[(-0.16666666666666666 + N[(im$95$m * N[(im$95$m * N[(-0.008333333333333333 + N[(im$95$m * N[(im$95$m * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[im$95$m, 3.4e+39], N[(N[(im$95$m * N[(1.0 - N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(-1.0 - N[(im$95$m * N[(im$95$m * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(im$95$m * N[(-2.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(-0.3333333333333333 + N[(im$95$m * N[(im$95$m * N[(-0.016666666666666666 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.0003968253968253968), $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)
      
      \\
      \begin{array}{l}
      t_0 := -0.16666666666666666 + im\_m \cdot \left(im\_m \cdot \left(-0.008333333333333333 + im\_m \cdot \left(im\_m \cdot -0.0001984126984126984\right)\right)\right)\\
      im\_s \cdot \begin{array}{l}
      \mathbf{if}\;im\_m \leq 3.4 \cdot 10^{+39}:\\
      \;\;\;\;\frac{im\_m \cdot \left(1 - \left(\left(im\_m \cdot im\_m\right) \cdot \left(im\_m \cdot im\_m\right)\right) \cdot \left(t\_0 \cdot t\_0\right)\right)}{-1 - im\_m \cdot \left(im\_m \cdot t\_0\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(im\_m \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.3333333333333333 + im\_m \cdot \left(im\_m \cdot \left(-0.016666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.0003968253968253968\right)\right)\right)\right)\right)\\
      
      
      \end{array}
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if im < 3.3999999999999999e39

        1. Initial program 49.5%

          \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
        2. Add Preprocessing
        3. Taylor expanded in im around 0

          \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
        4. Step-by-step derivation
          1. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
          2. distribute-rgt-inN/A

            \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
          3. associate-+r+N/A

            \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
          4. *-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
          5. +-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
          6. +-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
        5. Simplified87.7%

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

          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\color{blue}{1}, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        7. Step-by-step derivation
          1. Simplified57.2%

            \[\leadsto im \cdot \left(\color{blue}{1} \cdot \left(\left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + -0.16666666666666666 \cdot \left(im \cdot im\right)\right)\right)\right) \]
          2. Step-by-step derivation
            1. *-lft-identityN/A

              \[\leadsto \mathsf{*.f64}\left(im, \left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \color{blue}{\left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)}\right)\right) \]
            2. flip-+N/A

              \[\leadsto \mathsf{*.f64}\left(im, \left(\frac{\left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right) - \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right) \cdot \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)}{\color{blue}{\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) - \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)}}\right)\right) \]
            3. div-subN/A

              \[\leadsto \mathsf{*.f64}\left(im, \left(\frac{\left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)}{\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) - \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)} - \color{blue}{\frac{\left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right) \cdot \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)}{\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) - \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)}}\right)\right) \]
            4. --lowering--.f64N/A

              \[\leadsto \mathsf{*.f64}\left(im, \mathsf{\_.f64}\left(\left(\frac{\left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)}{\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) - \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)}\right), \color{blue}{\left(\frac{\left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right) \cdot \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)}{\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) - \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)}\right)}\right)\right) \]
          3. Applied egg-rr36.7%

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

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

          if 3.3999999999999999e39 < im

          1. Initial program 100.0%

            \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
          2. Add Preprocessing
          3. Taylor expanded in re around 0

            \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
          4. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right)} \]
            2. associate-*r*N/A

              \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \left(\frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
            3. distribute-rgt-outN/A

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

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(e^{\mathsf{neg}\left(im\right)}\right), \left(e^{im}\right)\right), \left(\color{blue}{\frac{1}{2}} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
            6. exp-negN/A

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(e^{im}\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
            8. exp-lowering-exp.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
            9. exp-lowering-exp.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
            10. +-lowering-+.f64N/A

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right) \]
            12. unpow2N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right) \]
            13. *-lowering-*.f6478.0%

              \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right) \]
          5. Simplified78.0%

            \[\leadsto \color{blue}{\left(\frac{1}{e^{im}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)} \]
          6. Taylor expanded in im around 0

            \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(im \cdot \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right)\right)}, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
          7. Step-by-step derivation
            1. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right)\right), \mathsf{+.f64}\left(\color{blue}{\frac{1}{2}}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
            2. sub-negN/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) + \left(\mathsf{neg}\left(2\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
            3. metadata-evalN/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) + -2\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
            4. +-commutativeN/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \left(-2 + {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
            5. +-lowering-+.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
            6. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\left({im}^{2}\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
            7. unpow2N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\left(im \cdot im\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
            8. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
            9. sub-negN/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
            10. metadata-evalN/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) + \frac{-1}{3}\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
            11. +-commutativeN/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{3} + {im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
            12. +-lowering-+.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
            13. unpow2N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \left(\left(im \cdot im\right) \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
            14. associate-*l*N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \left(im \cdot \left(im \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
            15. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \left(im \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
            17. sub-negN/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{2520} \cdot {im}^{2} + \left(\mathsf{neg}\left(\frac{1}{60}\right)\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
            18. metadata-evalN/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{2520} \cdot {im}^{2} + \frac{-1}{60}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
            19. +-commutativeN/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{60} + \frac{-1}{2520} \cdot {im}^{2}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
            20. +-lowering-+.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{60}, \left(\frac{-1}{2520} \cdot {im}^{2}\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
          8. Simplified78.0%

            \[\leadsto \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot \left(-0.3333333333333333 + im \cdot \left(im \cdot \left(-0.016666666666666666 + \left(im \cdot im\right) \cdot -0.0003968253968253968\right)\right)\right)\right)\right)} \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \]
        8. Recombined 2 regimes into one program.
        9. Final simplification45.1%

          \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 3.4 \cdot 10^{+39}:\\ \;\;\;\;\frac{im \cdot \left(1 - \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(\left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)\right)\right) \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)\right)\right)\right)\right)}{-1 - im \cdot \left(im \cdot \left(-0.16666666666666666 + im \cdot \left(im \cdot \left(-0.008333333333333333 + im \cdot \left(im \cdot -0.0001984126984126984\right)\right)\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot \left(-0.3333333333333333 + im \cdot \left(im \cdot \left(-0.016666666666666666 + \left(im \cdot im\right) \cdot -0.0003968253968253968\right)\right)\right)\right)\right)\\ \end{array} \]
        10. Add Preprocessing

        Alternative 18: 62.0% accurate, 6.6× speedup?

        \[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := -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)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;im\_m \leq 480:\\ \;\;\;\;im\_m \cdot t\_0\\ \mathbf{elif}\;im\_m \leq 2 \cdot 10^{+107}:\\ \;\;\;\;t\_0 \cdot \left(im\_m + \left(re \cdot re\right) \cdot \left(im\_m \cdot -0.5 + 0.041666666666666664 \cdot \left(im\_m \cdot \left(re \cdot re\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;im\_m \cdot \left(\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot -0.3333333333333333\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
                 (+
                  -1.0
                  (*
                   (* im_m im_m)
                   (+
                    -0.16666666666666666
                    (*
                     im_m
                     (*
                      im_m
                      (+
                       -0.008333333333333333
                       (* (* im_m im_m) -0.0001984126984126984)))))))))
           (*
            im_s
            (if (<= im_m 480.0)
              (* im_m t_0)
              (if (<= im_m 2e+107)
                (*
                 t_0
                 (+
                  im_m
                  (*
                   (* re re)
                   (+ (* im_m -0.5) (* 0.041666666666666664 (* im_m (* re re)))))))
                (*
                 im_m
                 (*
                  (+ 0.5 (* -0.25 (* re re)))
                  (+ -2.0 (* (* 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 t_0 = -1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))));
        	double tmp;
        	if (im_m <= 480.0) {
        		tmp = im_m * t_0;
        	} else if (im_m <= 2e+107) {
        		tmp = t_0 * (im_m + ((re * re) * ((im_m * -0.5) + (0.041666666666666664 * (im_m * (re * re))))));
        	} else {
        		tmp = im_m * ((0.5 + (-0.25 * (re * re))) * (-2.0 + ((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) :: t_0
            real(8) :: tmp
            t_0 = (-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + (im_m * (im_m * ((-0.008333333333333333d0) + ((im_m * im_m) * (-0.0001984126984126984d0)))))))
            if (im_m <= 480.0d0) then
                tmp = im_m * t_0
            else if (im_m <= 2d+107) then
                tmp = t_0 * (im_m + ((re * re) * ((im_m * (-0.5d0)) + (0.041666666666666664d0 * (im_m * (re * re))))))
            else
                tmp = im_m * ((0.5d0 + ((-0.25d0) * (re * re))) * ((-2.0d0) + ((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 t_0 = -1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))));
        	double tmp;
        	if (im_m <= 480.0) {
        		tmp = im_m * t_0;
        	} else if (im_m <= 2e+107) {
        		tmp = t_0 * (im_m + ((re * re) * ((im_m * -0.5) + (0.041666666666666664 * (im_m * (re * re))))));
        	} else {
        		tmp = im_m * ((0.5 + (-0.25 * (re * re))) * (-2.0 + ((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):
        	t_0 = -1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))))
        	tmp = 0
        	if im_m <= 480.0:
        		tmp = im_m * t_0
        	elif im_m <= 2e+107:
        		tmp = t_0 * (im_m + ((re * re) * ((im_m * -0.5) + (0.041666666666666664 * (im_m * (re * re))))))
        	else:
        		tmp = im_m * ((0.5 + (-0.25 * (re * re))) * (-2.0 + ((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)
        	t_0 = 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)))))))
        	tmp = 0.0
        	if (im_m <= 480.0)
        		tmp = Float64(im_m * t_0);
        	elseif (im_m <= 2e+107)
        		tmp = Float64(t_0 * Float64(im_m + Float64(Float64(re * re) * Float64(Float64(im_m * -0.5) + Float64(0.041666666666666664 * Float64(im_m * Float64(re * re)))))));
        	else
        		tmp = Float64(im_m * Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * Float64(-2.0 + Float64(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)
        	t_0 = -1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984))))));
        	tmp = 0.0;
        	if (im_m <= 480.0)
        		tmp = im_m * t_0;
        	elseif (im_m <= 2e+107)
        		tmp = t_0 * (im_m + ((re * re) * ((im_m * -0.5) + (0.041666666666666664 * (im_m * (re * re))))));
        	else
        		tmp = im_m * ((0.5 + (-0.25 * (re * re))) * (-2.0 + ((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_] := Block[{t$95$0 = 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]}, N[(im$95$s * If[LessEqual[im$95$m, 480.0], N[(im$95$m * t$95$0), $MachinePrecision], If[LessEqual[im$95$m, 2e+107], N[(t$95$0 * N[(im$95$m + N[(N[(re * re), $MachinePrecision] * N[(N[(im$95$m * -0.5), $MachinePrecision] + N[(0.041666666666666664 * N[(im$95$m * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im$95$m * N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-2.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.3333333333333333), $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 := -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)\\
        im\_s \cdot \begin{array}{l}
        \mathbf{if}\;im\_m \leq 480:\\
        \;\;\;\;im\_m \cdot t\_0\\
        
        \mathbf{elif}\;im\_m \leq 2 \cdot 10^{+107}:\\
        \;\;\;\;t\_0 \cdot \left(im\_m + \left(re \cdot re\right) \cdot \left(im\_m \cdot -0.5 + 0.041666666666666664 \cdot \left(im\_m \cdot \left(re \cdot re\right)\right)\right)\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;im\_m \cdot \left(\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot -0.3333333333333333\right)\right)\\
        
        
        \end{array}
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if im < 480

          1. Initial program 46.7%

            \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
          2. Add Preprocessing
          3. Taylor expanded in im around 0

            \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
          4. Step-by-step derivation
            1. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
            2. distribute-rgt-inN/A

              \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
            3. associate-+r+N/A

              \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
            4. *-commutativeN/A

              \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
            5. +-commutativeN/A

              \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
            6. +-commutativeN/A

              \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
          5. Simplified92.4%

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

            \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\color{blue}{1}, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
          7. Step-by-step derivation
            1. Simplified60.2%

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

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

                \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) - 1\right)}\right) \]
              2. sub-negN/A

                \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
              3. metadata-evalN/A

                \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + -1\right)\right) \]
              4. +-commutativeN/A

                \[\leadsto \mathsf{*.f64}\left(im, \left(-1 + \color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)}\right)\right) \]
              5. +-lowering-+.f64N/A

                \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)}\right)\right) \]
              6. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)}\right)\right)\right) \]
              7. unpow2N/A

                \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left(\color{blue}{{im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)} - \frac{1}{6}\right)\right)\right)\right) \]
              8. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{{im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)} - \frac{1}{6}\right)\right)\right)\right) \]
              9. sub-negN/A

                \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}\right)\right)\right)\right) \]
              10. metadata-evalN/A

                \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \frac{-1}{6}\right)\right)\right)\right) \]
              11. +-commutativeN/A

                \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{6} + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)}\right)\right)\right)\right) \]
              12. +-lowering-+.f64N/A

                \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right) \]
              13. unpow2N/A

                \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\left(im \cdot im\right) \cdot \left(\color{blue}{\frac{-1}{5040} \cdot {im}^{2}} - \frac{1}{120}\right)\right)\right)\right)\right)\right) \]
              14. associate-*l*N/A

                \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(im \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right)\right) \]
              15. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \color{blue}{\left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right)\right) \]
              16. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)}\right)\right)\right)\right)\right)\right) \]
              17. sub-negN/A

                \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{120}\right)\right)}\right)\right)\right)\right)\right)\right)\right) \]
              18. metadata-evalN/A

                \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \frac{-1}{120}\right)\right)\right)\right)\right)\right)\right) \]
              19. +-commutativeN/A

                \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{120} + \color{blue}{\frac{-1}{5040} \cdot {im}^{2}}\right)\right)\right)\right)\right)\right)\right) \]
              20. +-lowering-+.f64N/A

                \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \color{blue}{\left(\frac{-1}{5040} \cdot {im}^{2}\right)}\right)\right)\right)\right)\right)\right)\right) \]
            4. Simplified60.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)} \]

            if 480 < im < 1.9999999999999999e107

            1. Initial program 100.0%

              \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
            2. Add Preprocessing
            3. Taylor expanded in im around 0

              \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
            4. Step-by-step derivation
              1. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
              2. distribute-rgt-inN/A

                \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
              3. associate-+r+N/A

                \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
              4. *-commutativeN/A

                \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
              5. +-commutativeN/A

                \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
              6. +-commutativeN/A

                \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
            5. Simplified59.5%

              \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(\left(-0.008333333333333333 + \left(im \cdot im\right) \cdot -0.0001984126984126984\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + -0.16666666666666666 \cdot \left(im \cdot im\right)\right)\right)\right)} \]
            6. Step-by-step derivation
              1. associate-*r*N/A

                \[\leadsto \left(im \cdot \cos re\right) \cdot \color{blue}{\left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)\right)} \]
              2. *-commutativeN/A

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

                \[\leadsto \mathsf{*.f64}\left(\left(\left(\frac{-1}{120} + \left(im \cdot im\right) \cdot \frac{-1}{5040}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(-1 + \frac{-1}{6} \cdot \left(im \cdot im\right)\right)\right), \color{blue}{\left(im \cdot \cos re\right)}\right) \]
            7. Applied egg-rr59.5%

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

              \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) - 1\right)}, \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
            9. Step-by-step derivation
              1. sub-negN/A

                \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + \left(\mathsf{neg}\left(1\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              2. metadata-evalN/A

                \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + -1\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              3. +-commutativeN/A

                \[\leadsto \mathsf{*.f64}\left(\left(-1 + {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              4. +-lowering-+.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              5. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left({im}^{2}\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              6. unpow2N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              7. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              8. sub-negN/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              9. metadata-evalN/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \frac{-1}{6}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              10. +-commutativeN/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{6} + {im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              11. +-lowering-+.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              12. unpow2N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\left(im \cdot im\right) \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              13. associate-*l*N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(im \cdot \left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              14. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              15. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              16. sub-negN/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \left(\mathsf{neg}\left(\frac{1}{120}\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              17. metadata-evalN/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \frac{-1}{120}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              18. +-commutativeN/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{120} + \frac{-1}{5040} \cdot {im}^{2}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              19. +-lowering-+.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \left(\frac{-1}{5040} \cdot {im}^{2}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              20. *-commutativeN/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \left({im}^{2} \cdot \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              21. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left({im}^{2}\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              22. unpow2N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              23. *-lowering-*.f6459.5%

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
            10. Simplified59.5%

              \[\leadsto \color{blue}{\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)} \cdot \left(im \cdot \cos re\right) \]
            11. Taylor expanded in re around 0

              \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \color{blue}{\left(im + {re}^{2} \cdot \left(\frac{-1}{2} \cdot im + \frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)\right)}\right) \]
            12. Step-by-step derivation
              1. +-lowering-+.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \color{blue}{\left({re}^{2} \cdot \left(\frac{-1}{2} \cdot im + \frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)\right)}\right)\right) \]
              2. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\left({re}^{2}\right), \color{blue}{\left(\frac{-1}{2} \cdot im + \frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)}\right)\right)\right) \]
              3. unpow2N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\left(re \cdot re\right), \left(\color{blue}{\frac{-1}{2} \cdot im} + \frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)\right)\right)\right) \]
              4. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \left(\color{blue}{\frac{-1}{2} \cdot im} + \frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)\right)\right)\right) \]
              5. +-lowering-+.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\left(\frac{-1}{2} \cdot im\right), \color{blue}{\left(\frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)}\right)\right)\right)\right) \]
              6. *-commutativeN/A

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

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(im, \frac{-1}{2}\right), \left(\color{blue}{\frac{1}{24}} \cdot \left(im \cdot {re}^{2}\right)\right)\right)\right)\right)\right) \]
              8. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(im, \frac{-1}{2}\right), \mathsf{*.f64}\left(\frac{1}{24}, \color{blue}{\left(im \cdot {re}^{2}\right)}\right)\right)\right)\right)\right) \]
              9. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(im, \frac{-1}{2}\right), \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, \color{blue}{\left({re}^{2}\right)}\right)\right)\right)\right)\right)\right) \]
              10. unpow2N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(im, \frac{-1}{2}\right), \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, \left(re \cdot \color{blue}{re}\right)\right)\right)\right)\right)\right)\right) \]
              11. *-lowering-*.f6465.1%

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(im, \frac{-1}{2}\right), \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right)\right)\right)\right) \]
            13. Simplified65.1%

              \[\leadsto \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) \cdot \color{blue}{\left(im + \left(re \cdot re\right) \cdot \left(im \cdot -0.5 + 0.041666666666666664 \cdot \left(im \cdot \left(re \cdot re\right)\right)\right)\right)} \]

            if 1.9999999999999999e107 < im

            1. Initial program 100.0%

              \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
            2. Add Preprocessing
            3. Taylor expanded in re around 0

              \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
            4. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right)} \]
              2. associate-*r*N/A

                \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \left(\frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
              3. distribute-rgt-outN/A

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

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

                \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(e^{\mathsf{neg}\left(im\right)}\right), \left(e^{im}\right)\right), \left(\color{blue}{\frac{1}{2}} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
              6. exp-negN/A

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

                \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(e^{im}\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
              8. exp-lowering-exp.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
              9. exp-lowering-exp.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
              10. +-lowering-+.f64N/A

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

                \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right) \]
              12. unpow2N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right) \]
              13. *-lowering-*.f6478.8%

                \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right) \]
            5. Simplified78.8%

              \[\leadsto \color{blue}{\left(\frac{1}{e^{im}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)} \]
            6. Taylor expanded in im around 0

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

                \[\leadsto im \cdot \left(-2 \cdot \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right) + \left({im}^{2} \cdot \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \cdot \color{blue}{\frac{-1}{3}}\right) \]
              2. associate-*r*N/A

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

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

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

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

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

                \[\leadsto \mathsf{*.f64}\left(im, \left(\left(\frac{-1}{3} \cdot {im}^{2}\right) \cdot \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right) + -2 \cdot \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right)\right) \]
              8. distribute-rgt-outN/A

                \[\leadsto \mathsf{*.f64}\left(im, \left(\left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(\frac{-1}{3} \cdot {im}^{2} + -2\right)}\right)\right) \]
              9. metadata-evalN/A

                \[\leadsto \mathsf{*.f64}\left(im, \left(\left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right) \cdot \left(\frac{-1}{3} \cdot {im}^{2} + \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right) \]
              10. sub-negN/A

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

                \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right), \color{blue}{\left(\frac{-1}{3} \cdot {im}^{2} - 2\right)}\right)\right) \]
            8. Simplified78.8%

              \[\leadsto \color{blue}{im \cdot \left(\left(0.5 + \left(re \cdot re\right) \cdot -0.25\right) \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)} \]
          8. Recombined 3 regimes into one program.
          9. Final simplification63.2%

            \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 480:\\ \;\;\;\;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)\\ \mathbf{elif}\;im \leq 2 \cdot 10^{+107}:\\ \;\;\;\;\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) \cdot \left(im + \left(re \cdot re\right) \cdot \left(im \cdot -0.5 + 0.041666666666666664 \cdot \left(im \cdot \left(re \cdot re\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)\\ \end{array} \]
          10. Add Preprocessing

          Alternative 19: 61.7% accurate, 7.9× 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 430:\\ \;\;\;\;im\_m \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)\\ \mathbf{elif}\;im\_m \leq 2.6 \cdot 10^{+24}:\\ \;\;\;\;\left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.008333333333333333\right)\right) \cdot \left(im\_m + \left(im\_m \cdot \left(re \cdot re\right)\right) \cdot \left(-0.5 + \left(re \cdot re\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(im\_m \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.3333333333333333 + im\_m \cdot \left(im\_m \cdot \left(-0.016666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.0003968253968253968\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 430.0)
              (*
               im_m
               (+
                -1.0
                (*
                 (* im_m im_m)
                 (+
                  -0.16666666666666666
                  (*
                   im_m
                   (*
                    im_m
                    (+
                     -0.008333333333333333
                     (* (* im_m im_m) -0.0001984126984126984))))))))
              (if (<= im_m 2.6e+24)
                (*
                 (+
                  -1.0
                  (*
                   (* im_m im_m)
                   (+ -0.16666666666666666 (* (* im_m im_m) -0.008333333333333333))))
                 (+
                  im_m
                  (* (* im_m (* re re)) (+ -0.5 (* (* re re) 0.041666666666666664)))))
                (*
                 (+ 0.5 (* -0.25 (* re re)))
                 (*
                  im_m
                  (+
                   -2.0
                   (*
                    (* im_m im_m)
                    (+
                     -0.3333333333333333
                     (*
                      im_m
                      (*
                       im_m
                       (+
                        -0.016666666666666666
                        (* (* im_m im_m) -0.0003968253968253968)))))))))))))
          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 <= 430.0) {
          		tmp = im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)))))));
          	} else if (im_m <= 2.6e+24) {
          		tmp = (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))) * (im_m + ((im_m * (re * re)) * (-0.5 + ((re * re) * 0.041666666666666664))));
          	} else {
          		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * (-2.0 + ((im_m * im_m) * (-0.3333333333333333 + (im_m * (im_m * (-0.016666666666666666 + ((im_m * im_m) * -0.0003968253968253968))))))));
          	}
          	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 <= 430.0d0) then
                  tmp = im_m * ((-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + (im_m * (im_m * ((-0.008333333333333333d0) + ((im_m * im_m) * (-0.0001984126984126984d0))))))))
              else if (im_m <= 2.6d+24) then
                  tmp = ((-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + ((im_m * im_m) * (-0.008333333333333333d0))))) * (im_m + ((im_m * (re * re)) * ((-0.5d0) + ((re * re) * 0.041666666666666664d0))))
              else
                  tmp = (0.5d0 + ((-0.25d0) * (re * re))) * (im_m * ((-2.0d0) + ((im_m * im_m) * ((-0.3333333333333333d0) + (im_m * (im_m * ((-0.016666666666666666d0) + ((im_m * im_m) * (-0.0003968253968253968d0)))))))))
              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 <= 430.0) {
          		tmp = im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)))))));
          	} else if (im_m <= 2.6e+24) {
          		tmp = (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))) * (im_m + ((im_m * (re * re)) * (-0.5 + ((re * re) * 0.041666666666666664))));
          	} else {
          		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * (-2.0 + ((im_m * im_m) * (-0.3333333333333333 + (im_m * (im_m * (-0.016666666666666666 + ((im_m * im_m) * -0.0003968253968253968))))))));
          	}
          	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 <= 430.0:
          		tmp = im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)))))))
          	elif im_m <= 2.6e+24:
          		tmp = (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))) * (im_m + ((im_m * (re * re)) * (-0.5 + ((re * re) * 0.041666666666666664))))
          	else:
          		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * (-2.0 + ((im_m * im_m) * (-0.3333333333333333 + (im_m * (im_m * (-0.016666666666666666 + ((im_m * im_m) * -0.0003968253968253968))))))))
          	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 <= 430.0)
          		tmp = Float64(im_m * 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))))))));
          	elseif (im_m <= 2.6e+24)
          		tmp = Float64(Float64(-1.0 + Float64(Float64(im_m * im_m) * Float64(-0.16666666666666666 + Float64(Float64(im_m * im_m) * -0.008333333333333333)))) * Float64(im_m + Float64(Float64(im_m * Float64(re * re)) * Float64(-0.5 + Float64(Float64(re * re) * 0.041666666666666664)))));
          	else
          		tmp = Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * Float64(im_m * Float64(-2.0 + Float64(Float64(im_m * im_m) * Float64(-0.3333333333333333 + Float64(im_m * Float64(im_m * Float64(-0.016666666666666666 + Float64(Float64(im_m * im_m) * -0.0003968253968253968)))))))));
          	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 <= 430.0)
          		tmp = im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)))))));
          	elseif (im_m <= 2.6e+24)
          		tmp = (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))) * (im_m + ((im_m * (re * re)) * (-0.5 + ((re * re) * 0.041666666666666664))));
          	else
          		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * (-2.0 + ((im_m * im_m) * (-0.3333333333333333 + (im_m * (im_m * (-0.016666666666666666 + ((im_m * im_m) * -0.0003968253968253968))))))));
          	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, 430.0], 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 * N[(-0.008333333333333333 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 2.6e+24], N[(N[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(-0.16666666666666666 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(im$95$m + N[(N[(im$95$m * N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(-0.5 + N[(N[(re * re), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(im$95$m * N[(-2.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(-0.3333333333333333 + N[(im$95$m * N[(im$95$m * N[(-0.016666666666666666 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.0003968253968253968), $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 430:\\
          \;\;\;\;im\_m \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)\\
          
          \mathbf{elif}\;im\_m \leq 2.6 \cdot 10^{+24}:\\
          \;\;\;\;\left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.008333333333333333\right)\right) \cdot \left(im\_m + \left(im\_m \cdot \left(re \cdot re\right)\right) \cdot \left(-0.5 + \left(re \cdot re\right) \cdot 0.041666666666666664\right)\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(im\_m \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.3333333333333333 + im\_m \cdot \left(im\_m \cdot \left(-0.016666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.0003968253968253968\right)\right)\right)\right)\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if im < 430

            1. Initial program 46.7%

              \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
            2. Add Preprocessing
            3. Taylor expanded in im around 0

              \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
            4. Step-by-step derivation
              1. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
              2. distribute-rgt-inN/A

                \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
              3. associate-+r+N/A

                \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
              4. *-commutativeN/A

                \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
              5. +-commutativeN/A

                \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
              6. +-commutativeN/A

                \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
            5. Simplified92.4%

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

              \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\color{blue}{1}, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
            7. Step-by-step derivation
              1. Simplified60.2%

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

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

                  \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) - 1\right)}\right) \]
                2. sub-negN/A

                  \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
                3. metadata-evalN/A

                  \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + -1\right)\right) \]
                4. +-commutativeN/A

                  \[\leadsto \mathsf{*.f64}\left(im, \left(-1 + \color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)}\right)\right) \]
                5. +-lowering-+.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)}\right)\right) \]
                6. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)}\right)\right)\right) \]
                7. unpow2N/A

                  \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left(\color{blue}{{im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)} - \frac{1}{6}\right)\right)\right)\right) \]
                8. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{{im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)} - \frac{1}{6}\right)\right)\right)\right) \]
                9. sub-negN/A

                  \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}\right)\right)\right)\right) \]
                10. metadata-evalN/A

                  \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \frac{-1}{6}\right)\right)\right)\right) \]
                11. +-commutativeN/A

                  \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{6} + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)}\right)\right)\right)\right) \]
                12. +-lowering-+.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right) \]
                13. unpow2N/A

                  \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\left(im \cdot im\right) \cdot \left(\color{blue}{\frac{-1}{5040} \cdot {im}^{2}} - \frac{1}{120}\right)\right)\right)\right)\right)\right) \]
                14. associate-*l*N/A

                  \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(im \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right)\right) \]
                15. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \color{blue}{\left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right)\right) \]
                16. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)}\right)\right)\right)\right)\right)\right) \]
                17. sub-negN/A

                  \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{120}\right)\right)}\right)\right)\right)\right)\right)\right)\right) \]
                18. metadata-evalN/A

                  \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \frac{-1}{120}\right)\right)\right)\right)\right)\right)\right) \]
                19. +-commutativeN/A

                  \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{120} + \color{blue}{\frac{-1}{5040} \cdot {im}^{2}}\right)\right)\right)\right)\right)\right)\right) \]
                20. +-lowering-+.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \color{blue}{\left(\frac{-1}{5040} \cdot {im}^{2}\right)}\right)\right)\right)\right)\right)\right)\right) \]
              4. Simplified60.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)} \]

              if 430 < im < 2.5999999999999998e24

              1. Initial program 100.0%

                \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
              2. Add Preprocessing
              3. Taylor expanded in im around 0

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

                  \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right) \]
                2. *-commutativeN/A

                  \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right) \]
                3. +-commutativeN/A

                  \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right) + \color{blue}{\frac{-1}{6} \cdot \cos re}\right)\right)\right) \]
                4. distribute-lft-inN/A

                  \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re\right)}\right)\right)\right) \]
                5. associate-*r*N/A

                  \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\left(\frac{-1}{120} \cdot {im}^{2}\right) \cdot \cos re\right) + {im}^{\color{blue}{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
                6. associate-*r*N/A

                  \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
                7. associate-*r*N/A

                  \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left({im}^{2} \cdot \frac{-1}{6}\right) \cdot \color{blue}{\cos re}\right)\right)\right) \]
                8. *-commutativeN/A

                  \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \cos \color{blue}{re}\right)\right)\right) \]
                9. distribute-rgt-outN/A

                  \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \cos re \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)}\right)\right) \]
                10. distribute-lft-outN/A

                  \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
                11. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\cos re, \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
                12. cos-lowering-cos.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(\color{blue}{-1} + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)\right)\right) \]
              5. Simplified4.0%

                \[\leadsto \color{blue}{im \cdot \left(\cos re \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot -0.008333333333333333\right)\right)\right)} \]
              6. Step-by-step derivation
                1. associate-*r*N/A

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

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

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

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

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left(\frac{-1}{6} + \left(im \cdot im\right) \cdot \frac{-1}{120}\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
                6. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{6} + \left(im \cdot im\right) \cdot \frac{-1}{120}\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
                7. +-lowering-+.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\left(im \cdot im\right) \cdot \frac{-1}{120}\right)\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
                8. *-commutativeN/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\frac{-1}{120} \cdot \left(im \cdot im\right)\right)\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
                9. *-lowering-*.f64N/A

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

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \left(im \cdot \cos re\right)\right) \]
                11. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \color{blue}{\cos re}\right)\right) \]
                12. cos-lowering-cos.f644.0%

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
              7. Applied egg-rr4.0%

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

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \color{blue}{\left(im + {re}^{2} \cdot \left(\frac{-1}{2} \cdot im + \frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)\right)}\right) \]
              9. Step-by-step derivation
                1. +-lowering-+.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \color{blue}{\left({re}^{2} \cdot \left(\frac{-1}{2} \cdot im + \frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)\right)}\right)\right) \]
                2. distribute-rgt-inN/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \left(\left(\frac{-1}{2} \cdot im\right) \cdot {re}^{2} + \color{blue}{\left(\frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right) \cdot {re}^{2}}\right)\right)\right) \]
                3. associate-*r*N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \left(\frac{-1}{2} \cdot \left(im \cdot {re}^{2}\right) + \color{blue}{\left(\frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)} \cdot {re}^{2}\right)\right)\right) \]
                4. *-commutativeN/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \left(\left(im \cdot {re}^{2}\right) \cdot \frac{-1}{2} + \color{blue}{\left(\frac{1}{24} \cdot \left(im \cdot {re}^{2}\right)\right)} \cdot {re}^{2}\right)\right)\right) \]
                5. *-commutativeN/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \left(\left(im \cdot {re}^{2}\right) \cdot \frac{-1}{2} + \left(\left(im \cdot {re}^{2}\right) \cdot \frac{1}{24}\right) \cdot {\color{blue}{re}}^{2}\right)\right)\right) \]
                6. associate-*l*N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \left(\left(im \cdot {re}^{2}\right) \cdot \frac{-1}{2} + \left(im \cdot {re}^{2}\right) \cdot \color{blue}{\left(\frac{1}{24} \cdot {re}^{2}\right)}\right)\right)\right) \]
                7. distribute-lft-outN/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \left(\left(im \cdot {re}^{2}\right) \cdot \color{blue}{\left(\frac{-1}{2} + \frac{1}{24} \cdot {re}^{2}\right)}\right)\right)\right) \]
                8. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\left(im \cdot {re}^{2}\right), \color{blue}{\left(\frac{-1}{2} + \frac{1}{24} \cdot {re}^{2}\right)}\right)\right)\right) \]
                9. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \left({re}^{2}\right)\right), \left(\color{blue}{\frac{-1}{2}} + \frac{1}{24} \cdot {re}^{2}\right)\right)\right)\right) \]
                10. unpow2N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \left(re \cdot re\right)\right), \left(\frac{-1}{2} + \frac{1}{24} \cdot {re}^{2}\right)\right)\right)\right) \]
                11. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{*.f64}\left(re, re\right)\right), \left(\frac{-1}{2} + \frac{1}{24} \cdot {re}^{2}\right)\right)\right)\right) \]
                12. +-lowering-+.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{*.f64}\left(re, re\right)\right), \mathsf{+.f64}\left(\frac{-1}{2}, \color{blue}{\left(\frac{1}{24} \cdot {re}^{2}\right)}\right)\right)\right)\right) \]
                13. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{*.f64}\left(re, re\right)\right), \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right)\right)\right) \]
                14. unpow2N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{*.f64}\left(re, re\right)\right), \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right)\right)\right) \]
                15. *-lowering-*.f6445.1%

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right), \mathsf{+.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{*.f64}\left(re, re\right)\right), \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right)\right)\right) \]
              10. Simplified45.1%

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

              if 2.5999999999999998e24 < im

              1. Initial program 100.0%

                \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
              2. Add Preprocessing
              3. Taylor expanded in re around 0

                \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
              4. Step-by-step derivation
                1. +-commutativeN/A

                  \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right)} \]
                2. associate-*r*N/A

                  \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \left(\frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
                3. distribute-rgt-outN/A

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

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

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(e^{\mathsf{neg}\left(im\right)}\right), \left(e^{im}\right)\right), \left(\color{blue}{\frac{1}{2}} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                6. exp-negN/A

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

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(e^{im}\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                8. exp-lowering-exp.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                9. exp-lowering-exp.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                10. +-lowering-+.f64N/A

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

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right) \]
                12. unpow2N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right) \]
                13. *-lowering-*.f6477.8%

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right) \]
              5. Simplified77.8%

                \[\leadsto \color{blue}{\left(\frac{1}{e^{im}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)} \]
              6. Taylor expanded in im around 0

                \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(im \cdot \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right)\right)}, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
              7. Step-by-step derivation
                1. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right)\right), \mathsf{+.f64}\left(\color{blue}{\frac{1}{2}}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                2. sub-negN/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) + \left(\mathsf{neg}\left(2\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                3. metadata-evalN/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) + -2\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                4. +-commutativeN/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \left(-2 + {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                5. +-lowering-+.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                6. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\left({im}^{2}\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                7. unpow2N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\left(im \cdot im\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                8. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                9. sub-negN/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                10. metadata-evalN/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) + \frac{-1}{3}\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                11. +-commutativeN/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{3} + {im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                12. +-lowering-+.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                13. unpow2N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \left(\left(im \cdot im\right) \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                14. associate-*l*N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \left(im \cdot \left(im \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                15. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \left(im \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                16. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                17. sub-negN/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{2520} \cdot {im}^{2} + \left(\mathsf{neg}\left(\frac{1}{60}\right)\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                18. metadata-evalN/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{2520} \cdot {im}^{2} + \frac{-1}{60}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                19. +-commutativeN/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{60} + \frac{-1}{2520} \cdot {im}^{2}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                20. +-lowering-+.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{60}, \left(\frac{-1}{2520} \cdot {im}^{2}\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
              8. Simplified76.0%

                \[\leadsto \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot \left(-0.3333333333333333 + im \cdot \left(im \cdot \left(-0.016666666666666666 + \left(im \cdot im\right) \cdot -0.0003968253968253968\right)\right)\right)\right)\right)} \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \]
            8. Recombined 3 regimes into one program.
            9. Final simplification63.1%

              \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 430:\\ \;\;\;\;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)\\ \mathbf{elif}\;im \leq 2.6 \cdot 10^{+24}:\\ \;\;\;\;\left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot -0.008333333333333333\right)\right) \cdot \left(im + \left(im \cdot \left(re \cdot re\right)\right) \cdot \left(-0.5 + \left(re \cdot re\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot \left(-0.3333333333333333 + im \cdot \left(im \cdot \left(-0.016666666666666666 + \left(im \cdot im\right) \cdot -0.0003968253968253968\right)\right)\right)\right)\right)\\ \end{array} \]
            10. Add Preprocessing

            Alternative 20: 61.7% accurate, 7.9× 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 410:\\ \;\;\;\;im\_m \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)\\ \mathbf{elif}\;im\_m \leq 2.8 \cdot 10^{+24}:\\ \;\;\;\;im\_m \cdot \left(\left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.008333333333333333\right)\right) \cdot \left(1 + re \cdot \left(re \cdot \left(-0.5 + \left(re \cdot re\right) \cdot 0.041666666666666664\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(im\_m \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.3333333333333333 + im\_m \cdot \left(im\_m \cdot \left(-0.016666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.0003968253968253968\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 410.0)
                (*
                 im_m
                 (+
                  -1.0
                  (*
                   (* im_m im_m)
                   (+
                    -0.16666666666666666
                    (*
                     im_m
                     (*
                      im_m
                      (+
                       -0.008333333333333333
                       (* (* im_m im_m) -0.0001984126984126984))))))))
                (if (<= im_m 2.8e+24)
                  (*
                   im_m
                   (*
                    (+
                     -1.0
                     (*
                      (* im_m im_m)
                      (+ -0.16666666666666666 (* (* im_m im_m) -0.008333333333333333))))
                    (+ 1.0 (* re (* re (+ -0.5 (* (* re re) 0.041666666666666664)))))))
                  (*
                   (+ 0.5 (* -0.25 (* re re)))
                   (*
                    im_m
                    (+
                     -2.0
                     (*
                      (* im_m im_m)
                      (+
                       -0.3333333333333333
                       (*
                        im_m
                        (*
                         im_m
                         (+
                          -0.016666666666666666
                          (* (* im_m im_m) -0.0003968253968253968)))))))))))))
            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 <= 410.0) {
            		tmp = im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)))))));
            	} else if (im_m <= 2.8e+24) {
            		tmp = im_m * ((-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))) * (1.0 + (re * (re * (-0.5 + ((re * re) * 0.041666666666666664))))));
            	} else {
            		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * (-2.0 + ((im_m * im_m) * (-0.3333333333333333 + (im_m * (im_m * (-0.016666666666666666 + ((im_m * im_m) * -0.0003968253968253968))))))));
            	}
            	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 <= 410.0d0) then
                    tmp = im_m * ((-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + (im_m * (im_m * ((-0.008333333333333333d0) + ((im_m * im_m) * (-0.0001984126984126984d0))))))))
                else if (im_m <= 2.8d+24) then
                    tmp = im_m * (((-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + ((im_m * im_m) * (-0.008333333333333333d0))))) * (1.0d0 + (re * (re * ((-0.5d0) + ((re * re) * 0.041666666666666664d0))))))
                else
                    tmp = (0.5d0 + ((-0.25d0) * (re * re))) * (im_m * ((-2.0d0) + ((im_m * im_m) * ((-0.3333333333333333d0) + (im_m * (im_m * ((-0.016666666666666666d0) + ((im_m * im_m) * (-0.0003968253968253968d0)))))))))
                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 <= 410.0) {
            		tmp = im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)))))));
            	} else if (im_m <= 2.8e+24) {
            		tmp = im_m * ((-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))) * (1.0 + (re * (re * (-0.5 + ((re * re) * 0.041666666666666664))))));
            	} else {
            		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * (-2.0 + ((im_m * im_m) * (-0.3333333333333333 + (im_m * (im_m * (-0.016666666666666666 + ((im_m * im_m) * -0.0003968253968253968))))))));
            	}
            	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 <= 410.0:
            		tmp = im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)))))))
            	elif im_m <= 2.8e+24:
            		tmp = im_m * ((-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))) * (1.0 + (re * (re * (-0.5 + ((re * re) * 0.041666666666666664))))))
            	else:
            		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * (-2.0 + ((im_m * im_m) * (-0.3333333333333333 + (im_m * (im_m * (-0.016666666666666666 + ((im_m * im_m) * -0.0003968253968253968))))))))
            	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 <= 410.0)
            		tmp = Float64(im_m * 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))))))));
            	elseif (im_m <= 2.8e+24)
            		tmp = Float64(im_m * Float64(Float64(-1.0 + Float64(Float64(im_m * im_m) * Float64(-0.16666666666666666 + Float64(Float64(im_m * im_m) * -0.008333333333333333)))) * Float64(1.0 + Float64(re * Float64(re * Float64(-0.5 + Float64(Float64(re * re) * 0.041666666666666664)))))));
            	else
            		tmp = Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * Float64(im_m * Float64(-2.0 + Float64(Float64(im_m * im_m) * Float64(-0.3333333333333333 + Float64(im_m * Float64(im_m * Float64(-0.016666666666666666 + Float64(Float64(im_m * im_m) * -0.0003968253968253968)))))))));
            	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 <= 410.0)
            		tmp = im_m * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)))))));
            	elseif (im_m <= 2.8e+24)
            		tmp = im_m * ((-1.0 + ((im_m * im_m) * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))) * (1.0 + (re * (re * (-0.5 + ((re * re) * 0.041666666666666664))))));
            	else
            		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * (-2.0 + ((im_m * im_m) * (-0.3333333333333333 + (im_m * (im_m * (-0.016666666666666666 + ((im_m * im_m) * -0.0003968253968253968))))))));
            	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, 410.0], 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 * N[(-0.008333333333333333 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 2.8e+24], N[(im$95$m * N[(N[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(-0.16666666666666666 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(re * N[(re * N[(-0.5 + N[(N[(re * re), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(im$95$m * N[(-2.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(-0.3333333333333333 + N[(im$95$m * N[(im$95$m * N[(-0.016666666666666666 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.0003968253968253968), $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 410:\\
            \;\;\;\;im\_m \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)\\
            
            \mathbf{elif}\;im\_m \leq 2.8 \cdot 10^{+24}:\\
            \;\;\;\;im\_m \cdot \left(\left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.008333333333333333\right)\right) \cdot \left(1 + re \cdot \left(re \cdot \left(-0.5 + \left(re \cdot re\right) \cdot 0.041666666666666664\right)\right)\right)\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(im\_m \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot \left(-0.3333333333333333 + im\_m \cdot \left(im\_m \cdot \left(-0.016666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.0003968253968253968\right)\right)\right)\right)\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if im < 410

              1. Initial program 46.7%

                \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
              2. Add Preprocessing
              3. Taylor expanded in im around 0

                \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
              4. Step-by-step derivation
                1. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
                2. distribute-rgt-inN/A

                  \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
                3. associate-+r+N/A

                  \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
                4. *-commutativeN/A

                  \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
                5. +-commutativeN/A

                  \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
                6. +-commutativeN/A

                  \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
              5. Simplified92.4%

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

                \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\color{blue}{1}, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
              7. Step-by-step derivation
                1. Simplified60.2%

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

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

                    \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) - 1\right)}\right) \]
                  2. sub-negN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
                  3. metadata-evalN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + -1\right)\right) \]
                  4. +-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \left(-1 + \color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)}\right)\right) \]
                  5. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)}\right)\right) \]
                  6. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)}\right)\right)\right) \]
                  7. unpow2N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left(\color{blue}{{im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)} - \frac{1}{6}\right)\right)\right)\right) \]
                  8. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{{im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)} - \frac{1}{6}\right)\right)\right)\right) \]
                  9. sub-negN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}\right)\right)\right)\right) \]
                  10. metadata-evalN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \frac{-1}{6}\right)\right)\right)\right) \]
                  11. +-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{6} + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)}\right)\right)\right)\right) \]
                  12. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right) \]
                  13. unpow2N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\left(im \cdot im\right) \cdot \left(\color{blue}{\frac{-1}{5040} \cdot {im}^{2}} - \frac{1}{120}\right)\right)\right)\right)\right)\right) \]
                  14. associate-*l*N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(im \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right)\right) \]
                  15. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \color{blue}{\left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right)\right) \]
                  16. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)}\right)\right)\right)\right)\right)\right) \]
                  17. sub-negN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{120}\right)\right)}\right)\right)\right)\right)\right)\right)\right) \]
                  18. metadata-evalN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \frac{-1}{120}\right)\right)\right)\right)\right)\right)\right) \]
                  19. +-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{120} + \color{blue}{\frac{-1}{5040} \cdot {im}^{2}}\right)\right)\right)\right)\right)\right)\right) \]
                  20. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \color{blue}{\left(\frac{-1}{5040} \cdot {im}^{2}\right)}\right)\right)\right)\right)\right)\right)\right) \]
                4. Simplified60.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)} \]

                if 410 < im < 2.8000000000000002e24

                1. Initial program 100.0%

                  \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                2. Add Preprocessing
                3. Taylor expanded in im around 0

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

                    \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right) \]
                  2. *-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right) \]
                  3. +-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right) + \color{blue}{\frac{-1}{6} \cdot \cos re}\right)\right)\right) \]
                  4. distribute-lft-inN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re\right)}\right)\right)\right) \]
                  5. associate-*r*N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\left(\frac{-1}{120} \cdot {im}^{2}\right) \cdot \cos re\right) + {im}^{\color{blue}{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
                  6. associate-*r*N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
                  7. associate-*r*N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left({im}^{2} \cdot \frac{-1}{6}\right) \cdot \color{blue}{\cos re}\right)\right)\right) \]
                  8. *-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \cos \color{blue}{re}\right)\right)\right) \]
                  9. distribute-rgt-outN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \cos re \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)}\right)\right) \]
                  10. distribute-lft-outN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
                  11. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\cos re, \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
                  12. cos-lowering-cos.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(\color{blue}{-1} + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)\right)\right) \]
                5. Simplified4.0%

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

                  \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\color{blue}{\left(1 + {re}^{2} \cdot \left(\frac{1}{24} \cdot {re}^{2} - \frac{1}{2}\right)\right)}, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{120}\right)\right)\right)\right)\right)\right) \]
                7. Step-by-step derivation
                  1. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left({re}^{2} \cdot \left(\frac{1}{24} \cdot {re}^{2} - \frac{1}{2}\right)\right)\right), \mathsf{+.f64}\left(\color{blue}{-1}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{120}\right)\right)\right)\right)\right)\right) \]
                  2. unpow2N/A

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

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(re \cdot \left(re \cdot \left(\frac{1}{24} \cdot {re}^{2} - \frac{1}{2}\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{120}\right)\right)\right)\right)\right)\right) \]
                  4. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \left(re \cdot \left(\frac{1}{24} \cdot {re}^{2} - \frac{1}{2}\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{120}\right)\right)\right)\right)\right)\right) \]
                  5. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \left(\frac{1}{24} \cdot {re}^{2} - \frac{1}{2}\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{120}\right)\right)\right)\right)\right)\right) \]
                  6. sub-negN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \left(\frac{1}{24} \cdot {re}^{2} + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{120}\right)\right)\right)\right)\right)\right) \]
                  7. metadata-evalN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \left(\frac{1}{24} \cdot {re}^{2} + \frac{-1}{2}\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{120}\right)\right)\right)\right)\right)\right) \]
                  8. +-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \left(\frac{-1}{2} + \frac{1}{24} \cdot {re}^{2}\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{120}\right)\right)\right)\right)\right)\right) \]
                  9. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{-1}{2}, \left(\frac{1}{24} \cdot {re}^{2}\right)\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{120}\right)\right)\right)\right)\right)\right) \]
                  10. *-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{-1}{2}, \left({re}^{2} \cdot \frac{1}{24}\right)\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{120}\right)\right)\right)\right)\right)\right) \]
                  11. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\left({re}^{2}\right), \frac{1}{24}\right)\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{120}\right)\right)\right)\right)\right)\right) \]
                  12. unpow2N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\left(re \cdot re\right), \frac{1}{24}\right)\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{120}\right)\right)\right)\right)\right)\right) \]
                  13. *-lowering-*.f6445.1%

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \frac{1}{24}\right)\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{120}\right)\right)\right)\right)\right)\right) \]
                8. Simplified45.1%

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

                if 2.8000000000000002e24 < im

                1. Initial program 100.0%

                  \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                2. Add Preprocessing
                3. Taylor expanded in re around 0

                  \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
                4. Step-by-step derivation
                  1. +-commutativeN/A

                    \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right)} \]
                  2. associate-*r*N/A

                    \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \left(\frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
                  3. distribute-rgt-outN/A

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

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

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(e^{\mathsf{neg}\left(im\right)}\right), \left(e^{im}\right)\right), \left(\color{blue}{\frac{1}{2}} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                  6. exp-negN/A

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

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(e^{im}\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                  8. exp-lowering-exp.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                  9. exp-lowering-exp.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                  10. +-lowering-+.f64N/A

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

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right) \]
                  12. unpow2N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right) \]
                  13. *-lowering-*.f6477.8%

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right) \]
                5. Simplified77.8%

                  \[\leadsto \color{blue}{\left(\frac{1}{e^{im}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)} \]
                6. Taylor expanded in im around 0

                  \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(im \cdot \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right)\right)}, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                7. Step-by-step derivation
                  1. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right)\right), \mathsf{+.f64}\left(\color{blue}{\frac{1}{2}}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                  2. sub-negN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) + \left(\mathsf{neg}\left(2\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                  3. metadata-evalN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) + -2\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                  4. +-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \left(-2 + {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                  5. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                  6. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\left({im}^{2}\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                  7. unpow2N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\left(im \cdot im\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                  8. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                  9. sub-negN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                  10. metadata-evalN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) + \frac{-1}{3}\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                  11. +-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{3} + {im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                  12. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                  13. unpow2N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \left(\left(im \cdot im\right) \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                  14. associate-*l*N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \left(im \cdot \left(im \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                  15. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \left(im \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                  16. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                  17. sub-negN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{2520} \cdot {im}^{2} + \left(\mathsf{neg}\left(\frac{1}{60}\right)\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                  18. metadata-evalN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{2520} \cdot {im}^{2} + \frac{-1}{60}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                  19. +-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{60} + \frac{-1}{2520} \cdot {im}^{2}\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                  20. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{60}, \left(\frac{-1}{2520} \cdot {im}^{2}\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                8. Simplified76.0%

                  \[\leadsto \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot \left(-0.3333333333333333 + im \cdot \left(im \cdot \left(-0.016666666666666666 + \left(im \cdot im\right) \cdot -0.0003968253968253968\right)\right)\right)\right)\right)} \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \]
              8. Recombined 3 regimes into one program.
              9. Final simplification63.1%

                \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 410:\\ \;\;\;\;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)\\ \mathbf{elif}\;im \leq 2.8 \cdot 10^{+24}:\\ \;\;\;\;im \cdot \left(\left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot -0.008333333333333333\right)\right) \cdot \left(1 + re \cdot \left(re \cdot \left(-0.5 + \left(re \cdot re\right) \cdot 0.041666666666666664\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot \left(-0.3333333333333333 + im \cdot \left(im \cdot \left(-0.016666666666666666 + \left(im \cdot im\right) \cdot -0.0003968253968253968\right)\right)\right)\right)\right)\\ \end{array} \]
              10. Add Preprocessing

              Alternative 21: 60.4% accurate, 10.0× 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(-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)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;re \leq 4.4 \cdot 10^{+101}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\ \;\;\;\;im\_m \cdot \left(\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot -0.3333333333333333\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \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
                        (+
                         -1.0
                         (*
                          (* im_m im_m)
                          (+
                           -0.16666666666666666
                           (*
                            im_m
                            (*
                             im_m
                             (+
                              -0.008333333333333333
                              (* (* im_m im_m) -0.0001984126984126984))))))))))
                 (*
                  im_s
                  (if (<= re 4.4e+101)
                    t_0
                    (if (<= re 2.1e+198)
                      (*
                       im_m
                       (*
                        (+ 0.5 (* -0.25 (* re re)))
                        (+ -2.0 (* (* im_m im_m) -0.3333333333333333))))
                      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 * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)))))));
              	double tmp;
              	if (re <= 4.4e+101) {
              		tmp = t_0;
              	} else if (re <= 2.1e+198) {
              		tmp = im_m * ((0.5 + (-0.25 * (re * re))) * (-2.0 + ((im_m * im_m) * -0.3333333333333333)));
              	} else {
              		tmp = 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 * ((-1.0d0) + ((im_m * im_m) * ((-0.16666666666666666d0) + (im_m * (im_m * ((-0.008333333333333333d0) + ((im_m * im_m) * (-0.0001984126984126984d0))))))))
                  if (re <= 4.4d+101) then
                      tmp = t_0
                  else if (re <= 2.1d+198) then
                      tmp = im_m * ((0.5d0 + ((-0.25d0) * (re * re))) * ((-2.0d0) + ((im_m * im_m) * (-0.3333333333333333d0))))
                  else
                      tmp = 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 * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)))))));
              	double tmp;
              	if (re <= 4.4e+101) {
              		tmp = t_0;
              	} else if (re <= 2.1e+198) {
              		tmp = im_m * ((0.5 + (-0.25 * (re * re))) * (-2.0 + ((im_m * im_m) * -0.3333333333333333)));
              	} else {
              		tmp = 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 * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)))))))
              	tmp = 0
              	if re <= 4.4e+101:
              		tmp = t_0
              	elif re <= 2.1e+198:
              		tmp = im_m * ((0.5 + (-0.25 * (re * re))) * (-2.0 + ((im_m * im_m) * -0.3333333333333333)))
              	else:
              		tmp = 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(-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))))))))
              	tmp = 0.0
              	if (re <= 4.4e+101)
              		tmp = t_0;
              	elseif (re <= 2.1e+198)
              		tmp = Float64(im_m * Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * Float64(-2.0 + Float64(Float64(im_m * im_m) * -0.3333333333333333))));
              	else
              		tmp = 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 * (-1.0 + ((im_m * im_m) * (-0.16666666666666666 + (im_m * (im_m * (-0.008333333333333333 + ((im_m * im_m) * -0.0001984126984126984)))))));
              	tmp = 0.0;
              	if (re <= 4.4e+101)
              		tmp = t_0;
              	elseif (re <= 2.1e+198)
              		tmp = im_m * ((0.5 + (-0.25 * (re * re))) * (-2.0 + ((im_m * im_m) * -0.3333333333333333)));
              	else
              		tmp = 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[(-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]}, N[(im$95$s * If[LessEqual[re, 4.4e+101], t$95$0, If[LessEqual[re, 2.1e+198], N[(im$95$m * N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-2.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]), $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(-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)\\
              im\_s \cdot \begin{array}{l}
              \mathbf{if}\;re \leq 4.4 \cdot 10^{+101}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\
              \;\;\;\;im\_m \cdot \left(\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot -0.3333333333333333\right)\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_0\\
              
              
              \end{array}
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if re < 4.4000000000000001e101 or 2.10000000000000013e198 < re

                1. Initial program 57.5%

                  \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                2. Add Preprocessing
                3. Taylor expanded in im around 0

                  \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
                4. Step-by-step derivation
                  1. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
                  2. distribute-rgt-inN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
                  3. associate-+r+N/A

                    \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
                  4. *-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
                  5. +-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
                  6. +-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
                5. Simplified90.2%

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

                  \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\color{blue}{1}, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
                7. Step-by-step derivation
                  1. Simplified63.1%

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

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

                      \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) - 1\right)}\right) \]
                    2. sub-negN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
                    3. metadata-evalN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) + -1\right)\right) \]
                    4. +-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(-1 + \color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)}\right)\right) \]
                    5. +-lowering-+.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)\right)}\right)\right) \]
                    6. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right)}\right)\right)\right) \]
                    7. unpow2N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left(\color{blue}{{im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)} - \frac{1}{6}\right)\right)\right)\right) \]
                    8. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{{im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)} - \frac{1}{6}\right)\right)\right)\right) \]
                    9. sub-negN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}\right)\right)\right)\right) \]
                    10. metadata-evalN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) + \frac{-1}{6}\right)\right)\right)\right) \]
                    11. +-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{6} + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)}\right)\right)\right)\right) \]
                    12. +-lowering-+.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right) \]
                    13. unpow2N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(\left(im \cdot im\right) \cdot \left(\color{blue}{\frac{-1}{5040} \cdot {im}^{2}} - \frac{1}{120}\right)\right)\right)\right)\right)\right) \]
                    14. associate-*l*N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \left(im \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right)\right) \]
                    15. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \color{blue}{\left(im \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)\right)}\right)\right)\right)\right)\right) \]
                    16. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right)}\right)\right)\right)\right)\right)\right) \]
                    17. sub-negN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{120}\right)\right)}\right)\right)\right)\right)\right)\right)\right) \]
                    18. metadata-evalN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{5040} \cdot {im}^{2} + \frac{-1}{120}\right)\right)\right)\right)\right)\right)\right) \]
                    19. +-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{120} + \color{blue}{\frac{-1}{5040} \cdot {im}^{2}}\right)\right)\right)\right)\right)\right)\right) \]
                    20. +-lowering-+.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{120}, \color{blue}{\left(\frac{-1}{5040} \cdot {im}^{2}\right)}\right)\right)\right)\right)\right)\right)\right) \]
                  4. Simplified63.1%

                    \[\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)} \]

                  if 4.4000000000000001e101 < re < 2.10000000000000013e198

                  1. Initial program 83.9%

                    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                  2. Add Preprocessing
                  3. Taylor expanded in re around 0

                    \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
                  4. Step-by-step derivation
                    1. +-commutativeN/A

                      \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right)} \]
                    2. associate-*r*N/A

                      \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \left(\frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
                    3. distribute-rgt-outN/A

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

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

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(e^{\mathsf{neg}\left(im\right)}\right), \left(e^{im}\right)\right), \left(\color{blue}{\frac{1}{2}} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                    6. exp-negN/A

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

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(e^{im}\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                    8. exp-lowering-exp.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                    9. exp-lowering-exp.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                    10. +-lowering-+.f64N/A

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

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right) \]
                    12. unpow2N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right) \]
                    13. *-lowering-*.f6439.4%

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right) \]
                  5. Simplified39.4%

                    \[\leadsto \color{blue}{\left(\frac{1}{e^{im}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)} \]
                  6. Taylor expanded in im around 0

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

                      \[\leadsto im \cdot \left(-2 \cdot \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right) + \left({im}^{2} \cdot \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \cdot \color{blue}{\frac{-1}{3}}\right) \]
                    2. associate-*r*N/A

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

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

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

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

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

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\left(\frac{-1}{3} \cdot {im}^{2}\right) \cdot \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right) + -2 \cdot \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right)\right) \]
                    8. distribute-rgt-outN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(\frac{-1}{3} \cdot {im}^{2} + -2\right)}\right)\right) \]
                    9. metadata-evalN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right) \cdot \left(\frac{-1}{3} \cdot {im}^{2} + \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right) \]
                    10. sub-negN/A

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

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right), \color{blue}{\left(\frac{-1}{3} \cdot {im}^{2} - 2\right)}\right)\right) \]
                  8. Simplified39.3%

                    \[\leadsto \color{blue}{im \cdot \left(\left(0.5 + \left(re \cdot re\right) \cdot -0.25\right) \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)} \]
                8. Recombined 2 regimes into one program.
                9. Final simplification61.4%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 4.4 \cdot 10^{+101}:\\ \;\;\;\;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)\\ \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\ \;\;\;\;im \cdot \left(\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)\\ \mathbf{else}:\\ \;\;\;\;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)\\ \end{array} \]
                10. Add Preprocessing

                Alternative 22: 58.7% 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(-1 + im\_m \cdot \left(im\_m \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.008333333333333333\right)\right)\right)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;re \leq 4.4 \cdot 10^{+101}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\ \;\;\;\;im\_m \cdot \left(\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot -0.3333333333333333\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \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
                          (+
                           -1.0
                           (*
                            im_m
                            (*
                             im_m
                             (+
                              -0.16666666666666666
                              (* (* im_m im_m) -0.008333333333333333))))))))
                   (*
                    im_s
                    (if (<= re 4.4e+101)
                      t_0
                      (if (<= re 2.1e+198)
                        (*
                         im_m
                         (*
                          (+ 0.5 (* -0.25 (* re re)))
                          (+ -2.0 (* (* im_m im_m) -0.3333333333333333))))
                        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 * (-1.0 + (im_m * (im_m * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))));
                	double tmp;
                	if (re <= 4.4e+101) {
                		tmp = t_0;
                	} else if (re <= 2.1e+198) {
                		tmp = im_m * ((0.5 + (-0.25 * (re * re))) * (-2.0 + ((im_m * im_m) * -0.3333333333333333)));
                	} else {
                		tmp = 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 * ((-1.0d0) + (im_m * (im_m * ((-0.16666666666666666d0) + ((im_m * im_m) * (-0.008333333333333333d0))))))
                    if (re <= 4.4d+101) then
                        tmp = t_0
                    else if (re <= 2.1d+198) then
                        tmp = im_m * ((0.5d0 + ((-0.25d0) * (re * re))) * ((-2.0d0) + ((im_m * im_m) * (-0.3333333333333333d0))))
                    else
                        tmp = 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 * (-1.0 + (im_m * (im_m * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))));
                	double tmp;
                	if (re <= 4.4e+101) {
                		tmp = t_0;
                	} else if (re <= 2.1e+198) {
                		tmp = im_m * ((0.5 + (-0.25 * (re * re))) * (-2.0 + ((im_m * im_m) * -0.3333333333333333)));
                	} else {
                		tmp = 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 * (-1.0 + (im_m * (im_m * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))))
                	tmp = 0
                	if re <= 4.4e+101:
                		tmp = t_0
                	elif re <= 2.1e+198:
                		tmp = im_m * ((0.5 + (-0.25 * (re * re))) * (-2.0 + ((im_m * im_m) * -0.3333333333333333)))
                	else:
                		tmp = 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(-1.0 + Float64(im_m * Float64(im_m * Float64(-0.16666666666666666 + Float64(Float64(im_m * im_m) * -0.008333333333333333))))))
                	tmp = 0.0
                	if (re <= 4.4e+101)
                		tmp = t_0;
                	elseif (re <= 2.1e+198)
                		tmp = Float64(im_m * Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * Float64(-2.0 + Float64(Float64(im_m * im_m) * -0.3333333333333333))));
                	else
                		tmp = 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 * (-1.0 + (im_m * (im_m * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))));
                	tmp = 0.0;
                	if (re <= 4.4e+101)
                		tmp = t_0;
                	elseif (re <= 2.1e+198)
                		tmp = im_m * ((0.5 + (-0.25 * (re * re))) * (-2.0 + ((im_m * im_m) * -0.3333333333333333)));
                	else
                		tmp = 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[(-1.0 + N[(im$95$m * N[(im$95$m * N[(-0.16666666666666666 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[re, 4.4e+101], t$95$0, If[LessEqual[re, 2.1e+198], N[(im$95$m * N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-2.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]), $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(-1 + im\_m \cdot \left(im\_m \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.008333333333333333\right)\right)\right)\\
                im\_s \cdot \begin{array}{l}
                \mathbf{if}\;re \leq 4.4 \cdot 10^{+101}:\\
                \;\;\;\;t\_0\\
                
                \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\
                \;\;\;\;im\_m \cdot \left(\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(-2 + \left(im\_m \cdot im\_m\right) \cdot -0.3333333333333333\right)\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_0\\
                
                
                \end{array}
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if re < 4.4000000000000001e101 or 2.10000000000000013e198 < re

                  1. Initial program 57.5%

                    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                  2. Add Preprocessing
                  3. Taylor expanded in im around 0

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

                      \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right) \]
                    2. *-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right) \]
                    3. +-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right) + \color{blue}{\frac{-1}{6} \cdot \cos re}\right)\right)\right) \]
                    4. distribute-lft-inN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re\right)}\right)\right)\right) \]
                    5. associate-*r*N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\left(\frac{-1}{120} \cdot {im}^{2}\right) \cdot \cos re\right) + {im}^{\color{blue}{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
                    6. associate-*r*N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
                    7. associate-*r*N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left({im}^{2} \cdot \frac{-1}{6}\right) \cdot \color{blue}{\cos re}\right)\right)\right) \]
                    8. *-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \cos \color{blue}{re}\right)\right)\right) \]
                    9. distribute-rgt-outN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \cos re \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)}\right)\right) \]
                    10. distribute-lft-outN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
                    11. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\cos re, \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
                    12. cos-lowering-cos.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(\color{blue}{-1} + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)\right)\right) \]
                  5. Simplified86.3%

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

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

                      \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2} - \frac{1}{6}\right) - 1\right)}\right) \]
                    2. sub-negN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2} - \frac{1}{6}\right) + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
                    3. metadata-evalN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2} - \frac{1}{6}\right) + -1\right)\right) \]
                    4. +-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(-1 + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2} - \frac{1}{6}\right)}\right)\right) \]
                    5. +-lowering-+.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2} - \frac{1}{6}\right)\right)}\right)\right) \]
                    6. unpow2N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \left(\left(im \cdot im\right) \cdot \left(\color{blue}{\frac{-1}{120} \cdot {im}^{2}} - \frac{1}{6}\right)\right)\right)\right) \]
                    7. associate-*l*N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \left(im \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{120} \cdot {im}^{2} - \frac{1}{6}\right)\right)}\right)\right)\right) \]
                    8. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(im, \color{blue}{\left(im \cdot \left(\frac{-1}{120} \cdot {im}^{2} - \frac{1}{6}\right)\right)}\right)\right)\right) \]
                    9. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{120} \cdot {im}^{2} - \frac{1}{6}\right)}\right)\right)\right)\right) \]
                    10. sub-negN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{120} \cdot {im}^{2} + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}\right)\right)\right)\right)\right) \]
                    11. metadata-evalN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{120} \cdot {im}^{2} + \frac{-1}{6}\right)\right)\right)\right)\right) \]
                    12. +-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{6} + \color{blue}{\frac{-1}{120} \cdot {im}^{2}}\right)\right)\right)\right)\right) \]
                    13. +-lowering-+.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{6}, \color{blue}{\left(\frac{-1}{120} \cdot {im}^{2}\right)}\right)\right)\right)\right)\right) \]
                    14. *-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{6}, \left({im}^{2} \cdot \color{blue}{\frac{-1}{120}}\right)\right)\right)\right)\right)\right) \]
                    15. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\frac{-1}{120}}\right)\right)\right)\right)\right)\right) \]
                    16. unpow2N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{-1}{120}\right)\right)\right)\right)\right)\right) \]
                    17. *-lowering-*.f6459.5%

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{120}\right)\right)\right)\right)\right)\right) \]
                  8. Simplified59.5%

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

                  if 4.4000000000000001e101 < re < 2.10000000000000013e198

                  1. Initial program 83.9%

                    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                  2. Add Preprocessing
                  3. Taylor expanded in re around 0

                    \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
                  4. Step-by-step derivation
                    1. +-commutativeN/A

                      \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right)} \]
                    2. associate-*r*N/A

                      \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \left(\frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
                    3. distribute-rgt-outN/A

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

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

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(e^{\mathsf{neg}\left(im\right)}\right), \left(e^{im}\right)\right), \left(\color{blue}{\frac{1}{2}} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                    6. exp-negN/A

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

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(e^{im}\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                    8. exp-lowering-exp.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                    9. exp-lowering-exp.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                    10. +-lowering-+.f64N/A

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

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right) \]
                    12. unpow2N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right) \]
                    13. *-lowering-*.f6439.4%

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right) \]
                  5. Simplified39.4%

                    \[\leadsto \color{blue}{\left(\frac{1}{e^{im}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)} \]
                  6. Taylor expanded in im around 0

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

                      \[\leadsto im \cdot \left(-2 \cdot \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right) + \left({im}^{2} \cdot \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \cdot \color{blue}{\frac{-1}{3}}\right) \]
                    2. associate-*r*N/A

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

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

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

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

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

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\left(\frac{-1}{3} \cdot {im}^{2}\right) \cdot \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right) + -2 \cdot \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right)\right) \]
                    8. distribute-rgt-outN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(\frac{-1}{3} \cdot {im}^{2} + -2\right)}\right)\right) \]
                    9. metadata-evalN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right) \cdot \left(\frac{-1}{3} \cdot {im}^{2} + \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right) \]
                    10. sub-negN/A

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

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right), \color{blue}{\left(\frac{-1}{3} \cdot {im}^{2} - 2\right)}\right)\right) \]
                  8. Simplified39.3%

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

                  \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 4.4 \cdot 10^{+101}:\\ \;\;\;\;im \cdot \left(-1 + im \cdot \left(im \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot -0.008333333333333333\right)\right)\right)\\ \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\ \;\;\;\;im \cdot \left(\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(-1 + im \cdot \left(im \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot -0.008333333333333333\right)\right)\right)\\ \end{array} \]
                5. Add Preprocessing

                Alternative 23: 58.5% accurate, 12.3× 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(-1 + im\_m \cdot \left(im\_m \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.008333333333333333\right)\right)\right)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;re \leq 4.4 \cdot 10^{+101}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(im\_m \cdot -2\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \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
                          (+
                           -1.0
                           (*
                            im_m
                            (*
                             im_m
                             (+
                              -0.16666666666666666
                              (* (* im_m im_m) -0.008333333333333333))))))))
                   (*
                    im_s
                    (if (<= re 4.4e+101)
                      t_0
                      (if (<= re 2.1e+198)
                        (* (+ 0.5 (* -0.25 (* re re))) (* im_m -2.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 * (-1.0 + (im_m * (im_m * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))));
                	double tmp;
                	if (re <= 4.4e+101) {
                		tmp = t_0;
                	} else if (re <= 2.1e+198) {
                		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * -2.0);
                	} else {
                		tmp = 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 * ((-1.0d0) + (im_m * (im_m * ((-0.16666666666666666d0) + ((im_m * im_m) * (-0.008333333333333333d0))))))
                    if (re <= 4.4d+101) then
                        tmp = t_0
                    else if (re <= 2.1d+198) then
                        tmp = (0.5d0 + ((-0.25d0) * (re * re))) * (im_m * (-2.0d0))
                    else
                        tmp = 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 * (-1.0 + (im_m * (im_m * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))));
                	double tmp;
                	if (re <= 4.4e+101) {
                		tmp = t_0;
                	} else if (re <= 2.1e+198) {
                		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * -2.0);
                	} else {
                		tmp = 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 * (-1.0 + (im_m * (im_m * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))))
                	tmp = 0
                	if re <= 4.4e+101:
                		tmp = t_0
                	elif re <= 2.1e+198:
                		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * -2.0)
                	else:
                		tmp = 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(-1.0 + Float64(im_m * Float64(im_m * Float64(-0.16666666666666666 + Float64(Float64(im_m * im_m) * -0.008333333333333333))))))
                	tmp = 0.0
                	if (re <= 4.4e+101)
                		tmp = t_0;
                	elseif (re <= 2.1e+198)
                		tmp = Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * Float64(im_m * -2.0));
                	else
                		tmp = 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 * (-1.0 + (im_m * (im_m * (-0.16666666666666666 + ((im_m * im_m) * -0.008333333333333333)))));
                	tmp = 0.0;
                	if (re <= 4.4e+101)
                		tmp = t_0;
                	elseif (re <= 2.1e+198)
                		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * -2.0);
                	else
                		tmp = 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[(-1.0 + N[(im$95$m * N[(im$95$m * N[(-0.16666666666666666 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[re, 4.4e+101], t$95$0, If[LessEqual[re, 2.1e+198], N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(im$95$m * -2.0), $MachinePrecision]), $MachinePrecision], t$95$0]]), $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(-1 + im\_m \cdot \left(im\_m \cdot \left(-0.16666666666666666 + \left(im\_m \cdot im\_m\right) \cdot -0.008333333333333333\right)\right)\right)\\
                im\_s \cdot \begin{array}{l}
                \mathbf{if}\;re \leq 4.4 \cdot 10^{+101}:\\
                \;\;\;\;t\_0\\
                
                \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\
                \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(im\_m \cdot -2\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_0\\
                
                
                \end{array}
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if re < 4.4000000000000001e101 or 2.10000000000000013e198 < re

                  1. Initial program 57.5%

                    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                  2. Add Preprocessing
                  3. Taylor expanded in im around 0

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

                      \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right) \]
                    2. *-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right) \]
                    3. +-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right) + \color{blue}{\frac{-1}{6} \cdot \cos re}\right)\right)\right) \]
                    4. distribute-lft-inN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re\right)}\right)\right)\right) \]
                    5. associate-*r*N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\left(\frac{-1}{120} \cdot {im}^{2}\right) \cdot \cos re\right) + {im}^{\color{blue}{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
                    6. associate-*r*N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
                    7. associate-*r*N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left({im}^{2} \cdot \frac{-1}{6}\right) \cdot \color{blue}{\cos re}\right)\right)\right) \]
                    8. *-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \cos \color{blue}{re}\right)\right)\right) \]
                    9. distribute-rgt-outN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \cos re \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)}\right)\right) \]
                    10. distribute-lft-outN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
                    11. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\cos re, \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
                    12. cos-lowering-cos.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(\color{blue}{-1} + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)\right)\right) \]
                  5. Simplified86.3%

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

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

                      \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2} - \frac{1}{6}\right) - 1\right)}\right) \]
                    2. sub-negN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2} - \frac{1}{6}\right) + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
                    3. metadata-evalN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2} - \frac{1}{6}\right) + -1\right)\right) \]
                    4. +-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(-1 + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2} - \frac{1}{6}\right)}\right)\right) \]
                    5. +-lowering-+.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2} - \frac{1}{6}\right)\right)}\right)\right) \]
                    6. unpow2N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \left(\left(im \cdot im\right) \cdot \left(\color{blue}{\frac{-1}{120} \cdot {im}^{2}} - \frac{1}{6}\right)\right)\right)\right) \]
                    7. associate-*l*N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \left(im \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{120} \cdot {im}^{2} - \frac{1}{6}\right)\right)}\right)\right)\right) \]
                    8. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(im, \color{blue}{\left(im \cdot \left(\frac{-1}{120} \cdot {im}^{2} - \frac{1}{6}\right)\right)}\right)\right)\right) \]
                    9. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{120} \cdot {im}^{2} - \frac{1}{6}\right)}\right)\right)\right)\right) \]
                    10. sub-negN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{120} \cdot {im}^{2} + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}\right)\right)\right)\right)\right) \]
                    11. metadata-evalN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{120} \cdot {im}^{2} + \frac{-1}{6}\right)\right)\right)\right)\right) \]
                    12. +-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{6} + \color{blue}{\frac{-1}{120} \cdot {im}^{2}}\right)\right)\right)\right)\right) \]
                    13. +-lowering-+.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{6}, \color{blue}{\left(\frac{-1}{120} \cdot {im}^{2}\right)}\right)\right)\right)\right)\right) \]
                    14. *-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{6}, \left({im}^{2} \cdot \color{blue}{\frac{-1}{120}}\right)\right)\right)\right)\right)\right) \]
                    15. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\frac{-1}{120}}\right)\right)\right)\right)\right)\right) \]
                    16. unpow2N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{-1}{120}\right)\right)\right)\right)\right)\right) \]
                    17. *-lowering-*.f6459.5%

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{120}\right)\right)\right)\right)\right)\right) \]
                  8. Simplified59.5%

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

                  if 4.4000000000000001e101 < re < 2.10000000000000013e198

                  1. Initial program 83.9%

                    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                  2. Add Preprocessing
                  3. Taylor expanded in re around 0

                    \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
                  4. Step-by-step derivation
                    1. +-commutativeN/A

                      \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right)} \]
                    2. associate-*r*N/A

                      \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \left(\frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
                    3. distribute-rgt-outN/A

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

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

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(e^{\mathsf{neg}\left(im\right)}\right), \left(e^{im}\right)\right), \left(\color{blue}{\frac{1}{2}} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                    6. exp-negN/A

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

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(e^{im}\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                    8. exp-lowering-exp.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                    9. exp-lowering-exp.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                    10. +-lowering-+.f64N/A

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

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right) \]
                    12. unpow2N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right) \]
                    13. *-lowering-*.f6439.4%

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right) \]
                  5. Simplified39.4%

                    \[\leadsto \color{blue}{\left(\frac{1}{e^{im}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)} \]
                  6. Taylor expanded in im around 0

                    \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(-2 \cdot im\right)}, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                  7. Step-by-step derivation
                    1. *-commutativeN/A

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

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, -2\right), \mathsf{+.f64}\left(\color{blue}{\frac{1}{2}}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                  8. Simplified39.3%

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

                  \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 4.4 \cdot 10^{+101}:\\ \;\;\;\;im \cdot \left(-1 + im \cdot \left(im \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot -0.008333333333333333\right)\right)\right)\\ \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(im \cdot -2\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(-1 + im \cdot \left(im \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot -0.008333333333333333\right)\right)\right)\\ \end{array} \]
                5. Add Preprocessing

                Alternative 24: 53.9% accurate, 14.7× 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(-1 + \left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666\right)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;re \leq 4.4 \cdot 10^{+101}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(im\_m \cdot -2\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \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 (+ -1.0 (* (* im_m im_m) -0.16666666666666666)))))
                   (*
                    im_s
                    (if (<= re 4.4e+101)
                      t_0
                      (if (<= re 2.1e+198)
                        (* (+ 0.5 (* -0.25 (* re re))) (* im_m -2.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 * (-1.0 + ((im_m * im_m) * -0.16666666666666666));
                	double tmp;
                	if (re <= 4.4e+101) {
                		tmp = t_0;
                	} else if (re <= 2.1e+198) {
                		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * -2.0);
                	} else {
                		tmp = 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 * ((-1.0d0) + ((im_m * im_m) * (-0.16666666666666666d0)))
                    if (re <= 4.4d+101) then
                        tmp = t_0
                    else if (re <= 2.1d+198) then
                        tmp = (0.5d0 + ((-0.25d0) * (re * re))) * (im_m * (-2.0d0))
                    else
                        tmp = 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 * (-1.0 + ((im_m * im_m) * -0.16666666666666666));
                	double tmp;
                	if (re <= 4.4e+101) {
                		tmp = t_0;
                	} else if (re <= 2.1e+198) {
                		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * -2.0);
                	} else {
                		tmp = 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 * (-1.0 + ((im_m * im_m) * -0.16666666666666666))
                	tmp = 0
                	if re <= 4.4e+101:
                		tmp = t_0
                	elif re <= 2.1e+198:
                		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * -2.0)
                	else:
                		tmp = 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(-1.0 + Float64(Float64(im_m * im_m) * -0.16666666666666666)))
                	tmp = 0.0
                	if (re <= 4.4e+101)
                		tmp = t_0;
                	elseif (re <= 2.1e+198)
                		tmp = Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * Float64(im_m * -2.0));
                	else
                		tmp = 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 * (-1.0 + ((im_m * im_m) * -0.16666666666666666));
                	tmp = 0.0;
                	if (re <= 4.4e+101)
                		tmp = t_0;
                	elseif (re <= 2.1e+198)
                		tmp = (0.5 + (-0.25 * (re * re))) * (im_m * -2.0);
                	else
                		tmp = 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[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[re, 4.4e+101], t$95$0, If[LessEqual[re, 2.1e+198], N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(im$95$m * -2.0), $MachinePrecision]), $MachinePrecision], t$95$0]]), $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(-1 + \left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666\right)\\
                im\_s \cdot \begin{array}{l}
                \mathbf{if}\;re \leq 4.4 \cdot 10^{+101}:\\
                \;\;\;\;t\_0\\
                
                \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\
                \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(im\_m \cdot -2\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_0\\
                
                
                \end{array}
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if re < 4.4000000000000001e101 or 2.10000000000000013e198 < re

                  1. Initial program 57.5%

                    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                  2. Add Preprocessing
                  3. Taylor expanded in im around 0

                    \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
                  4. Step-by-step derivation
                    1. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
                    2. distribute-rgt-inN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
                    3. associate-+r+N/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
                    4. *-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
                    5. +-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
                    6. +-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
                  5. Simplified90.2%

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

                    \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\color{blue}{1}, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
                  7. Step-by-step derivation
                    1. Simplified63.1%

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

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

                        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{6} \cdot {im}^{2} - 1\right)}\right) \]
                      2. sub-negN/A

                        \[\leadsto \mathsf{*.f64}\left(im, \left(\frac{-1}{6} \cdot {im}^{2} + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
                      3. metadata-evalN/A

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

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

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

                        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \color{blue}{\left({im}^{2}\right)}\right)\right)\right) \]
                      7. unpow2N/A

                        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \left(im \cdot \color{blue}{im}\right)\right)\right)\right) \]
                      8. *-lowering-*.f6454.9%

                        \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right)\right) \]
                    4. Simplified54.9%

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

                    if 4.4000000000000001e101 < re < 2.10000000000000013e198

                    1. Initial program 83.9%

                      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                    2. Add Preprocessing
                    3. Taylor expanded in re around 0

                      \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
                    4. Step-by-step derivation
                      1. +-commutativeN/A

                        \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \color{blue}{\frac{-1}{4} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right)} \]
                      2. associate-*r*N/A

                        \[\leadsto \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) + \left(\frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)} \]
                      3. distribute-rgt-outN/A

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

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

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(e^{\mathsf{neg}\left(im\right)}\right), \left(e^{im}\right)\right), \left(\color{blue}{\frac{1}{2}} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                      6. exp-negN/A

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

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(e^{im}\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                      8. exp-lowering-exp.f64N/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \left(e^{im}\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                      9. exp-lowering-exp.f64N/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                      10. +-lowering-+.f64N/A

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

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right) \]
                      12. unpow2N/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right) \]
                      13. *-lowering-*.f6439.4%

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(im\right)\right), \mathsf{exp.f64}\left(im\right)\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right) \]
                    5. Simplified39.4%

                      \[\leadsto \color{blue}{\left(\frac{1}{e^{im}} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)} \]
                    6. Taylor expanded in im around 0

                      \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(-2 \cdot im\right)}, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                    7. Step-by-step derivation
                      1. *-commutativeN/A

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

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, -2\right), \mathsf{+.f64}\left(\color{blue}{\frac{1}{2}}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right) \]
                    8. Simplified39.3%

                      \[\leadsto \color{blue}{\left(im \cdot -2\right)} \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \]
                  8. Recombined 2 regimes into one program.
                  9. Final simplification53.8%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 4.4 \cdot 10^{+101}:\\ \;\;\;\;im \cdot \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\\ \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\ \;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(im \cdot -2\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\\ \end{array} \]
                  10. Add Preprocessing

                  Alternative 25: 53.9% accurate, 16.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(-1 + \left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666\right)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;re \leq 4.4 \cdot 10^{+101}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\ \;\;\;\;im\_m \cdot \left(-1 + 0.5 \cdot \left(re \cdot re\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \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 (+ -1.0 (* (* im_m im_m) -0.16666666666666666)))))
                     (*
                      im_s
                      (if (<= re 4.4e+101)
                        t_0
                        (if (<= re 2.1e+198) (* im_m (+ -1.0 (* 0.5 (* re 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 * (-1.0 + ((im_m * im_m) * -0.16666666666666666));
                  	double tmp;
                  	if (re <= 4.4e+101) {
                  		tmp = t_0;
                  	} else if (re <= 2.1e+198) {
                  		tmp = im_m * (-1.0 + (0.5 * (re * re)));
                  	} else {
                  		tmp = 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 * ((-1.0d0) + ((im_m * im_m) * (-0.16666666666666666d0)))
                      if (re <= 4.4d+101) then
                          tmp = t_0
                      else if (re <= 2.1d+198) then
                          tmp = im_m * ((-1.0d0) + (0.5d0 * (re * re)))
                      else
                          tmp = 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 * (-1.0 + ((im_m * im_m) * -0.16666666666666666));
                  	double tmp;
                  	if (re <= 4.4e+101) {
                  		tmp = t_0;
                  	} else if (re <= 2.1e+198) {
                  		tmp = im_m * (-1.0 + (0.5 * (re * re)));
                  	} else {
                  		tmp = 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 * (-1.0 + ((im_m * im_m) * -0.16666666666666666))
                  	tmp = 0
                  	if re <= 4.4e+101:
                  		tmp = t_0
                  	elif re <= 2.1e+198:
                  		tmp = im_m * (-1.0 + (0.5 * (re * re)))
                  	else:
                  		tmp = 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(-1.0 + Float64(Float64(im_m * im_m) * -0.16666666666666666)))
                  	tmp = 0.0
                  	if (re <= 4.4e+101)
                  		tmp = t_0;
                  	elseif (re <= 2.1e+198)
                  		tmp = Float64(im_m * Float64(-1.0 + Float64(0.5 * Float64(re * re))));
                  	else
                  		tmp = 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 * (-1.0 + ((im_m * im_m) * -0.16666666666666666));
                  	tmp = 0.0;
                  	if (re <= 4.4e+101)
                  		tmp = t_0;
                  	elseif (re <= 2.1e+198)
                  		tmp = im_m * (-1.0 + (0.5 * (re * re)));
                  	else
                  		tmp = 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[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[re, 4.4e+101], t$95$0, If[LessEqual[re, 2.1e+198], N[(im$95$m * N[(-1.0 + N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]), $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(-1 + \left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666\right)\\
                  im\_s \cdot \begin{array}{l}
                  \mathbf{if}\;re \leq 4.4 \cdot 10^{+101}:\\
                  \;\;\;\;t\_0\\
                  
                  \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\
                  \;\;\;\;im\_m \cdot \left(-1 + 0.5 \cdot \left(re \cdot re\right)\right)\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;t\_0\\
                  
                  
                  \end{array}
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if re < 4.4000000000000001e101 or 2.10000000000000013e198 < re

                    1. Initial program 57.5%

                      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                    2. Add Preprocessing
                    3. Taylor expanded in im around 0

                      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
                    4. Step-by-step derivation
                      1. *-lowering-*.f64N/A

                        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
                      2. distribute-rgt-inN/A

                        \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
                      3. associate-+r+N/A

                        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
                      4. *-commutativeN/A

                        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
                      5. +-commutativeN/A

                        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
                      6. +-commutativeN/A

                        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
                    5. Simplified90.2%

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

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\color{blue}{1}, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
                    7. Step-by-step derivation
                      1. Simplified63.1%

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

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

                          \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{6} \cdot {im}^{2} - 1\right)}\right) \]
                        2. sub-negN/A

                          \[\leadsto \mathsf{*.f64}\left(im, \left(\frac{-1}{6} \cdot {im}^{2} + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
                        3. metadata-evalN/A

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

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

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

                          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \color{blue}{\left({im}^{2}\right)}\right)\right)\right) \]
                        7. unpow2N/A

                          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \left(im \cdot \color{blue}{im}\right)\right)\right)\right) \]
                        8. *-lowering-*.f6454.9%

                          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right)\right) \]
                      4. Simplified54.9%

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

                      if 4.4000000000000001e101 < re < 2.10000000000000013e198

                      1. Initial program 83.9%

                        \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                      2. Add Preprocessing
                      3. Taylor expanded in im around 0

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

                          \[\leadsto \mathsf{neg}\left(im \cdot \cos re\right) \]
                        2. neg-sub0N/A

                          \[\leadsto 0 - \color{blue}{im \cdot \cos re} \]
                        3. --lowering--.f64N/A

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

                          \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \color{blue}{\cos re}\right)\right) \]
                        5. cos-lowering-cos.f6422.7%

                          \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
                      5. Simplified22.7%

                        \[\leadsto \color{blue}{0 - im \cdot \cos re} \]
                      6. Taylor expanded in re around 0

                        \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(im \cdot {re}^{2}\right) - im} \]
                      7. Step-by-step derivation
                        1. sub-negN/A

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

                          \[\leadsto \left(\mathsf{neg}\left(im\right)\right) + \color{blue}{\frac{1}{2} \cdot \left(im \cdot {re}^{2}\right)} \]
                        3. mul-1-negN/A

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

                          \[\leadsto -1 \cdot im + \frac{1}{2} \cdot \left({re}^{2} \cdot \color{blue}{im}\right) \]
                        5. associate-*r*N/A

                          \[\leadsto -1 \cdot im + \left(\frac{1}{2} \cdot {re}^{2}\right) \cdot \color{blue}{im} \]
                        6. metadata-evalN/A

                          \[\leadsto -1 \cdot im + \left(\left(-2 \cdot \frac{-1}{4}\right) \cdot {re}^{2}\right) \cdot im \]
                        7. associate-*r*N/A

                          \[\leadsto -1 \cdot im + \left(-2 \cdot \left(\frac{-1}{4} \cdot {re}^{2}\right)\right) \cdot im \]
                        8. distribute-rgt-inN/A

                          \[\leadsto im \cdot \color{blue}{\left(-1 + -2 \cdot \left(\frac{-1}{4} \cdot {re}^{2}\right)\right)} \]
                        9. metadata-evalN/A

                          \[\leadsto im \cdot \left(-2 \cdot \frac{1}{2} + \color{blue}{-2} \cdot \left(\frac{-1}{4} \cdot {re}^{2}\right)\right) \]
                        10. distribute-lft-inN/A

                          \[\leadsto im \cdot \left(-2 \cdot \color{blue}{\left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)}\right) \]
                        11. *-lowering-*.f64N/A

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

                          \[\leadsto \mathsf{*.f64}\left(im, \left(-2 \cdot \frac{1}{2} + \color{blue}{-2 \cdot \left(\frac{-1}{4} \cdot {re}^{2}\right)}\right)\right) \]
                        13. metadata-evalN/A

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

                          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \color{blue}{\left(-2 \cdot \left(\frac{-1}{4} \cdot {re}^{2}\right)\right)}\right)\right) \]
                        15. *-commutativeN/A

                          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \left(\left(\frac{-1}{4} \cdot {re}^{2}\right) \cdot \color{blue}{-2}\right)\right)\right) \]
                        16. *-commutativeN/A

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

                          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \left({re}^{2} \cdot \color{blue}{\left(\frac{-1}{4} \cdot -2\right)}\right)\right)\right) \]
                        18. metadata-evalN/A

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

                          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left({re}^{2}\right), \color{blue}{\frac{1}{2}}\right)\right)\right) \]
                        20. unpow2N/A

                          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left(re \cdot re\right), \frac{1}{2}\right)\right)\right) \]
                        21. *-lowering-*.f6439.3%

                          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \frac{1}{2}\right)\right)\right) \]
                      8. Simplified39.3%

                        \[\leadsto \color{blue}{im \cdot \left(-1 + \left(re \cdot re\right) \cdot 0.5\right)} \]
                    8. Recombined 2 regimes into one program.
                    9. Final simplification53.8%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 4.4 \cdot 10^{+101}:\\ \;\;\;\;im \cdot \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\\ \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\ \;\;\;\;im \cdot \left(-1 + 0.5 \cdot \left(re \cdot re\right)\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\\ \end{array} \]
                    10. Add Preprocessing

                    Alternative 26: 45.6% accurate, 25.7× 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 1.1 \cdot 10^{+171}:\\ \;\;\;\;0 - im\_m\\ \mathbf{else}:\\ \;\;\;\;0 - \frac{im\_m \cdot im\_m}{im\_m}\\ \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 1.1e+171) (- 0.0 im_m) (- 0.0 (/ (* im_m im_m) im_m)))))
                    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 <= 1.1e+171) {
                    		tmp = 0.0 - im_m;
                    	} else {
                    		tmp = 0.0 - ((im_m * im_m) / im_m);
                    	}
                    	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 <= 1.1d+171) then
                            tmp = 0.0d0 - im_m
                        else
                            tmp = 0.0d0 - ((im_m * im_m) / im_m)
                        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 <= 1.1e+171) {
                    		tmp = 0.0 - im_m;
                    	} else {
                    		tmp = 0.0 - ((im_m * im_m) / im_m);
                    	}
                    	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 <= 1.1e+171:
                    		tmp = 0.0 - im_m
                    	else:
                    		tmp = 0.0 - ((im_m * im_m) / im_m)
                    	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 <= 1.1e+171)
                    		tmp = Float64(0.0 - im_m);
                    	else
                    		tmp = Float64(0.0 - Float64(Float64(im_m * im_m) / im_m));
                    	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 <= 1.1e+171)
                    		tmp = 0.0 - im_m;
                    	else
                    		tmp = 0.0 - ((im_m * im_m) / im_m);
                    	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, 1.1e+171], N[(0.0 - im$95$m), $MachinePrecision], N[(0.0 - N[(N[(im$95$m * im$95$m), $MachinePrecision] / im$95$m), $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 1.1 \cdot 10^{+171}:\\
                    \;\;\;\;0 - im\_m\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;0 - \frac{im\_m \cdot im\_m}{im\_m}\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if im < 1.1e171

                      1. Initial program 56.1%

                        \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                      2. Add Preprocessing
                      3. Taylor expanded in im around 0

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

                          \[\leadsto \mathsf{neg}\left(im \cdot \cos re\right) \]
                        2. neg-sub0N/A

                          \[\leadsto 0 - \color{blue}{im \cdot \cos re} \]
                        3. --lowering--.f64N/A

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

                          \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \color{blue}{\cos re}\right)\right) \]
                        5. cos-lowering-cos.f6450.7%

                          \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
                      5. Simplified50.7%

                        \[\leadsto \color{blue}{0 - im \cdot \cos re} \]
                      6. Taylor expanded in re around 0

                        \[\leadsto \color{blue}{-1 \cdot im} \]
                      7. Step-by-step derivation
                        1. mul-1-negN/A

                          \[\leadsto \mathsf{neg}\left(im\right) \]
                        2. neg-sub0N/A

                          \[\leadsto 0 - \color{blue}{im} \]
                        3. --lowering--.f6430.0%

                          \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{im}\right) \]
                      8. Simplified30.0%

                        \[\leadsto \color{blue}{0 - im} \]
                      9. Step-by-step derivation
                        1. sub0-negN/A

                          \[\leadsto \mathsf{neg}\left(im\right) \]
                        2. neg-lowering-neg.f6430.0%

                          \[\leadsto \mathsf{neg.f64}\left(im\right) \]
                      10. Applied egg-rr30.0%

                        \[\leadsto \color{blue}{-im} \]

                      if 1.1e171 < im

                      1. Initial program 100.0%

                        \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                      2. Add Preprocessing
                      3. Taylor expanded in im around 0

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

                          \[\leadsto \mathsf{neg}\left(im \cdot \cos re\right) \]
                        2. neg-sub0N/A

                          \[\leadsto 0 - \color{blue}{im \cdot \cos re} \]
                        3. --lowering--.f64N/A

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

                          \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \color{blue}{\cos re}\right)\right) \]
                        5. cos-lowering-cos.f647.5%

                          \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
                      5. Simplified7.5%

                        \[\leadsto \color{blue}{0 - im \cdot \cos re} \]
                      6. Taylor expanded in re around 0

                        \[\leadsto \color{blue}{-1 \cdot im} \]
                      7. Step-by-step derivation
                        1. mul-1-negN/A

                          \[\leadsto \mathsf{neg}\left(im\right) \]
                        2. neg-sub0N/A

                          \[\leadsto 0 - \color{blue}{im} \]
                        3. --lowering--.f646.3%

                          \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{im}\right) \]
                      8. Simplified6.3%

                        \[\leadsto \color{blue}{0 - im} \]
                      9. Step-by-step derivation
                        1. flip--N/A

                          \[\leadsto \frac{0 \cdot 0 - im \cdot im}{\color{blue}{0 + im}} \]
                        2. +-lft-identityN/A

                          \[\leadsto \frac{0 \cdot 0 - im \cdot im}{im} \]
                        3. /-lowering-/.f64N/A

                          \[\leadsto \mathsf{/.f64}\left(\left(0 \cdot 0 - im \cdot im\right), \color{blue}{im}\right) \]
                        4. metadata-evalN/A

                          \[\leadsto \mathsf{/.f64}\left(\left(0 - im \cdot im\right), im\right) \]
                        5. --lowering--.f64N/A

                          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(0, \left(im \cdot im\right)\right), im\right) \]
                        6. *-lowering-*.f6484.2%

                          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, im\right)\right), im\right) \]
                      10. Applied egg-rr84.2%

                        \[\leadsto \color{blue}{\frac{0 - im \cdot im}{im}} \]
                    3. Recombined 2 regimes into one program.
                    4. Final simplification34.0%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 1.1 \cdot 10^{+171}:\\ \;\;\;\;0 - im\\ \mathbf{else}:\\ \;\;\;\;0 - \frac{im \cdot im}{im}\\ \end{array} \]
                    5. Add Preprocessing

                    Alternative 27: 53.8% 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 + \left(im\_m \cdot im\_m\right) \cdot -0.16666666666666666\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(Float64(im_m * 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[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666), $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 -0.16666666666666666\right)\right)
                    \end{array}
                    
                    Derivation
                    1. Initial program 59.4%

                      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                    2. Add Preprocessing
                    3. Taylor expanded in im around 0

                      \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)} \]
                    4. Step-by-step derivation
                      1. *-lowering-*.f64N/A

                        \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right)}\right) \]
                      2. distribute-rgt-inN/A

                        \[\leadsto \mathsf{*.f64}\left(im, \left(-1 \cdot \cos re + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right)\right) \]
                      3. associate-+r+N/A

                        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) \cdot {im}^{2}}\right)\right) \]
                      4. *-commutativeN/A

                        \[\leadsto \mathsf{*.f64}\left(im, \left(\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) + {im}^{2} \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right)\right) \]
                      5. +-commutativeN/A

                        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \color{blue}{\left(-1 \cdot \cos re + \left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)}\right)\right) \]
                      6. +-commutativeN/A

                        \[\leadsto \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \cos re + \frac{-1}{5040} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right) + \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1 \cdot \cos re}\right)\right)\right) \]
                    5. Simplified89.8%

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

                      \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\color{blue}{1}, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{-1}{120}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{5040}\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
                    7. Step-by-step derivation
                      1. Simplified60.5%

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

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

                          \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{6} \cdot {im}^{2} - 1\right)}\right) \]
                        2. sub-negN/A

                          \[\leadsto \mathsf{*.f64}\left(im, \left(\frac{-1}{6} \cdot {im}^{2} + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
                        3. metadata-evalN/A

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

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

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

                          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \color{blue}{\left({im}^{2}\right)}\right)\right)\right) \]
                        7. unpow2N/A

                          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \left(im \cdot \color{blue}{im}\right)\right)\right)\right) \]
                        8. *-lowering-*.f6452.5%

                          \[\leadsto \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right)\right) \]
                      4. Simplified52.5%

                        \[\leadsto \color{blue}{im \cdot \left(-1 + -0.16666666666666666 \cdot \left(im \cdot im\right)\right)} \]
                      5. Final simplification52.5%

                        \[\leadsto im \cdot \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right) \]
                      6. Add Preprocessing

                      Alternative 28: 29.9% accurate, 103.0× speedup?

                      \[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \left(0 - 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 (- 0.0 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 * (0.0 - 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 * (0.0d0 - 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 * (0.0 - im_m);
                      }
                      
                      im\_m = math.fabs(im)
                      im\_s = math.copysign(1.0, im)
                      def code(im_s, re, im_m):
                      	return im_s * (0.0 - im_m)
                      
                      im\_m = abs(im)
                      im\_s = copysign(1.0, im)
                      function code(im_s, re, im_m)
                      	return Float64(im_s * Float64(0.0 - 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 * (0.0 - 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 * N[(0.0 - im$95$m), $MachinePrecision]), $MachinePrecision]
                      
                      \begin{array}{l}
                      im\_m = \left|im\right|
                      \\
                      im\_s = \mathsf{copysign}\left(1, im\right)
                      
                      \\
                      im\_s \cdot \left(0 - im\_m\right)
                      \end{array}
                      
                      Derivation
                      1. Initial program 59.4%

                        \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                      2. Add Preprocessing
                      3. Taylor expanded in im around 0

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

                          \[\leadsto \mathsf{neg}\left(im \cdot \cos re\right) \]
                        2. neg-sub0N/A

                          \[\leadsto 0 - \color{blue}{im \cdot \cos re} \]
                        3. --lowering--.f64N/A

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

                          \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \color{blue}{\cos re}\right)\right) \]
                        5. cos-lowering-cos.f6447.5%

                          \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
                      5. Simplified47.5%

                        \[\leadsto \color{blue}{0 - im \cdot \cos re} \]
                      6. Taylor expanded in re around 0

                        \[\leadsto \color{blue}{-1 \cdot im} \]
                      7. Step-by-step derivation
                        1. mul-1-negN/A

                          \[\leadsto \mathsf{neg}\left(im\right) \]
                        2. neg-sub0N/A

                          \[\leadsto 0 - \color{blue}{im} \]
                        3. --lowering--.f6428.2%

                          \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{im}\right) \]
                      8. Simplified28.2%

                        \[\leadsto \color{blue}{0 - im} \]
                      9. Step-by-step derivation
                        1. sub0-negN/A

                          \[\leadsto \mathsf{neg}\left(im\right) \]
                        2. neg-lowering-neg.f6428.2%

                          \[\leadsto \mathsf{neg.f64}\left(im\right) \]
                      10. Applied egg-rr28.2%

                        \[\leadsto \color{blue}{-im} \]
                      11. Final simplification28.2%

                        \[\leadsto 0 - im \]
                      12. Add Preprocessing

                      Developer Target 1: 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 2024155 
                      (FPCore (re im)
                        :name "math.sin on complex, imaginary part"
                        :precision binary64
                      
                        :alt
                        (! :herbie-platform default (if (< (fabs im) 1) (- (* (cos re) (+ im (* 1/6 im im im) (* 1/120 im im im im im)))) (* (* 1/2 (cos re)) (- (exp (- 0 im)) (exp im)))))
                      
                        (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))