math.cos on complex, real part

Percentage Accurate: 100.0% → 100.0%
Time: 12.9s
Alternatives: 26
Speedup: 1.5×

Specification

?
\[\begin{array}{l} \\ \left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right) \end{array} \]
(FPCore (re im)
 :precision binary64
 (* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))
double code(double re, double im) {
	return (0.5 * cos(re)) * (exp(-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(-im) + exp(im))
end function
public static double code(double re, double im) {
	return (0.5 * Math.cos(re)) * (Math.exp(-im) + Math.exp(im));
}
def code(re, im):
	return (0.5 * math.cos(re)) * (math.exp(-im) + math.exp(im))
function code(re, im)
	return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(-im)) + exp(im)))
end
function tmp = code(re, im)
	tmp = (0.5 * cos(re)) * (exp(-im) + exp(im));
end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

\[\begin{array}{l} \\ \left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right) \end{array} \]
(FPCore (re im)
 :precision binary64
 (* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))
double code(double re, double im) {
	return (0.5 * cos(re)) * (exp(-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(-im) + exp(im))
end function
public static double code(double re, double im) {
	return (0.5 * Math.cos(re)) * (Math.exp(-im) + Math.exp(im));
}
def code(re, im):
	return (0.5 * math.cos(re)) * (math.exp(-im) + math.exp(im))
function code(re, im)
	return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(-im)) + exp(im)))
end
function tmp = code(re, im)
	tmp = (0.5 * cos(re)) * (exp(-im) + exp(im));
end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 100.0% accurate, 0.6× speedup?

\[\begin{array}{l} im_m = \left|im\right| \\ \mathsf{fma}\left(\frac{0.5}{e^{im\_m}}, \cos re, \cos re \cdot \left(0.5 \cdot e^{im\_m}\right)\right) \end{array} \]
im_m = (fabs.f64 im)
(FPCore (re im_m)
 :precision binary64
 (fma (/ 0.5 (exp im_m)) (cos re) (* (cos re) (* 0.5 (exp im_m)))))
im_m = fabs(im);
double code(double re, double im_m) {
	return fma((0.5 / exp(im_m)), cos(re), (cos(re) * (0.5 * exp(im_m))));
}
im_m = abs(im)
function code(re, im_m)
	return fma(Float64(0.5 / exp(im_m)), cos(re), Float64(cos(re) * Float64(0.5 * exp(im_m))))
end
im_m = N[Abs[im], $MachinePrecision]
code[re_, im$95$m_] := N[(N[(0.5 / N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision] * N[Cos[re], $MachinePrecision] + N[(N[Cos[re], $MachinePrecision] * N[(0.5 * N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
im_m = \left|im\right|

\\
\mathsf{fma}\left(\frac{0.5}{e^{im\_m}}, \cos re, \cos re \cdot \left(0.5 \cdot e^{im\_m}\right)\right)
\end{array}
Derivation
  1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{exp.f64}\left(im\right)\right), \mathsf{cos.f64}\left(re\right), \left(\left(\frac{1}{2} \cdot \cos re\right) \cdot e^{im}\right)\right) \]
    12. *-commutativeN/A

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

      \[\leadsto \mathsf{fma.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{exp.f64}\left(im\right)\right), \mathsf{cos.f64}\left(re\right), \left(\left(e^{im} \cdot \frac{1}{2}\right) \cdot \cos re\right)\right) \]
    14. *-commutativeN/A

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

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

      \[\leadsto \mathsf{fma.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{exp.f64}\left(im\right)\right), \mathsf{cos.f64}\left(re\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(e^{im} \cdot \frac{1}{2}\right)\right)\right) \]
    17. *-commutativeN/A

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{0.5}{e^{im}}, \cos re, \cos re \cdot \left(0.5 \cdot e^{im}\right)\right)} \]
  5. Add Preprocessing

Alternative 2: 100.0% accurate, 0.7× speedup?

\[\begin{array}{l} im_m = \left|im\right| \\ \cos re \cdot \left(0.5 \cdot e^{im\_m}\right) + \frac{0.5 \cdot \cos re}{e^{im\_m}} \end{array} \]
im_m = (fabs.f64 im)
(FPCore (re im_m)
 :precision binary64
 (+ (* (cos re) (* 0.5 (exp im_m))) (/ (* 0.5 (cos re)) (exp im_m))))
im_m = fabs(im);
double code(double re, double im_m) {
	return (cos(re) * (0.5 * exp(im_m))) + ((0.5 * cos(re)) / exp(im_m));
}
im_m = abs(im)
real(8) function code(re, im_m)
    real(8), intent (in) :: re
    real(8), intent (in) :: im_m
    code = (cos(re) * (0.5d0 * exp(im_m))) + ((0.5d0 * cos(re)) / exp(im_m))
end function
im_m = Math.abs(im);
public static double code(double re, double im_m) {
	return (Math.cos(re) * (0.5 * Math.exp(im_m))) + ((0.5 * Math.cos(re)) / Math.exp(im_m));
}
im_m = math.fabs(im)
def code(re, im_m):
	return (math.cos(re) * (0.5 * math.exp(im_m))) + ((0.5 * math.cos(re)) / math.exp(im_m))
im_m = abs(im)
function code(re, im_m)
	return Float64(Float64(cos(re) * Float64(0.5 * exp(im_m))) + Float64(Float64(0.5 * cos(re)) / exp(im_m)))
end
im_m = abs(im);
function tmp = code(re, im_m)
	tmp = (cos(re) * (0.5 * exp(im_m))) + ((0.5 * cos(re)) / exp(im_m));
end
im_m = N[Abs[im], $MachinePrecision]
code[re_, im$95$m_] := N[(N[(N[Cos[re], $MachinePrecision] * N[(0.5 * N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] / N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
im_m = \left|im\right|

\\
\cos re \cdot \left(0.5 \cdot e^{im\_m}\right) + \frac{0.5 \cdot \cos re}{e^{im\_m}}
\end{array}
Derivation
  1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{0.5 \cdot \cos re}{e^{im}} + \cos re \cdot \left(0.5 \cdot e^{im}\right)} \]
  5. Final simplification100.0%

    \[\leadsto \cos re \cdot \left(0.5 \cdot e^{im}\right) + \frac{0.5 \cdot \cos re}{e^{im}} \]
  6. Add Preprocessing

Alternative 3: 100.0% accurate, 1.5× speedup?

\[\begin{array}{l} im_m = \left|im\right| \\ \cos re \cdot \cosh im\_m \end{array} \]
im_m = (fabs.f64 im)
(FPCore (re im_m) :precision binary64 (* (cos re) (cosh im_m)))
im_m = fabs(im);
double code(double re, double im_m) {
	return cos(re) * cosh(im_m);
}
im_m = abs(im)
real(8) function code(re, im_m)
    real(8), intent (in) :: re
    real(8), intent (in) :: im_m
    code = cos(re) * cosh(im_m)
end function
im_m = Math.abs(im);
public static double code(double re, double im_m) {
	return Math.cos(re) * Math.cosh(im_m);
}
im_m = math.fabs(im)
def code(re, im_m):
	return math.cos(re) * math.cosh(im_m)
im_m = abs(im)
function code(re, im_m)
	return Float64(cos(re) * cosh(im_m))
end
im_m = abs(im);
function tmp = code(re, im_m)
	tmp = cos(re) * cosh(im_m);
end
im_m = N[Abs[im], $MachinePrecision]
code[re_, im$95$m_] := N[(N[Cos[re], $MachinePrecision] * N[Cosh[im$95$m], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
im_m = \left|im\right|

\\
\cos re \cdot \cosh im\_m
\end{array}
Derivation
  1. Initial program 100.0%

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\left(\left(\frac{1}{2} \cdot 2\right) \cdot \cosh im\right), \cos \color{blue}{re}\right) \]
    8. metadata-evalN/A

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \cosh im\right), \cos \color{blue}{re}\right) \]
    10. cosh-lowering-cosh.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \cos re\right) \]
    11. cos-lowering-cos.f64100.0%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \mathsf{cos.f64}\left(re\right)\right) \]
  4. Applied egg-rr100.0%

    \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right) \cdot \cos re} \]
  5. Step-by-step derivation
    1. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(1 \cdot \cosh im\right), \color{blue}{\cos re}\right) \]
    2. *-lft-identityN/A

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \cos \color{blue}{re}\right) \]
    4. cos-lowering-cos.f64100.0%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \mathsf{cos.f64}\left(re\right)\right) \]
  6. Applied egg-rr100.0%

    \[\leadsto \color{blue}{\cosh im \cdot \cos re} \]
  7. Final simplification100.0%

    \[\leadsto \cos re \cdot \cosh im \]
  8. Add Preprocessing

Alternative 4: 97.7% accurate, 1.7× speedup?

\[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} t_0 := im\_m \cdot \left(im\_m \cdot \left(im\_m \cdot im\_m\right)\right)\\ t_1 := -1 + im\_m \cdot \left(0.5 \cdot im\_m\right)\\ t_2 := 0.5 \cdot \left(im\_m \cdot im\_m\right)\\ t_3 := 1 + t\_2\\ t_4 := 0.041666666666666664 + \left(im\_m \cdot im\_m\right) \cdot 0.001388888888888889\\ t_5 := 0.041666666666666664 + im\_m \cdot \left(im\_m \cdot -0.001388888888888889\right)\\ \mathbf{if}\;im\_m \leq 0.98:\\ \;\;\;\;\frac{\cos re \cdot \left(\left(t\_4 \cdot t\_4\right) \cdot \left(t\_0 \cdot t\_0\right) + t\_3 \cdot \left(-1 - t\_2\right)\right)}{t\_4 \cdot t\_0 - t\_3}\\ \mathbf{elif}\;im\_m \leq 3.4 \cdot 10^{+24}:\\ \;\;\;\;\cosh im\_m\\ \mathbf{elif}\;im\_m \leq 2 \cdot 10^{+154}:\\ \;\;\;\;\frac{\frac{\cos re \cdot \left(\left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(\left(im\_m \cdot im\_m\right) \cdot 0.25\right)\right) \cdot t\_5 + t\_0 \cdot \left(t\_1 \cdot \left(0.001736111111111111 + t\_0 \cdot -1.9290123456790124 \cdot 10^{-6}\right)\right)\right)}{t\_5}}{t\_1}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(im\_m \cdot im\_m + 2\right)\\ \end{array} \end{array} \]
im_m = (fabs.f64 im)
(FPCore (re im_m)
 :precision binary64
 (let* ((t_0 (* im_m (* im_m (* im_m im_m))))
        (t_1 (+ -1.0 (* im_m (* 0.5 im_m))))
        (t_2 (* 0.5 (* im_m im_m)))
        (t_3 (+ 1.0 t_2))
        (t_4 (+ 0.041666666666666664 (* (* im_m im_m) 0.001388888888888889)))
        (t_5 (+ 0.041666666666666664 (* im_m (* im_m -0.001388888888888889)))))
   (if (<= im_m 0.98)
     (/
      (* (cos re) (+ (* (* t_4 t_4) (* t_0 t_0)) (* t_3 (- -1.0 t_2))))
      (- (* t_4 t_0) t_3))
     (if (<= im_m 3.4e+24)
       (cosh im_m)
       (if (<= im_m 2e+154)
         (/
          (/
           (*
            (cos re)
            (+
             (* (+ -1.0 (* (* im_m im_m) (* (* im_m im_m) 0.25))) t_5)
             (*
              t_0
              (*
               t_1
               (+ 0.001736111111111111 (* t_0 -1.9290123456790124e-6))))))
           t_5)
          t_1)
         (* (* 0.5 (cos re)) (+ (* im_m im_m) 2.0)))))))
im_m = fabs(im);
double code(double re, double im_m) {
	double t_0 = im_m * (im_m * (im_m * im_m));
	double t_1 = -1.0 + (im_m * (0.5 * im_m));
	double t_2 = 0.5 * (im_m * im_m);
	double t_3 = 1.0 + t_2;
	double t_4 = 0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889);
	double t_5 = 0.041666666666666664 + (im_m * (im_m * -0.001388888888888889));
	double tmp;
	if (im_m <= 0.98) {
		tmp = (cos(re) * (((t_4 * t_4) * (t_0 * t_0)) + (t_3 * (-1.0 - t_2)))) / ((t_4 * t_0) - t_3);
	} else if (im_m <= 3.4e+24) {
		tmp = cosh(im_m);
	} else if (im_m <= 2e+154) {
		tmp = ((cos(re) * (((-1.0 + ((im_m * im_m) * ((im_m * im_m) * 0.25))) * t_5) + (t_0 * (t_1 * (0.001736111111111111 + (t_0 * -1.9290123456790124e-6)))))) / t_5) / t_1;
	} else {
		tmp = (0.5 * cos(re)) * ((im_m * im_m) + 2.0);
	}
	return tmp;
}
im_m = abs(im)
real(8) function code(re, im_m)
    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) :: t_5
    real(8) :: tmp
    t_0 = im_m * (im_m * (im_m * im_m))
    t_1 = (-1.0d0) + (im_m * (0.5d0 * im_m))
    t_2 = 0.5d0 * (im_m * im_m)
    t_3 = 1.0d0 + t_2
    t_4 = 0.041666666666666664d0 + ((im_m * im_m) * 0.001388888888888889d0)
    t_5 = 0.041666666666666664d0 + (im_m * (im_m * (-0.001388888888888889d0)))
    if (im_m <= 0.98d0) then
        tmp = (cos(re) * (((t_4 * t_4) * (t_0 * t_0)) + (t_3 * ((-1.0d0) - t_2)))) / ((t_4 * t_0) - t_3)
    else if (im_m <= 3.4d+24) then
        tmp = cosh(im_m)
    else if (im_m <= 2d+154) then
        tmp = ((cos(re) * ((((-1.0d0) + ((im_m * im_m) * ((im_m * im_m) * 0.25d0))) * t_5) + (t_0 * (t_1 * (0.001736111111111111d0 + (t_0 * (-1.9290123456790124d-6))))))) / t_5) / t_1
    else
        tmp = (0.5d0 * cos(re)) * ((im_m * im_m) + 2.0d0)
    end if
    code = tmp
end function
im_m = Math.abs(im);
public static double code(double re, double im_m) {
	double t_0 = im_m * (im_m * (im_m * im_m));
	double t_1 = -1.0 + (im_m * (0.5 * im_m));
	double t_2 = 0.5 * (im_m * im_m);
	double t_3 = 1.0 + t_2;
	double t_4 = 0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889);
	double t_5 = 0.041666666666666664 + (im_m * (im_m * -0.001388888888888889));
	double tmp;
	if (im_m <= 0.98) {
		tmp = (Math.cos(re) * (((t_4 * t_4) * (t_0 * t_0)) + (t_3 * (-1.0 - t_2)))) / ((t_4 * t_0) - t_3);
	} else if (im_m <= 3.4e+24) {
		tmp = Math.cosh(im_m);
	} else if (im_m <= 2e+154) {
		tmp = ((Math.cos(re) * (((-1.0 + ((im_m * im_m) * ((im_m * im_m) * 0.25))) * t_5) + (t_0 * (t_1 * (0.001736111111111111 + (t_0 * -1.9290123456790124e-6)))))) / t_5) / t_1;
	} else {
		tmp = (0.5 * Math.cos(re)) * ((im_m * im_m) + 2.0);
	}
	return tmp;
}
im_m = math.fabs(im)
def code(re, im_m):
	t_0 = im_m * (im_m * (im_m * im_m))
	t_1 = -1.0 + (im_m * (0.5 * im_m))
	t_2 = 0.5 * (im_m * im_m)
	t_3 = 1.0 + t_2
	t_4 = 0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889)
	t_5 = 0.041666666666666664 + (im_m * (im_m * -0.001388888888888889))
	tmp = 0
	if im_m <= 0.98:
		tmp = (math.cos(re) * (((t_4 * t_4) * (t_0 * t_0)) + (t_3 * (-1.0 - t_2)))) / ((t_4 * t_0) - t_3)
	elif im_m <= 3.4e+24:
		tmp = math.cosh(im_m)
	elif im_m <= 2e+154:
		tmp = ((math.cos(re) * (((-1.0 + ((im_m * im_m) * ((im_m * im_m) * 0.25))) * t_5) + (t_0 * (t_1 * (0.001736111111111111 + (t_0 * -1.9290123456790124e-6)))))) / t_5) / t_1
	else:
		tmp = (0.5 * math.cos(re)) * ((im_m * im_m) + 2.0)
	return tmp
im_m = abs(im)
function code(re, im_m)
	t_0 = Float64(im_m * Float64(im_m * Float64(im_m * im_m)))
	t_1 = Float64(-1.0 + Float64(im_m * Float64(0.5 * im_m)))
	t_2 = Float64(0.5 * Float64(im_m * im_m))
	t_3 = Float64(1.0 + t_2)
	t_4 = Float64(0.041666666666666664 + Float64(Float64(im_m * im_m) * 0.001388888888888889))
	t_5 = Float64(0.041666666666666664 + Float64(im_m * Float64(im_m * -0.001388888888888889)))
	tmp = 0.0
	if (im_m <= 0.98)
		tmp = Float64(Float64(cos(re) * Float64(Float64(Float64(t_4 * t_4) * Float64(t_0 * t_0)) + Float64(t_3 * Float64(-1.0 - t_2)))) / Float64(Float64(t_4 * t_0) - t_3));
	elseif (im_m <= 3.4e+24)
		tmp = cosh(im_m);
	elseif (im_m <= 2e+154)
		tmp = Float64(Float64(Float64(cos(re) * Float64(Float64(Float64(-1.0 + Float64(Float64(im_m * im_m) * Float64(Float64(im_m * im_m) * 0.25))) * t_5) + Float64(t_0 * Float64(t_1 * Float64(0.001736111111111111 + Float64(t_0 * -1.9290123456790124e-6)))))) / t_5) / t_1);
	else
		tmp = Float64(Float64(0.5 * cos(re)) * Float64(Float64(im_m * im_m) + 2.0));
	end
	return tmp
end
im_m = abs(im);
function tmp_2 = code(re, im_m)
	t_0 = im_m * (im_m * (im_m * im_m));
	t_1 = -1.0 + (im_m * (0.5 * im_m));
	t_2 = 0.5 * (im_m * im_m);
	t_3 = 1.0 + t_2;
	t_4 = 0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889);
	t_5 = 0.041666666666666664 + (im_m * (im_m * -0.001388888888888889));
	tmp = 0.0;
	if (im_m <= 0.98)
		tmp = (cos(re) * (((t_4 * t_4) * (t_0 * t_0)) + (t_3 * (-1.0 - t_2)))) / ((t_4 * t_0) - t_3);
	elseif (im_m <= 3.4e+24)
		tmp = cosh(im_m);
	elseif (im_m <= 2e+154)
		tmp = ((cos(re) * (((-1.0 + ((im_m * im_m) * ((im_m * im_m) * 0.25))) * t_5) + (t_0 * (t_1 * (0.001736111111111111 + (t_0 * -1.9290123456790124e-6)))))) / t_5) / t_1;
	else
		tmp = (0.5 * cos(re)) * ((im_m * im_m) + 2.0);
	end
	tmp_2 = tmp;
end
im_m = N[Abs[im], $MachinePrecision]
code[re_, im$95$m_] := Block[{t$95$0 = N[(im$95$m * N[(im$95$m * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 + N[(im$95$m * N[(0.5 * im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 + t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(0.041666666666666664 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(0.041666666666666664 + N[(im$95$m * N[(im$95$m * -0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im$95$m, 0.98], N[(N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(t$95$4 * t$95$4), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 * N[(-1.0 - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(t$95$4 * t$95$0), $MachinePrecision] - t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 3.4e+24], N[Cosh[im$95$m], $MachinePrecision], If[LessEqual[im$95$m, 2e+154], N[(N[(N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$5), $MachinePrecision] + N[(t$95$0 * N[(t$95$1 * N[(0.001736111111111111 + N[(t$95$0 * -1.9290123456790124e-6), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$5), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
im_m = \left|im\right|

\\
\begin{array}{l}
t_0 := im\_m \cdot \left(im\_m \cdot \left(im\_m \cdot im\_m\right)\right)\\
t_1 := -1 + im\_m \cdot \left(0.5 \cdot im\_m\right)\\
t_2 := 0.5 \cdot \left(im\_m \cdot im\_m\right)\\
t_3 := 1 + t\_2\\
t_4 := 0.041666666666666664 + \left(im\_m \cdot im\_m\right) \cdot 0.001388888888888889\\
t_5 := 0.041666666666666664 + im\_m \cdot \left(im\_m \cdot -0.001388888888888889\right)\\
\mathbf{if}\;im\_m \leq 0.98:\\
\;\;\;\;\frac{\cos re \cdot \left(\left(t\_4 \cdot t\_4\right) \cdot \left(t\_0 \cdot t\_0\right) + t\_3 \cdot \left(-1 - t\_2\right)\right)}{t\_4 \cdot t\_0 - t\_3}\\

\mathbf{elif}\;im\_m \leq 3.4 \cdot 10^{+24}:\\
\;\;\;\;\cosh im\_m\\

\mathbf{elif}\;im\_m \leq 2 \cdot 10^{+154}:\\
\;\;\;\;\frac{\frac{\cos re \cdot \left(\left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(\left(im\_m \cdot im\_m\right) \cdot 0.25\right)\right) \cdot t\_5 + t\_0 \cdot \left(t\_1 \cdot \left(0.001736111111111111 + t\_0 \cdot -1.9290123456790124 \cdot 10^{-6}\right)\right)\right)}{t\_5}}{t\_1}\\

\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(im\_m \cdot im\_m + 2\right)\\


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

    1. Initial program 100.0%

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

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

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

        \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \cos re \]
      3. distribute-lft-inN/A

        \[\leadsto \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + {im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right)\right) + \cos \color{blue}{re} \]
      4. associate-+l+N/A

        \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right) + \cos re\right)} \]
    5. Simplified91.3%

      \[\leadsto \color{blue}{\cos re \cdot \left(\left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\right)} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(\left(\frac{1}{24} + \left(im \cdot im\right) \cdot \frac{1}{720}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(1 + \frac{1}{2} \cdot \left(im \cdot im\right)\right)\right) \cdot \color{blue}{\cos re} \]
      2. flip-+N/A

        \[\leadsto \frac{\left(\left(\frac{1}{24} + \left(im \cdot im\right) \cdot \frac{1}{720}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \left(\left(\frac{1}{24} + \left(im \cdot im\right) \cdot \frac{1}{720}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right) - \left(1 + \frac{1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(1 + \frac{1}{2} \cdot \left(im \cdot im\right)\right)}{\left(\frac{1}{24} + \left(im \cdot im\right) \cdot \frac{1}{720}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) - \left(1 + \frac{1}{2} \cdot \left(im \cdot im\right)\right)} \cdot \cos \color{blue}{re} \]
      3. associate-*l/N/A

        \[\leadsto \frac{\left(\left(\left(\frac{1}{24} + \left(im \cdot im\right) \cdot \frac{1}{720}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \left(\left(\frac{1}{24} + \left(im \cdot im\right) \cdot \frac{1}{720}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right) - \left(1 + \frac{1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(1 + \frac{1}{2} \cdot \left(im \cdot im\right)\right)\right) \cdot \cos re}{\color{blue}{\left(\frac{1}{24} + \left(im \cdot im\right) \cdot \frac{1}{720}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) - \left(1 + \frac{1}{2} \cdot \left(im \cdot im\right)\right)}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\left(\left(\left(\frac{1}{24} + \left(im \cdot im\right) \cdot \frac{1}{720}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right) \cdot \left(\left(\frac{1}{24} + \left(im \cdot im\right) \cdot \frac{1}{720}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right) - \left(1 + \frac{1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(1 + \frac{1}{2} \cdot \left(im \cdot im\right)\right)\right) \cdot \cos re\right), \color{blue}{\left(\left(\frac{1}{24} + \left(im \cdot im\right) \cdot \frac{1}{720}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) - \left(1 + \frac{1}{2} \cdot \left(im \cdot im\right)\right)\right)}\right) \]
    7. Applied egg-rr64.7%

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

    if 0.97999999999999998 < im < 3.4000000000000001e24

    1. Initial program 100.0%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\left(\frac{1}{2} \cdot 2\right) \cdot \cosh im\right), \cos \color{blue}{re}\right) \]
      8. metadata-evalN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \cosh im\right), \cos \color{blue}{re}\right) \]
      10. cosh-lowering-cosh.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \cos re\right) \]
      11. cos-lowering-cos.f64100.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \mathsf{cos.f64}\left(re\right)\right) \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right) \cdot \cos re} \]
    5. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(1 \cdot \cosh im\right), \color{blue}{\cos re}\right) \]
      2. *-lft-identityN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \cos \color{blue}{re}\right) \]
      4. cos-lowering-cos.f64100.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \mathsf{cos.f64}\left(re\right)\right) \]
    6. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\cosh im \cdot \cos re} \]
    7. Taylor expanded in re around 0

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \color{blue}{1}\right) \]
    8. Step-by-step derivation
      1. Simplified100.0%

        \[\leadsto \cosh im \cdot \color{blue}{1} \]

      if 3.4000000000000001e24 < im < 2.00000000000000007e154

      1. Initial program 100.0%

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

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

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

          \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \cos re \]
        3. distribute-lft-inN/A

          \[\leadsto \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + {im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right)\right) + \cos \color{blue}{re} \]
        4. associate-+l+N/A

          \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right) + \cos re\right)} \]
      5. Simplified83.0%

        \[\leadsto \color{blue}{\cos re \cdot \left(\left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\right)} \]
      6. Applied egg-rr39.5%

        \[\leadsto \cos re \cdot \color{blue}{\frac{\left(\left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot 0.25 - 1\right) \cdot \left(0.041666666666666664 + -0.001388888888888889 \cdot \left(im \cdot im\right)\right) + \left(0.5 \cdot \left(im \cdot im\right) - 1\right) \cdot \left(\left(0.001736111111111111 - \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot 1.9290123456790124 \cdot 10^{-6}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)}{\left(0.5 \cdot \left(im \cdot im\right) - 1\right) \cdot \left(0.041666666666666664 + -0.001388888888888889 \cdot \left(im \cdot im\right)\right)}} \]
      7. Applied egg-rr97.1%

        \[\leadsto \color{blue}{\frac{\frac{\cos re \cdot \left(\left(-1 + \left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.25\right)\right) \cdot \left(0.041666666666666664 + im \cdot \left(im \cdot -0.001388888888888889\right)\right) + \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot \left(\left(im \cdot \left(im \cdot 0.5\right) + -1\right) \cdot \left(0.001736111111111111 + \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot -1.9290123456790124 \cdot 10^{-6}\right)\right)\right)}{0.041666666666666664 + im \cdot \left(im \cdot -0.001388888888888889\right)}}{im \cdot \left(im \cdot 0.5\right) + -1}} \]

      if 2.00000000000000007e154 < im

      1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(2 + im \cdot im\right)} \]
    9. Recombined 4 regimes into one program.
    10. Final simplification72.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.98:\\ \;\;\;\;\frac{\cos re \cdot \left(\left(\left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right) \cdot \left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right)\right) \cdot \left(\left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right) + \left(1 + 0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(-1 - 0.5 \cdot \left(im \cdot im\right)\right)\right)}{\left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) - \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)}\\ \mathbf{elif}\;im \leq 3.4 \cdot 10^{+24}:\\ \;\;\;\;\cosh im\\ \mathbf{elif}\;im \leq 2 \cdot 10^{+154}:\\ \;\;\;\;\frac{\frac{\cos re \cdot \left(\left(-1 + \left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.25\right)\right) \cdot \left(0.041666666666666664 + im \cdot \left(im \cdot -0.001388888888888889\right)\right) + \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot \left(\left(-1 + im \cdot \left(0.5 \cdot im\right)\right) \cdot \left(0.001736111111111111 + \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot -1.9290123456790124 \cdot 10^{-6}\right)\right)\right)}{0.041666666666666664 + im \cdot \left(im \cdot -0.001388888888888889\right)}}{-1 + im \cdot \left(0.5 \cdot im\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(im \cdot im + 2\right)\\ \end{array} \]
    11. Add Preprocessing

    Alternative 5: 97.7% accurate, 1.7× speedup?

    \[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} t_0 := im\_m \cdot \left(im\_m \cdot \left(im\_m \cdot im\_m\right)\right)\\ t_1 := -1 + im\_m \cdot \left(0.5 \cdot im\_m\right)\\ t_2 := 0.041666666666666664 + im\_m \cdot \left(im\_m \cdot -0.001388888888888889\right)\\ \mathbf{if}\;im\_m \leq 0.99:\\ \;\;\;\;\cos re \cdot \frac{\left(im\_m \cdot im\_m\right) \cdot \left(0.001388888888888889 + im\_m \cdot \left(im\_m \cdot \left(0.008680555555555556 + \left(im\_m \cdot im\_m\right) \cdot 0.0005208333333333333\right)\right)\right) + -0.041666666666666664}{\left(0.041666666666666664 + \left(im\_m \cdot im\_m\right) \cdot -0.001388888888888889\right) \cdot \left(0.5 \cdot \left(im\_m \cdot im\_m\right) + -1\right)}\\ \mathbf{elif}\;im\_m \leq 3.4 \cdot 10^{+24}:\\ \;\;\;\;\cosh im\_m\\ \mathbf{elif}\;im\_m \leq 2 \cdot 10^{+154}:\\ \;\;\;\;\frac{\frac{\cos re \cdot \left(\left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(\left(im\_m \cdot im\_m\right) \cdot 0.25\right)\right) \cdot t\_2 + t\_0 \cdot \left(t\_1 \cdot \left(0.001736111111111111 + t\_0 \cdot -1.9290123456790124 \cdot 10^{-6}\right)\right)\right)}{t\_2}}{t\_1}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(im\_m \cdot im\_m + 2\right)\\ \end{array} \end{array} \]
    im_m = (fabs.f64 im)
    (FPCore (re im_m)
     :precision binary64
     (let* ((t_0 (* im_m (* im_m (* im_m im_m))))
            (t_1 (+ -1.0 (* im_m (* 0.5 im_m))))
            (t_2 (+ 0.041666666666666664 (* im_m (* im_m -0.001388888888888889)))))
       (if (<= im_m 0.99)
         (*
          (cos re)
          (/
           (+
            (*
             (* im_m im_m)
             (+
              0.001388888888888889
              (*
               im_m
               (*
                im_m
                (+
                 0.008680555555555556
                 (* (* im_m im_m) 0.0005208333333333333))))))
            -0.041666666666666664)
           (*
            (+ 0.041666666666666664 (* (* im_m im_m) -0.001388888888888889))
            (+ (* 0.5 (* im_m im_m)) -1.0))))
         (if (<= im_m 3.4e+24)
           (cosh im_m)
           (if (<= im_m 2e+154)
             (/
              (/
               (*
                (cos re)
                (+
                 (* (+ -1.0 (* (* im_m im_m) (* (* im_m im_m) 0.25))) t_2)
                 (*
                  t_0
                  (*
                   t_1
                   (+ 0.001736111111111111 (* t_0 -1.9290123456790124e-6))))))
               t_2)
              t_1)
             (* (* 0.5 (cos re)) (+ (* im_m im_m) 2.0)))))))
    im_m = fabs(im);
    double code(double re, double im_m) {
    	double t_0 = im_m * (im_m * (im_m * im_m));
    	double t_1 = -1.0 + (im_m * (0.5 * im_m));
    	double t_2 = 0.041666666666666664 + (im_m * (im_m * -0.001388888888888889));
    	double tmp;
    	if (im_m <= 0.99) {
    		tmp = cos(re) * ((((im_m * im_m) * (0.001388888888888889 + (im_m * (im_m * (0.008680555555555556 + ((im_m * im_m) * 0.0005208333333333333)))))) + -0.041666666666666664) / ((0.041666666666666664 + ((im_m * im_m) * -0.001388888888888889)) * ((0.5 * (im_m * im_m)) + -1.0)));
    	} else if (im_m <= 3.4e+24) {
    		tmp = cosh(im_m);
    	} else if (im_m <= 2e+154) {
    		tmp = ((cos(re) * (((-1.0 + ((im_m * im_m) * ((im_m * im_m) * 0.25))) * t_2) + (t_0 * (t_1 * (0.001736111111111111 + (t_0 * -1.9290123456790124e-6)))))) / t_2) / t_1;
    	} else {
    		tmp = (0.5 * cos(re)) * ((im_m * im_m) + 2.0);
    	}
    	return tmp;
    }
    
    im_m = abs(im)
    real(8) function code(re, im_m)
        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) :: tmp
        t_0 = im_m * (im_m * (im_m * im_m))
        t_1 = (-1.0d0) + (im_m * (0.5d0 * im_m))
        t_2 = 0.041666666666666664d0 + (im_m * (im_m * (-0.001388888888888889d0)))
        if (im_m <= 0.99d0) then
            tmp = cos(re) * ((((im_m * im_m) * (0.001388888888888889d0 + (im_m * (im_m * (0.008680555555555556d0 + ((im_m * im_m) * 0.0005208333333333333d0)))))) + (-0.041666666666666664d0)) / ((0.041666666666666664d0 + ((im_m * im_m) * (-0.001388888888888889d0))) * ((0.5d0 * (im_m * im_m)) + (-1.0d0))))
        else if (im_m <= 3.4d+24) then
            tmp = cosh(im_m)
        else if (im_m <= 2d+154) then
            tmp = ((cos(re) * ((((-1.0d0) + ((im_m * im_m) * ((im_m * im_m) * 0.25d0))) * t_2) + (t_0 * (t_1 * (0.001736111111111111d0 + (t_0 * (-1.9290123456790124d-6))))))) / t_2) / t_1
        else
            tmp = (0.5d0 * cos(re)) * ((im_m * im_m) + 2.0d0)
        end if
        code = tmp
    end function
    
    im_m = Math.abs(im);
    public static double code(double re, double im_m) {
    	double t_0 = im_m * (im_m * (im_m * im_m));
    	double t_1 = -1.0 + (im_m * (0.5 * im_m));
    	double t_2 = 0.041666666666666664 + (im_m * (im_m * -0.001388888888888889));
    	double tmp;
    	if (im_m <= 0.99) {
    		tmp = Math.cos(re) * ((((im_m * im_m) * (0.001388888888888889 + (im_m * (im_m * (0.008680555555555556 + ((im_m * im_m) * 0.0005208333333333333)))))) + -0.041666666666666664) / ((0.041666666666666664 + ((im_m * im_m) * -0.001388888888888889)) * ((0.5 * (im_m * im_m)) + -1.0)));
    	} else if (im_m <= 3.4e+24) {
    		tmp = Math.cosh(im_m);
    	} else if (im_m <= 2e+154) {
    		tmp = ((Math.cos(re) * (((-1.0 + ((im_m * im_m) * ((im_m * im_m) * 0.25))) * t_2) + (t_0 * (t_1 * (0.001736111111111111 + (t_0 * -1.9290123456790124e-6)))))) / t_2) / t_1;
    	} else {
    		tmp = (0.5 * Math.cos(re)) * ((im_m * im_m) + 2.0);
    	}
    	return tmp;
    }
    
    im_m = math.fabs(im)
    def code(re, im_m):
    	t_0 = im_m * (im_m * (im_m * im_m))
    	t_1 = -1.0 + (im_m * (0.5 * im_m))
    	t_2 = 0.041666666666666664 + (im_m * (im_m * -0.001388888888888889))
    	tmp = 0
    	if im_m <= 0.99:
    		tmp = math.cos(re) * ((((im_m * im_m) * (0.001388888888888889 + (im_m * (im_m * (0.008680555555555556 + ((im_m * im_m) * 0.0005208333333333333)))))) + -0.041666666666666664) / ((0.041666666666666664 + ((im_m * im_m) * -0.001388888888888889)) * ((0.5 * (im_m * im_m)) + -1.0)))
    	elif im_m <= 3.4e+24:
    		tmp = math.cosh(im_m)
    	elif im_m <= 2e+154:
    		tmp = ((math.cos(re) * (((-1.0 + ((im_m * im_m) * ((im_m * im_m) * 0.25))) * t_2) + (t_0 * (t_1 * (0.001736111111111111 + (t_0 * -1.9290123456790124e-6)))))) / t_2) / t_1
    	else:
    		tmp = (0.5 * math.cos(re)) * ((im_m * im_m) + 2.0)
    	return tmp
    
    im_m = abs(im)
    function code(re, im_m)
    	t_0 = Float64(im_m * Float64(im_m * Float64(im_m * im_m)))
    	t_1 = Float64(-1.0 + Float64(im_m * Float64(0.5 * im_m)))
    	t_2 = Float64(0.041666666666666664 + Float64(im_m * Float64(im_m * -0.001388888888888889)))
    	tmp = 0.0
    	if (im_m <= 0.99)
    		tmp = Float64(cos(re) * Float64(Float64(Float64(Float64(im_m * im_m) * Float64(0.001388888888888889 + Float64(im_m * Float64(im_m * Float64(0.008680555555555556 + Float64(Float64(im_m * im_m) * 0.0005208333333333333)))))) + -0.041666666666666664) / Float64(Float64(0.041666666666666664 + Float64(Float64(im_m * im_m) * -0.001388888888888889)) * Float64(Float64(0.5 * Float64(im_m * im_m)) + -1.0))));
    	elseif (im_m <= 3.4e+24)
    		tmp = cosh(im_m);
    	elseif (im_m <= 2e+154)
    		tmp = Float64(Float64(Float64(cos(re) * Float64(Float64(Float64(-1.0 + Float64(Float64(im_m * im_m) * Float64(Float64(im_m * im_m) * 0.25))) * t_2) + Float64(t_0 * Float64(t_1 * Float64(0.001736111111111111 + Float64(t_0 * -1.9290123456790124e-6)))))) / t_2) / t_1);
    	else
    		tmp = Float64(Float64(0.5 * cos(re)) * Float64(Float64(im_m * im_m) + 2.0));
    	end
    	return tmp
    end
    
    im_m = abs(im);
    function tmp_2 = code(re, im_m)
    	t_0 = im_m * (im_m * (im_m * im_m));
    	t_1 = -1.0 + (im_m * (0.5 * im_m));
    	t_2 = 0.041666666666666664 + (im_m * (im_m * -0.001388888888888889));
    	tmp = 0.0;
    	if (im_m <= 0.99)
    		tmp = cos(re) * ((((im_m * im_m) * (0.001388888888888889 + (im_m * (im_m * (0.008680555555555556 + ((im_m * im_m) * 0.0005208333333333333)))))) + -0.041666666666666664) / ((0.041666666666666664 + ((im_m * im_m) * -0.001388888888888889)) * ((0.5 * (im_m * im_m)) + -1.0)));
    	elseif (im_m <= 3.4e+24)
    		tmp = cosh(im_m);
    	elseif (im_m <= 2e+154)
    		tmp = ((cos(re) * (((-1.0 + ((im_m * im_m) * ((im_m * im_m) * 0.25))) * t_2) + (t_0 * (t_1 * (0.001736111111111111 + (t_0 * -1.9290123456790124e-6)))))) / t_2) / t_1;
    	else
    		tmp = (0.5 * cos(re)) * ((im_m * im_m) + 2.0);
    	end
    	tmp_2 = tmp;
    end
    
    im_m = N[Abs[im], $MachinePrecision]
    code[re_, im$95$m_] := Block[{t$95$0 = N[(im$95$m * N[(im$95$m * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 + N[(im$95$m * N[(0.5 * im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.041666666666666664 + N[(im$95$m * N[(im$95$m * -0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im$95$m, 0.99], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.001388888888888889 + N[(im$95$m * N[(im$95$m * N[(0.008680555555555556 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * 0.0005208333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -0.041666666666666664), $MachinePrecision] / N[(N[(0.041666666666666664 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.001388888888888889), $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 3.4e+24], N[Cosh[im$95$m], $MachinePrecision], If[LessEqual[im$95$m, 2e+154], N[(N[(N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(-1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] + N[(t$95$0 * N[(t$95$1 * N[(0.001736111111111111 + N[(t$95$0 * -1.9290123456790124e-6), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]]]]]]]
    
    \begin{array}{l}
    im_m = \left|im\right|
    
    \\
    \begin{array}{l}
    t_0 := im\_m \cdot \left(im\_m \cdot \left(im\_m \cdot im\_m\right)\right)\\
    t_1 := -1 + im\_m \cdot \left(0.5 \cdot im\_m\right)\\
    t_2 := 0.041666666666666664 + im\_m \cdot \left(im\_m \cdot -0.001388888888888889\right)\\
    \mathbf{if}\;im\_m \leq 0.99:\\
    \;\;\;\;\cos re \cdot \frac{\left(im\_m \cdot im\_m\right) \cdot \left(0.001388888888888889 + im\_m \cdot \left(im\_m \cdot \left(0.008680555555555556 + \left(im\_m \cdot im\_m\right) \cdot 0.0005208333333333333\right)\right)\right) + -0.041666666666666664}{\left(0.041666666666666664 + \left(im\_m \cdot im\_m\right) \cdot -0.001388888888888889\right) \cdot \left(0.5 \cdot \left(im\_m \cdot im\_m\right) + -1\right)}\\
    
    \mathbf{elif}\;im\_m \leq 3.4 \cdot 10^{+24}:\\
    \;\;\;\;\cosh im\_m\\
    
    \mathbf{elif}\;im\_m \leq 2 \cdot 10^{+154}:\\
    \;\;\;\;\frac{\frac{\cos re \cdot \left(\left(-1 + \left(im\_m \cdot im\_m\right) \cdot \left(\left(im\_m \cdot im\_m\right) \cdot 0.25\right)\right) \cdot t\_2 + t\_0 \cdot \left(t\_1 \cdot \left(0.001736111111111111 + t\_0 \cdot -1.9290123456790124 \cdot 10^{-6}\right)\right)\right)}{t\_2}}{t\_1}\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(im\_m \cdot im\_m + 2\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if im < 0.98999999999999999

      1. Initial program 100.0%

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

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

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

          \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \cos re \]
        3. distribute-lft-inN/A

          \[\leadsto \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + {im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right)\right) + \cos \color{blue}{re} \]
        4. associate-+l+N/A

          \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right) + \cos re\right)} \]
      5. Simplified91.3%

        \[\leadsto \color{blue}{\cos re \cdot \left(\left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\right)} \]
      6. Applied egg-rr67.3%

        \[\leadsto \cos re \cdot \color{blue}{\frac{\left(\left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot 0.25 - 1\right) \cdot \left(0.041666666666666664 + -0.001388888888888889 \cdot \left(im \cdot im\right)\right) + \left(0.5 \cdot \left(im \cdot im\right) - 1\right) \cdot \left(\left(0.001736111111111111 - \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot 1.9290123456790124 \cdot 10^{-6}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)}{\left(0.5 \cdot \left(im \cdot im\right) - 1\right) \cdot \left(0.041666666666666664 + -0.001388888888888889 \cdot \left(im \cdot im\right)\right)}} \]
      7. Taylor expanded in im around 0

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\color{blue}{\left({im}^{2} \cdot \left(\frac{1}{720} + {im}^{2} \cdot \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right) - \frac{1}{24}\right)}, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
      8. Step-by-step derivation
        1. sub-negN/A

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left({im}^{2} \cdot \left(\frac{1}{720} + {im}^{2} \cdot \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right)}, \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\left({im}^{2}\right), \left(\frac{1}{720} + {im}^{2} \cdot \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\color{blue}{\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)}, 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        4. unpow2N/A

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \left({im}^{2} \cdot \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(im, im\right)}\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        7. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \left(\left(im \cdot im\right) \cdot \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        8. associate-*l*N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \left(im \cdot \left(im \cdot \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        9. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \left(im \cdot \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        11. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{5}{576}, \left(\frac{1}{1920} \cdot {im}^{2}\right)\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        12. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{5}{576}, \left({im}^{2} \cdot \frac{1}{1920}\right)\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        13. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{5}{576}, \mathsf{*.f64}\left(\left({im}^{2}\right), \frac{1}{1920}\right)\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        14. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{5}{576}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{1}{1920}\right)\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        15. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{5}{576}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{1}{1920}\right)\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        16. metadata-eval60.5%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{5}{576}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{1}{1920}\right)\right)\right)\right)\right)\right), \frac{-1}{24}\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), \color{blue}{1}\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
      9. Simplified60.5%

        \[\leadsto \cos re \cdot \frac{\color{blue}{\left(im \cdot im\right) \cdot \left(0.001388888888888889 + im \cdot \left(im \cdot \left(0.008680555555555556 + \left(im \cdot im\right) \cdot 0.0005208333333333333\right)\right)\right) + -0.041666666666666664}}{\left(0.5 \cdot \left(im \cdot im\right) - 1\right) \cdot \left(0.041666666666666664 + -0.001388888888888889 \cdot \left(im \cdot im\right)\right)} \]

      if 0.98999999999999999 < im < 3.4000000000000001e24

      1. Initial program 100.0%

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

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

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

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\left(\left(\frac{1}{2} \cdot 2\right) \cdot \cosh im\right), \cos \color{blue}{re}\right) \]
        8. metadata-evalN/A

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \cosh im\right), \cos \color{blue}{re}\right) \]
        10. cosh-lowering-cosh.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \cos re\right) \]
        11. cos-lowering-cos.f64100.0%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \mathsf{cos.f64}\left(re\right)\right) \]
      4. Applied egg-rr100.0%

        \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right) \cdot \cos re} \]
      5. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\left(1 \cdot \cosh im\right), \color{blue}{\cos re}\right) \]
        2. *-lft-identityN/A

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \cos \color{blue}{re}\right) \]
        4. cos-lowering-cos.f64100.0%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \mathsf{cos.f64}\left(re\right)\right) \]
      6. Applied egg-rr100.0%

        \[\leadsto \color{blue}{\cosh im \cdot \cos re} \]
      7. Taylor expanded in re around 0

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \color{blue}{1}\right) \]
      8. Step-by-step derivation
        1. Simplified100.0%

          \[\leadsto \cosh im \cdot \color{blue}{1} \]

        if 3.4000000000000001e24 < im < 2.00000000000000007e154

        1. Initial program 100.0%

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

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

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

            \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \cos re \]
          3. distribute-lft-inN/A

            \[\leadsto \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + {im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right)\right) + \cos \color{blue}{re} \]
          4. associate-+l+N/A

            \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right) + \cos re\right)} \]
        5. Simplified83.0%

          \[\leadsto \color{blue}{\cos re \cdot \left(\left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\right)} \]
        6. Applied egg-rr39.5%

          \[\leadsto \cos re \cdot \color{blue}{\frac{\left(\left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot 0.25 - 1\right) \cdot \left(0.041666666666666664 + -0.001388888888888889 \cdot \left(im \cdot im\right)\right) + \left(0.5 \cdot \left(im \cdot im\right) - 1\right) \cdot \left(\left(0.001736111111111111 - \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot 1.9290123456790124 \cdot 10^{-6}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)}{\left(0.5 \cdot \left(im \cdot im\right) - 1\right) \cdot \left(0.041666666666666664 + -0.001388888888888889 \cdot \left(im \cdot im\right)\right)}} \]
        7. Applied egg-rr97.1%

          \[\leadsto \color{blue}{\frac{\frac{\cos re \cdot \left(\left(-1 + \left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.25\right)\right) \cdot \left(0.041666666666666664 + im \cdot \left(im \cdot -0.001388888888888889\right)\right) + \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot \left(\left(im \cdot \left(im \cdot 0.5\right) + -1\right) \cdot \left(0.001736111111111111 + \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot -1.9290123456790124 \cdot 10^{-6}\right)\right)\right)}{0.041666666666666664 + im \cdot \left(im \cdot -0.001388888888888889\right)}}{im \cdot \left(im \cdot 0.5\right) + -1}} \]

        if 2.00000000000000007e154 < im

        1. Initial program 100.0%

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

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

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

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

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

          \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(2 + im \cdot im\right)} \]
      9. Recombined 4 regimes into one program.
      10. Final simplification69.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.99:\\ \;\;\;\;\cos re \cdot \frac{\left(im \cdot im\right) \cdot \left(0.001388888888888889 + im \cdot \left(im \cdot \left(0.008680555555555556 + \left(im \cdot im\right) \cdot 0.0005208333333333333\right)\right)\right) + -0.041666666666666664}{\left(0.041666666666666664 + \left(im \cdot im\right) \cdot -0.001388888888888889\right) \cdot \left(0.5 \cdot \left(im \cdot im\right) + -1\right)}\\ \mathbf{elif}\;im \leq 3.4 \cdot 10^{+24}:\\ \;\;\;\;\cosh im\\ \mathbf{elif}\;im \leq 2 \cdot 10^{+154}:\\ \;\;\;\;\frac{\frac{\cos re \cdot \left(\left(-1 + \left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.25\right)\right) \cdot \left(0.041666666666666664 + im \cdot \left(im \cdot -0.001388888888888889\right)\right) + \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot \left(\left(-1 + im \cdot \left(0.5 \cdot im\right)\right) \cdot \left(0.001736111111111111 + \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot -1.9290123456790124 \cdot 10^{-6}\right)\right)\right)}{0.041666666666666664 + im \cdot \left(im \cdot -0.001388888888888889\right)}}{-1 + im \cdot \left(0.5 \cdot im\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(im \cdot im + 2\right)\\ \end{array} \]
      11. Add Preprocessing

      Alternative 6: 97.6% accurate, 1.9× speedup?

      \[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} t_0 := \left(im\_m \cdot im\_m\right) \cdot 0.001388888888888889\\ t_1 := 0.5 \cdot \left(im\_m \cdot im\_m\right)\\ t_2 := im\_m \cdot \left(im\_m \cdot im\_m\right)\\ \mathbf{if}\;im\_m \leq 1.16:\\ \;\;\;\;\cos re \cdot \frac{\left(im\_m \cdot im\_m\right) \cdot \left(0.001388888888888889 + im\_m \cdot \left(im\_m \cdot \left(0.008680555555555556 + \left(im\_m \cdot im\_m\right) \cdot 0.0005208333333333333\right)\right)\right) + -0.041666666666666664}{\left(0.041666666666666664 + \left(im\_m \cdot im\_m\right) \cdot -0.001388888888888889\right) \cdot \left(t\_1 + -1\right)}\\ \mathbf{elif}\;im\_m \leq 3.4 \cdot 10^{+24}:\\ \;\;\;\;\cosh im\_m\\ \mathbf{elif}\;im\_m \leq 10^{+77}:\\ \;\;\;\;\cos re \cdot \left(\left(1 + t\_1\right) + \frac{\left(im\_m \cdot t\_2\right) \cdot \left(7.233796296296296 \cdot 10^{-5} + t\_2 \cdot \left(t\_2 \cdot 2.6791838134430728 \cdot 10^{-9}\right)\right)}{0.001736111111111111 + t\_0 \cdot \left(t\_0 - 0.041666666666666664\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\cos re \cdot \left(1 + \left(im\_m \cdot im\_m\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im\_m \cdot im\_m\right)\right)\right)\\ \end{array} \end{array} \]
      im_m = (fabs.f64 im)
      (FPCore (re im_m)
       :precision binary64
       (let* ((t_0 (* (* im_m im_m) 0.001388888888888889))
              (t_1 (* 0.5 (* im_m im_m)))
              (t_2 (* im_m (* im_m im_m))))
         (if (<= im_m 1.16)
           (*
            (cos re)
            (/
             (+
              (*
               (* im_m im_m)
               (+
                0.001388888888888889
                (*
                 im_m
                 (*
                  im_m
                  (+
                   0.008680555555555556
                   (* (* im_m im_m) 0.0005208333333333333))))))
              -0.041666666666666664)
             (*
              (+ 0.041666666666666664 (* (* im_m im_m) -0.001388888888888889))
              (+ t_1 -1.0))))
           (if (<= im_m 3.4e+24)
             (cosh im_m)
             (if (<= im_m 1e+77)
               (*
                (cos re)
                (+
                 (+ 1.0 t_1)
                 (/
                  (*
                   (* im_m t_2)
                   (+ 7.233796296296296e-5 (* t_2 (* t_2 2.6791838134430728e-9))))
                  (+ 0.001736111111111111 (* t_0 (- t_0 0.041666666666666664))))))
               (*
                (cos re)
                (+
                 1.0
                 (*
                  (* im_m im_m)
                  (+ 0.5 (* 0.041666666666666664 (* im_m im_m)))))))))))
      im_m = fabs(im);
      double code(double re, double im_m) {
      	double t_0 = (im_m * im_m) * 0.001388888888888889;
      	double t_1 = 0.5 * (im_m * im_m);
      	double t_2 = im_m * (im_m * im_m);
      	double tmp;
      	if (im_m <= 1.16) {
      		tmp = cos(re) * ((((im_m * im_m) * (0.001388888888888889 + (im_m * (im_m * (0.008680555555555556 + ((im_m * im_m) * 0.0005208333333333333)))))) + -0.041666666666666664) / ((0.041666666666666664 + ((im_m * im_m) * -0.001388888888888889)) * (t_1 + -1.0)));
      	} else if (im_m <= 3.4e+24) {
      		tmp = cosh(im_m);
      	} else if (im_m <= 1e+77) {
      		tmp = cos(re) * ((1.0 + t_1) + (((im_m * t_2) * (7.233796296296296e-5 + (t_2 * (t_2 * 2.6791838134430728e-9)))) / (0.001736111111111111 + (t_0 * (t_0 - 0.041666666666666664)))));
      	} else {
      		tmp = cos(re) * (1.0 + ((im_m * im_m) * (0.5 + (0.041666666666666664 * (im_m * im_m)))));
      	}
      	return tmp;
      }
      
      im_m = abs(im)
      real(8) function code(re, im_m)
          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) :: tmp
          t_0 = (im_m * im_m) * 0.001388888888888889d0
          t_1 = 0.5d0 * (im_m * im_m)
          t_2 = im_m * (im_m * im_m)
          if (im_m <= 1.16d0) then
              tmp = cos(re) * ((((im_m * im_m) * (0.001388888888888889d0 + (im_m * (im_m * (0.008680555555555556d0 + ((im_m * im_m) * 0.0005208333333333333d0)))))) + (-0.041666666666666664d0)) / ((0.041666666666666664d0 + ((im_m * im_m) * (-0.001388888888888889d0))) * (t_1 + (-1.0d0))))
          else if (im_m <= 3.4d+24) then
              tmp = cosh(im_m)
          else if (im_m <= 1d+77) then
              tmp = cos(re) * ((1.0d0 + t_1) + (((im_m * t_2) * (7.233796296296296d-5 + (t_2 * (t_2 * 2.6791838134430728d-9)))) / (0.001736111111111111d0 + (t_0 * (t_0 - 0.041666666666666664d0)))))
          else
              tmp = cos(re) * (1.0d0 + ((im_m * im_m) * (0.5d0 + (0.041666666666666664d0 * (im_m * im_m)))))
          end if
          code = tmp
      end function
      
      im_m = Math.abs(im);
      public static double code(double re, double im_m) {
      	double t_0 = (im_m * im_m) * 0.001388888888888889;
      	double t_1 = 0.5 * (im_m * im_m);
      	double t_2 = im_m * (im_m * im_m);
      	double tmp;
      	if (im_m <= 1.16) {
      		tmp = Math.cos(re) * ((((im_m * im_m) * (0.001388888888888889 + (im_m * (im_m * (0.008680555555555556 + ((im_m * im_m) * 0.0005208333333333333)))))) + -0.041666666666666664) / ((0.041666666666666664 + ((im_m * im_m) * -0.001388888888888889)) * (t_1 + -1.0)));
      	} else if (im_m <= 3.4e+24) {
      		tmp = Math.cosh(im_m);
      	} else if (im_m <= 1e+77) {
      		tmp = Math.cos(re) * ((1.0 + t_1) + (((im_m * t_2) * (7.233796296296296e-5 + (t_2 * (t_2 * 2.6791838134430728e-9)))) / (0.001736111111111111 + (t_0 * (t_0 - 0.041666666666666664)))));
      	} else {
      		tmp = Math.cos(re) * (1.0 + ((im_m * im_m) * (0.5 + (0.041666666666666664 * (im_m * im_m)))));
      	}
      	return tmp;
      }
      
      im_m = math.fabs(im)
      def code(re, im_m):
      	t_0 = (im_m * im_m) * 0.001388888888888889
      	t_1 = 0.5 * (im_m * im_m)
      	t_2 = im_m * (im_m * im_m)
      	tmp = 0
      	if im_m <= 1.16:
      		tmp = math.cos(re) * ((((im_m * im_m) * (0.001388888888888889 + (im_m * (im_m * (0.008680555555555556 + ((im_m * im_m) * 0.0005208333333333333)))))) + -0.041666666666666664) / ((0.041666666666666664 + ((im_m * im_m) * -0.001388888888888889)) * (t_1 + -1.0)))
      	elif im_m <= 3.4e+24:
      		tmp = math.cosh(im_m)
      	elif im_m <= 1e+77:
      		tmp = math.cos(re) * ((1.0 + t_1) + (((im_m * t_2) * (7.233796296296296e-5 + (t_2 * (t_2 * 2.6791838134430728e-9)))) / (0.001736111111111111 + (t_0 * (t_0 - 0.041666666666666664)))))
      	else:
      		tmp = math.cos(re) * (1.0 + ((im_m * im_m) * (0.5 + (0.041666666666666664 * (im_m * im_m)))))
      	return tmp
      
      im_m = abs(im)
      function code(re, im_m)
      	t_0 = Float64(Float64(im_m * im_m) * 0.001388888888888889)
      	t_1 = Float64(0.5 * Float64(im_m * im_m))
      	t_2 = Float64(im_m * Float64(im_m * im_m))
      	tmp = 0.0
      	if (im_m <= 1.16)
      		tmp = Float64(cos(re) * Float64(Float64(Float64(Float64(im_m * im_m) * Float64(0.001388888888888889 + Float64(im_m * Float64(im_m * Float64(0.008680555555555556 + Float64(Float64(im_m * im_m) * 0.0005208333333333333)))))) + -0.041666666666666664) / Float64(Float64(0.041666666666666664 + Float64(Float64(im_m * im_m) * -0.001388888888888889)) * Float64(t_1 + -1.0))));
      	elseif (im_m <= 3.4e+24)
      		tmp = cosh(im_m);
      	elseif (im_m <= 1e+77)
      		tmp = Float64(cos(re) * Float64(Float64(1.0 + t_1) + Float64(Float64(Float64(im_m * t_2) * Float64(7.233796296296296e-5 + Float64(t_2 * Float64(t_2 * 2.6791838134430728e-9)))) / Float64(0.001736111111111111 + Float64(t_0 * Float64(t_0 - 0.041666666666666664))))));
      	else
      		tmp = Float64(cos(re) * Float64(1.0 + Float64(Float64(im_m * im_m) * Float64(0.5 + Float64(0.041666666666666664 * Float64(im_m * im_m))))));
      	end
      	return tmp
      end
      
      im_m = abs(im);
      function tmp_2 = code(re, im_m)
      	t_0 = (im_m * im_m) * 0.001388888888888889;
      	t_1 = 0.5 * (im_m * im_m);
      	t_2 = im_m * (im_m * im_m);
      	tmp = 0.0;
      	if (im_m <= 1.16)
      		tmp = cos(re) * ((((im_m * im_m) * (0.001388888888888889 + (im_m * (im_m * (0.008680555555555556 + ((im_m * im_m) * 0.0005208333333333333)))))) + -0.041666666666666664) / ((0.041666666666666664 + ((im_m * im_m) * -0.001388888888888889)) * (t_1 + -1.0)));
      	elseif (im_m <= 3.4e+24)
      		tmp = cosh(im_m);
      	elseif (im_m <= 1e+77)
      		tmp = cos(re) * ((1.0 + t_1) + (((im_m * t_2) * (7.233796296296296e-5 + (t_2 * (t_2 * 2.6791838134430728e-9)))) / (0.001736111111111111 + (t_0 * (t_0 - 0.041666666666666664)))));
      	else
      		tmp = cos(re) * (1.0 + ((im_m * im_m) * (0.5 + (0.041666666666666664 * (im_m * im_m)))));
      	end
      	tmp_2 = tmp;
      end
      
      im_m = N[Abs[im], $MachinePrecision]
      code[re_, im$95$m_] := Block[{t$95$0 = N[(N[(im$95$m * im$95$m), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(im$95$m * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im$95$m, 1.16], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.001388888888888889 + N[(im$95$m * N[(im$95$m * N[(0.008680555555555556 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * 0.0005208333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -0.041666666666666664), $MachinePrecision] / N[(N[(0.041666666666666664 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.001388888888888889), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 3.4e+24], N[Cosh[im$95$m], $MachinePrecision], If[LessEqual[im$95$m, 1e+77], N[(N[Cos[re], $MachinePrecision] * N[(N[(1.0 + t$95$1), $MachinePrecision] + N[(N[(N[(im$95$m * t$95$2), $MachinePrecision] * N[(7.233796296296296e-5 + N[(t$95$2 * N[(t$95$2 * 2.6791838134430728e-9), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.001736111111111111 + N[(t$95$0 * N[(t$95$0 - 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.5 + N[(0.041666666666666664 * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
      
      \begin{array}{l}
      im_m = \left|im\right|
      
      \\
      \begin{array}{l}
      t_0 := \left(im\_m \cdot im\_m\right) \cdot 0.001388888888888889\\
      t_1 := 0.5 \cdot \left(im\_m \cdot im\_m\right)\\
      t_2 := im\_m \cdot \left(im\_m \cdot im\_m\right)\\
      \mathbf{if}\;im\_m \leq 1.16:\\
      \;\;\;\;\cos re \cdot \frac{\left(im\_m \cdot im\_m\right) \cdot \left(0.001388888888888889 + im\_m \cdot \left(im\_m \cdot \left(0.008680555555555556 + \left(im\_m \cdot im\_m\right) \cdot 0.0005208333333333333\right)\right)\right) + -0.041666666666666664}{\left(0.041666666666666664 + \left(im\_m \cdot im\_m\right) \cdot -0.001388888888888889\right) \cdot \left(t\_1 + -1\right)}\\
      
      \mathbf{elif}\;im\_m \leq 3.4 \cdot 10^{+24}:\\
      \;\;\;\;\cosh im\_m\\
      
      \mathbf{elif}\;im\_m \leq 10^{+77}:\\
      \;\;\;\;\cos re \cdot \left(\left(1 + t\_1\right) + \frac{\left(im\_m \cdot t\_2\right) \cdot \left(7.233796296296296 \cdot 10^{-5} + t\_2 \cdot \left(t\_2 \cdot 2.6791838134430728 \cdot 10^{-9}\right)\right)}{0.001736111111111111 + t\_0 \cdot \left(t\_0 - 0.041666666666666664\right)}\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\cos re \cdot \left(1 + \left(im\_m \cdot im\_m\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im\_m \cdot im\_m\right)\right)\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if im < 1.15999999999999992

        1. Initial program 100.0%

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

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

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

            \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \cos re \]
          3. distribute-lft-inN/A

            \[\leadsto \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + {im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right)\right) + \cos \color{blue}{re} \]
          4. associate-+l+N/A

            \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right) + \cos re\right)} \]
        5. Simplified91.3%

          \[\leadsto \color{blue}{\cos re \cdot \left(\left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\right)} \]
        6. Applied egg-rr67.3%

          \[\leadsto \cos re \cdot \color{blue}{\frac{\left(\left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot 0.25 - 1\right) \cdot \left(0.041666666666666664 + -0.001388888888888889 \cdot \left(im \cdot im\right)\right) + \left(0.5 \cdot \left(im \cdot im\right) - 1\right) \cdot \left(\left(0.001736111111111111 - \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot 1.9290123456790124 \cdot 10^{-6}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)}{\left(0.5 \cdot \left(im \cdot im\right) - 1\right) \cdot \left(0.041666666666666664 + -0.001388888888888889 \cdot \left(im \cdot im\right)\right)}} \]
        7. Taylor expanded in im around 0

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\color{blue}{\left({im}^{2} \cdot \left(\frac{1}{720} + {im}^{2} \cdot \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right) - \frac{1}{24}\right)}, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        8. Step-by-step derivation
          1. sub-negN/A

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left({im}^{2} \cdot \left(\frac{1}{720} + {im}^{2} \cdot \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right)}, \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
          3. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\left({im}^{2}\right), \left(\frac{1}{720} + {im}^{2} \cdot \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\color{blue}{\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)}, 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
          4. unpow2N/A

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

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \left({im}^{2} \cdot \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(im, im\right)}\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
          7. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \left(\left(im \cdot im\right) \cdot \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
          8. associate-*l*N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \left(im \cdot \left(im \cdot \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
          9. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \left(im \cdot \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
          10. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
          11. +-lowering-+.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{5}{576}, \left(\frac{1}{1920} \cdot {im}^{2}\right)\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
          12. *-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{5}{576}, \left({im}^{2} \cdot \frac{1}{1920}\right)\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{5}{576}, \mathsf{*.f64}\left(\left({im}^{2}\right), \frac{1}{1920}\right)\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
          14. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{5}{576}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{1}{1920}\right)\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
          15. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{5}{576}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{1}{1920}\right)\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
          16. metadata-eval60.5%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{5}{576}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{1}{1920}\right)\right)\right)\right)\right)\right), \frac{-1}{24}\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), \color{blue}{1}\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
        9. Simplified60.5%

          \[\leadsto \cos re \cdot \frac{\color{blue}{\left(im \cdot im\right) \cdot \left(0.001388888888888889 + im \cdot \left(im \cdot \left(0.008680555555555556 + \left(im \cdot im\right) \cdot 0.0005208333333333333\right)\right)\right) + -0.041666666666666664}}{\left(0.5 \cdot \left(im \cdot im\right) - 1\right) \cdot \left(0.041666666666666664 + -0.001388888888888889 \cdot \left(im \cdot im\right)\right)} \]

        if 1.15999999999999992 < im < 3.4000000000000001e24

        1. Initial program 100.0%

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

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

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

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

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

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

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

            \[\leadsto \mathsf{*.f64}\left(\left(\left(\frac{1}{2} \cdot 2\right) \cdot \cosh im\right), \cos \color{blue}{re}\right) \]
          8. metadata-evalN/A

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \cosh im\right), \cos \color{blue}{re}\right) \]
          10. cosh-lowering-cosh.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \cos re\right) \]
          11. cos-lowering-cos.f64100.0%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \mathsf{cos.f64}\left(re\right)\right) \]
        4. Applied egg-rr100.0%

          \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right) \cdot \cos re} \]
        5. Step-by-step derivation
          1. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\left(1 \cdot \cosh im\right), \color{blue}{\cos re}\right) \]
          2. *-lft-identityN/A

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \cos \color{blue}{re}\right) \]
          4. cos-lowering-cos.f64100.0%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \mathsf{cos.f64}\left(re\right)\right) \]
        6. Applied egg-rr100.0%

          \[\leadsto \color{blue}{\cosh im \cdot \cos re} \]
        7. Taylor expanded in re around 0

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \color{blue}{1}\right) \]
        8. Step-by-step derivation
          1. Simplified100.0%

            \[\leadsto \cosh im \cdot \color{blue}{1} \]

          if 3.4000000000000001e24 < im < 9.99999999999999983e76

          1. Initial program 100.0%

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

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

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

              \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \cos re \]
            3. distribute-lft-inN/A

              \[\leadsto \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + {im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right)\right) + \cos \color{blue}{re} \]
            4. associate-+l+N/A

              \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right) + \cos re\right)} \]
          5. Simplified59.9%

            \[\leadsto \color{blue}{\cos re \cdot \left(\left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\right)} \]
          6. Step-by-step derivation
            1. flip3-+N/A

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

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(\left({\frac{1}{24}}^{3} + {\left(\left(im \cdot im\right) \cdot \frac{1}{720}\right)}^{3}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right), \left(\frac{1}{24} \cdot \frac{1}{24} + \left(\left(\left(im \cdot im\right) \cdot \frac{1}{720}\right) \cdot \left(\left(im \cdot im\right) \cdot \frac{1}{720}\right) - \frac{1}{24} \cdot \left(\left(im \cdot im\right) \cdot \frac{1}{720}\right)\right)\right)\right), \mathsf{+.f64}\left(\color{blue}{1}, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right) \]
          7. Applied egg-rr93.2%

            \[\leadsto \cos re \cdot \left(\color{blue}{\frac{\left(7.233796296296296 \cdot 10^{-5} + \left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot 2.6791838134430728 \cdot 10^{-9}\right)\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)}{0.001736111111111111 + \left(\left(im \cdot im\right) \cdot 0.001388888888888889\right) \cdot \left(\left(im \cdot im\right) \cdot 0.001388888888888889 - 0.041666666666666664\right)}} + \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\right) \]

          if 9.99999999999999983e76 < im

          1. Initial program 100.0%

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

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

              \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
            2. distribute-rgt-inN/A

              \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
            3. associate-+l+N/A

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

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

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

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

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

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

              \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
            10. distribute-lft1-inN/A

              \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
            11. unpow2N/A

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

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

              \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
          5. Simplified100.0%

            \[\leadsto \color{blue}{\cos re \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right)} \]
        9. Recombined 4 regimes into one program.
        10. Final simplification69.7%

          \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 1.16:\\ \;\;\;\;\cos re \cdot \frac{\left(im \cdot im\right) \cdot \left(0.001388888888888889 + im \cdot \left(im \cdot \left(0.008680555555555556 + \left(im \cdot im\right) \cdot 0.0005208333333333333\right)\right)\right) + -0.041666666666666664}{\left(0.041666666666666664 + \left(im \cdot im\right) \cdot -0.001388888888888889\right) \cdot \left(0.5 \cdot \left(im \cdot im\right) + -1\right)}\\ \mathbf{elif}\;im \leq 3.4 \cdot 10^{+24}:\\ \;\;\;\;\cosh im\\ \mathbf{elif}\;im \leq 10^{+77}:\\ \;\;\;\;\cos re \cdot \left(\left(1 + 0.5 \cdot \left(im \cdot im\right)\right) + \frac{\left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot \left(7.233796296296296 \cdot 10^{-5} + \left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot 2.6791838134430728 \cdot 10^{-9}\right)\right)}{0.001736111111111111 + \left(\left(im \cdot im\right) \cdot 0.001388888888888889\right) \cdot \left(\left(im \cdot im\right) \cdot 0.001388888888888889 - 0.041666666666666664\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\cos re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right)\right)\\ \end{array} \]
        11. Add Preprocessing

        Alternative 7: 97.8% accurate, 2.2× speedup?

        \[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} \mathbf{if}\;im\_m \leq 1.25:\\ \;\;\;\;\cos re \cdot \frac{\left(im\_m \cdot im\_m\right) \cdot \left(0.001388888888888889 + im\_m \cdot \left(im\_m \cdot \left(0.008680555555555556 + \left(im\_m \cdot im\_m\right) \cdot 0.0005208333333333333\right)\right)\right) + -0.041666666666666664}{\left(0.041666666666666664 + \left(im\_m \cdot im\_m\right) \cdot -0.001388888888888889\right) \cdot \left(0.5 \cdot \left(im\_m \cdot im\_m\right) + -1\right)}\\ \mathbf{elif}\;im\_m \leq 7.2 \cdot 10^{+51}:\\ \;\;\;\;\cosh im\_m\\ \mathbf{else}:\\ \;\;\;\;\cos re \cdot \left(1 + \left(im\_m \cdot im\_m\right) \cdot \left(0.5 + im\_m \cdot \left(im\_m \cdot \left(0.041666666666666664 + \left(im\_m \cdot im\_m\right) \cdot 0.001388888888888889\right)\right)\right)\right)\\ \end{array} \end{array} \]
        im_m = (fabs.f64 im)
        (FPCore (re im_m)
         :precision binary64
         (if (<= im_m 1.25)
           (*
            (cos re)
            (/
             (+
              (*
               (* im_m im_m)
               (+
                0.001388888888888889
                (*
                 im_m
                 (*
                  im_m
                  (+ 0.008680555555555556 (* (* im_m im_m) 0.0005208333333333333))))))
              -0.041666666666666664)
             (*
              (+ 0.041666666666666664 (* (* im_m im_m) -0.001388888888888889))
              (+ (* 0.5 (* im_m im_m)) -1.0))))
           (if (<= im_m 7.2e+51)
             (cosh im_m)
             (*
              (cos re)
              (+
               1.0
               (*
                (* im_m im_m)
                (+
                 0.5
                 (*
                  im_m
                  (*
                   im_m
                   (+
                    0.041666666666666664
                    (* (* im_m im_m) 0.001388888888888889)))))))))))
        im_m = fabs(im);
        double code(double re, double im_m) {
        	double tmp;
        	if (im_m <= 1.25) {
        		tmp = cos(re) * ((((im_m * im_m) * (0.001388888888888889 + (im_m * (im_m * (0.008680555555555556 + ((im_m * im_m) * 0.0005208333333333333)))))) + -0.041666666666666664) / ((0.041666666666666664 + ((im_m * im_m) * -0.001388888888888889)) * ((0.5 * (im_m * im_m)) + -1.0)));
        	} else if (im_m <= 7.2e+51) {
        		tmp = cosh(im_m);
        	} else {
        		tmp = cos(re) * (1.0 + ((im_m * im_m) * (0.5 + (im_m * (im_m * (0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889)))))));
        	}
        	return tmp;
        }
        
        im_m = abs(im)
        real(8) function code(re, im_m)
            real(8), intent (in) :: re
            real(8), intent (in) :: im_m
            real(8) :: tmp
            if (im_m <= 1.25d0) then
                tmp = cos(re) * ((((im_m * im_m) * (0.001388888888888889d0 + (im_m * (im_m * (0.008680555555555556d0 + ((im_m * im_m) * 0.0005208333333333333d0)))))) + (-0.041666666666666664d0)) / ((0.041666666666666664d0 + ((im_m * im_m) * (-0.001388888888888889d0))) * ((0.5d0 * (im_m * im_m)) + (-1.0d0))))
            else if (im_m <= 7.2d+51) then
                tmp = cosh(im_m)
            else
                tmp = cos(re) * (1.0d0 + ((im_m * im_m) * (0.5d0 + (im_m * (im_m * (0.041666666666666664d0 + ((im_m * im_m) * 0.001388888888888889d0)))))))
            end if
            code = tmp
        end function
        
        im_m = Math.abs(im);
        public static double code(double re, double im_m) {
        	double tmp;
        	if (im_m <= 1.25) {
        		tmp = Math.cos(re) * ((((im_m * im_m) * (0.001388888888888889 + (im_m * (im_m * (0.008680555555555556 + ((im_m * im_m) * 0.0005208333333333333)))))) + -0.041666666666666664) / ((0.041666666666666664 + ((im_m * im_m) * -0.001388888888888889)) * ((0.5 * (im_m * im_m)) + -1.0)));
        	} else if (im_m <= 7.2e+51) {
        		tmp = Math.cosh(im_m);
        	} else {
        		tmp = Math.cos(re) * (1.0 + ((im_m * im_m) * (0.5 + (im_m * (im_m * (0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889)))))));
        	}
        	return tmp;
        }
        
        im_m = math.fabs(im)
        def code(re, im_m):
        	tmp = 0
        	if im_m <= 1.25:
        		tmp = math.cos(re) * ((((im_m * im_m) * (0.001388888888888889 + (im_m * (im_m * (0.008680555555555556 + ((im_m * im_m) * 0.0005208333333333333)))))) + -0.041666666666666664) / ((0.041666666666666664 + ((im_m * im_m) * -0.001388888888888889)) * ((0.5 * (im_m * im_m)) + -1.0)))
        	elif im_m <= 7.2e+51:
        		tmp = math.cosh(im_m)
        	else:
        		tmp = math.cos(re) * (1.0 + ((im_m * im_m) * (0.5 + (im_m * (im_m * (0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889)))))))
        	return tmp
        
        im_m = abs(im)
        function code(re, im_m)
        	tmp = 0.0
        	if (im_m <= 1.25)
        		tmp = Float64(cos(re) * Float64(Float64(Float64(Float64(im_m * im_m) * Float64(0.001388888888888889 + Float64(im_m * Float64(im_m * Float64(0.008680555555555556 + Float64(Float64(im_m * im_m) * 0.0005208333333333333)))))) + -0.041666666666666664) / Float64(Float64(0.041666666666666664 + Float64(Float64(im_m * im_m) * -0.001388888888888889)) * Float64(Float64(0.5 * Float64(im_m * im_m)) + -1.0))));
        	elseif (im_m <= 7.2e+51)
        		tmp = cosh(im_m);
        	else
        		tmp = Float64(cos(re) * Float64(1.0 + Float64(Float64(im_m * im_m) * Float64(0.5 + Float64(im_m * Float64(im_m * Float64(0.041666666666666664 + Float64(Float64(im_m * im_m) * 0.001388888888888889))))))));
        	end
        	return tmp
        end
        
        im_m = abs(im);
        function tmp_2 = code(re, im_m)
        	tmp = 0.0;
        	if (im_m <= 1.25)
        		tmp = cos(re) * ((((im_m * im_m) * (0.001388888888888889 + (im_m * (im_m * (0.008680555555555556 + ((im_m * im_m) * 0.0005208333333333333)))))) + -0.041666666666666664) / ((0.041666666666666664 + ((im_m * im_m) * -0.001388888888888889)) * ((0.5 * (im_m * im_m)) + -1.0)));
        	elseif (im_m <= 7.2e+51)
        		tmp = cosh(im_m);
        	else
        		tmp = cos(re) * (1.0 + ((im_m * im_m) * (0.5 + (im_m * (im_m * (0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889)))))));
        	end
        	tmp_2 = tmp;
        end
        
        im_m = N[Abs[im], $MachinePrecision]
        code[re_, im$95$m_] := If[LessEqual[im$95$m, 1.25], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.001388888888888889 + N[(im$95$m * N[(im$95$m * N[(0.008680555555555556 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * 0.0005208333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -0.041666666666666664), $MachinePrecision] / N[(N[(0.041666666666666664 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.001388888888888889), $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 7.2e+51], N[Cosh[im$95$m], $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.5 + N[(im$95$m * N[(im$95$m * N[(0.041666666666666664 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        im_m = \left|im\right|
        
        \\
        \begin{array}{l}
        \mathbf{if}\;im\_m \leq 1.25:\\
        \;\;\;\;\cos re \cdot \frac{\left(im\_m \cdot im\_m\right) \cdot \left(0.001388888888888889 + im\_m \cdot \left(im\_m \cdot \left(0.008680555555555556 + \left(im\_m \cdot im\_m\right) \cdot 0.0005208333333333333\right)\right)\right) + -0.041666666666666664}{\left(0.041666666666666664 + \left(im\_m \cdot im\_m\right) \cdot -0.001388888888888889\right) \cdot \left(0.5 \cdot \left(im\_m \cdot im\_m\right) + -1\right)}\\
        
        \mathbf{elif}\;im\_m \leq 7.2 \cdot 10^{+51}:\\
        \;\;\;\;\cosh im\_m\\
        
        \mathbf{else}:\\
        \;\;\;\;\cos re \cdot \left(1 + \left(im\_m \cdot im\_m\right) \cdot \left(0.5 + im\_m \cdot \left(im\_m \cdot \left(0.041666666666666664 + \left(im\_m \cdot im\_m\right) \cdot 0.001388888888888889\right)\right)\right)\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if im < 1.25

          1. Initial program 100.0%

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

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

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

              \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \cos re \]
            3. distribute-lft-inN/A

              \[\leadsto \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + {im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right)\right) + \cos \color{blue}{re} \]
            4. associate-+l+N/A

              \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right) + \cos re\right)} \]
          5. Simplified91.3%

            \[\leadsto \color{blue}{\cos re \cdot \left(\left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\right)} \]
          6. Applied egg-rr67.3%

            \[\leadsto \cos re \cdot \color{blue}{\frac{\left(\left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot 0.25 - 1\right) \cdot \left(0.041666666666666664 + -0.001388888888888889 \cdot \left(im \cdot im\right)\right) + \left(0.5 \cdot \left(im \cdot im\right) - 1\right) \cdot \left(\left(0.001736111111111111 - \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot 1.9290123456790124 \cdot 10^{-6}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)}{\left(0.5 \cdot \left(im \cdot im\right) - 1\right) \cdot \left(0.041666666666666664 + -0.001388888888888889 \cdot \left(im \cdot im\right)\right)}} \]
          7. Taylor expanded in im around 0

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\color{blue}{\left({im}^{2} \cdot \left(\frac{1}{720} + {im}^{2} \cdot \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right) - \frac{1}{24}\right)}, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
          8. Step-by-step derivation
            1. sub-negN/A

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left({im}^{2} \cdot \left(\frac{1}{720} + {im}^{2} \cdot \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right)}, \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
            3. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\left({im}^{2}\right), \left(\frac{1}{720} + {im}^{2} \cdot \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\color{blue}{\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)}, 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
            4. unpow2N/A

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

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \left({im}^{2} \cdot \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(im, im\right)}\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
            7. unpow2N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \left(\left(im \cdot im\right) \cdot \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
            8. associate-*l*N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \left(im \cdot \left(im \cdot \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
            9. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \left(im \cdot \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
            10. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{5}{576} + \frac{1}{1920} \cdot {im}^{2}\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
            11. +-lowering-+.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{5}{576}, \left(\frac{1}{1920} \cdot {im}^{2}\right)\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
            12. *-commutativeN/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{5}{576}, \left({im}^{2} \cdot \frac{1}{1920}\right)\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
            13. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{5}{576}, \mathsf{*.f64}\left(\left({im}^{2}\right), \frac{1}{1920}\right)\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
            14. unpow2N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{5}{576}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{1}{1920}\right)\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
            15. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{5}{576}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{1}{1920}\right)\right)\right)\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), 1\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
            16. metadata-eval60.5%

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{720}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{5}{576}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{1}{1920}\right)\right)\right)\right)\right)\right), \frac{-1}{24}\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right), \color{blue}{1}\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\frac{-1}{720}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right)\right) \]
          9. Simplified60.5%

            \[\leadsto \cos re \cdot \frac{\color{blue}{\left(im \cdot im\right) \cdot \left(0.001388888888888889 + im \cdot \left(im \cdot \left(0.008680555555555556 + \left(im \cdot im\right) \cdot 0.0005208333333333333\right)\right)\right) + -0.041666666666666664}}{\left(0.5 \cdot \left(im \cdot im\right) - 1\right) \cdot \left(0.041666666666666664 + -0.001388888888888889 \cdot \left(im \cdot im\right)\right)} \]

          if 1.25 < im < 7.20000000000000022e51

          1. Initial program 100.0%

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

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

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

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

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

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

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

              \[\leadsto \mathsf{*.f64}\left(\left(\left(\frac{1}{2} \cdot 2\right) \cdot \cosh im\right), \cos \color{blue}{re}\right) \]
            8. metadata-evalN/A

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \cosh im\right), \cos \color{blue}{re}\right) \]
            10. cosh-lowering-cosh.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \cos re\right) \]
            11. cos-lowering-cos.f64100.0%

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \mathsf{cos.f64}\left(re\right)\right) \]
          4. Applied egg-rr100.0%

            \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right) \cdot \cos re} \]
          5. Step-by-step derivation
            1. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\left(1 \cdot \cosh im\right), \color{blue}{\cos re}\right) \]
            2. *-lft-identityN/A

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \cos \color{blue}{re}\right) \]
            4. cos-lowering-cos.f64100.0%

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \mathsf{cos.f64}\left(re\right)\right) \]
          6. Applied egg-rr100.0%

            \[\leadsto \color{blue}{\cosh im \cdot \cos re} \]
          7. Taylor expanded in re around 0

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \color{blue}{1}\right) \]
          8. Step-by-step derivation
            1. Simplified78.6%

              \[\leadsto \cosh im \cdot \color{blue}{1} \]

            if 7.20000000000000022e51 < im

            1. Initial program 100.0%

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

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

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

                \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \cos re \]
              3. distribute-lft-inN/A

                \[\leadsto \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + {im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right)\right) + \cos \color{blue}{re} \]
              4. associate-+l+N/A

                \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right) + \cos re\right)} \]
            5. Simplified100.0%

              \[\leadsto \color{blue}{\cos re \cdot \left(\left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\right)} \]
            6. Taylor expanded in re around inf

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

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

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

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

                \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(1, \left(\frac{1}{2} \cdot {im}^{2} + {im}^{\left(2 \cdot 2\right)} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)\right)\right) \]
              5. pow-sqrN/A

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

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

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

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

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

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

                \[\leadsto \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}{\frac{1}{2}} + {im}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)\right)\right)\right) \]
              12. +-lowering-+.f64N/A

                \[\leadsto \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}{2}, \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)}\right)\right)\right)\right) \]
              13. unpow2N/A

                \[\leadsto \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}{2}, \left(\left(im \cdot im\right) \cdot \left(\color{blue}{\frac{1}{24}} + \frac{1}{720} \cdot {im}^{2}\right)\right)\right)\right)\right)\right) \]
              14. associate-*l*N/A

                \[\leadsto \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}{2}, \left(im \cdot \color{blue}{\left(im \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)}\right)\right)\right)\right)\right) \]
              15. *-lowering-*.f64N/A

                \[\leadsto \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}{2}, \mathsf{*.f64}\left(im, \color{blue}{\left(im \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)}\right)\right)\right)\right)\right) \]
              16. *-lowering-*.f64N/A

                \[\leadsto \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}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)}\right)\right)\right)\right)\right)\right) \]
              17. +-lowering-+.f64N/A

                \[\leadsto \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}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{24}, \color{blue}{\left(\frac{1}{720} \cdot {im}^{2}\right)}\right)\right)\right)\right)\right)\right)\right) \]
              18. *-commutativeN/A

                \[\leadsto \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}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{24}, \left({im}^{2} \cdot \color{blue}{\frac{1}{720}}\right)\right)\right)\right)\right)\right)\right)\right) \]
              19. *-lowering-*.f64N/A

                \[\leadsto \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}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\frac{1}{720}}\right)\right)\right)\right)\right)\right)\right)\right) \]
            8. Simplified100.0%

              \[\leadsto \color{blue}{\cos re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right)\right)\right)\right)} \]
          9. Recombined 3 regimes into one program.
          10. Final simplification68.9%

            \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 1.25:\\ \;\;\;\;\cos re \cdot \frac{\left(im \cdot im\right) \cdot \left(0.001388888888888889 + im \cdot \left(im \cdot \left(0.008680555555555556 + \left(im \cdot im\right) \cdot 0.0005208333333333333\right)\right)\right) + -0.041666666666666664}{\left(0.041666666666666664 + \left(im \cdot im\right) \cdot -0.001388888888888889\right) \cdot \left(0.5 \cdot \left(im \cdot im\right) + -1\right)}\\ \mathbf{elif}\;im \leq 7.2 \cdot 10^{+51}:\\ \;\;\;\;\cosh im\\ \mathbf{else}:\\ \;\;\;\;\cos re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right)\right)\right)\right)\\ \end{array} \]
          11. Add Preprocessing

          Alternative 8: 97.8% accurate, 2.4× speedup?

          \[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} t_0 := im\_m \cdot \left(0.041666666666666664 + \left(im\_m \cdot im\_m\right) \cdot 0.001388888888888889\right)\\ \mathbf{if}\;im\_m \leq 0.98:\\ \;\;\;\;\cos re \cdot \left(\left(1 + 0.5 \cdot \left(im\_m \cdot im\_m\right)\right) + \left(im\_m \cdot \left(im\_m \cdot im\_m\right)\right) \cdot t\_0\right)\\ \mathbf{elif}\;im\_m \leq 7.2 \cdot 10^{+51}:\\ \;\;\;\;\cosh im\_m\\ \mathbf{else}:\\ \;\;\;\;\cos re \cdot \left(1 + \left(im\_m \cdot im\_m\right) \cdot \left(0.5 + im\_m \cdot t\_0\right)\right)\\ \end{array} \end{array} \]
          im_m = (fabs.f64 im)
          (FPCore (re im_m)
           :precision binary64
           (let* ((t_0
                   (*
                    im_m
                    (+ 0.041666666666666664 (* (* im_m im_m) 0.001388888888888889)))))
             (if (<= im_m 0.98)
               (*
                (cos re)
                (+ (+ 1.0 (* 0.5 (* im_m im_m))) (* (* im_m (* im_m im_m)) t_0)))
               (if (<= im_m 7.2e+51)
                 (cosh im_m)
                 (* (cos re) (+ 1.0 (* (* im_m im_m) (+ 0.5 (* im_m t_0)))))))))
          im_m = fabs(im);
          double code(double re, double im_m) {
          	double t_0 = im_m * (0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889));
          	double tmp;
          	if (im_m <= 0.98) {
          		tmp = cos(re) * ((1.0 + (0.5 * (im_m * im_m))) + ((im_m * (im_m * im_m)) * t_0));
          	} else if (im_m <= 7.2e+51) {
          		tmp = cosh(im_m);
          	} else {
          		tmp = cos(re) * (1.0 + ((im_m * im_m) * (0.5 + (im_m * t_0))));
          	}
          	return tmp;
          }
          
          im_m = abs(im)
          real(8) function code(re, im_m)
              real(8), intent (in) :: re
              real(8), intent (in) :: im_m
              real(8) :: t_0
              real(8) :: tmp
              t_0 = im_m * (0.041666666666666664d0 + ((im_m * im_m) * 0.001388888888888889d0))
              if (im_m <= 0.98d0) then
                  tmp = cos(re) * ((1.0d0 + (0.5d0 * (im_m * im_m))) + ((im_m * (im_m * im_m)) * t_0))
              else if (im_m <= 7.2d+51) then
                  tmp = cosh(im_m)
              else
                  tmp = cos(re) * (1.0d0 + ((im_m * im_m) * (0.5d0 + (im_m * t_0))))
              end if
              code = tmp
          end function
          
          im_m = Math.abs(im);
          public static double code(double re, double im_m) {
          	double t_0 = im_m * (0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889));
          	double tmp;
          	if (im_m <= 0.98) {
          		tmp = Math.cos(re) * ((1.0 + (0.5 * (im_m * im_m))) + ((im_m * (im_m * im_m)) * t_0));
          	} else if (im_m <= 7.2e+51) {
          		tmp = Math.cosh(im_m);
          	} else {
          		tmp = Math.cos(re) * (1.0 + ((im_m * im_m) * (0.5 + (im_m * t_0))));
          	}
          	return tmp;
          }
          
          im_m = math.fabs(im)
          def code(re, im_m):
          	t_0 = im_m * (0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889))
          	tmp = 0
          	if im_m <= 0.98:
          		tmp = math.cos(re) * ((1.0 + (0.5 * (im_m * im_m))) + ((im_m * (im_m * im_m)) * t_0))
          	elif im_m <= 7.2e+51:
          		tmp = math.cosh(im_m)
          	else:
          		tmp = math.cos(re) * (1.0 + ((im_m * im_m) * (0.5 + (im_m * t_0))))
          	return tmp
          
          im_m = abs(im)
          function code(re, im_m)
          	t_0 = Float64(im_m * Float64(0.041666666666666664 + Float64(Float64(im_m * im_m) * 0.001388888888888889)))
          	tmp = 0.0
          	if (im_m <= 0.98)
          		tmp = Float64(cos(re) * Float64(Float64(1.0 + Float64(0.5 * Float64(im_m * im_m))) + Float64(Float64(im_m * Float64(im_m * im_m)) * t_0)));
          	elseif (im_m <= 7.2e+51)
          		tmp = cosh(im_m);
          	else
          		tmp = Float64(cos(re) * Float64(1.0 + Float64(Float64(im_m * im_m) * Float64(0.5 + Float64(im_m * t_0)))));
          	end
          	return tmp
          end
          
          im_m = abs(im);
          function tmp_2 = code(re, im_m)
          	t_0 = im_m * (0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889));
          	tmp = 0.0;
          	if (im_m <= 0.98)
          		tmp = cos(re) * ((1.0 + (0.5 * (im_m * im_m))) + ((im_m * (im_m * im_m)) * t_0));
          	elseif (im_m <= 7.2e+51)
          		tmp = cosh(im_m);
          	else
          		tmp = cos(re) * (1.0 + ((im_m * im_m) * (0.5 + (im_m * t_0))));
          	end
          	tmp_2 = tmp;
          end
          
          im_m = N[Abs[im], $MachinePrecision]
          code[re_, im$95$m_] := Block[{t$95$0 = N[(im$95$m * N[(0.041666666666666664 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im$95$m, 0.98], N[(N[Cos[re], $MachinePrecision] * N[(N[(1.0 + N[(0.5 * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(im$95$m * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 7.2e+51], N[Cosh[im$95$m], $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.5 + N[(im$95$m * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
          
          \begin{array}{l}
          im_m = \left|im\right|
          
          \\
          \begin{array}{l}
          t_0 := im\_m \cdot \left(0.041666666666666664 + \left(im\_m \cdot im\_m\right) \cdot 0.001388888888888889\right)\\
          \mathbf{if}\;im\_m \leq 0.98:\\
          \;\;\;\;\cos re \cdot \left(\left(1 + 0.5 \cdot \left(im\_m \cdot im\_m\right)\right) + \left(im\_m \cdot \left(im\_m \cdot im\_m\right)\right) \cdot t\_0\right)\\
          
          \mathbf{elif}\;im\_m \leq 7.2 \cdot 10^{+51}:\\
          \;\;\;\;\cosh im\_m\\
          
          \mathbf{else}:\\
          \;\;\;\;\cos re \cdot \left(1 + \left(im\_m \cdot im\_m\right) \cdot \left(0.5 + im\_m \cdot t\_0\right)\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if im < 0.97999999999999998

            1. Initial program 100.0%

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

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

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

                \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \cos re \]
              3. distribute-lft-inN/A

                \[\leadsto \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + {im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right)\right) + \cos \color{blue}{re} \]
              4. associate-+l+N/A

                \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right) + \cos re\right)} \]
            5. Simplified91.3%

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{1}{720}\right)\right)\right), \mathsf{*.f64}\left(im, \left(im \cdot im\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right) \]
              9. *-lowering-*.f6491.3%

                \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{1}{720}\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)\right) \]
            7. Applied egg-rr91.3%

              \[\leadsto \cos re \cdot \left(\color{blue}{\left(im \cdot \left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right)\right) \cdot \left(im \cdot \left(im \cdot im\right)\right)} + \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\right) \]

            if 0.97999999999999998 < im < 7.20000000000000022e51

            1. Initial program 100.0%

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

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

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

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

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

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

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

                \[\leadsto \mathsf{*.f64}\left(\left(\left(\frac{1}{2} \cdot 2\right) \cdot \cosh im\right), \cos \color{blue}{re}\right) \]
              8. metadata-evalN/A

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

                \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \cosh im\right), \cos \color{blue}{re}\right) \]
              10. cosh-lowering-cosh.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \cos re\right) \]
              11. cos-lowering-cos.f64100.0%

                \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \mathsf{cos.f64}\left(re\right)\right) \]
            4. Applied egg-rr100.0%

              \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right) \cdot \cos re} \]
            5. Step-by-step derivation
              1. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\left(1 \cdot \cosh im\right), \color{blue}{\cos re}\right) \]
              2. *-lft-identityN/A

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

                \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \cos \color{blue}{re}\right) \]
              4. cos-lowering-cos.f64100.0%

                \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \mathsf{cos.f64}\left(re\right)\right) \]
            6. Applied egg-rr100.0%

              \[\leadsto \color{blue}{\cosh im \cdot \cos re} \]
            7. Taylor expanded in re around 0

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \color{blue}{1}\right) \]
            8. Step-by-step derivation
              1. Simplified78.6%

                \[\leadsto \cosh im \cdot \color{blue}{1} \]

              if 7.20000000000000022e51 < im

              1. Initial program 100.0%

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

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

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

                  \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \cos re \]
                3. distribute-lft-inN/A

                  \[\leadsto \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + {im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right)\right) + \cos \color{blue}{re} \]
                4. associate-+l+N/A

                  \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right) + \cos re\right)} \]
              5. Simplified100.0%

                \[\leadsto \color{blue}{\cos re \cdot \left(\left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\right)} \]
              6. Taylor expanded in re around inf

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

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

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

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

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(1, \left(\frac{1}{2} \cdot {im}^{2} + {im}^{\left(2 \cdot 2\right)} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)\right)\right) \]
                5. pow-sqrN/A

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

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

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

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

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

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

                  \[\leadsto \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}{\frac{1}{2}} + {im}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)\right)\right)\right) \]
                12. +-lowering-+.f64N/A

                  \[\leadsto \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}{2}, \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)}\right)\right)\right)\right) \]
                13. unpow2N/A

                  \[\leadsto \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}{2}, \left(\left(im \cdot im\right) \cdot \left(\color{blue}{\frac{1}{24}} + \frac{1}{720} \cdot {im}^{2}\right)\right)\right)\right)\right)\right) \]
                14. associate-*l*N/A

                  \[\leadsto \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}{2}, \left(im \cdot \color{blue}{\left(im \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)}\right)\right)\right)\right)\right) \]
                15. *-lowering-*.f64N/A

                  \[\leadsto \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}{2}, \mathsf{*.f64}\left(im, \color{blue}{\left(im \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)}\right)\right)\right)\right)\right) \]
                16. *-lowering-*.f64N/A

                  \[\leadsto \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}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)}\right)\right)\right)\right)\right)\right) \]
                17. +-lowering-+.f64N/A

                  \[\leadsto \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}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{24}, \color{blue}{\left(\frac{1}{720} \cdot {im}^{2}\right)}\right)\right)\right)\right)\right)\right)\right) \]
                18. *-commutativeN/A

                  \[\leadsto \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}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{24}, \left({im}^{2} \cdot \color{blue}{\frac{1}{720}}\right)\right)\right)\right)\right)\right)\right)\right) \]
                19. *-lowering-*.f64N/A

                  \[\leadsto \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}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\frac{1}{720}}\right)\right)\right)\right)\right)\right)\right)\right) \]
              8. Simplified100.0%

                \[\leadsto \color{blue}{\cos re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right)\right)\right)\right)} \]
            9. Recombined 3 regimes into one program.
            10. Final simplification92.3%

              \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.98:\\ \;\;\;\;\cos re \cdot \left(\left(1 + 0.5 \cdot \left(im \cdot im\right)\right) + \left(im \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot \left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right)\right)\right)\\ \mathbf{elif}\;im \leq 7.2 \cdot 10^{+51}:\\ \;\;\;\;\cosh im\\ \mathbf{else}:\\ \;\;\;\;\cos re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right)\right)\right)\right)\\ \end{array} \]
            11. Add Preprocessing

            Alternative 9: 97.8% accurate, 2.4× speedup?

            \[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} t_0 := \cos re \cdot \left(1 + \left(im\_m \cdot im\_m\right) \cdot \left(0.5 + im\_m \cdot \left(im\_m \cdot \left(0.041666666666666664 + \left(im\_m \cdot im\_m\right) \cdot 0.001388888888888889\right)\right)\right)\right)\\ \mathbf{if}\;im\_m \leq 0.98:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;im\_m \leq 7.2 \cdot 10^{+51}:\\ \;\;\;\;\cosh im\_m\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
            im_m = (fabs.f64 im)
            (FPCore (re im_m)
             :precision binary64
             (let* ((t_0
                     (*
                      (cos re)
                      (+
                       1.0
                       (*
                        (* im_m im_m)
                        (+
                         0.5
                         (*
                          im_m
                          (*
                           im_m
                           (+
                            0.041666666666666664
                            (* (* im_m im_m) 0.001388888888888889))))))))))
               (if (<= im_m 0.98) t_0 (if (<= im_m 7.2e+51) (cosh im_m) t_0))))
            im_m = fabs(im);
            double code(double re, double im_m) {
            	double t_0 = cos(re) * (1.0 + ((im_m * im_m) * (0.5 + (im_m * (im_m * (0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889)))))));
            	double tmp;
            	if (im_m <= 0.98) {
            		tmp = t_0;
            	} else if (im_m <= 7.2e+51) {
            		tmp = cosh(im_m);
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            im_m = abs(im)
            real(8) function code(re, im_m)
                real(8), intent (in) :: re
                real(8), intent (in) :: im_m
                real(8) :: t_0
                real(8) :: tmp
                t_0 = cos(re) * (1.0d0 + ((im_m * im_m) * (0.5d0 + (im_m * (im_m * (0.041666666666666664d0 + ((im_m * im_m) * 0.001388888888888889d0)))))))
                if (im_m <= 0.98d0) then
                    tmp = t_0
                else if (im_m <= 7.2d+51) then
                    tmp = cosh(im_m)
                else
                    tmp = t_0
                end if
                code = tmp
            end function
            
            im_m = Math.abs(im);
            public static double code(double re, double im_m) {
            	double t_0 = Math.cos(re) * (1.0 + ((im_m * im_m) * (0.5 + (im_m * (im_m * (0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889)))))));
            	double tmp;
            	if (im_m <= 0.98) {
            		tmp = t_0;
            	} else if (im_m <= 7.2e+51) {
            		tmp = Math.cosh(im_m);
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            im_m = math.fabs(im)
            def code(re, im_m):
            	t_0 = math.cos(re) * (1.0 + ((im_m * im_m) * (0.5 + (im_m * (im_m * (0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889)))))))
            	tmp = 0
            	if im_m <= 0.98:
            		tmp = t_0
            	elif im_m <= 7.2e+51:
            		tmp = math.cosh(im_m)
            	else:
            		tmp = t_0
            	return tmp
            
            im_m = abs(im)
            function code(re, im_m)
            	t_0 = Float64(cos(re) * Float64(1.0 + Float64(Float64(im_m * im_m) * Float64(0.5 + Float64(im_m * Float64(im_m * Float64(0.041666666666666664 + Float64(Float64(im_m * im_m) * 0.001388888888888889))))))))
            	tmp = 0.0
            	if (im_m <= 0.98)
            		tmp = t_0;
            	elseif (im_m <= 7.2e+51)
            		tmp = cosh(im_m);
            	else
            		tmp = t_0;
            	end
            	return tmp
            end
            
            im_m = abs(im);
            function tmp_2 = code(re, im_m)
            	t_0 = cos(re) * (1.0 + ((im_m * im_m) * (0.5 + (im_m * (im_m * (0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889)))))));
            	tmp = 0.0;
            	if (im_m <= 0.98)
            		tmp = t_0;
            	elseif (im_m <= 7.2e+51)
            		tmp = cosh(im_m);
            	else
            		tmp = t_0;
            	end
            	tmp_2 = tmp;
            end
            
            im_m = N[Abs[im], $MachinePrecision]
            code[re_, im$95$m_] := Block[{t$95$0 = N[(N[Cos[re], $MachinePrecision] * N[(1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.5 + N[(im$95$m * N[(im$95$m * N[(0.041666666666666664 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im$95$m, 0.98], t$95$0, If[LessEqual[im$95$m, 7.2e+51], N[Cosh[im$95$m], $MachinePrecision], t$95$0]]]
            
            \begin{array}{l}
            im_m = \left|im\right|
            
            \\
            \begin{array}{l}
            t_0 := \cos re \cdot \left(1 + \left(im\_m \cdot im\_m\right) \cdot \left(0.5 + im\_m \cdot \left(im\_m \cdot \left(0.041666666666666664 + \left(im\_m \cdot im\_m\right) \cdot 0.001388888888888889\right)\right)\right)\right)\\
            \mathbf{if}\;im\_m \leq 0.98:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;im\_m \leq 7.2 \cdot 10^{+51}:\\
            \;\;\;\;\cosh im\_m\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if im < 0.97999999999999998 or 7.20000000000000022e51 < im

              1. Initial program 100.0%

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

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

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

                  \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \cos re \]
                3. distribute-lft-inN/A

                  \[\leadsto \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + {im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right)\right) + \cos \color{blue}{re} \]
                4. associate-+l+N/A

                  \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right) + \cos re\right)} \]
              5. Simplified93.1%

                \[\leadsto \color{blue}{\cos re \cdot \left(\left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\right)} \]
              6. Taylor expanded in re around inf

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

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

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

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

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(1, \left(\frac{1}{2} \cdot {im}^{2} + {im}^{\left(2 \cdot 2\right)} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)\right)\right) \]
                5. pow-sqrN/A

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

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

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

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

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

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

                  \[\leadsto \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}{\frac{1}{2}} + {im}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)\right)\right)\right) \]
                12. +-lowering-+.f64N/A

                  \[\leadsto \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}{2}, \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)}\right)\right)\right)\right) \]
                13. unpow2N/A

                  \[\leadsto \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}{2}, \left(\left(im \cdot im\right) \cdot \left(\color{blue}{\frac{1}{24}} + \frac{1}{720} \cdot {im}^{2}\right)\right)\right)\right)\right)\right) \]
                14. associate-*l*N/A

                  \[\leadsto \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}{2}, \left(im \cdot \color{blue}{\left(im \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)}\right)\right)\right)\right)\right) \]
                15. *-lowering-*.f64N/A

                  \[\leadsto \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}{2}, \mathsf{*.f64}\left(im, \color{blue}{\left(im \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)}\right)\right)\right)\right)\right) \]
                16. *-lowering-*.f64N/A

                  \[\leadsto \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}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)}\right)\right)\right)\right)\right)\right) \]
                17. +-lowering-+.f64N/A

                  \[\leadsto \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}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{24}, \color{blue}{\left(\frac{1}{720} \cdot {im}^{2}\right)}\right)\right)\right)\right)\right)\right)\right) \]
                18. *-commutativeN/A

                  \[\leadsto \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}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{24}, \left({im}^{2} \cdot \color{blue}{\frac{1}{720}}\right)\right)\right)\right)\right)\right)\right)\right) \]
                19. *-lowering-*.f64N/A

                  \[\leadsto \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}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\frac{1}{720}}\right)\right)\right)\right)\right)\right)\right)\right) \]
              8. Simplified93.1%

                \[\leadsto \color{blue}{\cos re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right)\right)\right)\right)} \]

              if 0.97999999999999998 < im < 7.20000000000000022e51

              1. Initial program 100.0%

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{*.f64}\left(\left(\left(\frac{1}{2} \cdot 2\right) \cdot \cosh im\right), \cos \color{blue}{re}\right) \]
                8. metadata-evalN/A

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

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \cosh im\right), \cos \color{blue}{re}\right) \]
                10. cosh-lowering-cosh.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \cos re\right) \]
                11. cos-lowering-cos.f64100.0%

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \mathsf{cos.f64}\left(re\right)\right) \]
              4. Applied egg-rr100.0%

                \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right) \cdot \cos re} \]
              5. Step-by-step derivation
                1. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\left(1 \cdot \cosh im\right), \color{blue}{\cos re}\right) \]
                2. *-lft-identityN/A

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

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \cos \color{blue}{re}\right) \]
                4. cos-lowering-cos.f64100.0%

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \mathsf{cos.f64}\left(re\right)\right) \]
              6. Applied egg-rr100.0%

                \[\leadsto \color{blue}{\cosh im \cdot \cos re} \]
              7. Taylor expanded in re around 0

                \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \color{blue}{1}\right) \]
              8. Step-by-step derivation
                1. Simplified78.6%

                  \[\leadsto \cosh im \cdot \color{blue}{1} \]
              9. Recombined 2 regimes into one program.
              10. Final simplification92.3%

                \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.98:\\ \;\;\;\;\cos re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right)\right)\right)\right)\\ \mathbf{elif}\;im \leq 7.2 \cdot 10^{+51}:\\ \;\;\;\;\cosh im\\ \mathbf{else}:\\ \;\;\;\;\cos re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right)\right)\right)\right)\\ \end{array} \]
              11. Add Preprocessing

              Alternative 10: 96.3% accurate, 2.5× speedup?

              \[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} t_0 := 0.041666666666666664 \cdot \left(im\_m \cdot im\_m\right)\\ \mathbf{if}\;im\_m \leq 0.98:\\ \;\;\;\;\cos re \cdot \left(\left(1 + 0.5 \cdot \left(im\_m \cdot im\_m\right)\right) + im\_m \cdot \left(im\_m \cdot t\_0\right)\right)\\ \mathbf{elif}\;im\_m \leq 6.8 \cdot 10^{+74}:\\ \;\;\;\;\cosh im\_m\\ \mathbf{else}:\\ \;\;\;\;\cos re \cdot \left(1 + \left(im\_m \cdot im\_m\right) \cdot \left(0.5 + t\_0\right)\right)\\ \end{array} \end{array} \]
              im_m = (fabs.f64 im)
              (FPCore (re im_m)
               :precision binary64
               (let* ((t_0 (* 0.041666666666666664 (* im_m im_m))))
                 (if (<= im_m 0.98)
                   (* (cos re) (+ (+ 1.0 (* 0.5 (* im_m im_m))) (* im_m (* im_m t_0))))
                   (if (<= im_m 6.8e+74)
                     (cosh im_m)
                     (* (cos re) (+ 1.0 (* (* im_m im_m) (+ 0.5 t_0))))))))
              im_m = fabs(im);
              double code(double re, double im_m) {
              	double t_0 = 0.041666666666666664 * (im_m * im_m);
              	double tmp;
              	if (im_m <= 0.98) {
              		tmp = cos(re) * ((1.0 + (0.5 * (im_m * im_m))) + (im_m * (im_m * t_0)));
              	} else if (im_m <= 6.8e+74) {
              		tmp = cosh(im_m);
              	} else {
              		tmp = cos(re) * (1.0 + ((im_m * im_m) * (0.5 + t_0)));
              	}
              	return tmp;
              }
              
              im_m = abs(im)
              real(8) function code(re, im_m)
                  real(8), intent (in) :: re
                  real(8), intent (in) :: im_m
                  real(8) :: t_0
                  real(8) :: tmp
                  t_0 = 0.041666666666666664d0 * (im_m * im_m)
                  if (im_m <= 0.98d0) then
                      tmp = cos(re) * ((1.0d0 + (0.5d0 * (im_m * im_m))) + (im_m * (im_m * t_0)))
                  else if (im_m <= 6.8d+74) then
                      tmp = cosh(im_m)
                  else
                      tmp = cos(re) * (1.0d0 + ((im_m * im_m) * (0.5d0 + t_0)))
                  end if
                  code = tmp
              end function
              
              im_m = Math.abs(im);
              public static double code(double re, double im_m) {
              	double t_0 = 0.041666666666666664 * (im_m * im_m);
              	double tmp;
              	if (im_m <= 0.98) {
              		tmp = Math.cos(re) * ((1.0 + (0.5 * (im_m * im_m))) + (im_m * (im_m * t_0)));
              	} else if (im_m <= 6.8e+74) {
              		tmp = Math.cosh(im_m);
              	} else {
              		tmp = Math.cos(re) * (1.0 + ((im_m * im_m) * (0.5 + t_0)));
              	}
              	return tmp;
              }
              
              im_m = math.fabs(im)
              def code(re, im_m):
              	t_0 = 0.041666666666666664 * (im_m * im_m)
              	tmp = 0
              	if im_m <= 0.98:
              		tmp = math.cos(re) * ((1.0 + (0.5 * (im_m * im_m))) + (im_m * (im_m * t_0)))
              	elif im_m <= 6.8e+74:
              		tmp = math.cosh(im_m)
              	else:
              		tmp = math.cos(re) * (1.0 + ((im_m * im_m) * (0.5 + t_0)))
              	return tmp
              
              im_m = abs(im)
              function code(re, im_m)
              	t_0 = Float64(0.041666666666666664 * Float64(im_m * im_m))
              	tmp = 0.0
              	if (im_m <= 0.98)
              		tmp = Float64(cos(re) * Float64(Float64(1.0 + Float64(0.5 * Float64(im_m * im_m))) + Float64(im_m * Float64(im_m * t_0))));
              	elseif (im_m <= 6.8e+74)
              		tmp = cosh(im_m);
              	else
              		tmp = Float64(cos(re) * Float64(1.0 + Float64(Float64(im_m * im_m) * Float64(0.5 + t_0))));
              	end
              	return tmp
              end
              
              im_m = abs(im);
              function tmp_2 = code(re, im_m)
              	t_0 = 0.041666666666666664 * (im_m * im_m);
              	tmp = 0.0;
              	if (im_m <= 0.98)
              		tmp = cos(re) * ((1.0 + (0.5 * (im_m * im_m))) + (im_m * (im_m * t_0)));
              	elseif (im_m <= 6.8e+74)
              		tmp = cosh(im_m);
              	else
              		tmp = cos(re) * (1.0 + ((im_m * im_m) * (0.5 + t_0)));
              	end
              	tmp_2 = tmp;
              end
              
              im_m = N[Abs[im], $MachinePrecision]
              code[re_, im$95$m_] := Block[{t$95$0 = N[(0.041666666666666664 * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im$95$m, 0.98], N[(N[Cos[re], $MachinePrecision] * N[(N[(1.0 + N[(0.5 * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(im$95$m * N[(im$95$m * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 6.8e+74], N[Cosh[im$95$m], $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.5 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
              
              \begin{array}{l}
              im_m = \left|im\right|
              
              \\
              \begin{array}{l}
              t_0 := 0.041666666666666664 \cdot \left(im\_m \cdot im\_m\right)\\
              \mathbf{if}\;im\_m \leq 0.98:\\
              \;\;\;\;\cos re \cdot \left(\left(1 + 0.5 \cdot \left(im\_m \cdot im\_m\right)\right) + im\_m \cdot \left(im\_m \cdot t\_0\right)\right)\\
              
              \mathbf{elif}\;im\_m \leq 6.8 \cdot 10^{+74}:\\
              \;\;\;\;\cosh im\_m\\
              
              \mathbf{else}:\\
              \;\;\;\;\cos re \cdot \left(1 + \left(im\_m \cdot im\_m\right) \cdot \left(0.5 + t\_0\right)\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if im < 0.97999999999999998

                1. Initial program 100.0%

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

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

                    \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                  2. distribute-rgt-inN/A

                    \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                  3. associate-+l+N/A

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

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

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

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

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

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

                    \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                  10. distribute-lft1-inN/A

                    \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                  11. unpow2N/A

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

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

                    \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                5. Simplified88.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\left(im \cdot im\right), \color{blue}{\frac{1}{24}}\right)\right)\right)\right)\right) \]
                  14. *-lowering-*.f6488.4%

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{+.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{1}{24}\right)\right)\right)\right)\right) \]
                7. Applied egg-rr88.4%

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

                if 0.97999999999999998 < im < 6.7999999999999998e74

                1. Initial program 100.0%

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{*.f64}\left(\left(\left(\frac{1}{2} \cdot 2\right) \cdot \cosh im\right), \cos \color{blue}{re}\right) \]
                  8. metadata-evalN/A

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

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \cosh im\right), \cos \color{blue}{re}\right) \]
                  10. cosh-lowering-cosh.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \cos re\right) \]
                  11. cos-lowering-cos.f64100.0%

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \mathsf{cos.f64}\left(re\right)\right) \]
                4. Applied egg-rr100.0%

                  \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right) \cdot \cos re} \]
                5. Step-by-step derivation
                  1. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\left(1 \cdot \cosh im\right), \color{blue}{\cos re}\right) \]
                  2. *-lft-identityN/A

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

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \cos \color{blue}{re}\right) \]
                  4. cos-lowering-cos.f64100.0%

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \mathsf{cos.f64}\left(re\right)\right) \]
                6. Applied egg-rr100.0%

                  \[\leadsto \color{blue}{\cosh im \cdot \cos re} \]
                7. Taylor expanded in re around 0

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \color{blue}{1}\right) \]
                8. Step-by-step derivation
                  1. Simplified81.0%

                    \[\leadsto \cosh im \cdot \color{blue}{1} \]

                  if 6.7999999999999998e74 < im

                  1. Initial program 100.0%

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

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

                      \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                    2. distribute-rgt-inN/A

                      \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                    3. associate-+l+N/A

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

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

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

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

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

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

                      \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                    10. distribute-lft1-inN/A

                      \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                    11. unpow2N/A

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

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

                      \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                  5. Simplified97.8%

                    \[\leadsto \color{blue}{\cos re \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right)} \]
                9. Recombined 3 regimes into one program.
                10. Final simplification89.3%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.98:\\ \;\;\;\;\cos re \cdot \left(\left(1 + 0.5 \cdot \left(im \cdot im\right)\right) + im \cdot \left(im \cdot \left(0.041666666666666664 \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{elif}\;im \leq 6.8 \cdot 10^{+74}:\\ \;\;\;\;\cosh im\\ \mathbf{else}:\\ \;\;\;\;\cos re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right)\right)\\ \end{array} \]
                11. Add Preprocessing

                Alternative 11: 96.3% accurate, 2.5× speedup?

                \[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} t_0 := \cos re \cdot \left(1 + \left(im\_m \cdot im\_m\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im\_m \cdot im\_m\right)\right)\right)\\ \mathbf{if}\;im\_m \leq 0.98:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;im\_m \leq 6.8 \cdot 10^{+74}:\\ \;\;\;\;\cosh im\_m\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                im_m = (fabs.f64 im)
                (FPCore (re im_m)
                 :precision binary64
                 (let* ((t_0
                         (*
                          (cos re)
                          (+
                           1.0
                           (* (* im_m im_m) (+ 0.5 (* 0.041666666666666664 (* im_m im_m))))))))
                   (if (<= im_m 0.98) t_0 (if (<= im_m 6.8e+74) (cosh im_m) t_0))))
                im_m = fabs(im);
                double code(double re, double im_m) {
                	double t_0 = cos(re) * (1.0 + ((im_m * im_m) * (0.5 + (0.041666666666666664 * (im_m * im_m)))));
                	double tmp;
                	if (im_m <= 0.98) {
                		tmp = t_0;
                	} else if (im_m <= 6.8e+74) {
                		tmp = cosh(im_m);
                	} else {
                		tmp = t_0;
                	}
                	return tmp;
                }
                
                im_m = abs(im)
                real(8) function code(re, im_m)
                    real(8), intent (in) :: re
                    real(8), intent (in) :: im_m
                    real(8) :: t_0
                    real(8) :: tmp
                    t_0 = cos(re) * (1.0d0 + ((im_m * im_m) * (0.5d0 + (0.041666666666666664d0 * (im_m * im_m)))))
                    if (im_m <= 0.98d0) then
                        tmp = t_0
                    else if (im_m <= 6.8d+74) then
                        tmp = cosh(im_m)
                    else
                        tmp = t_0
                    end if
                    code = tmp
                end function
                
                im_m = Math.abs(im);
                public static double code(double re, double im_m) {
                	double t_0 = Math.cos(re) * (1.0 + ((im_m * im_m) * (0.5 + (0.041666666666666664 * (im_m * im_m)))));
                	double tmp;
                	if (im_m <= 0.98) {
                		tmp = t_0;
                	} else if (im_m <= 6.8e+74) {
                		tmp = Math.cosh(im_m);
                	} else {
                		tmp = t_0;
                	}
                	return tmp;
                }
                
                im_m = math.fabs(im)
                def code(re, im_m):
                	t_0 = math.cos(re) * (1.0 + ((im_m * im_m) * (0.5 + (0.041666666666666664 * (im_m * im_m)))))
                	tmp = 0
                	if im_m <= 0.98:
                		tmp = t_0
                	elif im_m <= 6.8e+74:
                		tmp = math.cosh(im_m)
                	else:
                		tmp = t_0
                	return tmp
                
                im_m = abs(im)
                function code(re, im_m)
                	t_0 = Float64(cos(re) * Float64(1.0 + Float64(Float64(im_m * im_m) * Float64(0.5 + Float64(0.041666666666666664 * Float64(im_m * im_m))))))
                	tmp = 0.0
                	if (im_m <= 0.98)
                		tmp = t_0;
                	elseif (im_m <= 6.8e+74)
                		tmp = cosh(im_m);
                	else
                		tmp = t_0;
                	end
                	return tmp
                end
                
                im_m = abs(im);
                function tmp_2 = code(re, im_m)
                	t_0 = cos(re) * (1.0 + ((im_m * im_m) * (0.5 + (0.041666666666666664 * (im_m * im_m)))));
                	tmp = 0.0;
                	if (im_m <= 0.98)
                		tmp = t_0;
                	elseif (im_m <= 6.8e+74)
                		tmp = cosh(im_m);
                	else
                		tmp = t_0;
                	end
                	tmp_2 = tmp;
                end
                
                im_m = N[Abs[im], $MachinePrecision]
                code[re_, im$95$m_] := Block[{t$95$0 = N[(N[Cos[re], $MachinePrecision] * N[(1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.5 + N[(0.041666666666666664 * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im$95$m, 0.98], t$95$0, If[LessEqual[im$95$m, 6.8e+74], N[Cosh[im$95$m], $MachinePrecision], t$95$0]]]
                
                \begin{array}{l}
                im_m = \left|im\right|
                
                \\
                \begin{array}{l}
                t_0 := \cos re \cdot \left(1 + \left(im\_m \cdot im\_m\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im\_m \cdot im\_m\right)\right)\right)\\
                \mathbf{if}\;im\_m \leq 0.98:\\
                \;\;\;\;t\_0\\
                
                \mathbf{elif}\;im\_m \leq 6.8 \cdot 10^{+74}:\\
                \;\;\;\;\cosh im\_m\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_0\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if im < 0.97999999999999998 or 6.7999999999999998e74 < im

                  1. Initial program 100.0%

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

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

                      \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                    2. distribute-rgt-inN/A

                      \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                    3. associate-+l+N/A

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

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

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

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

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

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

                      \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                    10. distribute-lft1-inN/A

                      \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                    11. unpow2N/A

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

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

                      \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                  5. Simplified90.1%

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

                  if 0.97999999999999998 < im < 6.7999999999999998e74

                  1. Initial program 100.0%

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{*.f64}\left(\left(\left(\frac{1}{2} \cdot 2\right) \cdot \cosh im\right), \cos \color{blue}{re}\right) \]
                    8. metadata-evalN/A

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

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \cosh im\right), \cos \color{blue}{re}\right) \]
                    10. cosh-lowering-cosh.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \cos re\right) \]
                    11. cos-lowering-cos.f64100.0%

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \mathsf{cos.f64}\left(re\right)\right) \]
                  4. Applied egg-rr100.0%

                    \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right) \cdot \cos re} \]
                  5. Step-by-step derivation
                    1. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\left(1 \cdot \cosh im\right), \color{blue}{\cos re}\right) \]
                    2. *-lft-identityN/A

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

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \cos \color{blue}{re}\right) \]
                    4. cos-lowering-cos.f64100.0%

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \mathsf{cos.f64}\left(re\right)\right) \]
                  6. Applied egg-rr100.0%

                    \[\leadsto \color{blue}{\cosh im \cdot \cos re} \]
                  7. Taylor expanded in re around 0

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \color{blue}{1}\right) \]
                  8. Step-by-step derivation
                    1. Simplified81.0%

                      \[\leadsto \cosh im \cdot \color{blue}{1} \]
                  9. Recombined 2 regimes into one program.
                  10. Final simplification89.3%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.98:\\ \;\;\;\;\cos re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right)\right)\\ \mathbf{elif}\;im \leq 6.8 \cdot 10^{+74}:\\ \;\;\;\;\cosh im\\ \mathbf{else}:\\ \;\;\;\;\cos re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right)\right)\\ \end{array} \]
                  11. Add Preprocessing

                  Alternative 12: 93.3% accurate, 2.5× speedup?

                  \[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} t_0 := \left(0.5 \cdot \cos re\right) \cdot \left(im\_m \cdot im\_m + 2\right)\\ \mathbf{if}\;im\_m \leq 0.98:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;im\_m \leq 2 \cdot 10^{+107}:\\ \;\;\;\;\cosh im\_m\\ \mathbf{elif}\;im\_m \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\left(im\_m \cdot im\_m\right) \cdot \left(\left(im\_m \cdot im\_m\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                  im_m = (fabs.f64 im)
                  (FPCore (re im_m)
                   :precision binary64
                   (let* ((t_0 (* (* 0.5 (cos re)) (+ (* im_m im_m) 2.0))))
                     (if (<= im_m 0.98)
                       t_0
                       (if (<= im_m 2e+107)
                         (cosh im_m)
                         (if (<= im_m 1.35e+154)
                           (*
                            (* im_m im_m)
                            (*
                             (* im_m im_m)
                             (+ 0.041666666666666664 (* (* re re) -0.020833333333333332))))
                           t_0)))))
                  im_m = fabs(im);
                  double code(double re, double im_m) {
                  	double t_0 = (0.5 * cos(re)) * ((im_m * im_m) + 2.0);
                  	double tmp;
                  	if (im_m <= 0.98) {
                  		tmp = t_0;
                  	} else if (im_m <= 2e+107) {
                  		tmp = cosh(im_m);
                  	} else if (im_m <= 1.35e+154) {
                  		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)));
                  	} else {
                  		tmp = t_0;
                  	}
                  	return tmp;
                  }
                  
                  im_m = abs(im)
                  real(8) function code(re, im_m)
                      real(8), intent (in) :: re
                      real(8), intent (in) :: im_m
                      real(8) :: t_0
                      real(8) :: tmp
                      t_0 = (0.5d0 * cos(re)) * ((im_m * im_m) + 2.0d0)
                      if (im_m <= 0.98d0) then
                          tmp = t_0
                      else if (im_m <= 2d+107) then
                          tmp = cosh(im_m)
                      else if (im_m <= 1.35d+154) then
                          tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664d0 + ((re * re) * (-0.020833333333333332d0))))
                      else
                          tmp = t_0
                      end if
                      code = tmp
                  end function
                  
                  im_m = Math.abs(im);
                  public static double code(double re, double im_m) {
                  	double t_0 = (0.5 * Math.cos(re)) * ((im_m * im_m) + 2.0);
                  	double tmp;
                  	if (im_m <= 0.98) {
                  		tmp = t_0;
                  	} else if (im_m <= 2e+107) {
                  		tmp = Math.cosh(im_m);
                  	} else if (im_m <= 1.35e+154) {
                  		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)));
                  	} else {
                  		tmp = t_0;
                  	}
                  	return tmp;
                  }
                  
                  im_m = math.fabs(im)
                  def code(re, im_m):
                  	t_0 = (0.5 * math.cos(re)) * ((im_m * im_m) + 2.0)
                  	tmp = 0
                  	if im_m <= 0.98:
                  		tmp = t_0
                  	elif im_m <= 2e+107:
                  		tmp = math.cosh(im_m)
                  	elif im_m <= 1.35e+154:
                  		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)))
                  	else:
                  		tmp = t_0
                  	return tmp
                  
                  im_m = abs(im)
                  function code(re, im_m)
                  	t_0 = Float64(Float64(0.5 * cos(re)) * Float64(Float64(im_m * im_m) + 2.0))
                  	tmp = 0.0
                  	if (im_m <= 0.98)
                  		tmp = t_0;
                  	elseif (im_m <= 2e+107)
                  		tmp = cosh(im_m);
                  	elseif (im_m <= 1.35e+154)
                  		tmp = Float64(Float64(im_m * im_m) * Float64(Float64(im_m * im_m) * Float64(0.041666666666666664 + Float64(Float64(re * re) * -0.020833333333333332))));
                  	else
                  		tmp = t_0;
                  	end
                  	return tmp
                  end
                  
                  im_m = abs(im);
                  function tmp_2 = code(re, im_m)
                  	t_0 = (0.5 * cos(re)) * ((im_m * im_m) + 2.0);
                  	tmp = 0.0;
                  	if (im_m <= 0.98)
                  		tmp = t_0;
                  	elseif (im_m <= 2e+107)
                  		tmp = cosh(im_m);
                  	elseif (im_m <= 1.35e+154)
                  		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)));
                  	else
                  		tmp = t_0;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  im_m = N[Abs[im], $MachinePrecision]
                  code[re_, im$95$m_] := Block[{t$95$0 = N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im$95$m, 0.98], t$95$0, If[LessEqual[im$95$m, 2e+107], N[Cosh[im$95$m], $MachinePrecision], If[LessEqual[im$95$m, 1.35e+154], N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.041666666666666664 + N[(N[(re * re), $MachinePrecision] * -0.020833333333333332), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
                  
                  \begin{array}{l}
                  im_m = \left|im\right|
                  
                  \\
                  \begin{array}{l}
                  t_0 := \left(0.5 \cdot \cos re\right) \cdot \left(im\_m \cdot im\_m + 2\right)\\
                  \mathbf{if}\;im\_m \leq 0.98:\\
                  \;\;\;\;t\_0\\
                  
                  \mathbf{elif}\;im\_m \leq 2 \cdot 10^{+107}:\\
                  \;\;\;\;\cosh im\_m\\
                  
                  \mathbf{elif}\;im\_m \leq 1.35 \cdot 10^{+154}:\\
                  \;\;\;\;\left(im\_m \cdot im\_m\right) \cdot \left(\left(im\_m \cdot im\_m\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;t\_0\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 3 regimes
                  2. if im < 0.97999999999999998 or 1.35000000000000003e154 < im

                    1. Initial program 100.0%

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

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

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

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

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
                    5. Simplified82.1%

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

                    if 0.97999999999999998 < im < 1.9999999999999999e107

                    1. Initial program 100.0%

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{*.f64}\left(\left(\left(\frac{1}{2} \cdot 2\right) \cdot \cosh im\right), \cos \color{blue}{re}\right) \]
                      8. metadata-evalN/A

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

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \cosh im\right), \cos \color{blue}{re}\right) \]
                      10. cosh-lowering-cosh.f64N/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \cos re\right) \]
                      11. cos-lowering-cos.f64100.0%

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \mathsf{cos.f64}\left(re\right)\right) \]
                    4. Applied egg-rr100.0%

                      \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right) \cdot \cos re} \]
                    5. Step-by-step derivation
                      1. *-lowering-*.f64N/A

                        \[\leadsto \mathsf{*.f64}\left(\left(1 \cdot \cosh im\right), \color{blue}{\cos re}\right) \]
                      2. *-lft-identityN/A

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

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \cos \color{blue}{re}\right) \]
                      4. cos-lowering-cos.f64100.0%

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \mathsf{cos.f64}\left(re\right)\right) \]
                    6. Applied egg-rr100.0%

                      \[\leadsto \color{blue}{\cosh im \cdot \cos re} \]
                    7. Taylor expanded in re around 0

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \color{blue}{1}\right) \]
                    8. Step-by-step derivation
                      1. Simplified82.8%

                        \[\leadsto \cosh im \cdot \color{blue}{1} \]

                      if 1.9999999999999999e107 < im < 1.35000000000000003e154

                      1. Initial program 100.0%

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

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

                          \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                        2. distribute-rgt-inN/A

                          \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                        3. associate-+l+N/A

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

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

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

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

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

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

                          \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                        10. distribute-lft1-inN/A

                          \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                        11. unpow2N/A

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

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

                          \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                      5. Simplified100.0%

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

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

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

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

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(re \cdot re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                        4. *-lowering-*.f6483.3%

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                      8. Simplified83.3%

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

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

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

                          \[\leadsto \left(\frac{1}{24} \cdot {im}^{\left(2 \cdot 2\right)}\right) \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) \]
                        3. pow-sqrN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{24}, \left({re}^{2} \cdot \frac{-1}{48}\right)\right)\right)\right) \]
                        23. metadata-evalN/A

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

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left({re}^{2}\right), \color{blue}{\left(\frac{1}{24} \cdot \frac{-1}{2}\right)}\right)\right)\right)\right) \]
                      11. Simplified83.3%

                        \[\leadsto \color{blue}{\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)} \]
                    9. Recombined 3 regimes into one program.
                    10. Final simplification82.3%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.98:\\ \;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(im \cdot im + 2\right)\\ \mathbf{elif}\;im \leq 2 \cdot 10^{+107}:\\ \;\;\;\;\cosh im\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(im \cdot im + 2\right)\\ \end{array} \]
                    11. Add Preprocessing

                    Alternative 13: 87.0% accurate, 2.8× speedup?

                    \[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} \mathbf{if}\;im\_m \leq 0.0152:\\ \;\;\;\;\cos re\\ \mathbf{elif}\;im\_m \leq 4.1 \cdot 10^{+107}:\\ \;\;\;\;\cosh im\_m\\ \mathbf{else}:\\ \;\;\;\;\left(im\_m \cdot im\_m\right) \cdot \left(\left(im\_m \cdot im\_m\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)\\ \end{array} \end{array} \]
                    im_m = (fabs.f64 im)
                    (FPCore (re im_m)
                     :precision binary64
                     (if (<= im_m 0.0152)
                       (cos re)
                       (if (<= im_m 4.1e+107)
                         (cosh im_m)
                         (*
                          (* im_m im_m)
                          (*
                           (* im_m im_m)
                           (+ 0.041666666666666664 (* (* re re) -0.020833333333333332)))))))
                    im_m = fabs(im);
                    double code(double re, double im_m) {
                    	double tmp;
                    	if (im_m <= 0.0152) {
                    		tmp = cos(re);
                    	} else if (im_m <= 4.1e+107) {
                    		tmp = cosh(im_m);
                    	} else {
                    		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)));
                    	}
                    	return tmp;
                    }
                    
                    im_m = abs(im)
                    real(8) function code(re, im_m)
                        real(8), intent (in) :: re
                        real(8), intent (in) :: im_m
                        real(8) :: tmp
                        if (im_m <= 0.0152d0) then
                            tmp = cos(re)
                        else if (im_m <= 4.1d+107) then
                            tmp = cosh(im_m)
                        else
                            tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664d0 + ((re * re) * (-0.020833333333333332d0))))
                        end if
                        code = tmp
                    end function
                    
                    im_m = Math.abs(im);
                    public static double code(double re, double im_m) {
                    	double tmp;
                    	if (im_m <= 0.0152) {
                    		tmp = Math.cos(re);
                    	} else if (im_m <= 4.1e+107) {
                    		tmp = Math.cosh(im_m);
                    	} else {
                    		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)));
                    	}
                    	return tmp;
                    }
                    
                    im_m = math.fabs(im)
                    def code(re, im_m):
                    	tmp = 0
                    	if im_m <= 0.0152:
                    		tmp = math.cos(re)
                    	elif im_m <= 4.1e+107:
                    		tmp = math.cosh(im_m)
                    	else:
                    		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)))
                    	return tmp
                    
                    im_m = abs(im)
                    function code(re, im_m)
                    	tmp = 0.0
                    	if (im_m <= 0.0152)
                    		tmp = cos(re);
                    	elseif (im_m <= 4.1e+107)
                    		tmp = cosh(im_m);
                    	else
                    		tmp = Float64(Float64(im_m * im_m) * Float64(Float64(im_m * im_m) * Float64(0.041666666666666664 + Float64(Float64(re * re) * -0.020833333333333332))));
                    	end
                    	return tmp
                    end
                    
                    im_m = abs(im);
                    function tmp_2 = code(re, im_m)
                    	tmp = 0.0;
                    	if (im_m <= 0.0152)
                    		tmp = cos(re);
                    	elseif (im_m <= 4.1e+107)
                    		tmp = cosh(im_m);
                    	else
                    		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)));
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    im_m = N[Abs[im], $MachinePrecision]
                    code[re_, im$95$m_] := If[LessEqual[im$95$m, 0.0152], N[Cos[re], $MachinePrecision], If[LessEqual[im$95$m, 4.1e+107], N[Cosh[im$95$m], $MachinePrecision], N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.041666666666666664 + N[(N[(re * re), $MachinePrecision] * -0.020833333333333332), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                    
                    \begin{array}{l}
                    im_m = \left|im\right|
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;im\_m \leq 0.0152:\\
                    \;\;\;\;\cos re\\
                    
                    \mathbf{elif}\;im\_m \leq 4.1 \cdot 10^{+107}:\\
                    \;\;\;\;\cosh im\_m\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\left(im\_m \cdot im\_m\right) \cdot \left(\left(im\_m \cdot im\_m\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 3 regimes
                    2. if im < 0.0152

                      1. Initial program 100.0%

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

                        \[\leadsto \color{blue}{\cos re} \]
                      4. Step-by-step derivation
                        1. cos-lowering-cos.f6460.6%

                          \[\leadsto \mathsf{cos.f64}\left(re\right) \]
                      5. Simplified60.6%

                        \[\leadsto \color{blue}{\cos re} \]

                      if 0.0152 < im < 4.0999999999999999e107

                      1. Initial program 100.0%

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

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

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

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

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

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

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

                          \[\leadsto \mathsf{*.f64}\left(\left(\left(\frac{1}{2} \cdot 2\right) \cdot \cosh im\right), \cos \color{blue}{re}\right) \]
                        8. metadata-evalN/A

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

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \cosh im\right), \cos \color{blue}{re}\right) \]
                        10. cosh-lowering-cosh.f64N/A

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \cos re\right) \]
                        11. cos-lowering-cos.f64100.0%

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(1, \mathsf{cosh.f64}\left(im\right)\right), \mathsf{cos.f64}\left(re\right)\right) \]
                      4. Applied egg-rr100.0%

                        \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right) \cdot \cos re} \]
                      5. Step-by-step derivation
                        1. *-lowering-*.f64N/A

                          \[\leadsto \mathsf{*.f64}\left(\left(1 \cdot \cosh im\right), \color{blue}{\cos re}\right) \]
                        2. *-lft-identityN/A

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

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \cos \color{blue}{re}\right) \]
                        4. cos-lowering-cos.f64100.0%

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \mathsf{cos.f64}\left(re\right)\right) \]
                      6. Applied egg-rr100.0%

                        \[\leadsto \color{blue}{\cosh im \cdot \cos re} \]
                      7. Taylor expanded in re around 0

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{cosh.f64}\left(im\right), \color{blue}{1}\right) \]
                      8. Step-by-step derivation
                        1. Simplified79.5%

                          \[\leadsto \cosh im \cdot \color{blue}{1} \]

                        if 4.0999999999999999e107 < im

                        1. Initial program 100.0%

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

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

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                          2. distribute-rgt-inN/A

                            \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                          3. associate-+l+N/A

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

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

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

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

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                          10. distribute-lft1-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                          11. unpow2N/A

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                        5. Simplified100.0%

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(re \cdot re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                          4. *-lowering-*.f6478.8%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                        8. Simplified78.8%

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

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

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

                            \[\leadsto \left(\frac{1}{24} \cdot {im}^{\left(2 \cdot 2\right)}\right) \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) \]
                          3. pow-sqrN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{24}, \left({re}^{2} \cdot \frac{-1}{48}\right)\right)\right)\right) \]
                          23. metadata-evalN/A

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left({re}^{2}\right), \color{blue}{\left(\frac{1}{24} \cdot \frac{-1}{2}\right)}\right)\right)\right)\right) \]
                        11. Simplified78.8%

                          \[\leadsto \color{blue}{\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)} \]
                      9. Recombined 3 regimes into one program.
                      10. Final simplification65.3%

                        \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.0152:\\ \;\;\;\;\cos re\\ \mathbf{elif}\;im \leq 4.1 \cdot 10^{+107}:\\ \;\;\;\;\cosh im\\ \mathbf{else}:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)\\ \end{array} \]
                      11. Add Preprocessing

                      Alternative 14: 82.8% accurate, 2.9× speedup?

                      \[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} \mathbf{if}\;im\_m \leq 145000:\\ \;\;\;\;\cos re\\ \mathbf{elif}\;im\_m \leq 2.05 \cdot 10^{+71}:\\ \;\;\;\;\left(1 + \left(im\_m \cdot im\_m\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im\_m \cdot im\_m\right)\right)\right) \cdot \left(\left(1 - 0.25 \cdot \left(\left(re \cdot re\right) \cdot \left(re \cdot re\right)\right)\right) \cdot \frac{2}{re \cdot re}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(im\_m \cdot im\_m\right) \cdot \left(\left(im\_m \cdot im\_m\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)\\ \end{array} \end{array} \]
                      im_m = (fabs.f64 im)
                      (FPCore (re im_m)
                       :precision binary64
                       (if (<= im_m 145000.0)
                         (cos re)
                         (if (<= im_m 2.05e+71)
                           (*
                            (+ 1.0 (* (* im_m im_m) (+ 0.5 (* 0.041666666666666664 (* im_m im_m)))))
                            (* (- 1.0 (* 0.25 (* (* re re) (* re re)))) (/ 2.0 (* re re))))
                           (*
                            (* im_m im_m)
                            (*
                             (* im_m im_m)
                             (+ 0.041666666666666664 (* (* re re) -0.020833333333333332)))))))
                      im_m = fabs(im);
                      double code(double re, double im_m) {
                      	double tmp;
                      	if (im_m <= 145000.0) {
                      		tmp = cos(re);
                      	} else if (im_m <= 2.05e+71) {
                      		tmp = (1.0 + ((im_m * im_m) * (0.5 + (0.041666666666666664 * (im_m * im_m))))) * ((1.0 - (0.25 * ((re * re) * (re * re)))) * (2.0 / (re * re)));
                      	} else {
                      		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)));
                      	}
                      	return tmp;
                      }
                      
                      im_m = abs(im)
                      real(8) function code(re, im_m)
                          real(8), intent (in) :: re
                          real(8), intent (in) :: im_m
                          real(8) :: tmp
                          if (im_m <= 145000.0d0) then
                              tmp = cos(re)
                          else if (im_m <= 2.05d+71) then
                              tmp = (1.0d0 + ((im_m * im_m) * (0.5d0 + (0.041666666666666664d0 * (im_m * im_m))))) * ((1.0d0 - (0.25d0 * ((re * re) * (re * re)))) * (2.0d0 / (re * re)))
                          else
                              tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664d0 + ((re * re) * (-0.020833333333333332d0))))
                          end if
                          code = tmp
                      end function
                      
                      im_m = Math.abs(im);
                      public static double code(double re, double im_m) {
                      	double tmp;
                      	if (im_m <= 145000.0) {
                      		tmp = Math.cos(re);
                      	} else if (im_m <= 2.05e+71) {
                      		tmp = (1.0 + ((im_m * im_m) * (0.5 + (0.041666666666666664 * (im_m * im_m))))) * ((1.0 - (0.25 * ((re * re) * (re * re)))) * (2.0 / (re * re)));
                      	} else {
                      		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)));
                      	}
                      	return tmp;
                      }
                      
                      im_m = math.fabs(im)
                      def code(re, im_m):
                      	tmp = 0
                      	if im_m <= 145000.0:
                      		tmp = math.cos(re)
                      	elif im_m <= 2.05e+71:
                      		tmp = (1.0 + ((im_m * im_m) * (0.5 + (0.041666666666666664 * (im_m * im_m))))) * ((1.0 - (0.25 * ((re * re) * (re * re)))) * (2.0 / (re * re)))
                      	else:
                      		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)))
                      	return tmp
                      
                      im_m = abs(im)
                      function code(re, im_m)
                      	tmp = 0.0
                      	if (im_m <= 145000.0)
                      		tmp = cos(re);
                      	elseif (im_m <= 2.05e+71)
                      		tmp = Float64(Float64(1.0 + Float64(Float64(im_m * im_m) * Float64(0.5 + Float64(0.041666666666666664 * Float64(im_m * im_m))))) * Float64(Float64(1.0 - Float64(0.25 * Float64(Float64(re * re) * Float64(re * re)))) * Float64(2.0 / Float64(re * re))));
                      	else
                      		tmp = Float64(Float64(im_m * im_m) * Float64(Float64(im_m * im_m) * Float64(0.041666666666666664 + Float64(Float64(re * re) * -0.020833333333333332))));
                      	end
                      	return tmp
                      end
                      
                      im_m = abs(im);
                      function tmp_2 = code(re, im_m)
                      	tmp = 0.0;
                      	if (im_m <= 145000.0)
                      		tmp = cos(re);
                      	elseif (im_m <= 2.05e+71)
                      		tmp = (1.0 + ((im_m * im_m) * (0.5 + (0.041666666666666664 * (im_m * im_m))))) * ((1.0 - (0.25 * ((re * re) * (re * re)))) * (2.0 / (re * re)));
                      	else
                      		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)));
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      im_m = N[Abs[im], $MachinePrecision]
                      code[re_, im$95$m_] := If[LessEqual[im$95$m, 145000.0], N[Cos[re], $MachinePrecision], If[LessEqual[im$95$m, 2.05e+71], N[(N[(1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.5 + N[(0.041666666666666664 * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 - N[(0.25 * N[(N[(re * re), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.041666666666666664 + N[(N[(re * re), $MachinePrecision] * -0.020833333333333332), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                      
                      \begin{array}{l}
                      im_m = \left|im\right|
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;im\_m \leq 145000:\\
                      \;\;\;\;\cos re\\
                      
                      \mathbf{elif}\;im\_m \leq 2.05 \cdot 10^{+71}:\\
                      \;\;\;\;\left(1 + \left(im\_m \cdot im\_m\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im\_m \cdot im\_m\right)\right)\right) \cdot \left(\left(1 - 0.25 \cdot \left(\left(re \cdot re\right) \cdot \left(re \cdot re\right)\right)\right) \cdot \frac{2}{re \cdot re}\right)\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\left(im\_m \cdot im\_m\right) \cdot \left(\left(im\_m \cdot im\_m\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if im < 145000

                        1. Initial program 100.0%

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

                          \[\leadsto \color{blue}{\cos re} \]
                        4. Step-by-step derivation
                          1. cos-lowering-cos.f6459.8%

                            \[\leadsto \mathsf{cos.f64}\left(re\right) \]
                        5. Simplified59.8%

                          \[\leadsto \color{blue}{\cos re} \]

                        if 145000 < im < 2.0500000000000001e71

                        1. Initial program 100.0%

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

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

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                          2. distribute-rgt-inN/A

                            \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                          3. associate-+l+N/A

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

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

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

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

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                          10. distribute-lft1-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                          11. unpow2N/A

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                        5. Simplified5.0%

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

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                        8. Simplified18.7%

                          \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(re \cdot re\right)\right)} \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right) \]
                        9. Step-by-step derivation
                          1. flip-+N/A

                            \[\leadsto \mathsf{*.f64}\left(\left(\frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(re \cdot re\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(re \cdot re\right)\right)}{1 - \frac{-1}{2} \cdot \left(re \cdot re\right)}\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)}, 1\right)\right) \]
                          2. div-invN/A

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, \left(\left(\frac{-1}{2} \cdot \left(re \cdot re\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(re \cdot re\right)\right)\right)\right), \left(\frac{1}{1 - \frac{-1}{2} \cdot \left(re \cdot re\right)}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{*.f64}\left(im, im\right)}, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), 1\right)\right) \]
                          6. swap-sqrN/A

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

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

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{*.f64}\left(re, re\right)\right)\right)\right), \mathsf{/.f64}\left(1, \left(1 - \frac{-1}{2} \cdot \left(re \cdot re\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \color{blue}{\mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)}\right), 1\right)\right) \]
                          13. cancel-sign-sub-invN/A

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{*.f64}\left(re, re\right)\right)\right)\right), \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left(\left(\mathsf{neg}\left(\frac{-1}{2}\right)\right) \cdot \left(re \cdot re\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                          15. metadata-evalN/A

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{*.f64}\left(re, re\right)\right)\right)\right), \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right)\right), 1\right)\right) \]
                        10. Applied egg-rr8.2%

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

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

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

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

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

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

                        if 2.0500000000000001e71 < im

                        1. Initial program 100.0%

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

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

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                          2. distribute-rgt-inN/A

                            \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                          3. associate-+l+N/A

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

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

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

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

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                          10. distribute-lft1-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                          11. unpow2N/A

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                        5. Simplified95.7%

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

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                        8. Simplified76.2%

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

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

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

                            \[\leadsto \left(\frac{1}{24} \cdot {im}^{\left(2 \cdot 2\right)}\right) \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) \]
                          3. pow-sqrN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{24}, \left({re}^{2} \cdot \frac{-1}{48}\right)\right)\right)\right) \]
                          23. metadata-evalN/A

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left({re}^{2}\right), \color{blue}{\left(\frac{1}{24} \cdot \frac{-1}{2}\right)}\right)\right)\right)\right) \]
                        11. Simplified76.2%

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

                        \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 145000:\\ \;\;\;\;\cos re\\ \mathbf{elif}\;im \leq 2.05 \cdot 10^{+71}:\\ \;\;\;\;\left(1 + \left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right)\right) \cdot \left(\left(1 - 0.25 \cdot \left(\left(re \cdot re\right) \cdot \left(re \cdot re\right)\right)\right) \cdot \frac{2}{re \cdot re}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)\\ \end{array} \]
                      5. Add Preprocessing

                      Alternative 15: 61.0% accurate, 4.5× speedup?

                      \[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} t_0 := \left(im\_m \cdot im\_m\right) \cdot \left(im\_m \cdot im\_m\right)\\ t_1 := 0.041666666666666664 + im\_m \cdot \left(im\_m \cdot -0.001388888888888889\right)\\ t_2 := 0.5 \cdot \left(im\_m \cdot im\_m\right) + -1\\ \mathbf{if}\;im\_m \leq 2.05 \cdot 10^{+71}:\\ \;\;\;\;\frac{t\_1 \cdot \left(-1 + 0.25 \cdot t\_0\right) + t\_0 \cdot \left(\left(0.001736111111111111 + -1.9290123456790124 \cdot 10^{-6} \cdot t\_0\right) \cdot t\_2\right)}{t\_1 \cdot t\_2}\\ \mathbf{else}:\\ \;\;\;\;\left(im\_m \cdot im\_m\right) \cdot \left(\left(im\_m \cdot im\_m\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)\\ \end{array} \end{array} \]
                      im_m = (fabs.f64 im)
                      (FPCore (re im_m)
                       :precision binary64
                       (let* ((t_0 (* (* im_m im_m) (* im_m im_m)))
                              (t_1 (+ 0.041666666666666664 (* im_m (* im_m -0.001388888888888889))))
                              (t_2 (+ (* 0.5 (* im_m im_m)) -1.0)))
                         (if (<= im_m 2.05e+71)
                           (/
                            (+
                             (* t_1 (+ -1.0 (* 0.25 t_0)))
                             (* t_0 (* (+ 0.001736111111111111 (* -1.9290123456790124e-6 t_0)) t_2)))
                            (* t_1 t_2))
                           (*
                            (* im_m im_m)
                            (*
                             (* im_m im_m)
                             (+ 0.041666666666666664 (* (* re re) -0.020833333333333332)))))))
                      im_m = fabs(im);
                      double code(double re, double im_m) {
                      	double t_0 = (im_m * im_m) * (im_m * im_m);
                      	double t_1 = 0.041666666666666664 + (im_m * (im_m * -0.001388888888888889));
                      	double t_2 = (0.5 * (im_m * im_m)) + -1.0;
                      	double tmp;
                      	if (im_m <= 2.05e+71) {
                      		tmp = ((t_1 * (-1.0 + (0.25 * t_0))) + (t_0 * ((0.001736111111111111 + (-1.9290123456790124e-6 * t_0)) * t_2))) / (t_1 * t_2);
                      	} else {
                      		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)));
                      	}
                      	return tmp;
                      }
                      
                      im_m = abs(im)
                      real(8) function code(re, im_m)
                          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) :: tmp
                          t_0 = (im_m * im_m) * (im_m * im_m)
                          t_1 = 0.041666666666666664d0 + (im_m * (im_m * (-0.001388888888888889d0)))
                          t_2 = (0.5d0 * (im_m * im_m)) + (-1.0d0)
                          if (im_m <= 2.05d+71) then
                              tmp = ((t_1 * ((-1.0d0) + (0.25d0 * t_0))) + (t_0 * ((0.001736111111111111d0 + ((-1.9290123456790124d-6) * t_0)) * t_2))) / (t_1 * t_2)
                          else
                              tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664d0 + ((re * re) * (-0.020833333333333332d0))))
                          end if
                          code = tmp
                      end function
                      
                      im_m = Math.abs(im);
                      public static double code(double re, double im_m) {
                      	double t_0 = (im_m * im_m) * (im_m * im_m);
                      	double t_1 = 0.041666666666666664 + (im_m * (im_m * -0.001388888888888889));
                      	double t_2 = (0.5 * (im_m * im_m)) + -1.0;
                      	double tmp;
                      	if (im_m <= 2.05e+71) {
                      		tmp = ((t_1 * (-1.0 + (0.25 * t_0))) + (t_0 * ((0.001736111111111111 + (-1.9290123456790124e-6 * t_0)) * t_2))) / (t_1 * t_2);
                      	} else {
                      		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)));
                      	}
                      	return tmp;
                      }
                      
                      im_m = math.fabs(im)
                      def code(re, im_m):
                      	t_0 = (im_m * im_m) * (im_m * im_m)
                      	t_1 = 0.041666666666666664 + (im_m * (im_m * -0.001388888888888889))
                      	t_2 = (0.5 * (im_m * im_m)) + -1.0
                      	tmp = 0
                      	if im_m <= 2.05e+71:
                      		tmp = ((t_1 * (-1.0 + (0.25 * t_0))) + (t_0 * ((0.001736111111111111 + (-1.9290123456790124e-6 * t_0)) * t_2))) / (t_1 * t_2)
                      	else:
                      		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)))
                      	return tmp
                      
                      im_m = abs(im)
                      function code(re, im_m)
                      	t_0 = Float64(Float64(im_m * im_m) * Float64(im_m * im_m))
                      	t_1 = Float64(0.041666666666666664 + Float64(im_m * Float64(im_m * -0.001388888888888889)))
                      	t_2 = Float64(Float64(0.5 * Float64(im_m * im_m)) + -1.0)
                      	tmp = 0.0
                      	if (im_m <= 2.05e+71)
                      		tmp = Float64(Float64(Float64(t_1 * Float64(-1.0 + Float64(0.25 * t_0))) + Float64(t_0 * Float64(Float64(0.001736111111111111 + Float64(-1.9290123456790124e-6 * t_0)) * t_2))) / Float64(t_1 * t_2));
                      	else
                      		tmp = Float64(Float64(im_m * im_m) * Float64(Float64(im_m * im_m) * Float64(0.041666666666666664 + Float64(Float64(re * re) * -0.020833333333333332))));
                      	end
                      	return tmp
                      end
                      
                      im_m = abs(im);
                      function tmp_2 = code(re, im_m)
                      	t_0 = (im_m * im_m) * (im_m * im_m);
                      	t_1 = 0.041666666666666664 + (im_m * (im_m * -0.001388888888888889));
                      	t_2 = (0.5 * (im_m * im_m)) + -1.0;
                      	tmp = 0.0;
                      	if (im_m <= 2.05e+71)
                      		tmp = ((t_1 * (-1.0 + (0.25 * t_0))) + (t_0 * ((0.001736111111111111 + (-1.9290123456790124e-6 * t_0)) * t_2))) / (t_1 * t_2);
                      	else
                      		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)));
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      im_m = N[Abs[im], $MachinePrecision]
                      code[re_, im$95$m_] := Block[{t$95$0 = N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.041666666666666664 + N[(im$95$m * N[(im$95$m * -0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(0.5 * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]}, If[LessEqual[im$95$m, 2.05e+71], N[(N[(N[(t$95$1 * N[(-1.0 + N[(0.25 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * N[(N[(0.001736111111111111 + N[(-1.9290123456790124e-6 * t$95$0), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 * t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.041666666666666664 + N[(N[(re * re), $MachinePrecision] * -0.020833333333333332), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
                      
                      \begin{array}{l}
                      im_m = \left|im\right|
                      
                      \\
                      \begin{array}{l}
                      t_0 := \left(im\_m \cdot im\_m\right) \cdot \left(im\_m \cdot im\_m\right)\\
                      t_1 := 0.041666666666666664 + im\_m \cdot \left(im\_m \cdot -0.001388888888888889\right)\\
                      t_2 := 0.5 \cdot \left(im\_m \cdot im\_m\right) + -1\\
                      \mathbf{if}\;im\_m \leq 2.05 \cdot 10^{+71}:\\
                      \;\;\;\;\frac{t\_1 \cdot \left(-1 + 0.25 \cdot t\_0\right) + t\_0 \cdot \left(\left(0.001736111111111111 + -1.9290123456790124 \cdot 10^{-6} \cdot t\_0\right) \cdot t\_2\right)}{t\_1 \cdot t\_2}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\left(im\_m \cdot im\_m\right) \cdot \left(\left(im\_m \cdot im\_m\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if im < 2.0500000000000001e71

                        1. Initial program 100.0%

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

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

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

                            \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \cos re \]
                          3. distribute-lft-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + {im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right)\right) + \cos \color{blue}{re} \]
                          4. associate-+l+N/A

                            \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right) + \cos re\right)} \]
                        5. Simplified86.0%

                          \[\leadsto \color{blue}{\cos re \cdot \left(\left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\right)} \]
                        6. Applied egg-rr66.4%

                          \[\leadsto \cos re \cdot \color{blue}{\frac{\left(\left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot 0.25 - 1\right) \cdot \left(0.041666666666666664 + -0.001388888888888889 \cdot \left(im \cdot im\right)\right) + \left(0.5 \cdot \left(im \cdot im\right) - 1\right) \cdot \left(\left(0.001736111111111111 - \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) \cdot 1.9290123456790124 \cdot 10^{-6}\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)}{\left(0.5 \cdot \left(im \cdot im\right) - 1\right) \cdot \left(0.041666666666666664 + -0.001388888888888889 \cdot \left(im \cdot im\right)\right)}} \]
                        7. Taylor expanded in re around 0

                          \[\leadsto \color{blue}{\frac{\left(\frac{1}{24} + \frac{-1}{720} \cdot {im}^{2}\right) \cdot \left(\frac{1}{4} \cdot {im}^{4} - 1\right) + {im}^{4} \cdot \left(\left(\frac{1}{576} - \frac{1}{518400} \cdot {im}^{4}\right) \cdot \left(\frac{1}{2} \cdot {im}^{2} - 1\right)\right)}{\left(\frac{1}{24} + \frac{-1}{720} \cdot {im}^{2}\right) \cdot \left(\frac{1}{2} \cdot {im}^{2} - 1\right)}} \]
                        8. Step-by-step derivation
                          1. /-lowering-/.f64N/A

                            \[\leadsto \mathsf{/.f64}\left(\left(\left(\frac{1}{24} + \frac{-1}{720} \cdot {im}^{2}\right) \cdot \left(\frac{1}{4} \cdot {im}^{4} - 1\right) + {im}^{4} \cdot \left(\left(\frac{1}{576} - \frac{1}{518400} \cdot {im}^{4}\right) \cdot \left(\frac{1}{2} \cdot {im}^{2} - 1\right)\right)\right), \color{blue}{\left(\left(\frac{1}{24} + \frac{-1}{720} \cdot {im}^{2}\right) \cdot \left(\frac{1}{2} \cdot {im}^{2} - 1\right)\right)}\right) \]
                        9. Simplified40.4%

                          \[\leadsto \color{blue}{\frac{\left(0.041666666666666664 + im \cdot \left(im \cdot -0.001388888888888889\right)\right) \cdot \left(\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot 0.25 + -1\right) + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.001736111111111111 + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot -1.9290123456790124 \cdot 10^{-6}\right) \cdot \left(0.5 \cdot \left(im \cdot im\right) + -1\right)\right)}{\left(0.041666666666666664 + im \cdot \left(im \cdot -0.001388888888888889\right)\right) \cdot \left(0.5 \cdot \left(im \cdot im\right) + -1\right)}} \]

                        if 2.0500000000000001e71 < im

                        1. Initial program 100.0%

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

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

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                          2. distribute-rgt-inN/A

                            \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                          3. associate-+l+N/A

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

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

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

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

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                          10. distribute-lft1-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                          11. unpow2N/A

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                        5. Simplified95.7%

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

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                        8. Simplified76.2%

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

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

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

                            \[\leadsto \left(\frac{1}{24} \cdot {im}^{\left(2 \cdot 2\right)}\right) \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) \]
                          3. pow-sqrN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{24}, \left({re}^{2} \cdot \frac{-1}{48}\right)\right)\right)\right) \]
                          23. metadata-evalN/A

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left({re}^{2}\right), \color{blue}{\left(\frac{1}{24} \cdot \frac{-1}{2}\right)}\right)\right)\right)\right) \]
                        11. Simplified76.2%

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

                        \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 2.05 \cdot 10^{+71}:\\ \;\;\;\;\frac{\left(0.041666666666666664 + im \cdot \left(im \cdot -0.001388888888888889\right)\right) \cdot \left(-1 + 0.25 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right) + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.001736111111111111 + -1.9290123456790124 \cdot 10^{-6} \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right) \cdot \left(0.5 \cdot \left(im \cdot im\right) + -1\right)\right)}{\left(0.041666666666666664 + im \cdot \left(im \cdot -0.001388888888888889\right)\right) \cdot \left(0.5 \cdot \left(im \cdot im\right) + -1\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)\\ \end{array} \]
                      5. Add Preprocessing

                      Alternative 16: 61.2% accurate, 7.5× speedup?

                      \[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} \mathbf{if}\;im\_m \leq 145000:\\ \;\;\;\;1 + \left(im\_m \cdot im\_m\right) \cdot \left(0.5 + im\_m \cdot \left(im\_m \cdot \left(0.041666666666666664 + \left(im\_m \cdot im\_m\right) \cdot 0.001388888888888889\right)\right)\right)\\ \mathbf{elif}\;im\_m \leq 2.05 \cdot 10^{+71}:\\ \;\;\;\;\left(1 + \left(im\_m \cdot im\_m\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im\_m \cdot im\_m\right)\right)\right) \cdot \left(\left(1 - 0.25 \cdot \left(\left(re \cdot re\right) \cdot \left(re \cdot re\right)\right)\right) \cdot \frac{2}{re \cdot re}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(im\_m \cdot im\_m\right) \cdot \left(\left(im\_m \cdot im\_m\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)\\ \end{array} \end{array} \]
                      im_m = (fabs.f64 im)
                      (FPCore (re im_m)
                       :precision binary64
                       (if (<= im_m 145000.0)
                         (+
                          1.0
                          (*
                           (* im_m im_m)
                           (+
                            0.5
                            (*
                             im_m
                             (*
                              im_m
                              (+ 0.041666666666666664 (* (* im_m im_m) 0.001388888888888889)))))))
                         (if (<= im_m 2.05e+71)
                           (*
                            (+ 1.0 (* (* im_m im_m) (+ 0.5 (* 0.041666666666666664 (* im_m im_m)))))
                            (* (- 1.0 (* 0.25 (* (* re re) (* re re)))) (/ 2.0 (* re re))))
                           (*
                            (* im_m im_m)
                            (*
                             (* im_m im_m)
                             (+ 0.041666666666666664 (* (* re re) -0.020833333333333332)))))))
                      im_m = fabs(im);
                      double code(double re, double im_m) {
                      	double tmp;
                      	if (im_m <= 145000.0) {
                      		tmp = 1.0 + ((im_m * im_m) * (0.5 + (im_m * (im_m * (0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889))))));
                      	} else if (im_m <= 2.05e+71) {
                      		tmp = (1.0 + ((im_m * im_m) * (0.5 + (0.041666666666666664 * (im_m * im_m))))) * ((1.0 - (0.25 * ((re * re) * (re * re)))) * (2.0 / (re * re)));
                      	} else {
                      		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)));
                      	}
                      	return tmp;
                      }
                      
                      im_m = abs(im)
                      real(8) function code(re, im_m)
                          real(8), intent (in) :: re
                          real(8), intent (in) :: im_m
                          real(8) :: tmp
                          if (im_m <= 145000.0d0) then
                              tmp = 1.0d0 + ((im_m * im_m) * (0.5d0 + (im_m * (im_m * (0.041666666666666664d0 + ((im_m * im_m) * 0.001388888888888889d0))))))
                          else if (im_m <= 2.05d+71) then
                              tmp = (1.0d0 + ((im_m * im_m) * (0.5d0 + (0.041666666666666664d0 * (im_m * im_m))))) * ((1.0d0 - (0.25d0 * ((re * re) * (re * re)))) * (2.0d0 / (re * re)))
                          else
                              tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664d0 + ((re * re) * (-0.020833333333333332d0))))
                          end if
                          code = tmp
                      end function
                      
                      im_m = Math.abs(im);
                      public static double code(double re, double im_m) {
                      	double tmp;
                      	if (im_m <= 145000.0) {
                      		tmp = 1.0 + ((im_m * im_m) * (0.5 + (im_m * (im_m * (0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889))))));
                      	} else if (im_m <= 2.05e+71) {
                      		tmp = (1.0 + ((im_m * im_m) * (0.5 + (0.041666666666666664 * (im_m * im_m))))) * ((1.0 - (0.25 * ((re * re) * (re * re)))) * (2.0 / (re * re)));
                      	} else {
                      		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)));
                      	}
                      	return tmp;
                      }
                      
                      im_m = math.fabs(im)
                      def code(re, im_m):
                      	tmp = 0
                      	if im_m <= 145000.0:
                      		tmp = 1.0 + ((im_m * im_m) * (0.5 + (im_m * (im_m * (0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889))))))
                      	elif im_m <= 2.05e+71:
                      		tmp = (1.0 + ((im_m * im_m) * (0.5 + (0.041666666666666664 * (im_m * im_m))))) * ((1.0 - (0.25 * ((re * re) * (re * re)))) * (2.0 / (re * re)))
                      	else:
                      		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)))
                      	return tmp
                      
                      im_m = abs(im)
                      function code(re, im_m)
                      	tmp = 0.0
                      	if (im_m <= 145000.0)
                      		tmp = Float64(1.0 + Float64(Float64(im_m * im_m) * Float64(0.5 + Float64(im_m * Float64(im_m * Float64(0.041666666666666664 + Float64(Float64(im_m * im_m) * 0.001388888888888889)))))));
                      	elseif (im_m <= 2.05e+71)
                      		tmp = Float64(Float64(1.0 + Float64(Float64(im_m * im_m) * Float64(0.5 + Float64(0.041666666666666664 * Float64(im_m * im_m))))) * Float64(Float64(1.0 - Float64(0.25 * Float64(Float64(re * re) * Float64(re * re)))) * Float64(2.0 / Float64(re * re))));
                      	else
                      		tmp = Float64(Float64(im_m * im_m) * Float64(Float64(im_m * im_m) * Float64(0.041666666666666664 + Float64(Float64(re * re) * -0.020833333333333332))));
                      	end
                      	return tmp
                      end
                      
                      im_m = abs(im);
                      function tmp_2 = code(re, im_m)
                      	tmp = 0.0;
                      	if (im_m <= 145000.0)
                      		tmp = 1.0 + ((im_m * im_m) * (0.5 + (im_m * (im_m * (0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889))))));
                      	elseif (im_m <= 2.05e+71)
                      		tmp = (1.0 + ((im_m * im_m) * (0.5 + (0.041666666666666664 * (im_m * im_m))))) * ((1.0 - (0.25 * ((re * re) * (re * re)))) * (2.0 / (re * re)));
                      	else
                      		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)));
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      im_m = N[Abs[im], $MachinePrecision]
                      code[re_, im$95$m_] := If[LessEqual[im$95$m, 145000.0], N[(1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.5 + N[(im$95$m * N[(im$95$m * N[(0.041666666666666664 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 2.05e+71], N[(N[(1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.5 + N[(0.041666666666666664 * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 - N[(0.25 * N[(N[(re * re), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.041666666666666664 + N[(N[(re * re), $MachinePrecision] * -0.020833333333333332), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                      
                      \begin{array}{l}
                      im_m = \left|im\right|
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;im\_m \leq 145000:\\
                      \;\;\;\;1 + \left(im\_m \cdot im\_m\right) \cdot \left(0.5 + im\_m \cdot \left(im\_m \cdot \left(0.041666666666666664 + \left(im\_m \cdot im\_m\right) \cdot 0.001388888888888889\right)\right)\right)\\
                      
                      \mathbf{elif}\;im\_m \leq 2.05 \cdot 10^{+71}:\\
                      \;\;\;\;\left(1 + \left(im\_m \cdot im\_m\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im\_m \cdot im\_m\right)\right)\right) \cdot \left(\left(1 - 0.25 \cdot \left(\left(re \cdot re\right) \cdot \left(re \cdot re\right)\right)\right) \cdot \frac{2}{re \cdot re}\right)\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\left(im\_m \cdot im\_m\right) \cdot \left(\left(im\_m \cdot im\_m\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if im < 145000

                        1. Initial program 100.0%

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

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

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

                            \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \cos re \]
                          3. distribute-lft-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + {im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right)\right) + \cos \color{blue}{re} \]
                          4. associate-+l+N/A

                            \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right) + \cos re\right)} \]
                        5. Simplified90.9%

                          \[\leadsto \color{blue}{\cos re \cdot \left(\left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\right)} \]
                        6. Taylor expanded in re around 0

                          \[\leadsto \color{blue}{1 + \left(\frac{1}{2} \cdot {im}^{2} + {im}^{4} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)} \]
                        7. Step-by-step derivation
                          1. +-lowering-+.f64N/A

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

                            \[\leadsto \mathsf{+.f64}\left(1, \left(\frac{1}{2} \cdot {im}^{2} + {im}^{\left(2 \cdot 2\right)} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)\right) \]
                          3. pow-sqrN/A

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

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

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

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

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left(\frac{1}{2} + {im}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)}\right)\right) \]
                          8. unpow2N/A

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

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

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)}\right)\right)\right) \]
                          11. unpow2N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\left(im \cdot im\right) \cdot \left(\color{blue}{\frac{1}{24}} + \frac{1}{720} \cdot {im}^{2}\right)\right)\right)\right)\right) \]
                          12. associate-*l*N/A

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

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

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

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

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

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\frac{1}{720}}\right)\right)\right)\right)\right)\right)\right) \]
                          18. unpow2N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{1}{720}\right)\right)\right)\right)\right)\right)\right) \]
                          19. *-lowering-*.f6458.3%

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{1}{720}\right)\right)\right)\right)\right)\right)\right) \]
                        8. Simplified58.3%

                          \[\leadsto \color{blue}{1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right)\right)\right)} \]

                        if 145000 < im < 2.0500000000000001e71

                        1. Initial program 100.0%

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

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

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                          2. distribute-rgt-inN/A

                            \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                          3. associate-+l+N/A

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

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

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

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

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                          10. distribute-lft1-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                          11. unpow2N/A

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                        5. Simplified5.0%

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

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                        8. Simplified18.7%

                          \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(re \cdot re\right)\right)} \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right) \]
                        9. Step-by-step derivation
                          1. flip-+N/A

                            \[\leadsto \mathsf{*.f64}\left(\left(\frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(re \cdot re\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(re \cdot re\right)\right)}{1 - \frac{-1}{2} \cdot \left(re \cdot re\right)}\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)}, 1\right)\right) \]
                          2. div-invN/A

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, \left(\left(\frac{-1}{2} \cdot \left(re \cdot re\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(re \cdot re\right)\right)\right)\right), \left(\frac{1}{1 - \frac{-1}{2} \cdot \left(re \cdot re\right)}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{*.f64}\left(im, im\right)}, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), 1\right)\right) \]
                          6. swap-sqrN/A

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

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

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{*.f64}\left(re, re\right)\right)\right)\right), \mathsf{/.f64}\left(1, \left(1 - \frac{-1}{2} \cdot \left(re \cdot re\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \color{blue}{\mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)}\right), 1\right)\right) \]
                          13. cancel-sign-sub-invN/A

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{*.f64}\left(re, re\right)\right)\right)\right), \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left(\left(\mathsf{neg}\left(\frac{-1}{2}\right)\right) \cdot \left(re \cdot re\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                          15. metadata-evalN/A

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{*.f64}\left(re, re\right)\right)\right)\right), \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right)\right), 1\right)\right) \]
                        10. Applied egg-rr8.2%

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

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

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

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

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

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

                        if 2.0500000000000001e71 < im

                        1. Initial program 100.0%

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

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

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                          2. distribute-rgt-inN/A

                            \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                          3. associate-+l+N/A

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

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

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

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

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                          10. distribute-lft1-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                          11. unpow2N/A

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                        5. Simplified95.7%

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

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                        8. Simplified76.2%

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

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

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

                            \[\leadsto \left(\frac{1}{24} \cdot {im}^{\left(2 \cdot 2\right)}\right) \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) \]
                          3. pow-sqrN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{24}, \left({re}^{2} \cdot \frac{-1}{48}\right)\right)\right)\right) \]
                          23. metadata-evalN/A

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left({re}^{2}\right), \color{blue}{\left(\frac{1}{24} \cdot \frac{-1}{2}\right)}\right)\right)\right)\right) \]
                        11. Simplified76.2%

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

                        \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 145000:\\ \;\;\;\;1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right)\right)\right)\\ \mathbf{elif}\;im \leq 2.05 \cdot 10^{+71}:\\ \;\;\;\;\left(1 + \left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right)\right) \cdot \left(\left(1 - 0.25 \cdot \left(\left(re \cdot re\right) \cdot \left(re \cdot re\right)\right)\right) \cdot \frac{2}{re \cdot re}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)\\ \end{array} \]
                      5. Add Preprocessing

                      Alternative 17: 59.3% accurate, 10.6× speedup?

                      \[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} t_0 := 1 + \left(im\_m \cdot im\_m\right) \cdot \left(0.5 + im\_m \cdot \left(im\_m \cdot \left(0.041666666666666664 + \left(im\_m \cdot im\_m\right) \cdot 0.001388888888888889\right)\right)\right)\\ \mathbf{if}\;re \leq 4.4 \cdot 10^{+101}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\ \;\;\;\;\left(im\_m \cdot im\_m\right) \cdot \left(\left(im\_m \cdot im\_m\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                      im_m = (fabs.f64 im)
                      (FPCore (re im_m)
                       :precision binary64
                       (let* ((t_0
                               (+
                                1.0
                                (*
                                 (* im_m im_m)
                                 (+
                                  0.5
                                  (*
                                   im_m
                                   (*
                                    im_m
                                    (+
                                     0.041666666666666664
                                     (* (* im_m im_m) 0.001388888888888889)))))))))
                         (if (<= re 4.4e+101)
                           t_0
                           (if (<= re 2.1e+198)
                             (*
                              (* im_m im_m)
                              (*
                               (* im_m im_m)
                               (+ 0.041666666666666664 (* (* re re) -0.020833333333333332))))
                             t_0))))
                      im_m = fabs(im);
                      double code(double re, double im_m) {
                      	double t_0 = 1.0 + ((im_m * im_m) * (0.5 + (im_m * (im_m * (0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889))))));
                      	double tmp;
                      	if (re <= 4.4e+101) {
                      		tmp = t_0;
                      	} else if (re <= 2.1e+198) {
                      		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)));
                      	} else {
                      		tmp = t_0;
                      	}
                      	return tmp;
                      }
                      
                      im_m = abs(im)
                      real(8) function code(re, im_m)
                          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.5d0 + (im_m * (im_m * (0.041666666666666664d0 + ((im_m * im_m) * 0.001388888888888889d0))))))
                          if (re <= 4.4d+101) then
                              tmp = t_0
                          else if (re <= 2.1d+198) then
                              tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664d0 + ((re * re) * (-0.020833333333333332d0))))
                          else
                              tmp = t_0
                          end if
                          code = tmp
                      end function
                      
                      im_m = Math.abs(im);
                      public static double code(double re, double im_m) {
                      	double t_0 = 1.0 + ((im_m * im_m) * (0.5 + (im_m * (im_m * (0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889))))));
                      	double tmp;
                      	if (re <= 4.4e+101) {
                      		tmp = t_0;
                      	} else if (re <= 2.1e+198) {
                      		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)));
                      	} else {
                      		tmp = t_0;
                      	}
                      	return tmp;
                      }
                      
                      im_m = math.fabs(im)
                      def code(re, im_m):
                      	t_0 = 1.0 + ((im_m * im_m) * (0.5 + (im_m * (im_m * (0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889))))))
                      	tmp = 0
                      	if re <= 4.4e+101:
                      		tmp = t_0
                      	elif re <= 2.1e+198:
                      		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)))
                      	else:
                      		tmp = t_0
                      	return tmp
                      
                      im_m = abs(im)
                      function code(re, im_m)
                      	t_0 = Float64(1.0 + Float64(Float64(im_m * im_m) * Float64(0.5 + Float64(im_m * Float64(im_m * Float64(0.041666666666666664 + Float64(Float64(im_m * im_m) * 0.001388888888888889)))))))
                      	tmp = 0.0
                      	if (re <= 4.4e+101)
                      		tmp = t_0;
                      	elseif (re <= 2.1e+198)
                      		tmp = Float64(Float64(im_m * im_m) * Float64(Float64(im_m * im_m) * Float64(0.041666666666666664 + Float64(Float64(re * re) * -0.020833333333333332))));
                      	else
                      		tmp = t_0;
                      	end
                      	return tmp
                      end
                      
                      im_m = abs(im);
                      function tmp_2 = code(re, im_m)
                      	t_0 = 1.0 + ((im_m * im_m) * (0.5 + (im_m * (im_m * (0.041666666666666664 + ((im_m * im_m) * 0.001388888888888889))))));
                      	tmp = 0.0;
                      	if (re <= 4.4e+101)
                      		tmp = t_0;
                      	elseif (re <= 2.1e+198)
                      		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)));
                      	else
                      		tmp = t_0;
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      im_m = N[Abs[im], $MachinePrecision]
                      code[re_, im$95$m_] := Block[{t$95$0 = N[(1.0 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.5 + N[(im$95$m * N[(im$95$m * N[(0.041666666666666664 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, 4.4e+101], t$95$0, If[LessEqual[re, 2.1e+198], N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.041666666666666664 + N[(N[(re * re), $MachinePrecision] * -0.020833333333333332), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                      
                      \begin{array}{l}
                      im_m = \left|im\right|
                      
                      \\
                      \begin{array}{l}
                      t_0 := 1 + \left(im\_m \cdot im\_m\right) \cdot \left(0.5 + im\_m \cdot \left(im\_m \cdot \left(0.041666666666666664 + \left(im\_m \cdot im\_m\right) \cdot 0.001388888888888889\right)\right)\right)\\
                      \mathbf{if}\;re \leq 4.4 \cdot 10^{+101}:\\
                      \;\;\;\;t\_0\\
                      
                      \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\
                      \;\;\;\;\left(im\_m \cdot im\_m\right) \cdot \left(\left(im\_m \cdot im\_m\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;t\_0\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if re < 4.4000000000000001e101 or 2.10000000000000013e198 < re

                        1. Initial program 100.0%

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

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

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

                            \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \cos re \]
                          3. distribute-lft-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + {im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right)\right) + \cos \color{blue}{re} \]
                          4. associate-+l+N/A

                            \[\leadsto {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{720} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{24} \cdot \cos re\right)\right) + \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{2} \cdot \cos re\right) + \cos re\right)} \]
                        5. Simplified88.6%

                          \[\leadsto \color{blue}{\cos re \cdot \left(\left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\right)} \]
                        6. Taylor expanded in re around 0

                          \[\leadsto \color{blue}{1 + \left(\frac{1}{2} \cdot {im}^{2} + {im}^{4} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)} \]
                        7. Step-by-step derivation
                          1. +-lowering-+.f64N/A

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

                            \[\leadsto \mathsf{+.f64}\left(1, \left(\frac{1}{2} \cdot {im}^{2} + {im}^{\left(2 \cdot 2\right)} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)\right) \]
                          3. pow-sqrN/A

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

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

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

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

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left(\frac{1}{2} + {im}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)}\right)\right) \]
                          8. unpow2N/A

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

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

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {im}^{2}\right)\right)}\right)\right)\right) \]
                          11. unpow2N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\left(im \cdot im\right) \cdot \left(\color{blue}{\frac{1}{24}} + \frac{1}{720} \cdot {im}^{2}\right)\right)\right)\right)\right) \]
                          12. associate-*l*N/A

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

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

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

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

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

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\frac{1}{720}}\right)\right)\right)\right)\right)\right)\right) \]
                          18. unpow2N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{1}{720}\right)\right)\right)\right)\right)\right)\right) \]
                          19. *-lowering-*.f6461.2%

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{1}{720}\right)\right)\right)\right)\right)\right)\right) \]
                        8. Simplified61.2%

                          \[\leadsto \color{blue}{1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right)\right)\right)} \]

                        if 4.4000000000000001e101 < re < 2.10000000000000013e198

                        1. Initial program 99.9%

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

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

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                          2. distribute-rgt-inN/A

                            \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                          3. associate-+l+N/A

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

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

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

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

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                          10. distribute-lft1-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                          11. unpow2N/A

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                        5. Simplified73.6%

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(re \cdot re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                          4. *-lowering-*.f6439.2%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                        8. Simplified39.2%

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

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

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

                            \[\leadsto \left(\frac{1}{24} \cdot {im}^{\left(2 \cdot 2\right)}\right) \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) \]
                          3. pow-sqrN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{24}, \left({re}^{2} \cdot \frac{-1}{48}\right)\right)\right)\right) \]
                          23. metadata-evalN/A

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left({re}^{2}\right), \color{blue}{\left(\frac{1}{24} \cdot \frac{-1}{2}\right)}\right)\right)\right)\right) \]
                        11. Simplified39.3%

                          \[\leadsto \color{blue}{\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)} \]
                      3. Recombined 2 regimes into one program.
                      4. Add Preprocessing

                      Alternative 18: 58.5% accurate, 12.3× speedup?

                      \[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} \mathbf{if}\;im\_m \leq 410:\\ \;\;\;\;1 + im\_m \cdot \left(im\_m \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im\_m \cdot im\_m\right)\right)\right)\\ \mathbf{elif}\;im\_m \leq 3.3 \cdot 10^{+24}:\\ \;\;\;\;1 + \left(re \cdot re\right) \cdot \left(-0.5 + re \cdot \left(re \cdot 0.041666666666666664\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(im\_m \cdot im\_m\right) \cdot \left(\left(im\_m \cdot im\_m\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)\\ \end{array} \end{array} \]
                      im_m = (fabs.f64 im)
                      (FPCore (re im_m)
                       :precision binary64
                       (if (<= im_m 410.0)
                         (+ 1.0 (* im_m (* im_m (+ 0.5 (* 0.041666666666666664 (* im_m im_m))))))
                         (if (<= im_m 3.3e+24)
                           (+ 1.0 (* (* re re) (+ -0.5 (* re (* re 0.041666666666666664)))))
                           (*
                            (* im_m im_m)
                            (*
                             (* im_m im_m)
                             (+ 0.041666666666666664 (* (* re re) -0.020833333333333332)))))))
                      im_m = fabs(im);
                      double code(double re, double im_m) {
                      	double tmp;
                      	if (im_m <= 410.0) {
                      		tmp = 1.0 + (im_m * (im_m * (0.5 + (0.041666666666666664 * (im_m * im_m)))));
                      	} else if (im_m <= 3.3e+24) {
                      		tmp = 1.0 + ((re * re) * (-0.5 + (re * (re * 0.041666666666666664))));
                      	} else {
                      		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)));
                      	}
                      	return tmp;
                      }
                      
                      im_m = abs(im)
                      real(8) function code(re, im_m)
                          real(8), intent (in) :: re
                          real(8), intent (in) :: im_m
                          real(8) :: tmp
                          if (im_m <= 410.0d0) then
                              tmp = 1.0d0 + (im_m * (im_m * (0.5d0 + (0.041666666666666664d0 * (im_m * im_m)))))
                          else if (im_m <= 3.3d+24) then
                              tmp = 1.0d0 + ((re * re) * ((-0.5d0) + (re * (re * 0.041666666666666664d0))))
                          else
                              tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664d0 + ((re * re) * (-0.020833333333333332d0))))
                          end if
                          code = tmp
                      end function
                      
                      im_m = Math.abs(im);
                      public static double code(double re, double im_m) {
                      	double tmp;
                      	if (im_m <= 410.0) {
                      		tmp = 1.0 + (im_m * (im_m * (0.5 + (0.041666666666666664 * (im_m * im_m)))));
                      	} else if (im_m <= 3.3e+24) {
                      		tmp = 1.0 + ((re * re) * (-0.5 + (re * (re * 0.041666666666666664))));
                      	} else {
                      		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)));
                      	}
                      	return tmp;
                      }
                      
                      im_m = math.fabs(im)
                      def code(re, im_m):
                      	tmp = 0
                      	if im_m <= 410.0:
                      		tmp = 1.0 + (im_m * (im_m * (0.5 + (0.041666666666666664 * (im_m * im_m)))))
                      	elif im_m <= 3.3e+24:
                      		tmp = 1.0 + ((re * re) * (-0.5 + (re * (re * 0.041666666666666664))))
                      	else:
                      		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)))
                      	return tmp
                      
                      im_m = abs(im)
                      function code(re, im_m)
                      	tmp = 0.0
                      	if (im_m <= 410.0)
                      		tmp = Float64(1.0 + Float64(im_m * Float64(im_m * Float64(0.5 + Float64(0.041666666666666664 * Float64(im_m * im_m))))));
                      	elseif (im_m <= 3.3e+24)
                      		tmp = Float64(1.0 + Float64(Float64(re * re) * Float64(-0.5 + Float64(re * Float64(re * 0.041666666666666664)))));
                      	else
                      		tmp = Float64(Float64(im_m * im_m) * Float64(Float64(im_m * im_m) * Float64(0.041666666666666664 + Float64(Float64(re * re) * -0.020833333333333332))));
                      	end
                      	return tmp
                      end
                      
                      im_m = abs(im);
                      function tmp_2 = code(re, im_m)
                      	tmp = 0.0;
                      	if (im_m <= 410.0)
                      		tmp = 1.0 + (im_m * (im_m * (0.5 + (0.041666666666666664 * (im_m * im_m)))));
                      	elseif (im_m <= 3.3e+24)
                      		tmp = 1.0 + ((re * re) * (-0.5 + (re * (re * 0.041666666666666664))));
                      	else
                      		tmp = (im_m * im_m) * ((im_m * im_m) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)));
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      im_m = N[Abs[im], $MachinePrecision]
                      code[re_, im$95$m_] := If[LessEqual[im$95$m, 410.0], N[(1.0 + N[(im$95$m * N[(im$95$m * N[(0.5 + N[(0.041666666666666664 * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 3.3e+24], N[(1.0 + N[(N[(re * re), $MachinePrecision] * N[(-0.5 + N[(re * N[(re * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.041666666666666664 + N[(N[(re * re), $MachinePrecision] * -0.020833333333333332), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                      
                      \begin{array}{l}
                      im_m = \left|im\right|
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;im\_m \leq 410:\\
                      \;\;\;\;1 + im\_m \cdot \left(im\_m \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im\_m \cdot im\_m\right)\right)\right)\\
                      
                      \mathbf{elif}\;im\_m \leq 3.3 \cdot 10^{+24}:\\
                      \;\;\;\;1 + \left(re \cdot re\right) \cdot \left(-0.5 + re \cdot \left(re \cdot 0.041666666666666664\right)\right)\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\left(im\_m \cdot im\_m\right) \cdot \left(\left(im\_m \cdot im\_m\right) \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\right)\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if im < 410

                        1. Initial program 100.0%

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

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

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                          2. distribute-rgt-inN/A

                            \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                          3. associate-+l+N/A

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

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

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

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

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                          10. distribute-lft1-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                          11. unpow2N/A

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                        5. Simplified88.0%

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

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

                            \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {im}^{2}\right)\right)}\right) \]
                          2. unpow2N/A

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

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

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

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

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

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \color{blue}{\left({im}^{2}\right)}\right)\right)\right)\right)\right) \]
                          8. unpow2N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \left(im \cdot \color{blue}{im}\right)\right)\right)\right)\right)\right) \]
                          9. *-lowering-*.f6455.7%

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right)\right)\right)\right) \]
                        8. Simplified55.7%

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

                        if 410 < im < 3.2999999999999999e24

                        1. Initial program 100.0%

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

                          \[\leadsto \color{blue}{\cos re} \]
                        4. Step-by-step derivation
                          1. cos-lowering-cos.f643.1%

                            \[\leadsto \mathsf{cos.f64}\left(re\right) \]
                        5. Simplified3.1%

                          \[\leadsto \color{blue}{\cos re} \]
                        6. Taylor expanded in re around 0

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

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

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

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

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \left(\color{blue}{\frac{1}{24} \cdot {re}^{2}} - \frac{1}{2}\right)\right)\right) \]
                          5. sub-negN/A

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

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

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

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

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

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(\left(re \cdot re\right) \cdot \frac{1}{24}\right)\right)\right)\right) \]
                          11. associate-*l*N/A

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

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, \color{blue}{\left(re \cdot \frac{1}{24}\right)}\right)\right)\right)\right) \]
                          13. *-lowering-*.f6444.7%

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{24}}\right)\right)\right)\right)\right) \]
                        8. Simplified44.7%

                          \[\leadsto \color{blue}{1 + \left(re \cdot re\right) \cdot \left(-0.5 + re \cdot \left(re \cdot 0.041666666666666664\right)\right)} \]

                        if 3.2999999999999999e24 < im

                        1. Initial program 100.0%

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

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

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                          2. distribute-rgt-inN/A

                            \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                          3. associate-+l+N/A

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

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

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

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

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                          10. distribute-lft1-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                          11. unpow2N/A

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                        5. Simplified75.7%

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

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                        8. Simplified65.6%

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

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

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

                            \[\leadsto \left(\frac{1}{24} \cdot {im}^{\left(2 \cdot 2\right)}\right) \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) \]
                          3. pow-sqrN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{24}, \left({re}^{2} \cdot \frac{-1}{48}\right)\right)\right)\right) \]
                          23. metadata-evalN/A

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

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

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

                      Alternative 19: 56.6% accurate, 14.6× speedup?

                      \[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} \mathbf{if}\;re \leq 4.4 \cdot 10^{+101}:\\ \;\;\;\;1 + im\_m \cdot \left(im\_m \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im\_m \cdot im\_m\right)\right)\right)\\ \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\ \;\;\;\;\left(im\_m \cdot im\_m\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;1 - re \cdot \left(re \cdot -0.5\right)\\ \end{array} \end{array} \]
                      im_m = (fabs.f64 im)
                      (FPCore (re im_m)
                       :precision binary64
                       (if (<= re 4.4e+101)
                         (+ 1.0 (* im_m (* im_m (+ 0.5 (* 0.041666666666666664 (* im_m im_m))))))
                         (if (<= re 2.1e+198)
                           (* (* im_m im_m) (+ 0.5 (* (* re re) -0.25)))
                           (- 1.0 (* re (* re -0.5))))))
                      im_m = fabs(im);
                      double code(double re, double im_m) {
                      	double tmp;
                      	if (re <= 4.4e+101) {
                      		tmp = 1.0 + (im_m * (im_m * (0.5 + (0.041666666666666664 * (im_m * im_m)))));
                      	} else if (re <= 2.1e+198) {
                      		tmp = (im_m * im_m) * (0.5 + ((re * re) * -0.25));
                      	} else {
                      		tmp = 1.0 - (re * (re * -0.5));
                      	}
                      	return tmp;
                      }
                      
                      im_m = abs(im)
                      real(8) function code(re, im_m)
                          real(8), intent (in) :: re
                          real(8), intent (in) :: im_m
                          real(8) :: tmp
                          if (re <= 4.4d+101) then
                              tmp = 1.0d0 + (im_m * (im_m * (0.5d0 + (0.041666666666666664d0 * (im_m * im_m)))))
                          else if (re <= 2.1d+198) then
                              tmp = (im_m * im_m) * (0.5d0 + ((re * re) * (-0.25d0)))
                          else
                              tmp = 1.0d0 - (re * (re * (-0.5d0)))
                          end if
                          code = tmp
                      end function
                      
                      im_m = Math.abs(im);
                      public static double code(double re, double im_m) {
                      	double tmp;
                      	if (re <= 4.4e+101) {
                      		tmp = 1.0 + (im_m * (im_m * (0.5 + (0.041666666666666664 * (im_m * im_m)))));
                      	} else if (re <= 2.1e+198) {
                      		tmp = (im_m * im_m) * (0.5 + ((re * re) * -0.25));
                      	} else {
                      		tmp = 1.0 - (re * (re * -0.5));
                      	}
                      	return tmp;
                      }
                      
                      im_m = math.fabs(im)
                      def code(re, im_m):
                      	tmp = 0
                      	if re <= 4.4e+101:
                      		tmp = 1.0 + (im_m * (im_m * (0.5 + (0.041666666666666664 * (im_m * im_m)))))
                      	elif re <= 2.1e+198:
                      		tmp = (im_m * im_m) * (0.5 + ((re * re) * -0.25))
                      	else:
                      		tmp = 1.0 - (re * (re * -0.5))
                      	return tmp
                      
                      im_m = abs(im)
                      function code(re, im_m)
                      	tmp = 0.0
                      	if (re <= 4.4e+101)
                      		tmp = Float64(1.0 + Float64(im_m * Float64(im_m * Float64(0.5 + Float64(0.041666666666666664 * Float64(im_m * im_m))))));
                      	elseif (re <= 2.1e+198)
                      		tmp = Float64(Float64(im_m * im_m) * Float64(0.5 + Float64(Float64(re * re) * -0.25)));
                      	else
                      		tmp = Float64(1.0 - Float64(re * Float64(re * -0.5)));
                      	end
                      	return tmp
                      end
                      
                      im_m = abs(im);
                      function tmp_2 = code(re, im_m)
                      	tmp = 0.0;
                      	if (re <= 4.4e+101)
                      		tmp = 1.0 + (im_m * (im_m * (0.5 + (0.041666666666666664 * (im_m * im_m)))));
                      	elseif (re <= 2.1e+198)
                      		tmp = (im_m * im_m) * (0.5 + ((re * re) * -0.25));
                      	else
                      		tmp = 1.0 - (re * (re * -0.5));
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      im_m = N[Abs[im], $MachinePrecision]
                      code[re_, im$95$m_] := If[LessEqual[re, 4.4e+101], N[(1.0 + N[(im$95$m * N[(im$95$m * N[(0.5 + N[(0.041666666666666664 * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.1e+198], N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(re * N[(re * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                      
                      \begin{array}{l}
                      im_m = \left|im\right|
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;re \leq 4.4 \cdot 10^{+101}:\\
                      \;\;\;\;1 + im\_m \cdot \left(im\_m \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im\_m \cdot im\_m\right)\right)\right)\\
                      
                      \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\
                      \;\;\;\;\left(im\_m \cdot im\_m\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;1 - re \cdot \left(re \cdot -0.5\right)\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if re < 4.4000000000000001e101

                        1. Initial program 100.0%

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

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

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                          2. distribute-rgt-inN/A

                            \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                          3. associate-+l+N/A

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

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

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

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

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                          10. distribute-lft1-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                          11. unpow2N/A

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                        5. Simplified83.4%

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

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

                            \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {im}^{2}\right)\right)}\right) \]
                          2. unpow2N/A

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

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

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

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

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

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \color{blue}{\left({im}^{2}\right)}\right)\right)\right)\right)\right) \]
                          8. unpow2N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \left(im \cdot \color{blue}{im}\right)\right)\right)\right)\right)\right) \]
                          9. *-lowering-*.f6459.8%

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right)\right)\right)\right) \]
                        8. Simplified59.8%

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

                        if 4.4000000000000001e101 < re < 2.10000000000000013e198

                        1. Initial program 99.9%

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

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

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                          2. distribute-rgt-inN/A

                            \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                          3. associate-+l+N/A

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

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

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

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

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                          10. distribute-lft1-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                          11. unpow2N/A

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                        5. Simplified73.6%

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(re \cdot re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                          4. *-lowering-*.f6439.2%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                        8. Simplified39.2%

                          \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(re \cdot re\right)\right)} \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right) \]
                        9. Taylor expanded in im around 0

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

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

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

                            \[\leadsto \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)} \]
                          4. lft-mult-inverseN/A

                            \[\leadsto \left(\frac{1}{2} \cdot {im}^{2} + \frac{1}{{im}^{2}} \cdot {im}^{2}\right) \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) \]
                          5. distribute-rgt-inN/A

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{{im}^{2}} \cdot {im}^{2} + \frac{1}{2} \cdot {im}^{2}\right), \left(\color{blue}{1} + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          9. lft-mult-inverseN/A

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(re \cdot re\right), \frac{-1}{2}\right)\right)\right) \]
                          18. *-lowering-*.f6439.2%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \frac{-1}{2}\right)\right)\right) \]
                        11. Simplified39.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right) \]
                          14. *-lowering-*.f6439.3%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right) \]
                        14. Simplified39.3%

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

                        if 2.10000000000000013e198 < re

                        1. Initial program 100.0%

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

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

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                          2. distribute-rgt-inN/A

                            \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                          3. associate-+l+N/A

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

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

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

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

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                          10. distribute-lft1-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                          11. unpow2N/A

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                        5. Simplified87.6%

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

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                        8. Simplified11.6%

                          \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(re \cdot re\right)\right)} \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right) \]
                        9. Taylor expanded in im around 0

                          \[\leadsto \color{blue}{1 + \frac{-1}{2} \cdot {re}^{2}} \]
                        10. Step-by-step derivation
                          1. +-lowering-+.f64N/A

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

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

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

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(re \cdot re\right), \frac{-1}{2}\right)\right) \]
                          5. *-lowering-*.f6411.6%

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \frac{-1}{2}\right)\right) \]
                        11. Simplified11.6%

                          \[\leadsto \color{blue}{1 + \left(re \cdot re\right) \cdot -0.5} \]
                        12. Applied egg-rr33.4%

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

                        \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 4.4 \cdot 10^{+101}:\\ \;\;\;\;1 + im \cdot \left(im \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right)\right)\\ \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;1 - re \cdot \left(re \cdot -0.5\right)\\ \end{array} \]
                      5. Add Preprocessing

                      Alternative 20: 51.6% accurate, 14.6× speedup?

                      \[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} \mathbf{if}\;im\_m \leq 430:\\ \;\;\;\;1 + 0.5 \cdot \left(im\_m \cdot im\_m\right)\\ \mathbf{elif}\;im\_m \leq 2.6 \cdot 10^{+24}:\\ \;\;\;\;1 - re \cdot \left(re \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\left(im\_m \cdot im\_m\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\ \end{array} \end{array} \]
                      im_m = (fabs.f64 im)
                      (FPCore (re im_m)
                       :precision binary64
                       (if (<= im_m 430.0)
                         (+ 1.0 (* 0.5 (* im_m im_m)))
                         (if (<= im_m 2.6e+24)
                           (- 1.0 (* re (* re -0.5)))
                           (* (* im_m im_m) (+ 0.5 (* (* re re) -0.25))))))
                      im_m = fabs(im);
                      double code(double re, double im_m) {
                      	double tmp;
                      	if (im_m <= 430.0) {
                      		tmp = 1.0 + (0.5 * (im_m * im_m));
                      	} else if (im_m <= 2.6e+24) {
                      		tmp = 1.0 - (re * (re * -0.5));
                      	} else {
                      		tmp = (im_m * im_m) * (0.5 + ((re * re) * -0.25));
                      	}
                      	return tmp;
                      }
                      
                      im_m = abs(im)
                      real(8) function code(re, im_m)
                          real(8), intent (in) :: re
                          real(8), intent (in) :: im_m
                          real(8) :: tmp
                          if (im_m <= 430.0d0) then
                              tmp = 1.0d0 + (0.5d0 * (im_m * im_m))
                          else if (im_m <= 2.6d+24) then
                              tmp = 1.0d0 - (re * (re * (-0.5d0)))
                          else
                              tmp = (im_m * im_m) * (0.5d0 + ((re * re) * (-0.25d0)))
                          end if
                          code = tmp
                      end function
                      
                      im_m = Math.abs(im);
                      public static double code(double re, double im_m) {
                      	double tmp;
                      	if (im_m <= 430.0) {
                      		tmp = 1.0 + (0.5 * (im_m * im_m));
                      	} else if (im_m <= 2.6e+24) {
                      		tmp = 1.0 - (re * (re * -0.5));
                      	} else {
                      		tmp = (im_m * im_m) * (0.5 + ((re * re) * -0.25));
                      	}
                      	return tmp;
                      }
                      
                      im_m = math.fabs(im)
                      def code(re, im_m):
                      	tmp = 0
                      	if im_m <= 430.0:
                      		tmp = 1.0 + (0.5 * (im_m * im_m))
                      	elif im_m <= 2.6e+24:
                      		tmp = 1.0 - (re * (re * -0.5))
                      	else:
                      		tmp = (im_m * im_m) * (0.5 + ((re * re) * -0.25))
                      	return tmp
                      
                      im_m = abs(im)
                      function code(re, im_m)
                      	tmp = 0.0
                      	if (im_m <= 430.0)
                      		tmp = Float64(1.0 + Float64(0.5 * Float64(im_m * im_m)));
                      	elseif (im_m <= 2.6e+24)
                      		tmp = Float64(1.0 - Float64(re * Float64(re * -0.5)));
                      	else
                      		tmp = Float64(Float64(im_m * im_m) * Float64(0.5 + Float64(Float64(re * re) * -0.25)));
                      	end
                      	return tmp
                      end
                      
                      im_m = abs(im);
                      function tmp_2 = code(re, im_m)
                      	tmp = 0.0;
                      	if (im_m <= 430.0)
                      		tmp = 1.0 + (0.5 * (im_m * im_m));
                      	elseif (im_m <= 2.6e+24)
                      		tmp = 1.0 - (re * (re * -0.5));
                      	else
                      		tmp = (im_m * im_m) * (0.5 + ((re * re) * -0.25));
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      im_m = N[Abs[im], $MachinePrecision]
                      code[re_, im$95$m_] := If[LessEqual[im$95$m, 430.0], N[(1.0 + N[(0.5 * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im$95$m, 2.6e+24], N[(1.0 - N[(re * N[(re * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                      
                      \begin{array}{l}
                      im_m = \left|im\right|
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;im\_m \leq 430:\\
                      \;\;\;\;1 + 0.5 \cdot \left(im\_m \cdot im\_m\right)\\
                      
                      \mathbf{elif}\;im\_m \leq 2.6 \cdot 10^{+24}:\\
                      \;\;\;\;1 - re \cdot \left(re \cdot -0.5\right)\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\left(im\_m \cdot im\_m\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if im < 430

                        1. Initial program 100.0%

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

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

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                          2. distribute-rgt-inN/A

                            \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                          3. associate-+l+N/A

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

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

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

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

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                          10. distribute-lft1-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                          11. unpow2N/A

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

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

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                        5. Simplified88.0%

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(re \cdot re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                          4. *-lowering-*.f6456.2%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                        8. Simplified56.2%

                          \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(re \cdot re\right)\right)} \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right) \]
                        9. Taylor expanded in im around 0

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

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

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

                            \[\leadsto \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)} \]
                          4. lft-mult-inverseN/A

                            \[\leadsto \left(\frac{1}{2} \cdot {im}^{2} + \frac{1}{{im}^{2}} \cdot {im}^{2}\right) \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) \]
                          5. distribute-rgt-inN/A

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{{im}^{2}} \cdot {im}^{2} + \frac{1}{2} \cdot {im}^{2}\right), \left(\color{blue}{1} + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          9. lft-mult-inverseN/A

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(re \cdot re\right), \frac{-1}{2}\right)\right)\right) \]
                          18. *-lowering-*.f6450.4%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \frac{-1}{2}\right)\right)\right) \]
                        11. Simplified50.4%

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

                          \[\leadsto \color{blue}{1 + \frac{1}{2} \cdot {im}^{2}} \]
                        13. Step-by-step derivation
                          1. +-lowering-+.f64N/A

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

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left({im}^{2}\right)}\right)\right) \]
                          3. unpow2N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \left(im \cdot \color{blue}{im}\right)\right)\right) \]
                          4. *-lowering-*.f6449.9%

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
                        14. Simplified49.9%

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

                        if 430 < im < 2.5999999999999998e24

                        1. Initial program 100.0%

                          \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right) \]
                        2. Add Preprocessing
                        3. Taylor expanded in im around 0

                          \[\leadsto \color{blue}{\cos re + {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right)} \]
                        4. Step-by-step derivation
                          1. +-commutativeN/A

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                          2. distribute-rgt-inN/A

                            \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                          3. associate-+l+N/A

                            \[\leadsto \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \color{blue}{\left(\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2} + \cos re\right)} \]
                          4. *-commutativeN/A

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \left(\color{blue}{\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}} + \cos re\right) \]
                          5. associate-*r*N/A

                            \[\leadsto {im}^{2} \cdot \left(\left(\frac{1}{24} \cdot {im}^{2}\right) \cdot \cos re\right) + \left(\left(\frac{1}{2} \cdot \cos re\right) \cdot \color{blue}{{im}^{2}} + \cos re\right) \]
                          6. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\color{blue}{\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}} + \cos re\right) \]
                          7. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left(\cos re \cdot {im}^{2}\right) + \cos \color{blue}{re}\right) \]
                          8. *-commutativeN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left({im}^{2} \cdot \cos re\right) + \cos re\right) \]
                          9. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                          10. distribute-lft1-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                          11. unpow2N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left(im \cdot im\right) + 1\right) \cdot \cos re \]
                          12. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot im\right) \cdot im + 1\right) \cdot \cos re \]
                          13. *-commutativeN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                        5. Simplified3.8%

                          \[\leadsto \color{blue}{\cos re \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right)} \]
                        6. Taylor expanded in re around 0

                          \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)}, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), 1\right)\right) \]
                        7. Step-by-step derivation
                          1. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot {re}^{2}\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)}, 1\right)\right) \]
                          2. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left({re}^{2}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \color{blue}{\mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)}\right), 1\right)\right) \]
                          3. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(re \cdot re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                          4. *-lowering-*.f641.6%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                        8. Simplified1.6%

                          \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(re \cdot re\right)\right)} \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right) \]
                        9. Taylor expanded in im around 0

                          \[\leadsto \color{blue}{1 + \frac{-1}{2} \cdot {re}^{2}} \]
                        10. Step-by-step derivation
                          1. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {re}^{2}\right)}\right) \]
                          2. *-commutativeN/A

                            \[\leadsto \mathsf{+.f64}\left(1, \left({re}^{2} \cdot \color{blue}{\frac{-1}{2}}\right)\right) \]
                          3. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({re}^{2}\right), \color{blue}{\frac{-1}{2}}\right)\right) \]
                          4. unpow2N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(re \cdot re\right), \frac{-1}{2}\right)\right) \]
                          5. *-lowering-*.f641.5%

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \frac{-1}{2}\right)\right) \]
                        11. Simplified1.5%

                          \[\leadsto \color{blue}{1 + \left(re \cdot re\right) \cdot -0.5} \]
                        12. Applied egg-rr31.2%

                          \[\leadsto \color{blue}{1 - re \cdot \left(re \cdot -0.5\right)} \]

                        if 2.5999999999999998e24 < im

                        1. Initial program 100.0%

                          \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right) \]
                        2. Add Preprocessing
                        3. Taylor expanded in im around 0

                          \[\leadsto \color{blue}{\cos re + {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right)} \]
                        4. Step-by-step derivation
                          1. +-commutativeN/A

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                          2. distribute-rgt-inN/A

                            \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                          3. associate-+l+N/A

                            \[\leadsto \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \color{blue}{\left(\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2} + \cos re\right)} \]
                          4. *-commutativeN/A

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \left(\color{blue}{\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}} + \cos re\right) \]
                          5. associate-*r*N/A

                            \[\leadsto {im}^{2} \cdot \left(\left(\frac{1}{24} \cdot {im}^{2}\right) \cdot \cos re\right) + \left(\left(\frac{1}{2} \cdot \cos re\right) \cdot \color{blue}{{im}^{2}} + \cos re\right) \]
                          6. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\color{blue}{\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}} + \cos re\right) \]
                          7. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left(\cos re \cdot {im}^{2}\right) + \cos \color{blue}{re}\right) \]
                          8. *-commutativeN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left({im}^{2} \cdot \cos re\right) + \cos re\right) \]
                          9. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                          10. distribute-lft1-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                          11. unpow2N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left(im \cdot im\right) + 1\right) \cdot \cos re \]
                          12. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot im\right) \cdot im + 1\right) \cdot \cos re \]
                          13. *-commutativeN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                        5. Simplified75.7%

                          \[\leadsto \color{blue}{\cos re \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right)} \]
                        6. Taylor expanded in re around 0

                          \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)}, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), 1\right)\right) \]
                        7. Step-by-step derivation
                          1. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot {re}^{2}\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)}, 1\right)\right) \]
                          2. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left({re}^{2}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \color{blue}{\mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)}\right), 1\right)\right) \]
                          3. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(re \cdot re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                          4. *-lowering-*.f6465.6%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                        8. Simplified65.6%

                          \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(re \cdot re\right)\right)} \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right) \]
                        9. Taylor expanded in im around 0

                          \[\leadsto \color{blue}{1 + \left(\frac{-1}{2} \cdot {re}^{2} + \frac{1}{2} \cdot \left({im}^{2} \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right)\right)} \]
                        10. Step-by-step derivation
                          1. associate-+r+N/A

                            \[\leadsto \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) + \color{blue}{\frac{1}{2} \cdot \left({im}^{2} \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right)} \]
                          2. associate-*r*N/A

                            \[\leadsto \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) + \left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)} \]
                          3. distribute-rgt1-inN/A

                            \[\leadsto \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)} \]
                          4. lft-mult-inverseN/A

                            \[\leadsto \left(\frac{1}{2} \cdot {im}^{2} + \frac{1}{{im}^{2}} \cdot {im}^{2}\right) \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) \]
                          5. distribute-rgt-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{2} + \frac{1}{{im}^{2}}\right)\right) \cdot \left(\color{blue}{1} + \frac{-1}{2} \cdot {re}^{2}\right) \]
                          6. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left(\frac{1}{2} + \frac{1}{{im}^{2}}\right)\right), \color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)}\right) \]
                          7. +-commutativeN/A

                            \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left(\frac{1}{{im}^{2}} + \frac{1}{2}\right)\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          8. distribute-rgt-inN/A

                            \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{{im}^{2}} \cdot {im}^{2} + \frac{1}{2} \cdot {im}^{2}\right), \left(\color{blue}{1} + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          9. lft-mult-inverseN/A

                            \[\leadsto \mathsf{*.f64}\left(\left(1 + \frac{1}{2} \cdot {im}^{2}\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          10. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{1}{2} \cdot {im}^{2}\right)\right), \left(\color{blue}{1} + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          11. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \left({im}^{2}\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          12. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \left(im \cdot im\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          13. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          14. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {re}^{2}\right)}\right)\right) \]
                          15. *-commutativeN/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \left({re}^{2} \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right) \]
                          16. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({re}^{2}\right), \color{blue}{\frac{-1}{2}}\right)\right)\right) \]
                          17. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(re \cdot re\right), \frac{-1}{2}\right)\right)\right) \]
                          18. *-lowering-*.f6448.1%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \frac{-1}{2}\right)\right)\right) \]
                        11. Simplified48.1%

                          \[\leadsto \color{blue}{\left(1 + 0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(1 + \left(re \cdot re\right) \cdot -0.5\right)} \]
                        12. Taylor expanded in im around inf

                          \[\leadsto \color{blue}{\frac{1}{2} \cdot \left({im}^{2} \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right)} \]
                        13. Step-by-step derivation
                          1. associate-*r*N/A

                            \[\leadsto \left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)} \]
                          2. *-commutativeN/A

                            \[\leadsto \left({im}^{2} \cdot \frac{1}{2}\right) \cdot \left(\color{blue}{1} + \frac{-1}{2} \cdot {re}^{2}\right) \]
                          3. associate-*l*N/A

                            \[\leadsto {im}^{2} \cdot \color{blue}{\left(\frac{1}{2} \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right)} \]
                          4. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left(\frac{1}{2} \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right)}\right) \]
                          5. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\left(im \cdot im\right), \left(\color{blue}{\frac{1}{2}} \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right)\right) \]
                          6. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{\frac{1}{2}} \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right)\right) \]
                          7. distribute-lft-inN/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{1}{2} \cdot 1 + \color{blue}{\frac{1}{2} \cdot \left(\frac{-1}{2} \cdot {re}^{2}\right)}\right)\right) \]
                          8. metadata-evalN/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{1}{2} + \color{blue}{\frac{1}{2}} \cdot \left(\frac{-1}{2} \cdot {re}^{2}\right)\right)\right) \]
                          9. associate-*r*N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{1}{2} + \left(\frac{1}{2} \cdot \frac{-1}{2}\right) \cdot \color{blue}{{re}^{2}}\right)\right) \]
                          10. metadata-evalN/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{1}{2} + \frac{-1}{4} \cdot {\color{blue}{re}}^{2}\right)\right) \]
                          11. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\left(\frac{-1}{4} \cdot {re}^{2}\right)}\right)\right) \]
                          12. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right) \]
                          13. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right) \]
                          14. *-lowering-*.f6448.1%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right) \]
                        14. Simplified48.1%

                          \[\leadsto \color{blue}{\left(im \cdot im\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)} \]
                      3. Recombined 3 regimes into one program.
                      4. Final simplification49.0%

                        \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 430:\\ \;\;\;\;1 + 0.5 \cdot \left(im \cdot im\right)\\ \mathbf{elif}\;im \leq 2.6 \cdot 10^{+24}:\\ \;\;\;\;1 - re \cdot \left(re \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\ \end{array} \]
                      5. Add Preprocessing

                      Alternative 21: 48.5% accurate, 14.6× speedup?

                      \[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} \mathbf{if}\;re \leq 4.2 \cdot 10^{+33}:\\ \;\;\;\;1 + 0.5 \cdot \left(im\_m \cdot im\_m\right)\\ \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\ \;\;\;\;re \cdot \left(re \cdot \left(-0.5 + \left(im\_m \cdot im\_m\right) \cdot -0.25\right)\right)\\ \mathbf{else}:\\ \;\;\;\;1 - re \cdot \left(re \cdot -0.5\right)\\ \end{array} \end{array} \]
                      im_m = (fabs.f64 im)
                      (FPCore (re im_m)
                       :precision binary64
                       (if (<= re 4.2e+33)
                         (+ 1.0 (* 0.5 (* im_m im_m)))
                         (if (<= re 2.1e+198)
                           (* re (* re (+ -0.5 (* (* im_m im_m) -0.25))))
                           (- 1.0 (* re (* re -0.5))))))
                      im_m = fabs(im);
                      double code(double re, double im_m) {
                      	double tmp;
                      	if (re <= 4.2e+33) {
                      		tmp = 1.0 + (0.5 * (im_m * im_m));
                      	} else if (re <= 2.1e+198) {
                      		tmp = re * (re * (-0.5 + ((im_m * im_m) * -0.25)));
                      	} else {
                      		tmp = 1.0 - (re * (re * -0.5));
                      	}
                      	return tmp;
                      }
                      
                      im_m = abs(im)
                      real(8) function code(re, im_m)
                          real(8), intent (in) :: re
                          real(8), intent (in) :: im_m
                          real(8) :: tmp
                          if (re <= 4.2d+33) then
                              tmp = 1.0d0 + (0.5d0 * (im_m * im_m))
                          else if (re <= 2.1d+198) then
                              tmp = re * (re * ((-0.5d0) + ((im_m * im_m) * (-0.25d0))))
                          else
                              tmp = 1.0d0 - (re * (re * (-0.5d0)))
                          end if
                          code = tmp
                      end function
                      
                      im_m = Math.abs(im);
                      public static double code(double re, double im_m) {
                      	double tmp;
                      	if (re <= 4.2e+33) {
                      		tmp = 1.0 + (0.5 * (im_m * im_m));
                      	} else if (re <= 2.1e+198) {
                      		tmp = re * (re * (-0.5 + ((im_m * im_m) * -0.25)));
                      	} else {
                      		tmp = 1.0 - (re * (re * -0.5));
                      	}
                      	return tmp;
                      }
                      
                      im_m = math.fabs(im)
                      def code(re, im_m):
                      	tmp = 0
                      	if re <= 4.2e+33:
                      		tmp = 1.0 + (0.5 * (im_m * im_m))
                      	elif re <= 2.1e+198:
                      		tmp = re * (re * (-0.5 + ((im_m * im_m) * -0.25)))
                      	else:
                      		tmp = 1.0 - (re * (re * -0.5))
                      	return tmp
                      
                      im_m = abs(im)
                      function code(re, im_m)
                      	tmp = 0.0
                      	if (re <= 4.2e+33)
                      		tmp = Float64(1.0 + Float64(0.5 * Float64(im_m * im_m)));
                      	elseif (re <= 2.1e+198)
                      		tmp = Float64(re * Float64(re * Float64(-0.5 + Float64(Float64(im_m * im_m) * -0.25))));
                      	else
                      		tmp = Float64(1.0 - Float64(re * Float64(re * -0.5)));
                      	end
                      	return tmp
                      end
                      
                      im_m = abs(im);
                      function tmp_2 = code(re, im_m)
                      	tmp = 0.0;
                      	if (re <= 4.2e+33)
                      		tmp = 1.0 + (0.5 * (im_m * im_m));
                      	elseif (re <= 2.1e+198)
                      		tmp = re * (re * (-0.5 + ((im_m * im_m) * -0.25)));
                      	else
                      		tmp = 1.0 - (re * (re * -0.5));
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      im_m = N[Abs[im], $MachinePrecision]
                      code[re_, im$95$m_] := If[LessEqual[re, 4.2e+33], N[(1.0 + N[(0.5 * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.1e+198], N[(re * N[(re * N[(-0.5 + N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(re * N[(re * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                      
                      \begin{array}{l}
                      im_m = \left|im\right|
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;re \leq 4.2 \cdot 10^{+33}:\\
                      \;\;\;\;1 + 0.5 \cdot \left(im\_m \cdot im\_m\right)\\
                      
                      \mathbf{elif}\;re \leq 2.1 \cdot 10^{+198}:\\
                      \;\;\;\;re \cdot \left(re \cdot \left(-0.5 + \left(im\_m \cdot im\_m\right) \cdot -0.25\right)\right)\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;1 - re \cdot \left(re \cdot -0.5\right)\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if re < 4.2000000000000001e33

                        1. Initial program 100.0%

                          \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right) \]
                        2. Add Preprocessing
                        3. Taylor expanded in im around 0

                          \[\leadsto \color{blue}{\cos re + {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right)} \]
                        4. Step-by-step derivation
                          1. +-commutativeN/A

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                          2. distribute-rgt-inN/A

                            \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                          3. associate-+l+N/A

                            \[\leadsto \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \color{blue}{\left(\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2} + \cos re\right)} \]
                          4. *-commutativeN/A

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \left(\color{blue}{\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}} + \cos re\right) \]
                          5. associate-*r*N/A

                            \[\leadsto {im}^{2} \cdot \left(\left(\frac{1}{24} \cdot {im}^{2}\right) \cdot \cos re\right) + \left(\left(\frac{1}{2} \cdot \cos re\right) \cdot \color{blue}{{im}^{2}} + \cos re\right) \]
                          6. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\color{blue}{\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}} + \cos re\right) \]
                          7. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left(\cos re \cdot {im}^{2}\right) + \cos \color{blue}{re}\right) \]
                          8. *-commutativeN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left({im}^{2} \cdot \cos re\right) + \cos re\right) \]
                          9. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                          10. distribute-lft1-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                          11. unpow2N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left(im \cdot im\right) + 1\right) \cdot \cos re \]
                          12. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot im\right) \cdot im + 1\right) \cdot \cos re \]
                          13. *-commutativeN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                        5. Simplified83.6%

                          \[\leadsto \color{blue}{\cos re \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right)} \]
                        6. Taylor expanded in re around 0

                          \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)}, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), 1\right)\right) \]
                        7. Step-by-step derivation
                          1. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot {re}^{2}\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)}, 1\right)\right) \]
                          2. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left({re}^{2}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \color{blue}{\mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)}\right), 1\right)\right) \]
                          3. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(re \cdot re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                          4. *-lowering-*.f6467.4%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                        8. Simplified67.4%

                          \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(re \cdot re\right)\right)} \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right) \]
                        9. Taylor expanded in im around 0

                          \[\leadsto \color{blue}{1 + \left(\frac{-1}{2} \cdot {re}^{2} + \frac{1}{2} \cdot \left({im}^{2} \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right)\right)} \]
                        10. Step-by-step derivation
                          1. associate-+r+N/A

                            \[\leadsto \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) + \color{blue}{\frac{1}{2} \cdot \left({im}^{2} \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right)} \]
                          2. associate-*r*N/A

                            \[\leadsto \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) + \left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)} \]
                          3. distribute-rgt1-inN/A

                            \[\leadsto \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)} \]
                          4. lft-mult-inverseN/A

                            \[\leadsto \left(\frac{1}{2} \cdot {im}^{2} + \frac{1}{{im}^{2}} \cdot {im}^{2}\right) \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) \]
                          5. distribute-rgt-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{2} + \frac{1}{{im}^{2}}\right)\right) \cdot \left(\color{blue}{1} + \frac{-1}{2} \cdot {re}^{2}\right) \]
                          6. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left(\frac{1}{2} + \frac{1}{{im}^{2}}\right)\right), \color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)}\right) \]
                          7. +-commutativeN/A

                            \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left(\frac{1}{{im}^{2}} + \frac{1}{2}\right)\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          8. distribute-rgt-inN/A

                            \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{{im}^{2}} \cdot {im}^{2} + \frac{1}{2} \cdot {im}^{2}\right), \left(\color{blue}{1} + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          9. lft-mult-inverseN/A

                            \[\leadsto \mathsf{*.f64}\left(\left(1 + \frac{1}{2} \cdot {im}^{2}\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          10. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{1}{2} \cdot {im}^{2}\right)\right), \left(\color{blue}{1} + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          11. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \left({im}^{2}\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          12. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \left(im \cdot im\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          13. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          14. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {re}^{2}\right)}\right)\right) \]
                          15. *-commutativeN/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \left({re}^{2} \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right) \]
                          16. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({re}^{2}\right), \color{blue}{\frac{-1}{2}}\right)\right)\right) \]
                          17. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(re \cdot re\right), \frac{-1}{2}\right)\right)\right) \]
                          18. *-lowering-*.f6457.4%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \frac{-1}{2}\right)\right)\right) \]
                        11. Simplified57.4%

                          \[\leadsto \color{blue}{\left(1 + 0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(1 + \left(re \cdot re\right) \cdot -0.5\right)} \]
                        12. Taylor expanded in re around 0

                          \[\leadsto \color{blue}{1 + \frac{1}{2} \cdot {im}^{2}} \]
                        13. Step-by-step derivation
                          1. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{2} \cdot {im}^{2}\right)}\right) \]
                          2. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left({im}^{2}\right)}\right)\right) \]
                          3. unpow2N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \left(im \cdot \color{blue}{im}\right)\right)\right) \]
                          4. *-lowering-*.f6452.0%

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
                        14. Simplified52.0%

                          \[\leadsto \color{blue}{1 + 0.5 \cdot \left(im \cdot im\right)} \]

                        if 4.2000000000000001e33 < re < 2.10000000000000013e198

                        1. Initial program 99.9%

                          \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right) \]
                        2. Add Preprocessing
                        3. Taylor expanded in im around 0

                          \[\leadsto \color{blue}{\cos re + {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right)} \]
                        4. Step-by-step derivation
                          1. +-commutativeN/A

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                          2. distribute-rgt-inN/A

                            \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                          3. associate-+l+N/A

                            \[\leadsto \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \color{blue}{\left(\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2} + \cos re\right)} \]
                          4. *-commutativeN/A

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \left(\color{blue}{\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}} + \cos re\right) \]
                          5. associate-*r*N/A

                            \[\leadsto {im}^{2} \cdot \left(\left(\frac{1}{24} \cdot {im}^{2}\right) \cdot \cos re\right) + \left(\left(\frac{1}{2} \cdot \cos re\right) \cdot \color{blue}{{im}^{2}} + \cos re\right) \]
                          6. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\color{blue}{\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}} + \cos re\right) \]
                          7. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left(\cos re \cdot {im}^{2}\right) + \cos \color{blue}{re}\right) \]
                          8. *-commutativeN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left({im}^{2} \cdot \cos re\right) + \cos re\right) \]
                          9. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                          10. distribute-lft1-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                          11. unpow2N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left(im \cdot im\right) + 1\right) \cdot \cos re \]
                          12. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot im\right) \cdot im + 1\right) \cdot \cos re \]
                          13. *-commutativeN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                        5. Simplified75.6%

                          \[\leadsto \color{blue}{\cos re \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right)} \]
                        6. Taylor expanded in re around 0

                          \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)}, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), 1\right)\right) \]
                        7. Step-by-step derivation
                          1. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot {re}^{2}\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)}, 1\right)\right) \]
                          2. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left({re}^{2}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \color{blue}{\mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)}\right), 1\right)\right) \]
                          3. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(re \cdot re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                          4. *-lowering-*.f6428.1%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                        8. Simplified28.1%

                          \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(re \cdot re\right)\right)} \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right) \]
                        9. Taylor expanded in im around 0

                          \[\leadsto \color{blue}{1 + \left(\frac{-1}{2} \cdot {re}^{2} + \frac{1}{2} \cdot \left({im}^{2} \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right)\right)} \]
                        10. Step-by-step derivation
                          1. associate-+r+N/A

                            \[\leadsto \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) + \color{blue}{\frac{1}{2} \cdot \left({im}^{2} \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right)} \]
                          2. associate-*r*N/A

                            \[\leadsto \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) + \left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)} \]
                          3. distribute-rgt1-inN/A

                            \[\leadsto \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)} \]
                          4. lft-mult-inverseN/A

                            \[\leadsto \left(\frac{1}{2} \cdot {im}^{2} + \frac{1}{{im}^{2}} \cdot {im}^{2}\right) \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) \]
                          5. distribute-rgt-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{2} + \frac{1}{{im}^{2}}\right)\right) \cdot \left(\color{blue}{1} + \frac{-1}{2} \cdot {re}^{2}\right) \]
                          6. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left(\frac{1}{2} + \frac{1}{{im}^{2}}\right)\right), \color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)}\right) \]
                          7. +-commutativeN/A

                            \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left(\frac{1}{{im}^{2}} + \frac{1}{2}\right)\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          8. distribute-rgt-inN/A

                            \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{{im}^{2}} \cdot {im}^{2} + \frac{1}{2} \cdot {im}^{2}\right), \left(\color{blue}{1} + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          9. lft-mult-inverseN/A

                            \[\leadsto \mathsf{*.f64}\left(\left(1 + \frac{1}{2} \cdot {im}^{2}\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          10. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{1}{2} \cdot {im}^{2}\right)\right), \left(\color{blue}{1} + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          11. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \left({im}^{2}\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          12. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \left(im \cdot im\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          13. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          14. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {re}^{2}\right)}\right)\right) \]
                          15. *-commutativeN/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \left({re}^{2} \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right) \]
                          16. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({re}^{2}\right), \color{blue}{\frac{-1}{2}}\right)\right)\right) \]
                          17. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(re \cdot re\right), \frac{-1}{2}\right)\right)\right) \]
                          18. *-lowering-*.f6425.0%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \frac{-1}{2}\right)\right)\right) \]
                        11. Simplified25.0%

                          \[\leadsto \color{blue}{\left(1 + 0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(1 + \left(re \cdot re\right) \cdot -0.5\right)} \]
                        12. Taylor expanded in re around inf

                          \[\leadsto \color{blue}{\frac{-1}{2} \cdot \left({re}^{2} \cdot \left(1 + \frac{1}{2} \cdot {im}^{2}\right)\right)} \]
                        13. Step-by-step derivation
                          1. *-commutativeN/A

                            \[\leadsto \left({re}^{2} \cdot \left(1 + \frac{1}{2} \cdot {im}^{2}\right)\right) \cdot \color{blue}{\frac{-1}{2}} \]
                          2. associate-*r*N/A

                            \[\leadsto {re}^{2} \cdot \color{blue}{\left(\left(1 + \frac{1}{2} \cdot {im}^{2}\right) \cdot \frac{-1}{2}\right)} \]
                          3. *-commutativeN/A

                            \[\leadsto {re}^{2} \cdot \left(\frac{-1}{2} \cdot \color{blue}{\left(1 + \frac{1}{2} \cdot {im}^{2}\right)}\right) \]
                          4. unpow2N/A

                            \[\leadsto \left(re \cdot re\right) \cdot \left(\color{blue}{\frac{-1}{2}} \cdot \left(1 + \frac{1}{2} \cdot {im}^{2}\right)\right) \]
                          5. associate-*l*N/A

                            \[\leadsto re \cdot \color{blue}{\left(re \cdot \left(\frac{-1}{2} \cdot \left(1 + \frac{1}{2} \cdot {im}^{2}\right)\right)\right)} \]
                          6. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(re, \color{blue}{\left(re \cdot \left(\frac{-1}{2} \cdot \left(1 + \frac{1}{2} \cdot {im}^{2}\right)\right)\right)}\right) \]
                          7. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \color{blue}{\left(\frac{-1}{2} \cdot \left(1 + \frac{1}{2} \cdot {im}^{2}\right)\right)}\right)\right) \]
                          8. distribute-lft-inN/A

                            \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \left(\frac{-1}{2} \cdot 1 + \color{blue}{\frac{-1}{2} \cdot \left(\frac{1}{2} \cdot {im}^{2}\right)}\right)\right)\right) \]
                          9. metadata-evalN/A

                            \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \left(\frac{-1}{2} + \color{blue}{\frac{-1}{2}} \cdot \left(\frac{1}{2} \cdot {im}^{2}\right)\right)\right)\right) \]
                          10. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{-1}{2}, \color{blue}{\left(\frac{-1}{2} \cdot \left(\frac{1}{2} \cdot {im}^{2}\right)\right)}\right)\right)\right) \]
                          11. *-commutativeN/A

                            \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{-1}{2}, \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
                          12. *-commutativeN/A

                            \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{-1}{2}, \left(\left({im}^{2} \cdot \frac{1}{2}\right) \cdot \frac{-1}{2}\right)\right)\right)\right) \]
                          13. associate-*l*N/A

                            \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{-1}{2}, \left({im}^{2} \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{-1}{2}\right)}\right)\right)\right)\right) \]
                          14. metadata-evalN/A

                            \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{-1}{2}, \left({im}^{2} \cdot \frac{-1}{4}\right)\right)\right)\right) \]
                          15. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\frac{-1}{4}}\right)\right)\right)\right) \]
                          16. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{-1}{4}\right)\right)\right)\right) \]
                          17. *-lowering-*.f6425.0%

                            \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{4}\right)\right)\right)\right) \]
                        14. Simplified25.0%

                          \[\leadsto \color{blue}{re \cdot \left(re \cdot \left(-0.5 + \left(im \cdot im\right) \cdot -0.25\right)\right)} \]

                        if 2.10000000000000013e198 < re

                        1. Initial program 100.0%

                          \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right) \]
                        2. Add Preprocessing
                        3. Taylor expanded in im around 0

                          \[\leadsto \color{blue}{\cos re + {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right)} \]
                        4. Step-by-step derivation
                          1. +-commutativeN/A

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                          2. distribute-rgt-inN/A

                            \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                          3. associate-+l+N/A

                            \[\leadsto \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \color{blue}{\left(\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2} + \cos re\right)} \]
                          4. *-commutativeN/A

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \left(\color{blue}{\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}} + \cos re\right) \]
                          5. associate-*r*N/A

                            \[\leadsto {im}^{2} \cdot \left(\left(\frac{1}{24} \cdot {im}^{2}\right) \cdot \cos re\right) + \left(\left(\frac{1}{2} \cdot \cos re\right) \cdot \color{blue}{{im}^{2}} + \cos re\right) \]
                          6. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\color{blue}{\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}} + \cos re\right) \]
                          7. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left(\cos re \cdot {im}^{2}\right) + \cos \color{blue}{re}\right) \]
                          8. *-commutativeN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left({im}^{2} \cdot \cos re\right) + \cos re\right) \]
                          9. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                          10. distribute-lft1-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                          11. unpow2N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left(im \cdot im\right) + 1\right) \cdot \cos re \]
                          12. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot im\right) \cdot im + 1\right) \cdot \cos re \]
                          13. *-commutativeN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                        5. Simplified87.6%

                          \[\leadsto \color{blue}{\cos re \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right)} \]
                        6. Taylor expanded in re around 0

                          \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)}, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), 1\right)\right) \]
                        7. Step-by-step derivation
                          1. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot {re}^{2}\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)}, 1\right)\right) \]
                          2. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left({re}^{2}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \color{blue}{\mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)}\right), 1\right)\right) \]
                          3. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(re \cdot re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                          4. *-lowering-*.f6411.6%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                        8. Simplified11.6%

                          \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(re \cdot re\right)\right)} \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right) \]
                        9. Taylor expanded in im around 0

                          \[\leadsto \color{blue}{1 + \frac{-1}{2} \cdot {re}^{2}} \]
                        10. Step-by-step derivation
                          1. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {re}^{2}\right)}\right) \]
                          2. *-commutativeN/A

                            \[\leadsto \mathsf{+.f64}\left(1, \left({re}^{2} \cdot \color{blue}{\frac{-1}{2}}\right)\right) \]
                          3. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({re}^{2}\right), \color{blue}{\frac{-1}{2}}\right)\right) \]
                          4. unpow2N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(re \cdot re\right), \frac{-1}{2}\right)\right) \]
                          5. *-lowering-*.f6411.6%

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \frac{-1}{2}\right)\right) \]
                        11. Simplified11.6%

                          \[\leadsto \color{blue}{1 + \left(re \cdot re\right) \cdot -0.5} \]
                        12. Applied egg-rr33.4%

                          \[\leadsto \color{blue}{1 - re \cdot \left(re \cdot -0.5\right)} \]
                      3. Recombined 3 regimes into one program.
                      4. Add Preprocessing

                      Alternative 22: 48.1% accurate, 25.6× speedup?

                      \[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} \mathbf{if}\;re \leq 6.8 \cdot 10^{+172}:\\ \;\;\;\;1 + 0.5 \cdot \left(im\_m \cdot im\_m\right)\\ \mathbf{else}:\\ \;\;\;\;1 - re \cdot \left(re \cdot -0.5\right)\\ \end{array} \end{array} \]
                      im_m = (fabs.f64 im)
                      (FPCore (re im_m)
                       :precision binary64
                       (if (<= re 6.8e+172)
                         (+ 1.0 (* 0.5 (* im_m im_m)))
                         (- 1.0 (* re (* re -0.5)))))
                      im_m = fabs(im);
                      double code(double re, double im_m) {
                      	double tmp;
                      	if (re <= 6.8e+172) {
                      		tmp = 1.0 + (0.5 * (im_m * im_m));
                      	} else {
                      		tmp = 1.0 - (re * (re * -0.5));
                      	}
                      	return tmp;
                      }
                      
                      im_m = abs(im)
                      real(8) function code(re, im_m)
                          real(8), intent (in) :: re
                          real(8), intent (in) :: im_m
                          real(8) :: tmp
                          if (re <= 6.8d+172) then
                              tmp = 1.0d0 + (0.5d0 * (im_m * im_m))
                          else
                              tmp = 1.0d0 - (re * (re * (-0.5d0)))
                          end if
                          code = tmp
                      end function
                      
                      im_m = Math.abs(im);
                      public static double code(double re, double im_m) {
                      	double tmp;
                      	if (re <= 6.8e+172) {
                      		tmp = 1.0 + (0.5 * (im_m * im_m));
                      	} else {
                      		tmp = 1.0 - (re * (re * -0.5));
                      	}
                      	return tmp;
                      }
                      
                      im_m = math.fabs(im)
                      def code(re, im_m):
                      	tmp = 0
                      	if re <= 6.8e+172:
                      		tmp = 1.0 + (0.5 * (im_m * im_m))
                      	else:
                      		tmp = 1.0 - (re * (re * -0.5))
                      	return tmp
                      
                      im_m = abs(im)
                      function code(re, im_m)
                      	tmp = 0.0
                      	if (re <= 6.8e+172)
                      		tmp = Float64(1.0 + Float64(0.5 * Float64(im_m * im_m)));
                      	else
                      		tmp = Float64(1.0 - Float64(re * Float64(re * -0.5)));
                      	end
                      	return tmp
                      end
                      
                      im_m = abs(im);
                      function tmp_2 = code(re, im_m)
                      	tmp = 0.0;
                      	if (re <= 6.8e+172)
                      		tmp = 1.0 + (0.5 * (im_m * im_m));
                      	else
                      		tmp = 1.0 - (re * (re * -0.5));
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      im_m = N[Abs[im], $MachinePrecision]
                      code[re_, im$95$m_] := If[LessEqual[re, 6.8e+172], N[(1.0 + N[(0.5 * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(re * N[(re * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                      
                      \begin{array}{l}
                      im_m = \left|im\right|
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;re \leq 6.8 \cdot 10^{+172}:\\
                      \;\;\;\;1 + 0.5 \cdot \left(im\_m \cdot im\_m\right)\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;1 - re \cdot \left(re \cdot -0.5\right)\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if re < 6.7999999999999996e172

                        1. Initial program 100.0%

                          \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right) \]
                        2. Add Preprocessing
                        3. Taylor expanded in im around 0

                          \[\leadsto \color{blue}{\cos re + {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right)} \]
                        4. Step-by-step derivation
                          1. +-commutativeN/A

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                          2. distribute-rgt-inN/A

                            \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                          3. associate-+l+N/A

                            \[\leadsto \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \color{blue}{\left(\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2} + \cos re\right)} \]
                          4. *-commutativeN/A

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \left(\color{blue}{\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}} + \cos re\right) \]
                          5. associate-*r*N/A

                            \[\leadsto {im}^{2} \cdot \left(\left(\frac{1}{24} \cdot {im}^{2}\right) \cdot \cos re\right) + \left(\left(\frac{1}{2} \cdot \cos re\right) \cdot \color{blue}{{im}^{2}} + \cos re\right) \]
                          6. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\color{blue}{\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}} + \cos re\right) \]
                          7. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left(\cos re \cdot {im}^{2}\right) + \cos \color{blue}{re}\right) \]
                          8. *-commutativeN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left({im}^{2} \cdot \cos re\right) + \cos re\right) \]
                          9. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                          10. distribute-lft1-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                          11. unpow2N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left(im \cdot im\right) + 1\right) \cdot \cos re \]
                          12. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot im\right) \cdot im + 1\right) \cdot \cos re \]
                          13. *-commutativeN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                        5. Simplified83.9%

                          \[\leadsto \color{blue}{\cos re \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right)} \]
                        6. Taylor expanded in re around 0

                          \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)}, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), 1\right)\right) \]
                        7. Step-by-step derivation
                          1. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot {re}^{2}\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)}, 1\right)\right) \]
                          2. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left({re}^{2}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \color{blue}{\mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)}\right), 1\right)\right) \]
                          3. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(re \cdot re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                          4. *-lowering-*.f6463.0%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                        8. Simplified63.0%

                          \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(re \cdot re\right)\right)} \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right) \]
                        9. Taylor expanded in im around 0

                          \[\leadsto \color{blue}{1 + \left(\frac{-1}{2} \cdot {re}^{2} + \frac{1}{2} \cdot \left({im}^{2} \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right)\right)} \]
                        10. Step-by-step derivation
                          1. associate-+r+N/A

                            \[\leadsto \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) + \color{blue}{\frac{1}{2} \cdot \left({im}^{2} \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right)} \]
                          2. associate-*r*N/A

                            \[\leadsto \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) + \left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)} \]
                          3. distribute-rgt1-inN/A

                            \[\leadsto \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)} \]
                          4. lft-mult-inverseN/A

                            \[\leadsto \left(\frac{1}{2} \cdot {im}^{2} + \frac{1}{{im}^{2}} \cdot {im}^{2}\right) \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) \]
                          5. distribute-rgt-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{2} + \frac{1}{{im}^{2}}\right)\right) \cdot \left(\color{blue}{1} + \frac{-1}{2} \cdot {re}^{2}\right) \]
                          6. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left(\frac{1}{2} + \frac{1}{{im}^{2}}\right)\right), \color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)}\right) \]
                          7. +-commutativeN/A

                            \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left(\frac{1}{{im}^{2}} + \frac{1}{2}\right)\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          8. distribute-rgt-inN/A

                            \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{{im}^{2}} \cdot {im}^{2} + \frac{1}{2} \cdot {im}^{2}\right), \left(\color{blue}{1} + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          9. lft-mult-inverseN/A

                            \[\leadsto \mathsf{*.f64}\left(\left(1 + \frac{1}{2} \cdot {im}^{2}\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          10. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{1}{2} \cdot {im}^{2}\right)\right), \left(\color{blue}{1} + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          11. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \left({im}^{2}\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          12. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \left(im \cdot im\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          13. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          14. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {re}^{2}\right)}\right)\right) \]
                          15. *-commutativeN/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \left({re}^{2} \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right) \]
                          16. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({re}^{2}\right), \color{blue}{\frac{-1}{2}}\right)\right)\right) \]
                          17. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(re \cdot re\right), \frac{-1}{2}\right)\right)\right) \]
                          18. *-lowering-*.f6453.5%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \frac{-1}{2}\right)\right)\right) \]
                        11. Simplified53.5%

                          \[\leadsto \color{blue}{\left(1 + 0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(1 + \left(re \cdot re\right) \cdot -0.5\right)} \]
                        12. Taylor expanded in re around 0

                          \[\leadsto \color{blue}{1 + \frac{1}{2} \cdot {im}^{2}} \]
                        13. Step-by-step derivation
                          1. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{2} \cdot {im}^{2}\right)}\right) \]
                          2. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left({im}^{2}\right)}\right)\right) \]
                          3. unpow2N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \left(im \cdot \color{blue}{im}\right)\right)\right) \]
                          4. *-lowering-*.f6450.2%

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
                        14. Simplified50.2%

                          \[\leadsto \color{blue}{1 + 0.5 \cdot \left(im \cdot im\right)} \]

                        if 6.7999999999999996e172 < re

                        1. Initial program 100.0%

                          \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right) \]
                        2. Add Preprocessing
                        3. Taylor expanded in im around 0

                          \[\leadsto \color{blue}{\cos re + {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right)} \]
                        4. Step-by-step derivation
                          1. +-commutativeN/A

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                          2. distribute-rgt-inN/A

                            \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                          3. associate-+l+N/A

                            \[\leadsto \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \color{blue}{\left(\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2} + \cos re\right)} \]
                          4. *-commutativeN/A

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \left(\color{blue}{\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}} + \cos re\right) \]
                          5. associate-*r*N/A

                            \[\leadsto {im}^{2} \cdot \left(\left(\frac{1}{24} \cdot {im}^{2}\right) \cdot \cos re\right) + \left(\left(\frac{1}{2} \cdot \cos re\right) \cdot \color{blue}{{im}^{2}} + \cos re\right) \]
                          6. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\color{blue}{\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}} + \cos re\right) \]
                          7. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left(\cos re \cdot {im}^{2}\right) + \cos \color{blue}{re}\right) \]
                          8. *-commutativeN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left({im}^{2} \cdot \cos re\right) + \cos re\right) \]
                          9. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                          10. distribute-lft1-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                          11. unpow2N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left(im \cdot im\right) + 1\right) \cdot \cos re \]
                          12. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot im\right) \cdot im + 1\right) \cdot \cos re \]
                          13. *-commutativeN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                        5. Simplified78.9%

                          \[\leadsto \color{blue}{\cos re \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right)} \]
                        6. Taylor expanded in re around 0

                          \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)}, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), 1\right)\right) \]
                        7. Step-by-step derivation
                          1. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot {re}^{2}\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)}, 1\right)\right) \]
                          2. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left({re}^{2}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \color{blue}{\mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)}\right), 1\right)\right) \]
                          3. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(re \cdot re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                          4. *-lowering-*.f6421.3%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                        8. Simplified21.3%

                          \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(re \cdot re\right)\right)} \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right) \]
                        9. Taylor expanded in im around 0

                          \[\leadsto \color{blue}{1 + \frac{-1}{2} \cdot {re}^{2}} \]
                        10. Step-by-step derivation
                          1. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {re}^{2}\right)}\right) \]
                          2. *-commutativeN/A

                            \[\leadsto \mathsf{+.f64}\left(1, \left({re}^{2} \cdot \color{blue}{\frac{-1}{2}}\right)\right) \]
                          3. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({re}^{2}\right), \color{blue}{\frac{-1}{2}}\right)\right) \]
                          4. unpow2N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(re \cdot re\right), \frac{-1}{2}\right)\right) \]
                          5. *-lowering-*.f6421.3%

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \frac{-1}{2}\right)\right) \]
                        11. Simplified21.3%

                          \[\leadsto \color{blue}{1 + \left(re \cdot re\right) \cdot -0.5} \]
                        12. Applied egg-rr34.3%

                          \[\leadsto \color{blue}{1 - re \cdot \left(re \cdot -0.5\right)} \]
                      3. Recombined 2 regimes into one program.
                      4. Add Preprocessing

                      Alternative 23: 48.2% accurate, 25.6× speedup?

                      \[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} \mathbf{if}\;re \leq 4.6 \cdot 10^{+169}:\\ \;\;\;\;1 + 0.5 \cdot \left(im\_m \cdot im\_m\right)\\ \mathbf{else}:\\ \;\;\;\;1 + \left(re \cdot re\right) \cdot -0.5\\ \end{array} \end{array} \]
                      im_m = (fabs.f64 im)
                      (FPCore (re im_m)
                       :precision binary64
                       (if (<= re 4.6e+169)
                         (+ 1.0 (* 0.5 (* im_m im_m)))
                         (+ 1.0 (* (* re re) -0.5))))
                      im_m = fabs(im);
                      double code(double re, double im_m) {
                      	double tmp;
                      	if (re <= 4.6e+169) {
                      		tmp = 1.0 + (0.5 * (im_m * im_m));
                      	} else {
                      		tmp = 1.0 + ((re * re) * -0.5);
                      	}
                      	return tmp;
                      }
                      
                      im_m = abs(im)
                      real(8) function code(re, im_m)
                          real(8), intent (in) :: re
                          real(8), intent (in) :: im_m
                          real(8) :: tmp
                          if (re <= 4.6d+169) then
                              tmp = 1.0d0 + (0.5d0 * (im_m * im_m))
                          else
                              tmp = 1.0d0 + ((re * re) * (-0.5d0))
                          end if
                          code = tmp
                      end function
                      
                      im_m = Math.abs(im);
                      public static double code(double re, double im_m) {
                      	double tmp;
                      	if (re <= 4.6e+169) {
                      		tmp = 1.0 + (0.5 * (im_m * im_m));
                      	} else {
                      		tmp = 1.0 + ((re * re) * -0.5);
                      	}
                      	return tmp;
                      }
                      
                      im_m = math.fabs(im)
                      def code(re, im_m):
                      	tmp = 0
                      	if re <= 4.6e+169:
                      		tmp = 1.0 + (0.5 * (im_m * im_m))
                      	else:
                      		tmp = 1.0 + ((re * re) * -0.5)
                      	return tmp
                      
                      im_m = abs(im)
                      function code(re, im_m)
                      	tmp = 0.0
                      	if (re <= 4.6e+169)
                      		tmp = Float64(1.0 + Float64(0.5 * Float64(im_m * im_m)));
                      	else
                      		tmp = Float64(1.0 + Float64(Float64(re * re) * -0.5));
                      	end
                      	return tmp
                      end
                      
                      im_m = abs(im);
                      function tmp_2 = code(re, im_m)
                      	tmp = 0.0;
                      	if (re <= 4.6e+169)
                      		tmp = 1.0 + (0.5 * (im_m * im_m));
                      	else
                      		tmp = 1.0 + ((re * re) * -0.5);
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      im_m = N[Abs[im], $MachinePrecision]
                      code[re_, im$95$m_] := If[LessEqual[re, 4.6e+169], N[(1.0 + N[(0.5 * N[(im$95$m * im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(re * re), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]]
                      
                      \begin{array}{l}
                      im_m = \left|im\right|
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;re \leq 4.6 \cdot 10^{+169}:\\
                      \;\;\;\;1 + 0.5 \cdot \left(im\_m \cdot im\_m\right)\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;1 + \left(re \cdot re\right) \cdot -0.5\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if re < 4.5999999999999999e169

                        1. Initial program 100.0%

                          \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right) \]
                        2. Add Preprocessing
                        3. Taylor expanded in im around 0

                          \[\leadsto \color{blue}{\cos re + {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right)} \]
                        4. Step-by-step derivation
                          1. +-commutativeN/A

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                          2. distribute-rgt-inN/A

                            \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                          3. associate-+l+N/A

                            \[\leadsto \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \color{blue}{\left(\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2} + \cos re\right)} \]
                          4. *-commutativeN/A

                            \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \left(\color{blue}{\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}} + \cos re\right) \]
                          5. associate-*r*N/A

                            \[\leadsto {im}^{2} \cdot \left(\left(\frac{1}{24} \cdot {im}^{2}\right) \cdot \cos re\right) + \left(\left(\frac{1}{2} \cdot \cos re\right) \cdot \color{blue}{{im}^{2}} + \cos re\right) \]
                          6. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\color{blue}{\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}} + \cos re\right) \]
                          7. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left(\cos re \cdot {im}^{2}\right) + \cos \color{blue}{re}\right) \]
                          8. *-commutativeN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left({im}^{2} \cdot \cos re\right) + \cos re\right) \]
                          9. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                          10. distribute-lft1-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                          11. unpow2N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left(im \cdot im\right) + 1\right) \cdot \cos re \]
                          12. associate-*r*N/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot im\right) \cdot im + 1\right) \cdot \cos re \]
                          13. *-commutativeN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                        5. Simplified83.9%

                          \[\leadsto \color{blue}{\cos re \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right)} \]
                        6. Taylor expanded in re around 0

                          \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)}, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), 1\right)\right) \]
                        7. Step-by-step derivation
                          1. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot {re}^{2}\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)}, 1\right)\right) \]
                          2. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left({re}^{2}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \color{blue}{\mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)}\right), 1\right)\right) \]
                          3. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(re \cdot re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                          4. *-lowering-*.f6463.0%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                        8. Simplified63.0%

                          \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(re \cdot re\right)\right)} \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right) \]
                        9. Taylor expanded in im around 0

                          \[\leadsto \color{blue}{1 + \left(\frac{-1}{2} \cdot {re}^{2} + \frac{1}{2} \cdot \left({im}^{2} \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right)\right)} \]
                        10. Step-by-step derivation
                          1. associate-+r+N/A

                            \[\leadsto \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) + \color{blue}{\frac{1}{2} \cdot \left({im}^{2} \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right)} \]
                          2. associate-*r*N/A

                            \[\leadsto \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) + \left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)} \]
                          3. distribute-rgt1-inN/A

                            \[\leadsto \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)} \]
                          4. lft-mult-inverseN/A

                            \[\leadsto \left(\frac{1}{2} \cdot {im}^{2} + \frac{1}{{im}^{2}} \cdot {im}^{2}\right) \cdot \left(1 + \frac{-1}{2} \cdot {re}^{2}\right) \]
                          5. distribute-rgt-inN/A

                            \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{2} + \frac{1}{{im}^{2}}\right)\right) \cdot \left(\color{blue}{1} + \frac{-1}{2} \cdot {re}^{2}\right) \]
                          6. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left(\frac{1}{2} + \frac{1}{{im}^{2}}\right)\right), \color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)}\right) \]
                          7. +-commutativeN/A

                            \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left(\frac{1}{{im}^{2}} + \frac{1}{2}\right)\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          8. distribute-rgt-inN/A

                            \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{{im}^{2}} \cdot {im}^{2} + \frac{1}{2} \cdot {im}^{2}\right), \left(\color{blue}{1} + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          9. lft-mult-inverseN/A

                            \[\leadsto \mathsf{*.f64}\left(\left(1 + \frac{1}{2} \cdot {im}^{2}\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          10. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{1}{2} \cdot {im}^{2}\right)\right), \left(\color{blue}{1} + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          11. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \left({im}^{2}\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          12. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \left(im \cdot im\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          13. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {re}^{2}\right)\right) \]
                          14. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {re}^{2}\right)}\right)\right) \]
                          15. *-commutativeN/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \left({re}^{2} \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right) \]
                          16. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({re}^{2}\right), \color{blue}{\frac{-1}{2}}\right)\right)\right) \]
                          17. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(re \cdot re\right), \frac{-1}{2}\right)\right)\right) \]
                          18. *-lowering-*.f6453.5%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \frac{-1}{2}\right)\right)\right) \]
                        11. Simplified53.5%

                          \[\leadsto \color{blue}{\left(1 + 0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(1 + \left(re \cdot re\right) \cdot -0.5\right)} \]
                        12. Taylor expanded in re around 0

                          \[\leadsto \color{blue}{1 + \frac{1}{2} \cdot {im}^{2}} \]
                        13. Step-by-step derivation
                          1. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{2} \cdot {im}^{2}\right)}\right) \]
                          2. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left({im}^{2}\right)}\right)\right) \]
                          3. unpow2N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \left(im \cdot \color{blue}{im}\right)\right)\right) \]
                          4. *-lowering-*.f6450.2%

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
                        14. Simplified50.2%

                          \[\leadsto \color{blue}{1 + 0.5 \cdot \left(im \cdot im\right)} \]

                        if 4.5999999999999999e169 < re

                        1. Initial program 100.0%

                          \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right) \]
                        2. Add Preprocessing
                        3. Taylor expanded in im around 0

                          \[\leadsto \color{blue}{\cos re} \]
                        4. Step-by-step derivation
                          1. cos-lowering-cos.f6445.8%

                            \[\leadsto \mathsf{cos.f64}\left(re\right) \]
                        5. Simplified45.8%

                          \[\leadsto \color{blue}{\cos re} \]
                        6. Taylor expanded in re around 0

                          \[\leadsto \color{blue}{1 + \frac{-1}{2} \cdot {re}^{2}} \]
                        7. Step-by-step derivation
                          1. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {re}^{2}\right)}\right) \]
                          2. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \color{blue}{\left({re}^{2}\right)}\right)\right) \]
                          3. unpow2N/A

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(re \cdot \color{blue}{re}\right)\right)\right) \]
                          4. *-lowering-*.f6421.3%

                            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right) \]
                        8. Simplified21.3%

                          \[\leadsto \color{blue}{1 + -0.5 \cdot \left(re \cdot re\right)} \]
                      3. Recombined 2 regimes into one program.
                      4. Final simplification45.8%

                        \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 4.6 \cdot 10^{+169}:\\ \;\;\;\;1 + 0.5 \cdot \left(im \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;1 + \left(re \cdot re\right) \cdot -0.5\\ \end{array} \]
                      5. Add Preprocessing

                      Alternative 24: 34.3% accurate, 25.6× speedup?

                      \[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} \mathbf{if}\;im\_m \leq 1.25 \cdot 10^{+22}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;1 + \left(re \cdot re\right) \cdot -0.5\\ \end{array} \end{array} \]
                      im_m = (fabs.f64 im)
                      (FPCore (re im_m)
                       :precision binary64
                       (if (<= im_m 1.25e+22) 1.0 (+ 1.0 (* (* re re) -0.5))))
                      im_m = fabs(im);
                      double code(double re, double im_m) {
                      	double tmp;
                      	if (im_m <= 1.25e+22) {
                      		tmp = 1.0;
                      	} else {
                      		tmp = 1.0 + ((re * re) * -0.5);
                      	}
                      	return tmp;
                      }
                      
                      im_m = abs(im)
                      real(8) function code(re, im_m)
                          real(8), intent (in) :: re
                          real(8), intent (in) :: im_m
                          real(8) :: tmp
                          if (im_m <= 1.25d+22) then
                              tmp = 1.0d0
                          else
                              tmp = 1.0d0 + ((re * re) * (-0.5d0))
                          end if
                          code = tmp
                      end function
                      
                      im_m = Math.abs(im);
                      public static double code(double re, double im_m) {
                      	double tmp;
                      	if (im_m <= 1.25e+22) {
                      		tmp = 1.0;
                      	} else {
                      		tmp = 1.0 + ((re * re) * -0.5);
                      	}
                      	return tmp;
                      }
                      
                      im_m = math.fabs(im)
                      def code(re, im_m):
                      	tmp = 0
                      	if im_m <= 1.25e+22:
                      		tmp = 1.0
                      	else:
                      		tmp = 1.0 + ((re * re) * -0.5)
                      	return tmp
                      
                      im_m = abs(im)
                      function code(re, im_m)
                      	tmp = 0.0
                      	if (im_m <= 1.25e+22)
                      		tmp = 1.0;
                      	else
                      		tmp = Float64(1.0 + Float64(Float64(re * re) * -0.5));
                      	end
                      	return tmp
                      end
                      
                      im_m = abs(im);
                      function tmp_2 = code(re, im_m)
                      	tmp = 0.0;
                      	if (im_m <= 1.25e+22)
                      		tmp = 1.0;
                      	else
                      		tmp = 1.0 + ((re * re) * -0.5);
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      im_m = N[Abs[im], $MachinePrecision]
                      code[re_, im$95$m_] := If[LessEqual[im$95$m, 1.25e+22], 1.0, N[(1.0 + N[(N[(re * re), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]]
                      
                      \begin{array}{l}
                      im_m = \left|im\right|
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;im\_m \leq 1.25 \cdot 10^{+22}:\\
                      \;\;\;\;1\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;1 + \left(re \cdot re\right) \cdot -0.5\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if im < 1.2499999999999999e22

                        1. Initial program 100.0%

                          \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right) \]
                        2. Add Preprocessing
                        3. Taylor expanded in im around 0

                          \[\leadsto \color{blue}{\cos re} \]
                        4. Step-by-step derivation
                          1. cos-lowering-cos.f6458.6%

                            \[\leadsto \mathsf{cos.f64}\left(re\right) \]
                        5. Simplified58.6%

                          \[\leadsto \color{blue}{\cos re} \]
                        6. Taylor expanded in re around 0

                          \[\leadsto \color{blue}{1} \]
                        7. Step-by-step derivation
                          1. Simplified33.9%

                            \[\leadsto \color{blue}{1} \]

                          if 1.2499999999999999e22 < im

                          1. Initial program 100.0%

                            \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right) \]
                          2. Add Preprocessing
                          3. Taylor expanded in im around 0

                            \[\leadsto \color{blue}{\cos re} \]
                          4. Step-by-step derivation
                            1. cos-lowering-cos.f643.1%

                              \[\leadsto \mathsf{cos.f64}\left(re\right) \]
                          5. Simplified3.1%

                            \[\leadsto \color{blue}{\cos re} \]
                          6. Taylor expanded in re around 0

                            \[\leadsto \color{blue}{1 + \frac{-1}{2} \cdot {re}^{2}} \]
                          7. Step-by-step derivation
                            1. +-lowering-+.f64N/A

                              \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {re}^{2}\right)}\right) \]
                            2. *-lowering-*.f64N/A

                              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \color{blue}{\left({re}^{2}\right)}\right)\right) \]
                            3. unpow2N/A

                              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(re \cdot \color{blue}{re}\right)\right)\right) \]
                            4. *-lowering-*.f6418.0%

                              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right) \]
                          8. Simplified18.0%

                            \[\leadsto \color{blue}{1 + -0.5 \cdot \left(re \cdot re\right)} \]
                        8. Recombined 2 regimes into one program.
                        9. Final simplification30.4%

                          \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 1.25 \cdot 10^{+22}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;1 + \left(re \cdot re\right) \cdot -0.5\\ \end{array} \]
                        10. Add Preprocessing

                        Alternative 25: 33.8% accurate, 30.8× speedup?

                        \[\begin{array}{l} im_m = \left|im\right| \\ \begin{array}{l} \mathbf{if}\;im\_m \leq 3.2 \cdot 10^{+24}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\left(re \cdot re\right) \cdot -0.5\\ \end{array} \end{array} \]
                        im_m = (fabs.f64 im)
                        (FPCore (re im_m)
                         :precision binary64
                         (if (<= im_m 3.2e+24) 1.0 (* (* re re) -0.5)))
                        im_m = fabs(im);
                        double code(double re, double im_m) {
                        	double tmp;
                        	if (im_m <= 3.2e+24) {
                        		tmp = 1.0;
                        	} else {
                        		tmp = (re * re) * -0.5;
                        	}
                        	return tmp;
                        }
                        
                        im_m = abs(im)
                        real(8) function code(re, im_m)
                            real(8), intent (in) :: re
                            real(8), intent (in) :: im_m
                            real(8) :: tmp
                            if (im_m <= 3.2d+24) then
                                tmp = 1.0d0
                            else
                                tmp = (re * re) * (-0.5d0)
                            end if
                            code = tmp
                        end function
                        
                        im_m = Math.abs(im);
                        public static double code(double re, double im_m) {
                        	double tmp;
                        	if (im_m <= 3.2e+24) {
                        		tmp = 1.0;
                        	} else {
                        		tmp = (re * re) * -0.5;
                        	}
                        	return tmp;
                        }
                        
                        im_m = math.fabs(im)
                        def code(re, im_m):
                        	tmp = 0
                        	if im_m <= 3.2e+24:
                        		tmp = 1.0
                        	else:
                        		tmp = (re * re) * -0.5
                        	return tmp
                        
                        im_m = abs(im)
                        function code(re, im_m)
                        	tmp = 0.0
                        	if (im_m <= 3.2e+24)
                        		tmp = 1.0;
                        	else
                        		tmp = Float64(Float64(re * re) * -0.5);
                        	end
                        	return tmp
                        end
                        
                        im_m = abs(im);
                        function tmp_2 = code(re, im_m)
                        	tmp = 0.0;
                        	if (im_m <= 3.2e+24)
                        		tmp = 1.0;
                        	else
                        		tmp = (re * re) * -0.5;
                        	end
                        	tmp_2 = tmp;
                        end
                        
                        im_m = N[Abs[im], $MachinePrecision]
                        code[re_, im$95$m_] := If[LessEqual[im$95$m, 3.2e+24], 1.0, N[(N[(re * re), $MachinePrecision] * -0.5), $MachinePrecision]]
                        
                        \begin{array}{l}
                        im_m = \left|im\right|
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;im\_m \leq 3.2 \cdot 10^{+24}:\\
                        \;\;\;\;1\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;\left(re \cdot re\right) \cdot -0.5\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if im < 3.1999999999999997e24

                          1. Initial program 100.0%

                            \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right) \]
                          2. Add Preprocessing
                          3. Taylor expanded in im around 0

                            \[\leadsto \color{blue}{\cos re} \]
                          4. Step-by-step derivation
                            1. cos-lowering-cos.f6457.8%

                              \[\leadsto \mathsf{cos.f64}\left(re\right) \]
                          5. Simplified57.8%

                            \[\leadsto \color{blue}{\cos re} \]
                          6. Taylor expanded in re around 0

                            \[\leadsto \color{blue}{1} \]
                          7. Step-by-step derivation
                            1. Simplified33.4%

                              \[\leadsto \color{blue}{1} \]

                            if 3.1999999999999997e24 < im

                            1. Initial program 100.0%

                              \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right) \]
                            2. Add Preprocessing
                            3. Taylor expanded in im around 0

                              \[\leadsto \color{blue}{\cos re + {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right)} \]
                            4. Step-by-step derivation
                              1. +-commutativeN/A

                                \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right) + \frac{1}{2} \cdot \cos re\right) + \color{blue}{\cos re} \]
                              2. distribute-rgt-inN/A

                                \[\leadsto \left(\left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}\right) + \cos \color{blue}{re} \]
                              3. associate-+l+N/A

                                \[\leadsto \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) \cdot {im}^{2} + \color{blue}{\left(\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2} + \cos re\right)} \]
                              4. *-commutativeN/A

                                \[\leadsto {im}^{2} \cdot \left(\frac{1}{24} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \left(\color{blue}{\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}} + \cos re\right) \]
                              5. associate-*r*N/A

                                \[\leadsto {im}^{2} \cdot \left(\left(\frac{1}{24} \cdot {im}^{2}\right) \cdot \cos re\right) + \left(\left(\frac{1}{2} \cdot \cos re\right) \cdot \color{blue}{{im}^{2}} + \cos re\right) \]
                              6. associate-*r*N/A

                                \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\color{blue}{\left(\frac{1}{2} \cdot \cos re\right) \cdot {im}^{2}} + \cos re\right) \]
                              7. associate-*r*N/A

                                \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left(\cos re \cdot {im}^{2}\right) + \cos \color{blue}{re}\right) \]
                              8. *-commutativeN/A

                                \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left({im}^{2} \cdot \cos re\right) + \cos re\right) \]
                              9. associate-*r*N/A

                                \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \cos re + \cos \color{blue}{re}\right) \]
                              10. distribute-lft1-inN/A

                                \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot {im}^{2} + 1\right) \cdot \color{blue}{\cos re} \]
                              11. unpow2N/A

                                \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{1}{2} \cdot \left(im \cdot im\right) + 1\right) \cdot \cos re \]
                              12. associate-*r*N/A

                                \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\left(\frac{1}{2} \cdot im\right) \cdot im + 1\right) \cdot \cos re \]
                              13. *-commutativeN/A

                                \[\leadsto \left({im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{1}{2} \cdot im\right) + 1\right) \cdot \cos re \]
                            5. Simplified75.7%

                              \[\leadsto \color{blue}{\cos re \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right)} \]
                            6. Taylor expanded in re around 0

                              \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)}, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right), 1\right)\right) \]
                            7. Step-by-step derivation
                              1. +-lowering-+.f64N/A

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot {re}^{2}\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)\right)}, 1\right)\right) \]
                              2. *-lowering-*.f64N/A

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left({re}^{2}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \color{blue}{\mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)\right)}\right), 1\right)\right) \]
                              3. unpow2N/A

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(re \cdot re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                              4. *-lowering-*.f6465.6%

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, re\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(im, im\right)\right)}\right)\right), 1\right)\right) \]
                            8. Simplified65.6%

                              \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(re \cdot re\right)\right)} \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right) + 1\right) \]
                            9. Taylor expanded in im around 0

                              \[\leadsto \color{blue}{1 + \frac{-1}{2} \cdot {re}^{2}} \]
                            10. Step-by-step derivation
                              1. +-lowering-+.f64N/A

                                \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {re}^{2}\right)}\right) \]
                              2. *-commutativeN/A

                                \[\leadsto \mathsf{+.f64}\left(1, \left({re}^{2} \cdot \color{blue}{\frac{-1}{2}}\right)\right) \]
                              3. *-lowering-*.f64N/A

                                \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({re}^{2}\right), \color{blue}{\frac{-1}{2}}\right)\right) \]
                              4. unpow2N/A

                                \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(re \cdot re\right), \frac{-1}{2}\right)\right) \]
                              5. *-lowering-*.f6418.9%

                                \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \frac{-1}{2}\right)\right) \]
                            11. Simplified18.9%

                              \[\leadsto \color{blue}{1 + \left(re \cdot re\right) \cdot -0.5} \]
                            12. Taylor expanded in re around inf

                              \[\leadsto \color{blue}{\frac{-1}{2} \cdot {re}^{2}} \]
                            13. Step-by-step derivation
                              1. *-commutativeN/A

                                \[\leadsto {re}^{2} \cdot \color{blue}{\frac{-1}{2}} \]
                              2. *-lowering-*.f64N/A

                                \[\leadsto \mathsf{*.f64}\left(\left({re}^{2}\right), \color{blue}{\frac{-1}{2}}\right) \]
                              3. unpow2N/A

                                \[\leadsto \mathsf{*.f64}\left(\left(re \cdot re\right), \frac{-1}{2}\right) \]
                              4. *-lowering-*.f6418.1%

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \frac{-1}{2}\right) \]
                            14. Simplified18.1%

                              \[\leadsto \color{blue}{\left(re \cdot re\right) \cdot -0.5} \]
                          8. Recombined 2 regimes into one program.
                          9. Add Preprocessing

                          Alternative 26: 28.7% accurate, 308.0× speedup?

                          \[\begin{array}{l} im_m = \left|im\right| \\ 1 \end{array} \]
                          im_m = (fabs.f64 im)
                          (FPCore (re im_m) :precision binary64 1.0)
                          im_m = fabs(im);
                          double code(double re, double im_m) {
                          	return 1.0;
                          }
                          
                          im_m = abs(im)
                          real(8) function code(re, im_m)
                              real(8), intent (in) :: re
                              real(8), intent (in) :: im_m
                              code = 1.0d0
                          end function
                          
                          im_m = Math.abs(im);
                          public static double code(double re, double im_m) {
                          	return 1.0;
                          }
                          
                          im_m = math.fabs(im)
                          def code(re, im_m):
                          	return 1.0
                          
                          im_m = abs(im)
                          function code(re, im_m)
                          	return 1.0
                          end
                          
                          im_m = abs(im);
                          function tmp = code(re, im_m)
                          	tmp = 1.0;
                          end
                          
                          im_m = N[Abs[im], $MachinePrecision]
                          code[re_, im$95$m_] := 1.0
                          
                          \begin{array}{l}
                          im_m = \left|im\right|
                          
                          \\
                          1
                          \end{array}
                          
                          Derivation
                          1. Initial program 100.0%

                            \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right) \]
                          2. Add Preprocessing
                          3. Taylor expanded in im around 0

                            \[\leadsto \color{blue}{\cos re} \]
                          4. Step-by-step derivation
                            1. cos-lowering-cos.f6446.3%

                              \[\leadsto \mathsf{cos.f64}\left(re\right) \]
                          5. Simplified46.3%

                            \[\leadsto \color{blue}{\cos re} \]
                          6. Taylor expanded in re around 0

                            \[\leadsto \color{blue}{1} \]
                          7. Step-by-step derivation
                            1. Simplified26.9%

                              \[\leadsto \color{blue}{1} \]
                            2. Add Preprocessing

                            Reproduce

                            ?
                            herbie shell --seed 2024155 
                            (FPCore (re im)
                              :name "math.cos on complex, real part"
                              :precision binary64
                              (* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))