math.exp on complex, real part

Percentage Accurate: 100.0% → 100.0%
Time: 14.7s
Alternatives: 25
Speedup: 1.0×

Specification

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

\\
e^{re} \cdot \cos im
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

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

\\
e^{re} \cdot \cos im
\end{array}

Alternative 1: 100.0% accurate, 1.0× speedup?

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

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

    \[e^{re} \cdot \cos im \]
  2. Add Preprocessing
  3. Add Preprocessing

Alternative 2: 92.7% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;e^{re} \leq 10^{-125}:\\ \;\;\;\;e^{re}\\ \mathbf{elif}\;e^{re} \leq 1:\\ \;\;\;\;\cos im \cdot \left(re + \left(1 + \left(0.5 + re \cdot 0.16666666666666666\right) \cdot \left(re \cdot re\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;e^{re} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= (exp re) 1e-125)
   (exp re)
   (if (<= (exp re) 1.0)
     (*
      (cos im)
      (+ re (+ 1.0 (* (+ 0.5 (* re 0.16666666666666666)) (* re re)))))
     (* (exp re) (+ 1.0 (* im (* im -0.5)))))))
double code(double re, double im) {
	double tmp;
	if (exp(re) <= 1e-125) {
		tmp = exp(re);
	} else if (exp(re) <= 1.0) {
		tmp = cos(im) * (re + (1.0 + ((0.5 + (re * 0.16666666666666666)) * (re * re))));
	} else {
		tmp = exp(re) * (1.0 + (im * (im * -0.5)));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (exp(re) <= 1d-125) then
        tmp = exp(re)
    else if (exp(re) <= 1.0d0) then
        tmp = cos(im) * (re + (1.0d0 + ((0.5d0 + (re * 0.16666666666666666d0)) * (re * re))))
    else
        tmp = exp(re) * (1.0d0 + (im * (im * (-0.5d0))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (Math.exp(re) <= 1e-125) {
		tmp = Math.exp(re);
	} else if (Math.exp(re) <= 1.0) {
		tmp = Math.cos(im) * (re + (1.0 + ((0.5 + (re * 0.16666666666666666)) * (re * re))));
	} else {
		tmp = Math.exp(re) * (1.0 + (im * (im * -0.5)));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if math.exp(re) <= 1e-125:
		tmp = math.exp(re)
	elif math.exp(re) <= 1.0:
		tmp = math.cos(im) * (re + (1.0 + ((0.5 + (re * 0.16666666666666666)) * (re * re))))
	else:
		tmp = math.exp(re) * (1.0 + (im * (im * -0.5)))
	return tmp
function code(re, im)
	tmp = 0.0
	if (exp(re) <= 1e-125)
		tmp = exp(re);
	elseif (exp(re) <= 1.0)
		tmp = Float64(cos(im) * Float64(re + Float64(1.0 + Float64(Float64(0.5 + Float64(re * 0.16666666666666666)) * Float64(re * re)))));
	else
		tmp = Float64(exp(re) * Float64(1.0 + Float64(im * Float64(im * -0.5))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (exp(re) <= 1e-125)
		tmp = exp(re);
	elseif (exp(re) <= 1.0)
		tmp = cos(im) * (re + (1.0 + ((0.5 + (re * 0.16666666666666666)) * (re * re))));
	else
		tmp = exp(re) * (1.0 + (im * (im * -0.5)));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 1e-125], N[Exp[re], $MachinePrecision], If[LessEqual[N[Exp[re], $MachinePrecision], 1.0], N[(N[Cos[im], $MachinePrecision] * N[(re + N[(1.0 + N[(N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[re], $MachinePrecision] * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 10^{-125}:\\
\;\;\;\;e^{re}\\

\mathbf{elif}\;e^{re} \leq 1:\\
\;\;\;\;\cos im \cdot \left(re + \left(1 + \left(0.5 + re \cdot 0.16666666666666666\right) \cdot \left(re \cdot re\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;e^{re} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (exp.f64 re) < 1.00000000000000001e-125

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{e^{re}} \]
    4. Step-by-step derivation
      1. exp-lowering-exp.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified100.0%

      \[\leadsto \color{blue}{e^{re}} \]

    if 1.00000000000000001e-125 < (exp.f64 re) < 1

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right), \left(re \cdot re\right)\right), 1\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      13. *-lowering-*.f6499.5%

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

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

    if 1 < (exp.f64 re)

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 92.7% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;e^{re} \leq 10^{-125}:\\ \;\;\;\;e^{re}\\ \mathbf{elif}\;e^{re} \leq 1:\\ \;\;\;\;\cos im \cdot \left(1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;e^{re} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= (exp re) 1e-125)
   (exp re)
   (if (<= (exp re) 1.0)
     (*
      (cos im)
      (+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666)))))))
     (* (exp re) (+ 1.0 (* im (* im -0.5)))))))
double code(double re, double im) {
	double tmp;
	if (exp(re) <= 1e-125) {
		tmp = exp(re);
	} else if (exp(re) <= 1.0) {
		tmp = cos(im) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))));
	} else {
		tmp = exp(re) * (1.0 + (im * (im * -0.5)));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (exp(re) <= 1d-125) then
        tmp = exp(re)
    else if (exp(re) <= 1.0d0) then
        tmp = cos(im) * (1.0d0 + (re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0))))))
    else
        tmp = exp(re) * (1.0d0 + (im * (im * (-0.5d0))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (Math.exp(re) <= 1e-125) {
		tmp = Math.exp(re);
	} else if (Math.exp(re) <= 1.0) {
		tmp = Math.cos(im) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))));
	} else {
		tmp = Math.exp(re) * (1.0 + (im * (im * -0.5)));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if math.exp(re) <= 1e-125:
		tmp = math.exp(re)
	elif math.exp(re) <= 1.0:
		tmp = math.cos(im) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))))
	else:
		tmp = math.exp(re) * (1.0 + (im * (im * -0.5)))
	return tmp
function code(re, im)
	tmp = 0.0
	if (exp(re) <= 1e-125)
		tmp = exp(re);
	elseif (exp(re) <= 1.0)
		tmp = Float64(cos(im) * Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))))));
	else
		tmp = Float64(exp(re) * Float64(1.0 + Float64(im * Float64(im * -0.5))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (exp(re) <= 1e-125)
		tmp = exp(re);
	elseif (exp(re) <= 1.0)
		tmp = cos(im) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))));
	else
		tmp = exp(re) * (1.0 + (im * (im * -0.5)));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 1e-125], N[Exp[re], $MachinePrecision], If[LessEqual[N[Exp[re], $MachinePrecision], 1.0], N[(N[Cos[im], $MachinePrecision] * N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[re], $MachinePrecision] * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 10^{-125}:\\
\;\;\;\;e^{re}\\

\mathbf{elif}\;e^{re} \leq 1:\\
\;\;\;\;\cos im \cdot \left(1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;e^{re} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (exp.f64 re) < 1.00000000000000001e-125

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{e^{re}} \]
    4. Step-by-step derivation
      1. exp-lowering-exp.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified100.0%

      \[\leadsto \color{blue}{e^{re}} \]

    if 1.00000000000000001e-125 < (exp.f64 re) < 1

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

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

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

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

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

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

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

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

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

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

    if 1 < (exp.f64 re)

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 92.6% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;e^{re} \leq 10^{-125}:\\ \;\;\;\;e^{re}\\ \mathbf{elif}\;e^{re} \leq 1:\\ \;\;\;\;\cos im \cdot \left(1 + re \cdot \left(1 + re \cdot 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;e^{re} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= (exp re) 1e-125)
   (exp re)
   (if (<= (exp re) 1.0)
     (* (cos im) (+ 1.0 (* re (+ 1.0 (* re 0.5)))))
     (* (exp re) (+ 1.0 (* im (* im -0.5)))))))
double code(double re, double im) {
	double tmp;
	if (exp(re) <= 1e-125) {
		tmp = exp(re);
	} else if (exp(re) <= 1.0) {
		tmp = cos(im) * (1.0 + (re * (1.0 + (re * 0.5))));
	} else {
		tmp = exp(re) * (1.0 + (im * (im * -0.5)));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (exp(re) <= 1d-125) then
        tmp = exp(re)
    else if (exp(re) <= 1.0d0) then
        tmp = cos(im) * (1.0d0 + (re * (1.0d0 + (re * 0.5d0))))
    else
        tmp = exp(re) * (1.0d0 + (im * (im * (-0.5d0))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (Math.exp(re) <= 1e-125) {
		tmp = Math.exp(re);
	} else if (Math.exp(re) <= 1.0) {
		tmp = Math.cos(im) * (1.0 + (re * (1.0 + (re * 0.5))));
	} else {
		tmp = Math.exp(re) * (1.0 + (im * (im * -0.5)));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if math.exp(re) <= 1e-125:
		tmp = math.exp(re)
	elif math.exp(re) <= 1.0:
		tmp = math.cos(im) * (1.0 + (re * (1.0 + (re * 0.5))))
	else:
		tmp = math.exp(re) * (1.0 + (im * (im * -0.5)))
	return tmp
function code(re, im)
	tmp = 0.0
	if (exp(re) <= 1e-125)
		tmp = exp(re);
	elseif (exp(re) <= 1.0)
		tmp = Float64(cos(im) * Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5)))));
	else
		tmp = Float64(exp(re) * Float64(1.0 + Float64(im * Float64(im * -0.5))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (exp(re) <= 1e-125)
		tmp = exp(re);
	elseif (exp(re) <= 1.0)
		tmp = cos(im) * (1.0 + (re * (1.0 + (re * 0.5))));
	else
		tmp = exp(re) * (1.0 + (im * (im * -0.5)));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 1e-125], N[Exp[re], $MachinePrecision], If[LessEqual[N[Exp[re], $MachinePrecision], 1.0], N[(N[Cos[im], $MachinePrecision] * N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[re], $MachinePrecision] * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 10^{-125}:\\
\;\;\;\;e^{re}\\

\mathbf{elif}\;e^{re} \leq 1:\\
\;\;\;\;\cos im \cdot \left(1 + re \cdot \left(1 + re \cdot 0.5\right)\right)\\

\mathbf{else}:\\
\;\;\;\;e^{re} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (exp.f64 re) < 1.00000000000000001e-125

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{e^{re}} \]
    4. Step-by-step derivation
      1. exp-lowering-exp.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified100.0%

      \[\leadsto \color{blue}{e^{re}} \]

    if 1.00000000000000001e-125 < (exp.f64 re) < 1

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

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

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

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

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

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

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

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

    if 1 < (exp.f64 re)

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 92.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;e^{re} \leq 10^{-125}:\\ \;\;\;\;e^{re}\\ \mathbf{elif}\;e^{re} \leq 1:\\ \;\;\;\;\cos im \cdot \left(re + 1\right)\\ \mathbf{else}:\\ \;\;\;\;e^{re} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= (exp re) 1e-125)
   (exp re)
   (if (<= (exp re) 1.0)
     (* (cos im) (+ re 1.0))
     (* (exp re) (+ 1.0 (* im (* im -0.5)))))))
double code(double re, double im) {
	double tmp;
	if (exp(re) <= 1e-125) {
		tmp = exp(re);
	} else if (exp(re) <= 1.0) {
		tmp = cos(im) * (re + 1.0);
	} else {
		tmp = exp(re) * (1.0 + (im * (im * -0.5)));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (exp(re) <= 1d-125) then
        tmp = exp(re)
    else if (exp(re) <= 1.0d0) then
        tmp = cos(im) * (re + 1.0d0)
    else
        tmp = exp(re) * (1.0d0 + (im * (im * (-0.5d0))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (Math.exp(re) <= 1e-125) {
		tmp = Math.exp(re);
	} else if (Math.exp(re) <= 1.0) {
		tmp = Math.cos(im) * (re + 1.0);
	} else {
		tmp = Math.exp(re) * (1.0 + (im * (im * -0.5)));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if math.exp(re) <= 1e-125:
		tmp = math.exp(re)
	elif math.exp(re) <= 1.0:
		tmp = math.cos(im) * (re + 1.0)
	else:
		tmp = math.exp(re) * (1.0 + (im * (im * -0.5)))
	return tmp
function code(re, im)
	tmp = 0.0
	if (exp(re) <= 1e-125)
		tmp = exp(re);
	elseif (exp(re) <= 1.0)
		tmp = Float64(cos(im) * Float64(re + 1.0));
	else
		tmp = Float64(exp(re) * Float64(1.0 + Float64(im * Float64(im * -0.5))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (exp(re) <= 1e-125)
		tmp = exp(re);
	elseif (exp(re) <= 1.0)
		tmp = cos(im) * (re + 1.0);
	else
		tmp = exp(re) * (1.0 + (im * (im * -0.5)));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 1e-125], N[Exp[re], $MachinePrecision], If[LessEqual[N[Exp[re], $MachinePrecision], 1.0], N[(N[Cos[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Exp[re], $MachinePrecision] * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 10^{-125}:\\
\;\;\;\;e^{re}\\

\mathbf{elif}\;e^{re} \leq 1:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\

\mathbf{else}:\\
\;\;\;\;e^{re} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (exp.f64 re) < 1.00000000000000001e-125

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{e^{re}} \]
    4. Step-by-step derivation
      1. exp-lowering-exp.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified100.0%

      \[\leadsto \color{blue}{e^{re}} \]

    if 1.00000000000000001e-125 < (exp.f64 re) < 1

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

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

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

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

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

    if 1 < (exp.f64 re)

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 90.9% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(0.5 + re \cdot 0.16666666666666666\right) \cdot \left(re \cdot re\right)\\ \mathbf{if}\;re \leq -0.36:\\ \;\;\;\;e^{re}\\ \mathbf{elif}\;re \leq 620:\\ \;\;\;\;\cos im \cdot \left(re + 1\right)\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+102}:\\ \;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \frac{re \cdot re - t\_0 \cdot t\_0}{re - t\_0}\\ \mathbf{else}:\\ \;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.16666666666666666 + \frac{0.5}{re}\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (+ 0.5 (* re 0.16666666666666666)) (* re re))))
   (if (<= re -0.36)
     (exp re)
     (if (<= re 620.0)
       (* (cos im) (+ re 1.0))
       (if (<= re 5e+102)
         (*
          (+ 1.0 (* im (* im -0.5)))
          (/ (- (* re re) (* t_0 t_0)) (- re t_0)))
         (*
          (* re (* re re))
          (*
           (+ 1.0 (* -0.5 (* im im)))
           (+ 0.16666666666666666 (/ 0.5 re)))))))))
double code(double re, double im) {
	double t_0 = (0.5 + (re * 0.16666666666666666)) * (re * re);
	double tmp;
	if (re <= -0.36) {
		tmp = exp(re);
	} else if (re <= 620.0) {
		tmp = cos(im) * (re + 1.0);
	} else if (re <= 5e+102) {
		tmp = (1.0 + (im * (im * -0.5))) * (((re * re) - (t_0 * t_0)) / (re - t_0));
	} else {
		tmp = (re * (re * re)) * ((1.0 + (-0.5 * (im * im))) * (0.16666666666666666 + (0.5 / re)));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (0.5d0 + (re * 0.16666666666666666d0)) * (re * re)
    if (re <= (-0.36d0)) then
        tmp = exp(re)
    else if (re <= 620.0d0) then
        tmp = cos(im) * (re + 1.0d0)
    else if (re <= 5d+102) then
        tmp = (1.0d0 + (im * (im * (-0.5d0)))) * (((re * re) - (t_0 * t_0)) / (re - t_0))
    else
        tmp = (re * (re * re)) * ((1.0d0 + ((-0.5d0) * (im * im))) * (0.16666666666666666d0 + (0.5d0 / re)))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = (0.5 + (re * 0.16666666666666666)) * (re * re);
	double tmp;
	if (re <= -0.36) {
		tmp = Math.exp(re);
	} else if (re <= 620.0) {
		tmp = Math.cos(im) * (re + 1.0);
	} else if (re <= 5e+102) {
		tmp = (1.0 + (im * (im * -0.5))) * (((re * re) - (t_0 * t_0)) / (re - t_0));
	} else {
		tmp = (re * (re * re)) * ((1.0 + (-0.5 * (im * im))) * (0.16666666666666666 + (0.5 / re)));
	}
	return tmp;
}
def code(re, im):
	t_0 = (0.5 + (re * 0.16666666666666666)) * (re * re)
	tmp = 0
	if re <= -0.36:
		tmp = math.exp(re)
	elif re <= 620.0:
		tmp = math.cos(im) * (re + 1.0)
	elif re <= 5e+102:
		tmp = (1.0 + (im * (im * -0.5))) * (((re * re) - (t_0 * t_0)) / (re - t_0))
	else:
		tmp = (re * (re * re)) * ((1.0 + (-0.5 * (im * im))) * (0.16666666666666666 + (0.5 / re)))
	return tmp
function code(re, im)
	t_0 = Float64(Float64(0.5 + Float64(re * 0.16666666666666666)) * Float64(re * re))
	tmp = 0.0
	if (re <= -0.36)
		tmp = exp(re);
	elseif (re <= 620.0)
		tmp = Float64(cos(im) * Float64(re + 1.0));
	elseif (re <= 5e+102)
		tmp = Float64(Float64(1.0 + Float64(im * Float64(im * -0.5))) * Float64(Float64(Float64(re * re) - Float64(t_0 * t_0)) / Float64(re - t_0)));
	else
		tmp = Float64(Float64(re * Float64(re * re)) * Float64(Float64(1.0 + Float64(-0.5 * Float64(im * im))) * Float64(0.16666666666666666 + Float64(0.5 / re))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = (0.5 + (re * 0.16666666666666666)) * (re * re);
	tmp = 0.0;
	if (re <= -0.36)
		tmp = exp(re);
	elseif (re <= 620.0)
		tmp = cos(im) * (re + 1.0);
	elseif (re <= 5e+102)
		tmp = (1.0 + (im * (im * -0.5))) * (((re * re) - (t_0 * t_0)) / (re - t_0));
	else
		tmp = (re * (re * re)) * ((1.0 + (-0.5 * (im * im))) * (0.16666666666666666 + (0.5 / re)));
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.36], N[Exp[re], $MachinePrecision], If[LessEqual[re, 620.0], N[(N[Cos[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 5e+102], N[(N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(re * re), $MachinePrecision] - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(re - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.16666666666666666 + N[(0.5 / re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(0.5 + re \cdot 0.16666666666666666\right) \cdot \left(re \cdot re\right)\\
\mathbf{if}\;re \leq -0.36:\\
\;\;\;\;e^{re}\\

\mathbf{elif}\;re \leq 620:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\

\mathbf{elif}\;re \leq 5 \cdot 10^{+102}:\\
\;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \frac{re \cdot re - t\_0 \cdot t\_0}{re - t\_0}\\

\mathbf{else}:\\
\;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.16666666666666666 + \frac{0.5}{re}\right)\right)\\


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

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{e^{re}} \]
    4. Step-by-step derivation
      1. exp-lowering-exp.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified100.0%

      \[\leadsto \color{blue}{e^{re}} \]

    if -0.35999999999999999 < re < 620

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

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

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

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

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

    if 620 < re < 5e102

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \left(re \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      7. *-lowering-*.f645.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left({re}^{3} \cdot \left(\frac{1}{6} + \left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right)\right)\right)}, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
    10. Step-by-step derivation
      1. cube-multN/A

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right) \]
    12. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(re + \frac{\left(\frac{1}{4} - \left(re \cdot re\right) \cdot \frac{1}{36}\right) \cdot re}{\frac{1}{2} - re \cdot \frac{1}{6}} \cdot re\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
      9. flip-+N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(re \cdot re - \left(\frac{\left(\frac{1}{4} - \left(re \cdot re\right) \cdot \frac{1}{36}\right) \cdot re}{\frac{1}{2} - re \cdot \frac{1}{6}} \cdot re\right) \cdot \left(\frac{\left(\frac{1}{4} - \left(re \cdot re\right) \cdot \frac{1}{36}\right) \cdot re}{\frac{1}{2} - re \cdot \frac{1}{6}} \cdot re\right)\right), \left(re - \frac{\left(\frac{1}{4} - \left(re \cdot re\right) \cdot \frac{1}{36}\right) \cdot re}{\frac{1}{2} - re \cdot \frac{1}{6}} \cdot re\right)\right), \mathsf{+.f64}\left(\color{blue}{1}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
    13. Applied egg-rr82.4%

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

    if 5e102 < re

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\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(\frac{1}{6}, \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{re}\right)}\right)\right)\right) \]
      20. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\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(\frac{1}{6}, \left(\frac{\frac{1}{2} \cdot 1}{\color{blue}{re}}\right)\right)\right)\right) \]
    11. Simplified90.2%

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

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

Alternative 7: 90.1% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\\ t_1 := re + \left(-1 - re \cdot t\_0\right)\\ \mathbf{if}\;re \leq -0.36:\\ \;\;\;\;e^{re}\\ \mathbf{elif}\;re \leq 5.8 \cdot 10^{-21}:\\ \;\;\;\;\cos im\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+102}:\\ \;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \frac{1}{\frac{t\_1}{\left(1 + re \cdot \left(1 + t\_0\right)\right) \cdot t\_1}}\\ \mathbf{else}:\\ \;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.16666666666666666 + \frac{0.5}{re}\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* re (+ 0.5 (* re 0.16666666666666666))))
        (t_1 (+ re (- -1.0 (* re t_0)))))
   (if (<= re -0.36)
     (exp re)
     (if (<= re 5.8e-21)
       (cos im)
       (if (<= re 5e+102)
         (*
          (+ 1.0 (* im (* im -0.5)))
          (/ 1.0 (/ t_1 (* (+ 1.0 (* re (+ 1.0 t_0))) t_1))))
         (*
          (* re (* re re))
          (*
           (+ 1.0 (* -0.5 (* im im)))
           (+ 0.16666666666666666 (/ 0.5 re)))))))))
double code(double re, double im) {
	double t_0 = re * (0.5 + (re * 0.16666666666666666));
	double t_1 = re + (-1.0 - (re * t_0));
	double tmp;
	if (re <= -0.36) {
		tmp = exp(re);
	} else if (re <= 5.8e-21) {
		tmp = cos(im);
	} else if (re <= 5e+102) {
		tmp = (1.0 + (im * (im * -0.5))) * (1.0 / (t_1 / ((1.0 + (re * (1.0 + t_0))) * t_1)));
	} else {
		tmp = (re * (re * re)) * ((1.0 + (-0.5 * (im * im))) * (0.16666666666666666 + (0.5 / re)));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = re * (0.5d0 + (re * 0.16666666666666666d0))
    t_1 = re + ((-1.0d0) - (re * t_0))
    if (re <= (-0.36d0)) then
        tmp = exp(re)
    else if (re <= 5.8d-21) then
        tmp = cos(im)
    else if (re <= 5d+102) then
        tmp = (1.0d0 + (im * (im * (-0.5d0)))) * (1.0d0 / (t_1 / ((1.0d0 + (re * (1.0d0 + t_0))) * t_1)))
    else
        tmp = (re * (re * re)) * ((1.0d0 + ((-0.5d0) * (im * im))) * (0.16666666666666666d0 + (0.5d0 / re)))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = re * (0.5 + (re * 0.16666666666666666));
	double t_1 = re + (-1.0 - (re * t_0));
	double tmp;
	if (re <= -0.36) {
		tmp = Math.exp(re);
	} else if (re <= 5.8e-21) {
		tmp = Math.cos(im);
	} else if (re <= 5e+102) {
		tmp = (1.0 + (im * (im * -0.5))) * (1.0 / (t_1 / ((1.0 + (re * (1.0 + t_0))) * t_1)));
	} else {
		tmp = (re * (re * re)) * ((1.0 + (-0.5 * (im * im))) * (0.16666666666666666 + (0.5 / re)));
	}
	return tmp;
}
def code(re, im):
	t_0 = re * (0.5 + (re * 0.16666666666666666))
	t_1 = re + (-1.0 - (re * t_0))
	tmp = 0
	if re <= -0.36:
		tmp = math.exp(re)
	elif re <= 5.8e-21:
		tmp = math.cos(im)
	elif re <= 5e+102:
		tmp = (1.0 + (im * (im * -0.5))) * (1.0 / (t_1 / ((1.0 + (re * (1.0 + t_0))) * t_1)))
	else:
		tmp = (re * (re * re)) * ((1.0 + (-0.5 * (im * im))) * (0.16666666666666666 + (0.5 / re)))
	return tmp
function code(re, im)
	t_0 = Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))
	t_1 = Float64(re + Float64(-1.0 - Float64(re * t_0)))
	tmp = 0.0
	if (re <= -0.36)
		tmp = exp(re);
	elseif (re <= 5.8e-21)
		tmp = cos(im);
	elseif (re <= 5e+102)
		tmp = Float64(Float64(1.0 + Float64(im * Float64(im * -0.5))) * Float64(1.0 / Float64(t_1 / Float64(Float64(1.0 + Float64(re * Float64(1.0 + t_0))) * t_1))));
	else
		tmp = Float64(Float64(re * Float64(re * re)) * Float64(Float64(1.0 + Float64(-0.5 * Float64(im * im))) * Float64(0.16666666666666666 + Float64(0.5 / re))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = re * (0.5 + (re * 0.16666666666666666));
	t_1 = re + (-1.0 - (re * t_0));
	tmp = 0.0;
	if (re <= -0.36)
		tmp = exp(re);
	elseif (re <= 5.8e-21)
		tmp = cos(im);
	elseif (re <= 5e+102)
		tmp = (1.0 + (im * (im * -0.5))) * (1.0 / (t_1 / ((1.0 + (re * (1.0 + t_0))) * t_1)));
	else
		tmp = (re * (re * re)) * ((1.0 + (-0.5 * (im * im))) * (0.16666666666666666 + (0.5 / re)));
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re + N[(-1.0 - N[(re * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.36], N[Exp[re], $MachinePrecision], If[LessEqual[re, 5.8e-21], N[Cos[im], $MachinePrecision], If[LessEqual[re, 5e+102], N[(N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(t$95$1 / N[(N[(1.0 + N[(re * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.16666666666666666 + N[(0.5 / re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\\
t_1 := re + \left(-1 - re \cdot t\_0\right)\\
\mathbf{if}\;re \leq -0.36:\\
\;\;\;\;e^{re}\\

\mathbf{elif}\;re \leq 5.8 \cdot 10^{-21}:\\
\;\;\;\;\cos im\\

\mathbf{elif}\;re \leq 5 \cdot 10^{+102}:\\
\;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \frac{1}{\frac{t\_1}{\left(1 + re \cdot \left(1 + t\_0\right)\right) \cdot t\_1}}\\

\mathbf{else}:\\
\;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.16666666666666666 + \frac{0.5}{re}\right)\right)\\


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

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{e^{re}} \]
    4. Step-by-step derivation
      1. exp-lowering-exp.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified100.0%

      \[\leadsto \color{blue}{e^{re}} \]

    if -0.35999999999999999 < re < 5.8e-21

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\cos im} \]
    4. Step-by-step derivation
      1. cos-lowering-cos.f6499.1%

        \[\leadsto \mathsf{cos.f64}\left(im\right) \]
    5. Simplified99.1%

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

    if 5.8e-21 < re < 5e102

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \left(re \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      7. *-lowering-*.f6416.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\left(1 \cdot re + \left(re \cdot \left(\frac{1}{2} + re \cdot \frac{1}{6}\right)\right) \cdot re\right) + 1\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
      3. *-lft-identityN/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(re - \left(\left(\frac{1}{2} + re \cdot \frac{1}{6}\right) \cdot \left(re \cdot re\right) + 1\right)\right), \left(re \cdot re - \left(\left(\frac{1}{2} + re \cdot \frac{1}{6}\right) \cdot \left(re \cdot re\right) + 1\right) \cdot \left(\left(\frac{1}{2} + re \cdot \frac{1}{6}\right) \cdot \left(re \cdot re\right) + 1\right)\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
    10. Applied egg-rr84.3%

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

    if 5e102 < re

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\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(\frac{1}{6}, \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{re}\right)}\right)\right)\right) \]
      20. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\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(\frac{1}{6}, \left(\frac{\frac{1}{2} \cdot 1}{\color{blue}{re}}\right)\right)\right)\right) \]
    11. Simplified90.2%

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

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

Alternative 8: 75.0% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\\ t_1 := re + \left(-1 - re \cdot t\_0\right)\\ \mathbf{if}\;re \leq -102000:\\ \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;re \leq 5.8 \cdot 10^{-21}:\\ \;\;\;\;\cos im\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+102}:\\ \;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \frac{1}{\frac{t\_1}{\left(1 + re \cdot \left(1 + t\_0\right)\right) \cdot t\_1}}\\ \mathbf{else}:\\ \;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.16666666666666666 + \frac{0.5}{re}\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* re (+ 0.5 (* re 0.16666666666666666))))
        (t_1 (+ re (- -1.0 (* re t_0)))))
   (if (<= re -102000.0)
     (* 0.041666666666666664 (* (* im im) (* im im)))
     (if (<= re 5.8e-21)
       (cos im)
       (if (<= re 5e+102)
         (*
          (+ 1.0 (* im (* im -0.5)))
          (/ 1.0 (/ t_1 (* (+ 1.0 (* re (+ 1.0 t_0))) t_1))))
         (*
          (* re (* re re))
          (*
           (+ 1.0 (* -0.5 (* im im)))
           (+ 0.16666666666666666 (/ 0.5 re)))))))))
double code(double re, double im) {
	double t_0 = re * (0.5 + (re * 0.16666666666666666));
	double t_1 = re + (-1.0 - (re * t_0));
	double tmp;
	if (re <= -102000.0) {
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	} else if (re <= 5.8e-21) {
		tmp = cos(im);
	} else if (re <= 5e+102) {
		tmp = (1.0 + (im * (im * -0.5))) * (1.0 / (t_1 / ((1.0 + (re * (1.0 + t_0))) * t_1)));
	} else {
		tmp = (re * (re * re)) * ((1.0 + (-0.5 * (im * im))) * (0.16666666666666666 + (0.5 / re)));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = re * (0.5d0 + (re * 0.16666666666666666d0))
    t_1 = re + ((-1.0d0) - (re * t_0))
    if (re <= (-102000.0d0)) then
        tmp = 0.041666666666666664d0 * ((im * im) * (im * im))
    else if (re <= 5.8d-21) then
        tmp = cos(im)
    else if (re <= 5d+102) then
        tmp = (1.0d0 + (im * (im * (-0.5d0)))) * (1.0d0 / (t_1 / ((1.0d0 + (re * (1.0d0 + t_0))) * t_1)))
    else
        tmp = (re * (re * re)) * ((1.0d0 + ((-0.5d0) * (im * im))) * (0.16666666666666666d0 + (0.5d0 / re)))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = re * (0.5 + (re * 0.16666666666666666));
	double t_1 = re + (-1.0 - (re * t_0));
	double tmp;
	if (re <= -102000.0) {
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	} else if (re <= 5.8e-21) {
		tmp = Math.cos(im);
	} else if (re <= 5e+102) {
		tmp = (1.0 + (im * (im * -0.5))) * (1.0 / (t_1 / ((1.0 + (re * (1.0 + t_0))) * t_1)));
	} else {
		tmp = (re * (re * re)) * ((1.0 + (-0.5 * (im * im))) * (0.16666666666666666 + (0.5 / re)));
	}
	return tmp;
}
def code(re, im):
	t_0 = re * (0.5 + (re * 0.16666666666666666))
	t_1 = re + (-1.0 - (re * t_0))
	tmp = 0
	if re <= -102000.0:
		tmp = 0.041666666666666664 * ((im * im) * (im * im))
	elif re <= 5.8e-21:
		tmp = math.cos(im)
	elif re <= 5e+102:
		tmp = (1.0 + (im * (im * -0.5))) * (1.0 / (t_1 / ((1.0 + (re * (1.0 + t_0))) * t_1)))
	else:
		tmp = (re * (re * re)) * ((1.0 + (-0.5 * (im * im))) * (0.16666666666666666 + (0.5 / re)))
	return tmp
function code(re, im)
	t_0 = Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))
	t_1 = Float64(re + Float64(-1.0 - Float64(re * t_0)))
	tmp = 0.0
	if (re <= -102000.0)
		tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im)));
	elseif (re <= 5.8e-21)
		tmp = cos(im);
	elseif (re <= 5e+102)
		tmp = Float64(Float64(1.0 + Float64(im * Float64(im * -0.5))) * Float64(1.0 / Float64(t_1 / Float64(Float64(1.0 + Float64(re * Float64(1.0 + t_0))) * t_1))));
	else
		tmp = Float64(Float64(re * Float64(re * re)) * Float64(Float64(1.0 + Float64(-0.5 * Float64(im * im))) * Float64(0.16666666666666666 + Float64(0.5 / re))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = re * (0.5 + (re * 0.16666666666666666));
	t_1 = re + (-1.0 - (re * t_0));
	tmp = 0.0;
	if (re <= -102000.0)
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	elseif (re <= 5.8e-21)
		tmp = cos(im);
	elseif (re <= 5e+102)
		tmp = (1.0 + (im * (im * -0.5))) * (1.0 / (t_1 / ((1.0 + (re * (1.0 + t_0))) * t_1)));
	else
		tmp = (re * (re * re)) * ((1.0 + (-0.5 * (im * im))) * (0.16666666666666666 + (0.5 / re)));
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re + N[(-1.0 - N[(re * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -102000.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 5.8e-21], N[Cos[im], $MachinePrecision], If[LessEqual[re, 5e+102], N[(N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(t$95$1 / N[(N[(1.0 + N[(re * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.16666666666666666 + N[(0.5 / re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\\
t_1 := re + \left(-1 - re \cdot t\_0\right)\\
\mathbf{if}\;re \leq -102000:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\

\mathbf{elif}\;re \leq 5.8 \cdot 10^{-21}:\\
\;\;\;\;\cos im\\

\mathbf{elif}\;re \leq 5 \cdot 10^{+102}:\\
\;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \frac{1}{\frac{t\_1}{\left(1 + re \cdot \left(1 + t\_0\right)\right) \cdot t\_1}}\\

\mathbf{else}:\\
\;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.16666666666666666 + \frac{0.5}{re}\right)\right)\\


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

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\cos im} \]
    4. Step-by-step derivation
      1. cos-lowering-cos.f643.1%

        \[\leadsto \mathsf{cos.f64}\left(im\right) \]
    5. Simplified3.1%

      \[\leadsto \color{blue}{\cos im} \]
    6. Taylor expanded in im around 0

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left({im}^{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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(\left(im \cdot im\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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{\left(im \cdot \frac{1}{24}\right)}\right)\right)\right)\right) \]
      12. *-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 \frac{1}{24}\right)}\right)\right)\right)\right) \]
      13. *-lowering-*.f642.6%

        \[\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}{\frac{1}{24}}\right)\right)\right)\right)\right) \]
    8. Simplified2.6%

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

      \[\leadsto \color{blue}{\frac{1}{24} \cdot {im}^{4}} \]
    10. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    11. Simplified46.1%

      \[\leadsto \color{blue}{0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)} \]

    if -102000 < re < 5.8e-21

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\cos im} \]
    4. Step-by-step derivation
      1. cos-lowering-cos.f6497.7%

        \[\leadsto \mathsf{cos.f64}\left(im\right) \]
    5. Simplified97.7%

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

    if 5.8e-21 < re < 5e102

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \left(re \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      7. *-lowering-*.f6416.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\left(1 \cdot re + \left(re \cdot \left(\frac{1}{2} + re \cdot \frac{1}{6}\right)\right) \cdot re\right) + 1\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
      3. *-lft-identityN/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(re - \left(\left(\frac{1}{2} + re \cdot \frac{1}{6}\right) \cdot \left(re \cdot re\right) + 1\right)\right), \left(re \cdot re - \left(\left(\frac{1}{2} + re \cdot \frac{1}{6}\right) \cdot \left(re \cdot re\right) + 1\right) \cdot \left(\left(\frac{1}{2} + re \cdot \frac{1}{6}\right) \cdot \left(re \cdot re\right) + 1\right)\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
    10. Applied egg-rr84.3%

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

    if 5e102 < re

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\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(\frac{1}{6}, \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{re}\right)}\right)\right)\right) \]
      20. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\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(\frac{1}{6}, \left(\frac{\frac{1}{2} \cdot 1}{\color{blue}{re}}\right)\right)\right)\right) \]
    11. Simplified90.2%

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

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

Alternative 9: 54.6% accurate, 3.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\\ t_1 := re + \left(-1 - re \cdot t\_0\right)\\ \mathbf{if}\;re \leq -102000:\\ \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;re \leq 1.6 \cdot 10^{-35}:\\ \;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+102}:\\ \;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \frac{1}{\frac{t\_1}{\left(1 + re \cdot \left(1 + t\_0\right)\right) \cdot t\_1}}\\ \mathbf{else}:\\ \;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.16666666666666666 + \frac{0.5}{re}\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* re (+ 0.5 (* re 0.16666666666666666))))
        (t_1 (+ re (- -1.0 (* re t_0)))))
   (if (<= re -102000.0)
     (* 0.041666666666666664 (* (* im im) (* im im)))
     (if (<= re 1.6e-35)
       (+ 1.0 (* re (+ 1.0 (* re 0.5))))
       (if (<= re 5e+102)
         (*
          (+ 1.0 (* im (* im -0.5)))
          (/ 1.0 (/ t_1 (* (+ 1.0 (* re (+ 1.0 t_0))) t_1))))
         (*
          (* re (* re re))
          (*
           (+ 1.0 (* -0.5 (* im im)))
           (+ 0.16666666666666666 (/ 0.5 re)))))))))
double code(double re, double im) {
	double t_0 = re * (0.5 + (re * 0.16666666666666666));
	double t_1 = re + (-1.0 - (re * t_0));
	double tmp;
	if (re <= -102000.0) {
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	} else if (re <= 1.6e-35) {
		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
	} else if (re <= 5e+102) {
		tmp = (1.0 + (im * (im * -0.5))) * (1.0 / (t_1 / ((1.0 + (re * (1.0 + t_0))) * t_1)));
	} else {
		tmp = (re * (re * re)) * ((1.0 + (-0.5 * (im * im))) * (0.16666666666666666 + (0.5 / re)));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = re * (0.5d0 + (re * 0.16666666666666666d0))
    t_1 = re + ((-1.0d0) - (re * t_0))
    if (re <= (-102000.0d0)) then
        tmp = 0.041666666666666664d0 * ((im * im) * (im * im))
    else if (re <= 1.6d-35) then
        tmp = 1.0d0 + (re * (1.0d0 + (re * 0.5d0)))
    else if (re <= 5d+102) then
        tmp = (1.0d0 + (im * (im * (-0.5d0)))) * (1.0d0 / (t_1 / ((1.0d0 + (re * (1.0d0 + t_0))) * t_1)))
    else
        tmp = (re * (re * re)) * ((1.0d0 + ((-0.5d0) * (im * im))) * (0.16666666666666666d0 + (0.5d0 / re)))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = re * (0.5 + (re * 0.16666666666666666));
	double t_1 = re + (-1.0 - (re * t_0));
	double tmp;
	if (re <= -102000.0) {
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	} else if (re <= 1.6e-35) {
		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
	} else if (re <= 5e+102) {
		tmp = (1.0 + (im * (im * -0.5))) * (1.0 / (t_1 / ((1.0 + (re * (1.0 + t_0))) * t_1)));
	} else {
		tmp = (re * (re * re)) * ((1.0 + (-0.5 * (im * im))) * (0.16666666666666666 + (0.5 / re)));
	}
	return tmp;
}
def code(re, im):
	t_0 = re * (0.5 + (re * 0.16666666666666666))
	t_1 = re + (-1.0 - (re * t_0))
	tmp = 0
	if re <= -102000.0:
		tmp = 0.041666666666666664 * ((im * im) * (im * im))
	elif re <= 1.6e-35:
		tmp = 1.0 + (re * (1.0 + (re * 0.5)))
	elif re <= 5e+102:
		tmp = (1.0 + (im * (im * -0.5))) * (1.0 / (t_1 / ((1.0 + (re * (1.0 + t_0))) * t_1)))
	else:
		tmp = (re * (re * re)) * ((1.0 + (-0.5 * (im * im))) * (0.16666666666666666 + (0.5 / re)))
	return tmp
function code(re, im)
	t_0 = Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))
	t_1 = Float64(re + Float64(-1.0 - Float64(re * t_0)))
	tmp = 0.0
	if (re <= -102000.0)
		tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im)));
	elseif (re <= 1.6e-35)
		tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5))));
	elseif (re <= 5e+102)
		tmp = Float64(Float64(1.0 + Float64(im * Float64(im * -0.5))) * Float64(1.0 / Float64(t_1 / Float64(Float64(1.0 + Float64(re * Float64(1.0 + t_0))) * t_1))));
	else
		tmp = Float64(Float64(re * Float64(re * re)) * Float64(Float64(1.0 + Float64(-0.5 * Float64(im * im))) * Float64(0.16666666666666666 + Float64(0.5 / re))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = re * (0.5 + (re * 0.16666666666666666));
	t_1 = re + (-1.0 - (re * t_0));
	tmp = 0.0;
	if (re <= -102000.0)
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	elseif (re <= 1.6e-35)
		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
	elseif (re <= 5e+102)
		tmp = (1.0 + (im * (im * -0.5))) * (1.0 / (t_1 / ((1.0 + (re * (1.0 + t_0))) * t_1)));
	else
		tmp = (re * (re * re)) * ((1.0 + (-0.5 * (im * im))) * (0.16666666666666666 + (0.5 / re)));
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re + N[(-1.0 - N[(re * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -102000.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.6e-35], N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 5e+102], N[(N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(t$95$1 / N[(N[(1.0 + N[(re * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.16666666666666666 + N[(0.5 / re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\\
t_1 := re + \left(-1 - re \cdot t\_0\right)\\
\mathbf{if}\;re \leq -102000:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\

\mathbf{elif}\;re \leq 1.6 \cdot 10^{-35}:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\

\mathbf{elif}\;re \leq 5 \cdot 10^{+102}:\\
\;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \frac{1}{\frac{t\_1}{\left(1 + re \cdot \left(1 + t\_0\right)\right) \cdot t\_1}}\\

\mathbf{else}:\\
\;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.16666666666666666 + \frac{0.5}{re}\right)\right)\\


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

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\cos im} \]
    4. Step-by-step derivation
      1. cos-lowering-cos.f643.1%

        \[\leadsto \mathsf{cos.f64}\left(im\right) \]
    5. Simplified3.1%

      \[\leadsto \color{blue}{\cos im} \]
    6. Taylor expanded in im around 0

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left({im}^{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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(\left(im \cdot im\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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{\left(im \cdot \frac{1}{24}\right)}\right)\right)\right)\right) \]
      12. *-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 \frac{1}{24}\right)}\right)\right)\right)\right) \]
      13. *-lowering-*.f642.6%

        \[\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}{\frac{1}{24}}\right)\right)\right)\right)\right) \]
    8. Simplified2.6%

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

      \[\leadsto \color{blue}{\frac{1}{24} \cdot {im}^{4}} \]
    10. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    11. Simplified46.1%

      \[\leadsto \color{blue}{0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)} \]

    if -102000 < re < 1.5999999999999999e-35

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{e^{re}} \]
    4. Step-by-step derivation
      1. exp-lowering-exp.f6457.9%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified57.9%

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re around 0

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

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

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

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

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

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

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

    if 1.5999999999999999e-35 < re < 5e102

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \left(re \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      7. *-lowering-*.f6420.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\left(1 \cdot re + \left(re \cdot \left(\frac{1}{2} + re \cdot \frac{1}{6}\right)\right) \cdot re\right) + 1\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
      3. *-lft-identityN/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(re - \left(\left(\frac{1}{2} + re \cdot \frac{1}{6}\right) \cdot \left(re \cdot re\right) + 1\right)\right), \left(re \cdot re - \left(\left(\frac{1}{2} + re \cdot \frac{1}{6}\right) \cdot \left(re \cdot re\right) + 1\right) \cdot \left(\left(\frac{1}{2} + re \cdot \frac{1}{6}\right) \cdot \left(re \cdot re\right) + 1\right)\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
    10. Applied egg-rr82.4%

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

    if 5e102 < re

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\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(\frac{1}{6}, \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{re}\right)}\right)\right)\right) \]
      20. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\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(\frac{1}{6}, \left(\frac{\frac{1}{2} \cdot 1}{\color{blue}{re}}\right)\right)\right)\right) \]
    11. Simplified90.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -102000:\\ \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;re \leq 1.6 \cdot 10^{-35}:\\ \;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+102}:\\ \;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \frac{1}{\frac{re + \left(-1 - re \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)}{\left(1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right) \cdot \left(re + \left(-1 - re \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.16666666666666666 + \frac{0.5}{re}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 54.7% accurate, 3.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(0.5 + re \cdot 0.16666666666666666\right) \cdot \left(re \cdot re\right)\\ t_1 := 0.5 \cdot \left(re \cdot re\right)\\ \mathbf{if}\;re \leq -102000:\\ \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;re \leq 360:\\ \;\;\;\;1 + \frac{re \cdot re - t\_1 \cdot t\_1}{re - t\_1}\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+102}:\\ \;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \frac{re \cdot re - t\_0 \cdot t\_0}{re - t\_0}\\ \mathbf{else}:\\ \;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.16666666666666666 + \frac{0.5}{re}\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (+ 0.5 (* re 0.16666666666666666)) (* re re)))
        (t_1 (* 0.5 (* re re))))
   (if (<= re -102000.0)
     (* 0.041666666666666664 (* (* im im) (* im im)))
     (if (<= re 360.0)
       (+ 1.0 (/ (- (* re re) (* t_1 t_1)) (- re t_1)))
       (if (<= re 5e+102)
         (*
          (+ 1.0 (* im (* im -0.5)))
          (/ (- (* re re) (* t_0 t_0)) (- re t_0)))
         (*
          (* re (* re re))
          (*
           (+ 1.0 (* -0.5 (* im im)))
           (+ 0.16666666666666666 (/ 0.5 re)))))))))
double code(double re, double im) {
	double t_0 = (0.5 + (re * 0.16666666666666666)) * (re * re);
	double t_1 = 0.5 * (re * re);
	double tmp;
	if (re <= -102000.0) {
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	} else if (re <= 360.0) {
		tmp = 1.0 + (((re * re) - (t_1 * t_1)) / (re - t_1));
	} else if (re <= 5e+102) {
		tmp = (1.0 + (im * (im * -0.5))) * (((re * re) - (t_0 * t_0)) / (re - t_0));
	} else {
		tmp = (re * (re * re)) * ((1.0 + (-0.5 * (im * im))) * (0.16666666666666666 + (0.5 / re)));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (0.5d0 + (re * 0.16666666666666666d0)) * (re * re)
    t_1 = 0.5d0 * (re * re)
    if (re <= (-102000.0d0)) then
        tmp = 0.041666666666666664d0 * ((im * im) * (im * im))
    else if (re <= 360.0d0) then
        tmp = 1.0d0 + (((re * re) - (t_1 * t_1)) / (re - t_1))
    else if (re <= 5d+102) then
        tmp = (1.0d0 + (im * (im * (-0.5d0)))) * (((re * re) - (t_0 * t_0)) / (re - t_0))
    else
        tmp = (re * (re * re)) * ((1.0d0 + ((-0.5d0) * (im * im))) * (0.16666666666666666d0 + (0.5d0 / re)))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = (0.5 + (re * 0.16666666666666666)) * (re * re);
	double t_1 = 0.5 * (re * re);
	double tmp;
	if (re <= -102000.0) {
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	} else if (re <= 360.0) {
		tmp = 1.0 + (((re * re) - (t_1 * t_1)) / (re - t_1));
	} else if (re <= 5e+102) {
		tmp = (1.0 + (im * (im * -0.5))) * (((re * re) - (t_0 * t_0)) / (re - t_0));
	} else {
		tmp = (re * (re * re)) * ((1.0 + (-0.5 * (im * im))) * (0.16666666666666666 + (0.5 / re)));
	}
	return tmp;
}
def code(re, im):
	t_0 = (0.5 + (re * 0.16666666666666666)) * (re * re)
	t_1 = 0.5 * (re * re)
	tmp = 0
	if re <= -102000.0:
		tmp = 0.041666666666666664 * ((im * im) * (im * im))
	elif re <= 360.0:
		tmp = 1.0 + (((re * re) - (t_1 * t_1)) / (re - t_1))
	elif re <= 5e+102:
		tmp = (1.0 + (im * (im * -0.5))) * (((re * re) - (t_0 * t_0)) / (re - t_0))
	else:
		tmp = (re * (re * re)) * ((1.0 + (-0.5 * (im * im))) * (0.16666666666666666 + (0.5 / re)))
	return tmp
function code(re, im)
	t_0 = Float64(Float64(0.5 + Float64(re * 0.16666666666666666)) * Float64(re * re))
	t_1 = Float64(0.5 * Float64(re * re))
	tmp = 0.0
	if (re <= -102000.0)
		tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im)));
	elseif (re <= 360.0)
		tmp = Float64(1.0 + Float64(Float64(Float64(re * re) - Float64(t_1 * t_1)) / Float64(re - t_1)));
	elseif (re <= 5e+102)
		tmp = Float64(Float64(1.0 + Float64(im * Float64(im * -0.5))) * Float64(Float64(Float64(re * re) - Float64(t_0 * t_0)) / Float64(re - t_0)));
	else
		tmp = Float64(Float64(re * Float64(re * re)) * Float64(Float64(1.0 + Float64(-0.5 * Float64(im * im))) * Float64(0.16666666666666666 + Float64(0.5 / re))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = (0.5 + (re * 0.16666666666666666)) * (re * re);
	t_1 = 0.5 * (re * re);
	tmp = 0.0;
	if (re <= -102000.0)
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	elseif (re <= 360.0)
		tmp = 1.0 + (((re * re) - (t_1 * t_1)) / (re - t_1));
	elseif (re <= 5e+102)
		tmp = (1.0 + (im * (im * -0.5))) * (((re * re) - (t_0 * t_0)) / (re - t_0));
	else
		tmp = (re * (re * re)) * ((1.0 + (-0.5 * (im * im))) * (0.16666666666666666 + (0.5 / re)));
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -102000.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 360.0], N[(1.0 + N[(N[(N[(re * re), $MachinePrecision] - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(re - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 5e+102], N[(N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(re * re), $MachinePrecision] - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(re - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.16666666666666666 + N[(0.5 / re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(0.5 + re \cdot 0.16666666666666666\right) \cdot \left(re \cdot re\right)\\
t_1 := 0.5 \cdot \left(re \cdot re\right)\\
\mathbf{if}\;re \leq -102000:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\

\mathbf{elif}\;re \leq 360:\\
\;\;\;\;1 + \frac{re \cdot re - t\_1 \cdot t\_1}{re - t\_1}\\

\mathbf{elif}\;re \leq 5 \cdot 10^{+102}:\\
\;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \frac{re \cdot re - t\_0 \cdot t\_0}{re - t\_0}\\

\mathbf{else}:\\
\;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.16666666666666666 + \frac{0.5}{re}\right)\right)\\


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

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\cos im} \]
    4. Step-by-step derivation
      1. cos-lowering-cos.f643.1%

        \[\leadsto \mathsf{cos.f64}\left(im\right) \]
    5. Simplified3.1%

      \[\leadsto \color{blue}{\cos im} \]
    6. Taylor expanded in im around 0

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left({im}^{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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(\left(im \cdot im\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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{\left(im \cdot \frac{1}{24}\right)}\right)\right)\right)\right) \]
      12. *-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 \frac{1}{24}\right)}\right)\right)\right)\right) \]
      13. *-lowering-*.f642.6%

        \[\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}{\frac{1}{24}}\right)\right)\right)\right)\right) \]
    8. Simplified2.6%

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

      \[\leadsto \color{blue}{\frac{1}{24} \cdot {im}^{4}} \]
    10. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    11. Simplified46.1%

      \[\leadsto \color{blue}{0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)} \]

    if -102000 < re < 360

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{e^{re}} \]
    4. Step-by-step derivation
      1. exp-lowering-exp.f6458.3%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified58.3%

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re around 0

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \left(re \cdot \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
      5. *-lowering-*.f6456.9%

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

      \[\leadsto \color{blue}{1 + re \cdot \left(1 + re \cdot 0.5\right)} \]
    9. Step-by-step derivation
      1. distribute-lft-inN/A

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

        \[\leadsto \mathsf{+.f64}\left(1, \left(re + \color{blue}{re} \cdot \left(re \cdot \frac{1}{2}\right)\right)\right) \]
      3. flip-+N/A

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

        \[\leadsto \mathsf{+.f64}\left(1, \left(\frac{re \cdot re - \left(re \cdot \left(re \cdot \frac{1}{2}\right)\right) \cdot \left(re \cdot \left(re \cdot \frac{1}{2}\right)\right)}{re \cdot 1 - \color{blue}{re} \cdot \left(re \cdot \frac{1}{2}\right)}\right)\right) \]
      5. fmm-defN/A

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

        \[\leadsto \mathsf{+.f64}\left(1, \left(\frac{re \cdot re - \left(re \cdot \left(re \cdot \frac{1}{2}\right)\right) \cdot \left(re \cdot \left(re \cdot \frac{1}{2}\right)\right)}{\mathsf{fma}\left(re, 1, \mathsf{neg}\left(\left(re \cdot \frac{1}{2}\right) \cdot re\right)\right)}\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\left(re \cdot re - \left(re \cdot \left(re \cdot \frac{1}{2}\right)\right) \cdot \left(re \cdot \left(re \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\mathsf{fma}\left(re, 1, \mathsf{neg}\left(\left(re \cdot \frac{1}{2}\right) \cdot re\right)\right)\right)}\right)\right) \]
    10. Applied egg-rr56.9%

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

    if 360 < re < 5e102

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \left(re \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      7. *-lowering-*.f645.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left({re}^{3} \cdot \left(\frac{1}{6} + \left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right)\right)\right)}, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
    10. Step-by-step derivation
      1. cube-multN/A

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right) \]
    12. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(re + \frac{\left(\frac{1}{4} - \left(re \cdot re\right) \cdot \frac{1}{36}\right) \cdot re}{\frac{1}{2} - re \cdot \frac{1}{6}} \cdot re\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
      9. flip-+N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(re \cdot re - \left(\frac{\left(\frac{1}{4} - \left(re \cdot re\right) \cdot \frac{1}{36}\right) \cdot re}{\frac{1}{2} - re \cdot \frac{1}{6}} \cdot re\right) \cdot \left(\frac{\left(\frac{1}{4} - \left(re \cdot re\right) \cdot \frac{1}{36}\right) \cdot re}{\frac{1}{2} - re \cdot \frac{1}{6}} \cdot re\right)\right), \left(re - \frac{\left(\frac{1}{4} - \left(re \cdot re\right) \cdot \frac{1}{36}\right) \cdot re}{\frac{1}{2} - re \cdot \frac{1}{6}} \cdot re\right)\right), \mathsf{+.f64}\left(\color{blue}{1}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
    13. Applied egg-rr82.4%

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

    if 5e102 < re

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\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(\frac{1}{6}, \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{re}\right)}\right)\right)\right) \]
      20. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\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(\frac{1}{6}, \left(\frac{\frac{1}{2} \cdot 1}{\color{blue}{re}}\right)\right)\right)\right) \]
    11. Simplified90.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -102000:\\ \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;re \leq 360:\\ \;\;\;\;1 + \frac{re \cdot re - \left(0.5 \cdot \left(re \cdot re\right)\right) \cdot \left(0.5 \cdot \left(re \cdot re\right)\right)}{re - 0.5 \cdot \left(re \cdot re\right)}\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+102}:\\ \;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \frac{re \cdot re - \left(\left(0.5 + re \cdot 0.16666666666666666\right) \cdot \left(re \cdot re\right)\right) \cdot \left(\left(0.5 + re \cdot 0.16666666666666666\right) \cdot \left(re \cdot re\right)\right)}{re - \left(0.5 + re \cdot 0.16666666666666666\right) \cdot \left(re \cdot re\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.16666666666666666 + \frac{0.5}{re}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 53.7% accurate, 3.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(re \cdot re\right)\\ t_1 := 1 + im \cdot \left(im \cdot -0.5\right)\\ \mathbf{if}\;re \leq -102000:\\ \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;re \leq 82:\\ \;\;\;\;1 + \frac{re \cdot re - t\_0 \cdot t\_0}{re - t\_0}\\ \mathbf{elif}\;re \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;t\_1 \cdot \left(re \cdot \left(1 + \frac{\left(0.0625 - \left(\left(re \cdot re\right) \cdot \left(re \cdot re\right)\right) \cdot 0.0007716049382716049\right) \cdot \frac{re}{0.5 + re \cdot -0.16666666666666666}}{0.25 + \left(re \cdot re\right) \cdot 0.027777777777777776}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \left(1 + re \cdot \left(1 + re \cdot 0.5\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* 0.5 (* re re))) (t_1 (+ 1.0 (* im (* im -0.5)))))
   (if (<= re -102000.0)
     (* 0.041666666666666664 (* (* im im) (* im im)))
     (if (<= re 82.0)
       (+ 1.0 (/ (- (* re re) (* t_0 t_0)) (- re t_0)))
       (if (<= re 1.35e+154)
         (*
          t_1
          (*
           re
           (+
            1.0
            (/
             (*
              (- 0.0625 (* (* (* re re) (* re re)) 0.0007716049382716049))
              (/ re (+ 0.5 (* re -0.16666666666666666))))
             (+ 0.25 (* (* re re) 0.027777777777777776))))))
         (* t_1 (+ 1.0 (* re (+ 1.0 (* re 0.5))))))))))
double code(double re, double im) {
	double t_0 = 0.5 * (re * re);
	double t_1 = 1.0 + (im * (im * -0.5));
	double tmp;
	if (re <= -102000.0) {
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	} else if (re <= 82.0) {
		tmp = 1.0 + (((re * re) - (t_0 * t_0)) / (re - t_0));
	} else if (re <= 1.35e+154) {
		tmp = t_1 * (re * (1.0 + (((0.0625 - (((re * re) * (re * re)) * 0.0007716049382716049)) * (re / (0.5 + (re * -0.16666666666666666)))) / (0.25 + ((re * re) * 0.027777777777777776)))));
	} else {
		tmp = t_1 * (1.0 + (re * (1.0 + (re * 0.5))));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 0.5d0 * (re * re)
    t_1 = 1.0d0 + (im * (im * (-0.5d0)))
    if (re <= (-102000.0d0)) then
        tmp = 0.041666666666666664d0 * ((im * im) * (im * im))
    else if (re <= 82.0d0) then
        tmp = 1.0d0 + (((re * re) - (t_0 * t_0)) / (re - t_0))
    else if (re <= 1.35d+154) then
        tmp = t_1 * (re * (1.0d0 + (((0.0625d0 - (((re * re) * (re * re)) * 0.0007716049382716049d0)) * (re / (0.5d0 + (re * (-0.16666666666666666d0))))) / (0.25d0 + ((re * re) * 0.027777777777777776d0)))))
    else
        tmp = t_1 * (1.0d0 + (re * (1.0d0 + (re * 0.5d0))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = 0.5 * (re * re);
	double t_1 = 1.0 + (im * (im * -0.5));
	double tmp;
	if (re <= -102000.0) {
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	} else if (re <= 82.0) {
		tmp = 1.0 + (((re * re) - (t_0 * t_0)) / (re - t_0));
	} else if (re <= 1.35e+154) {
		tmp = t_1 * (re * (1.0 + (((0.0625 - (((re * re) * (re * re)) * 0.0007716049382716049)) * (re / (0.5 + (re * -0.16666666666666666)))) / (0.25 + ((re * re) * 0.027777777777777776)))));
	} else {
		tmp = t_1 * (1.0 + (re * (1.0 + (re * 0.5))));
	}
	return tmp;
}
def code(re, im):
	t_0 = 0.5 * (re * re)
	t_1 = 1.0 + (im * (im * -0.5))
	tmp = 0
	if re <= -102000.0:
		tmp = 0.041666666666666664 * ((im * im) * (im * im))
	elif re <= 82.0:
		tmp = 1.0 + (((re * re) - (t_0 * t_0)) / (re - t_0))
	elif re <= 1.35e+154:
		tmp = t_1 * (re * (1.0 + (((0.0625 - (((re * re) * (re * re)) * 0.0007716049382716049)) * (re / (0.5 + (re * -0.16666666666666666)))) / (0.25 + ((re * re) * 0.027777777777777776)))))
	else:
		tmp = t_1 * (1.0 + (re * (1.0 + (re * 0.5))))
	return tmp
function code(re, im)
	t_0 = Float64(0.5 * Float64(re * re))
	t_1 = Float64(1.0 + Float64(im * Float64(im * -0.5)))
	tmp = 0.0
	if (re <= -102000.0)
		tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im)));
	elseif (re <= 82.0)
		tmp = Float64(1.0 + Float64(Float64(Float64(re * re) - Float64(t_0 * t_0)) / Float64(re - t_0)));
	elseif (re <= 1.35e+154)
		tmp = Float64(t_1 * Float64(re * Float64(1.0 + Float64(Float64(Float64(0.0625 - Float64(Float64(Float64(re * re) * Float64(re * re)) * 0.0007716049382716049)) * Float64(re / Float64(0.5 + Float64(re * -0.16666666666666666)))) / Float64(0.25 + Float64(Float64(re * re) * 0.027777777777777776))))));
	else
		tmp = Float64(t_1 * Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5)))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 0.5 * (re * re);
	t_1 = 1.0 + (im * (im * -0.5));
	tmp = 0.0;
	if (re <= -102000.0)
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	elseif (re <= 82.0)
		tmp = 1.0 + (((re * re) - (t_0 * t_0)) / (re - t_0));
	elseif (re <= 1.35e+154)
		tmp = t_1 * (re * (1.0 + (((0.0625 - (((re * re) * (re * re)) * 0.0007716049382716049)) * (re / (0.5 + (re * -0.16666666666666666)))) / (0.25 + ((re * re) * 0.027777777777777776)))));
	else
		tmp = t_1 * (1.0 + (re * (1.0 + (re * 0.5))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -102000.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 82.0], N[(1.0 + N[(N[(N[(re * re), $MachinePrecision] - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(re - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.35e+154], N[(t$95$1 * N[(re * N[(1.0 + N[(N[(N[(0.0625 - N[(N[(N[(re * re), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision] * 0.0007716049382716049), $MachinePrecision]), $MachinePrecision] * N[(re / N[(0.5 + N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.25 + N[(N[(re * re), $MachinePrecision] * 0.027777777777777776), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(re \cdot re\right)\\
t_1 := 1 + im \cdot \left(im \cdot -0.5\right)\\
\mathbf{if}\;re \leq -102000:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\

\mathbf{elif}\;re \leq 82:\\
\;\;\;\;1 + \frac{re \cdot re - t\_0 \cdot t\_0}{re - t\_0}\\

\mathbf{elif}\;re \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t\_1 \cdot \left(re \cdot \left(1 + \frac{\left(0.0625 - \left(\left(re \cdot re\right) \cdot \left(re \cdot re\right)\right) \cdot 0.0007716049382716049\right) \cdot \frac{re}{0.5 + re \cdot -0.16666666666666666}}{0.25 + \left(re \cdot re\right) \cdot 0.027777777777777776}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(1 + re \cdot \left(1 + re \cdot 0.5\right)\right)\\


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

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\cos im} \]
    4. Step-by-step derivation
      1. cos-lowering-cos.f643.1%

        \[\leadsto \mathsf{cos.f64}\left(im\right) \]
    5. Simplified3.1%

      \[\leadsto \color{blue}{\cos im} \]
    6. Taylor expanded in im around 0

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left({im}^{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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(\left(im \cdot im\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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{\left(im \cdot \frac{1}{24}\right)}\right)\right)\right)\right) \]
      12. *-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 \frac{1}{24}\right)}\right)\right)\right)\right) \]
      13. *-lowering-*.f642.6%

        \[\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}{\frac{1}{24}}\right)\right)\right)\right)\right) \]
    8. Simplified2.6%

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

      \[\leadsto \color{blue}{\frac{1}{24} \cdot {im}^{4}} \]
    10. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    11. Simplified46.1%

      \[\leadsto \color{blue}{0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)} \]

    if -102000 < re < 82

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{e^{re}} \]
    4. Step-by-step derivation
      1. exp-lowering-exp.f6458.3%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified58.3%

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re around 0

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \left(re \cdot \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
      5. *-lowering-*.f6456.9%

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

      \[\leadsto \color{blue}{1 + re \cdot \left(1 + re \cdot 0.5\right)} \]
    9. Step-by-step derivation
      1. distribute-lft-inN/A

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

        \[\leadsto \mathsf{+.f64}\left(1, \left(re + \color{blue}{re} \cdot \left(re \cdot \frac{1}{2}\right)\right)\right) \]
      3. flip-+N/A

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

        \[\leadsto \mathsf{+.f64}\left(1, \left(\frac{re \cdot re - \left(re \cdot \left(re \cdot \frac{1}{2}\right)\right) \cdot \left(re \cdot \left(re \cdot \frac{1}{2}\right)\right)}{re \cdot 1 - \color{blue}{re} \cdot \left(re \cdot \frac{1}{2}\right)}\right)\right) \]
      5. fmm-defN/A

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

        \[\leadsto \mathsf{+.f64}\left(1, \left(\frac{re \cdot re - \left(re \cdot \left(re \cdot \frac{1}{2}\right)\right) \cdot \left(re \cdot \left(re \cdot \frac{1}{2}\right)\right)}{\mathsf{fma}\left(re, 1, \mathsf{neg}\left(\left(re \cdot \frac{1}{2}\right) \cdot re\right)\right)}\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\left(re \cdot re - \left(re \cdot \left(re \cdot \frac{1}{2}\right)\right) \cdot \left(re \cdot \left(re \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\mathsf{fma}\left(re, 1, \mathsf{neg}\left(\left(re \cdot \frac{1}{2}\right) \cdot re\right)\right)\right)}\right)\right) \]
    10. Applied egg-rr56.9%

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

    if 82 < re < 1.35000000000000003e154

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \left(re \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      7. *-lowering-*.f6446.1%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left({re}^{3} \cdot \left(\frac{1}{6} + \left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right)\right)\right)}, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
    10. Step-by-step derivation
      1. cube-multN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \left(\left(\frac{1}{4} - \left(re \cdot re\right) \cdot \frac{1}{36}\right) \cdot \frac{re}{\frac{1}{2} - re \cdot \frac{1}{6}}\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
      8. flip--N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\left(\left(\frac{1}{4} \cdot \frac{1}{4} - \left(\left(re \cdot re\right) \cdot \frac{1}{36}\right) \cdot \left(\left(re \cdot re\right) \cdot \frac{1}{36}\right)\right) \cdot \frac{re}{\frac{1}{2} - re \cdot \frac{1}{6}}\right), \left(\frac{1}{4} + \left(re \cdot re\right) \cdot \frac{1}{36}\right)\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
    13. Applied egg-rr69.1%

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

    if 1.35000000000000003e154 < re

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(re\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \left(im \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
      12. *-lowering-*.f6496.6%

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \left(re \cdot \frac{1}{2}\right)\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
      5. *-lowering-*.f6496.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -102000:\\ \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;re \leq 82:\\ \;\;\;\;1 + \frac{re \cdot re - \left(0.5 \cdot \left(re \cdot re\right)\right) \cdot \left(0.5 \cdot \left(re \cdot re\right)\right)}{re - 0.5 \cdot \left(re \cdot re\right)}\\ \mathbf{elif}\;re \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \left(re \cdot \left(1 + \frac{\left(0.0625 - \left(\left(re \cdot re\right) \cdot \left(re \cdot re\right)\right) \cdot 0.0007716049382716049\right) \cdot \frac{re}{0.5 + re \cdot -0.16666666666666666}}{0.25 + \left(re \cdot re\right) \cdot 0.027777777777777776}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \left(1 + re \cdot \left(1 + re \cdot 0.5\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 52.9% accurate, 5.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(re \cdot re\right)\\ \mathbf{if}\;re \leq -102000:\\ \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;re \leq 8 \cdot 10^{+133}:\\ \;\;\;\;1 + \frac{re \cdot re - t\_0 \cdot t\_0}{re - t\_0}\\ \mathbf{else}:\\ \;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(0.16666666666666666 + \left(im \cdot im\right) \cdot -0.08333333333333333\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* 0.5 (* re re))))
   (if (<= re -102000.0)
     (* 0.041666666666666664 (* (* im im) (* im im)))
     (if (<= re 8e+133)
       (+ 1.0 (/ (- (* re re) (* t_0 t_0)) (- re t_0)))
       (*
        (* re (* re re))
        (+ 0.16666666666666666 (* (* im im) -0.08333333333333333)))))))
double code(double re, double im) {
	double t_0 = 0.5 * (re * re);
	double tmp;
	if (re <= -102000.0) {
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	} else if (re <= 8e+133) {
		tmp = 1.0 + (((re * re) - (t_0 * t_0)) / (re - t_0));
	} else {
		tmp = (re * (re * re)) * (0.16666666666666666 + ((im * im) * -0.08333333333333333));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 0.5d0 * (re * re)
    if (re <= (-102000.0d0)) then
        tmp = 0.041666666666666664d0 * ((im * im) * (im * im))
    else if (re <= 8d+133) then
        tmp = 1.0d0 + (((re * re) - (t_0 * t_0)) / (re - t_0))
    else
        tmp = (re * (re * re)) * (0.16666666666666666d0 + ((im * im) * (-0.08333333333333333d0)))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = 0.5 * (re * re);
	double tmp;
	if (re <= -102000.0) {
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	} else if (re <= 8e+133) {
		tmp = 1.0 + (((re * re) - (t_0 * t_0)) / (re - t_0));
	} else {
		tmp = (re * (re * re)) * (0.16666666666666666 + ((im * im) * -0.08333333333333333));
	}
	return tmp;
}
def code(re, im):
	t_0 = 0.5 * (re * re)
	tmp = 0
	if re <= -102000.0:
		tmp = 0.041666666666666664 * ((im * im) * (im * im))
	elif re <= 8e+133:
		tmp = 1.0 + (((re * re) - (t_0 * t_0)) / (re - t_0))
	else:
		tmp = (re * (re * re)) * (0.16666666666666666 + ((im * im) * -0.08333333333333333))
	return tmp
function code(re, im)
	t_0 = Float64(0.5 * Float64(re * re))
	tmp = 0.0
	if (re <= -102000.0)
		tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im)));
	elseif (re <= 8e+133)
		tmp = Float64(1.0 + Float64(Float64(Float64(re * re) - Float64(t_0 * t_0)) / Float64(re - t_0)));
	else
		tmp = Float64(Float64(re * Float64(re * re)) * Float64(0.16666666666666666 + Float64(Float64(im * im) * -0.08333333333333333)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 0.5 * (re * re);
	tmp = 0.0;
	if (re <= -102000.0)
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	elseif (re <= 8e+133)
		tmp = 1.0 + (((re * re) - (t_0 * t_0)) / (re - t_0));
	else
		tmp = (re * (re * re)) * (0.16666666666666666 + ((im * im) * -0.08333333333333333));
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -102000.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 8e+133], N[(1.0 + N[(N[(N[(re * re), $MachinePrecision] - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(re - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(0.16666666666666666 + N[(N[(im * im), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(re \cdot re\right)\\
\mathbf{if}\;re \leq -102000:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\

\mathbf{elif}\;re \leq 8 \cdot 10^{+133}:\\
\;\;\;\;1 + \frac{re \cdot re - t\_0 \cdot t\_0}{re - t\_0}\\

\mathbf{else}:\\
\;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(0.16666666666666666 + \left(im \cdot im\right) \cdot -0.08333333333333333\right)\\


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

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\cos im} \]
    4. Step-by-step derivation
      1. cos-lowering-cos.f643.1%

        \[\leadsto \mathsf{cos.f64}\left(im\right) \]
    5. Simplified3.1%

      \[\leadsto \color{blue}{\cos im} \]
    6. Taylor expanded in im around 0

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left({im}^{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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(\left(im \cdot im\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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{\left(im \cdot \frac{1}{24}\right)}\right)\right)\right)\right) \]
      12. *-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 \frac{1}{24}\right)}\right)\right)\right)\right) \]
      13. *-lowering-*.f642.6%

        \[\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}{\frac{1}{24}}\right)\right)\right)\right)\right) \]
    8. Simplified2.6%

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

      \[\leadsto \color{blue}{\frac{1}{24} \cdot {im}^{4}} \]
    10. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    11. Simplified46.1%

      \[\leadsto \color{blue}{0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)} \]

    if -102000 < re < 8.0000000000000002e133

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{e^{re}} \]
    4. Step-by-step derivation
      1. exp-lowering-exp.f6459.2%

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

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re around 0

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \left(re \cdot \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
      5. *-lowering-*.f6449.6%

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

      \[\leadsto \color{blue}{1 + re \cdot \left(1 + re \cdot 0.5\right)} \]
    9. Step-by-step derivation
      1. distribute-lft-inN/A

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

        \[\leadsto \mathsf{+.f64}\left(1, \left(re + \color{blue}{re} \cdot \left(re \cdot \frac{1}{2}\right)\right)\right) \]
      3. flip-+N/A

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

        \[\leadsto \mathsf{+.f64}\left(1, \left(\frac{re \cdot re - \left(re \cdot \left(re \cdot \frac{1}{2}\right)\right) \cdot \left(re \cdot \left(re \cdot \frac{1}{2}\right)\right)}{re \cdot 1 - \color{blue}{re} \cdot \left(re \cdot \frac{1}{2}\right)}\right)\right) \]
      5. fmm-defN/A

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

        \[\leadsto \mathsf{+.f64}\left(1, \left(\frac{re \cdot re - \left(re \cdot \left(re \cdot \frac{1}{2}\right)\right) \cdot \left(re \cdot \left(re \cdot \frac{1}{2}\right)\right)}{\mathsf{fma}\left(re, 1, \mathsf{neg}\left(\left(re \cdot \frac{1}{2}\right) \cdot re\right)\right)}\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\left(re \cdot re - \left(re \cdot \left(re \cdot \frac{1}{2}\right)\right) \cdot \left(re \cdot \left(re \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\mathsf{fma}\left(re, 1, \mathsf{neg}\left(\left(re \cdot \frac{1}{2}\right) \cdot re\right)\right)\right)}\right)\right) \]
    10. Applied egg-rr55.8%

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

    if 8.0000000000000002e133 < re

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\right), \mathsf{+.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{\frac{1}{6}} \cdot \frac{-1}{2}\right)\right)\right)\right) \]
      21. metadata-eval94.1%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\right), \mathsf{+.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{12}\right)\right)\right) \]
    11. Simplified94.1%

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

Alternative 13: 52.5% accurate, 6.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -102000:\\ \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;re \leq 1.6 \cdot 10^{-35}:\\ \;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \left(1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re -102000.0)
   (* 0.041666666666666664 (* (* im im) (* im im)))
   (if (<= re 1.6e-35)
     (+ 1.0 (* re (+ 1.0 (* re 0.5))))
     (*
      (+ 1.0 (* im (* im -0.5)))
      (+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666))))))))))
double code(double re, double im) {
	double tmp;
	if (re <= -102000.0) {
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	} else if (re <= 1.6e-35) {
		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
	} else {
		tmp = (1.0 + (im * (im * -0.5))) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= (-102000.0d0)) then
        tmp = 0.041666666666666664d0 * ((im * im) * (im * im))
    else if (re <= 1.6d-35) then
        tmp = 1.0d0 + (re * (1.0d0 + (re * 0.5d0)))
    else
        tmp = (1.0d0 + (im * (im * (-0.5d0)))) * (1.0d0 + (re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0))))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= -102000.0) {
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	} else if (re <= 1.6e-35) {
		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
	} else {
		tmp = (1.0 + (im * (im * -0.5))) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= -102000.0:
		tmp = 0.041666666666666664 * ((im * im) * (im * im))
	elif re <= 1.6e-35:
		tmp = 1.0 + (re * (1.0 + (re * 0.5)))
	else:
		tmp = (1.0 + (im * (im * -0.5))) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= -102000.0)
		tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im)));
	elseif (re <= 1.6e-35)
		tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5))));
	else
		tmp = Float64(Float64(1.0 + Float64(im * Float64(im * -0.5))) * Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= -102000.0)
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	elseif (re <= 1.6e-35)
		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
	else
		tmp = (1.0 + (im * (im * -0.5))) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, -102000.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.6e-35], N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq -102000:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\

\mathbf{elif}\;re \leq 1.6 \cdot 10^{-35}:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\

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


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

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\cos im} \]
    4. Step-by-step derivation
      1. cos-lowering-cos.f643.1%

        \[\leadsto \mathsf{cos.f64}\left(im\right) \]
    5. Simplified3.1%

      \[\leadsto \color{blue}{\cos im} \]
    6. Taylor expanded in im around 0

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left({im}^{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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(\left(im \cdot im\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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{\left(im \cdot \frac{1}{24}\right)}\right)\right)\right)\right) \]
      12. *-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 \frac{1}{24}\right)}\right)\right)\right)\right) \]
      13. *-lowering-*.f642.6%

        \[\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}{\frac{1}{24}}\right)\right)\right)\right)\right) \]
    8. Simplified2.6%

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

      \[\leadsto \color{blue}{\frac{1}{24} \cdot {im}^{4}} \]
    10. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    11. Simplified46.1%

      \[\leadsto \color{blue}{0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)} \]

    if -102000 < re < 1.5999999999999999e-35

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{e^{re}} \]
    4. Step-by-step derivation
      1. exp-lowering-exp.f6457.9%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified57.9%

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re around 0

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

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

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

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

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

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

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

    if 1.5999999999999999e-35 < re

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \left(re \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      7. *-lowering-*.f6474.8%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -102000:\\ \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;re \leq 1.6 \cdot 10^{-35}:\\ \;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \left(1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 52.5% accurate, 7.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -102000:\\ \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;re \leq 92000000000000:\\ \;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \left(re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re -102000.0)
   (* 0.041666666666666664 (* (* im im) (* im im)))
   (if (<= re 92000000000000.0)
     (+ 1.0 (* re (+ 1.0 (* re 0.5))))
     (*
      (+ 1.0 (* im (* im -0.5)))
      (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666)))))))))
double code(double re, double im) {
	double tmp;
	if (re <= -102000.0) {
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	} else if (re <= 92000000000000.0) {
		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
	} else {
		tmp = (1.0 + (im * (im * -0.5))) * (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= (-102000.0d0)) then
        tmp = 0.041666666666666664d0 * ((im * im) * (im * im))
    else if (re <= 92000000000000.0d0) then
        tmp = 1.0d0 + (re * (1.0d0 + (re * 0.5d0)))
    else
        tmp = (1.0d0 + (im * (im * (-0.5d0)))) * (re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0)))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= -102000.0) {
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	} else if (re <= 92000000000000.0) {
		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
	} else {
		tmp = (1.0 + (im * (im * -0.5))) * (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= -102000.0:
		tmp = 0.041666666666666664 * ((im * im) * (im * im))
	elif re <= 92000000000000.0:
		tmp = 1.0 + (re * (1.0 + (re * 0.5)))
	else:
		tmp = (1.0 + (im * (im * -0.5))) * (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= -102000.0)
		tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im)));
	elseif (re <= 92000000000000.0)
		tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5))));
	else
		tmp = Float64(Float64(1.0 + Float64(im * Float64(im * -0.5))) * Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666))))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= -102000.0)
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	elseif (re <= 92000000000000.0)
		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
	else
		tmp = (1.0 + (im * (im * -0.5))) * (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, -102000.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 92000000000000.0], N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq -102000:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\

\mathbf{elif}\;re \leq 92000000000000:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\

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


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

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\cos im} \]
    4. Step-by-step derivation
      1. cos-lowering-cos.f643.1%

        \[\leadsto \mathsf{cos.f64}\left(im\right) \]
    5. Simplified3.1%

      \[\leadsto \color{blue}{\cos im} \]
    6. Taylor expanded in im around 0

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left({im}^{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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(\left(im \cdot im\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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{\left(im \cdot \frac{1}{24}\right)}\right)\right)\right)\right) \]
      12. *-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 \frac{1}{24}\right)}\right)\right)\right)\right) \]
      13. *-lowering-*.f642.6%

        \[\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}{\frac{1}{24}}\right)\right)\right)\right)\right) \]
    8. Simplified2.6%

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

      \[\leadsto \color{blue}{\frac{1}{24} \cdot {im}^{4}} \]
    10. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    11. Simplified46.1%

      \[\leadsto \color{blue}{0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)} \]

    if -102000 < re < 9.2e13

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{e^{re}} \]
    4. Step-by-step derivation
      1. exp-lowering-exp.f6458.3%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified58.3%

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re around 0

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \left(re \cdot \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
      5. *-lowering-*.f6456.9%

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

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

    if 9.2e13 < re

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left({re}^{3} \cdot \left(\frac{1}{6} + \left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right)\right)\right)}, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
    10. Step-by-step derivation
      1. cube-multN/A

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -102000:\\ \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;re \leq 92000000000000:\\ \;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \left(re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 51.8% accurate, 7.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -102000:\\ \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;re \leq 1.6 \cdot 10^{-35}:\\ \;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\ \mathbf{elif}\;re \leq 6.2 \cdot 10^{+86}:\\ \;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \left(re + 1\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re -102000.0)
   (* 0.041666666666666664 (* (* im im) (* im im)))
   (if (<= re 1.6e-35)
     (+ 1.0 (* re (+ 1.0 (* re 0.5))))
     (if (<= re 6.2e+86)
       (* (+ 1.0 (* im (* im -0.5))) (+ re 1.0))
       (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666)))))))))
double code(double re, double im) {
	double tmp;
	if (re <= -102000.0) {
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	} else if (re <= 1.6e-35) {
		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
	} else if (re <= 6.2e+86) {
		tmp = (1.0 + (im * (im * -0.5))) * (re + 1.0);
	} else {
		tmp = re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= (-102000.0d0)) then
        tmp = 0.041666666666666664d0 * ((im * im) * (im * im))
    else if (re <= 1.6d-35) then
        tmp = 1.0d0 + (re * (1.0d0 + (re * 0.5d0)))
    else if (re <= 6.2d+86) then
        tmp = (1.0d0 + (im * (im * (-0.5d0)))) * (re + 1.0d0)
    else
        tmp = re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= -102000.0) {
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	} else if (re <= 1.6e-35) {
		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
	} else if (re <= 6.2e+86) {
		tmp = (1.0 + (im * (im * -0.5))) * (re + 1.0);
	} else {
		tmp = re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= -102000.0:
		tmp = 0.041666666666666664 * ((im * im) * (im * im))
	elif re <= 1.6e-35:
		tmp = 1.0 + (re * (1.0 + (re * 0.5)))
	elif re <= 6.2e+86:
		tmp = (1.0 + (im * (im * -0.5))) * (re + 1.0)
	else:
		tmp = re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= -102000.0)
		tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im)));
	elseif (re <= 1.6e-35)
		tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5))));
	elseif (re <= 6.2e+86)
		tmp = Float64(Float64(1.0 + Float64(im * Float64(im * -0.5))) * Float64(re + 1.0));
	else
		tmp = Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= -102000.0)
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	elseif (re <= 1.6e-35)
		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
	elseif (re <= 6.2e+86)
		tmp = (1.0 + (im * (im * -0.5))) * (re + 1.0);
	else
		tmp = re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, -102000.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.6e-35], N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 6.2e+86], N[(N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq -102000:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\

\mathbf{elif}\;re \leq 1.6 \cdot 10^{-35}:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\

\mathbf{elif}\;re \leq 6.2 \cdot 10^{+86}:\\
\;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \left(re + 1\right)\\

\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\


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

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\cos im} \]
    4. Step-by-step derivation
      1. cos-lowering-cos.f643.1%

        \[\leadsto \mathsf{cos.f64}\left(im\right) \]
    5. Simplified3.1%

      \[\leadsto \color{blue}{\cos im} \]
    6. Taylor expanded in im around 0

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left({im}^{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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(\left(im \cdot im\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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{\left(im \cdot \frac{1}{24}\right)}\right)\right)\right)\right) \]
      12. *-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 \frac{1}{24}\right)}\right)\right)\right)\right) \]
      13. *-lowering-*.f642.6%

        \[\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}{\frac{1}{24}}\right)\right)\right)\right)\right) \]
    8. Simplified2.6%

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

      \[\leadsto \color{blue}{\frac{1}{24} \cdot {im}^{4}} \]
    10. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    11. Simplified46.1%

      \[\leadsto \color{blue}{0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)} \]

    if -102000 < re < 1.5999999999999999e-35

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{e^{re}} \]
    4. Step-by-step derivation
      1. exp-lowering-exp.f6457.9%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified57.9%

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re around 0

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

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

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

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

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

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

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

    if 1.5999999999999999e-35 < re < 6.2000000000000004e86

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.2000000000000004e86 < re

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)\right)\right), \mathsf{cos.f64}\left(\color{blue}{im}\right)\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \left(re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{1}{6} \cdot re\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \left(re \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      7. *-lowering-*.f6490.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
    5. Simplified90.0%

      \[\leadsto \color{blue}{\left(1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)} \cdot \cos im \]
    6. Taylor expanded in im around 0

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \color{blue}{\left(1 + \frac{-1}{2} \cdot {im}^{2}\right)}\right) \]
    7. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {im}^{2}\right)}\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \left({im}^{2} \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \left(\left(im \cdot im\right) \cdot \frac{-1}{2}\right)\right)\right) \]
      4. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \left(im \cdot \color{blue}{\left(im \cdot \frac{-1}{2}\right)}\right)\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \left(im \cdot \left(\frac{-1}{2} \cdot \color{blue}{im}\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{2} \cdot im\right)}\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \left(im \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
      8. *-lowering-*.f6481.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
    8. Simplified81.3%

      \[\leadsto \left(1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right) \cdot \color{blue}{\left(1 + im \cdot \left(im \cdot -0.5\right)\right)} \]
    9. Taylor expanded in re around inf

      \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left({re}^{3} \cdot \left(\frac{1}{6} + \left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right)\right)\right)}, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
    10. Step-by-step derivation
      1. cube-multN/A

        \[\leadsto \mathsf{*.f64}\left(\left(\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(\frac{1}{6} + \left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\left(re \cdot {re}^{2}\right) \cdot \left(\frac{1}{6} + \left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
      3. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(\left(re \cdot \left({re}^{2} \cdot \left(\frac{1}{6} + \left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right)\right)\right)\right), \mathsf{+.f64}\left(\color{blue}{1}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\left(re \cdot \left({re}^{2} \cdot \left(\left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right) + \frac{1}{6}\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
      5. distribute-rgt-inN/A

        \[\leadsto \mathsf{*.f64}\left(\left(re \cdot \left(\left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right) \cdot {re}^{2} + \frac{1}{6} \cdot {re}^{2}\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\left(re \cdot \left(\left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right) \cdot {re}^{2} + \frac{1}{6} \cdot \left(re \cdot re\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(\left(re \cdot \left(\left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right) \cdot {re}^{2} + \left(\frac{1}{6} \cdot re\right) \cdot re\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\left(re \cdot \left({re}^{2} \cdot \left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right) + \left(\frac{1}{6} \cdot re\right) \cdot re\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
      9. distribute-rgt-outN/A

        \[\leadsto \mathsf{*.f64}\left(\left(\left({re}^{2} \cdot \left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right)\right) \cdot re + \left(\left(\frac{1}{6} \cdot re\right) \cdot re\right) \cdot re\right), \mathsf{+.f64}\left(\color{blue}{1}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
    11. Simplified81.3%

      \[\leadsto \color{blue}{\left(re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right) \]
    12. Taylor expanded in im around 0

      \[\leadsto \color{blue}{re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)} \]
    13. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(re, \color{blue}{\left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \color{blue}{\left(re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)}\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \color{blue}{\left(\frac{1}{2} + \frac{1}{6} \cdot re\right)}\right)\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\left(\frac{1}{6} \cdot re\right)}\right)\right)\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \left(re \cdot \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right) \]
      6. *-lowering-*.f6457.4%

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right) \]
    14. Simplified57.4%

      \[\leadsto \color{blue}{re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification54.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -102000:\\ \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;re \leq 1.6 \cdot 10^{-35}:\\ \;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\ \mathbf{elif}\;re \leq 6.2 \cdot 10^{+86}:\\ \;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \left(re + 1\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 52.0% accurate, 7.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -102000:\\ \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;re \leq 450:\\ \;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\ \mathbf{elif}\;re \leq 6.2 \cdot 10^{+86}:\\ \;\;\;\;re \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re -102000.0)
   (* 0.041666666666666664 (* (* im im) (* im im)))
   (if (<= re 450.0)
     (+ 1.0 (* re (+ 1.0 (* re 0.5))))
     (if (<= re 6.2e+86)
       (* re (+ 1.0 (* im (* im -0.5))))
       (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666)))))))))
double code(double re, double im) {
	double tmp;
	if (re <= -102000.0) {
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	} else if (re <= 450.0) {
		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
	} else if (re <= 6.2e+86) {
		tmp = re * (1.0 + (im * (im * -0.5)));
	} else {
		tmp = re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= (-102000.0d0)) then
        tmp = 0.041666666666666664d0 * ((im * im) * (im * im))
    else if (re <= 450.0d0) then
        tmp = 1.0d0 + (re * (1.0d0 + (re * 0.5d0)))
    else if (re <= 6.2d+86) then
        tmp = re * (1.0d0 + (im * (im * (-0.5d0))))
    else
        tmp = re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= -102000.0) {
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	} else if (re <= 450.0) {
		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
	} else if (re <= 6.2e+86) {
		tmp = re * (1.0 + (im * (im * -0.5)));
	} else {
		tmp = re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= -102000.0:
		tmp = 0.041666666666666664 * ((im * im) * (im * im))
	elif re <= 450.0:
		tmp = 1.0 + (re * (1.0 + (re * 0.5)))
	elif re <= 6.2e+86:
		tmp = re * (1.0 + (im * (im * -0.5)))
	else:
		tmp = re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= -102000.0)
		tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im)));
	elseif (re <= 450.0)
		tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5))));
	elseif (re <= 6.2e+86)
		tmp = Float64(re * Float64(1.0 + Float64(im * Float64(im * -0.5))));
	else
		tmp = Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= -102000.0)
		tmp = 0.041666666666666664 * ((im * im) * (im * im));
	elseif (re <= 450.0)
		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
	elseif (re <= 6.2e+86)
		tmp = re * (1.0 + (im * (im * -0.5)));
	else
		tmp = re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, -102000.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 450.0], N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 6.2e+86], N[(re * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq -102000:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\

\mathbf{elif}\;re \leq 450:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\

\mathbf{elif}\;re \leq 6.2 \cdot 10^{+86}:\\
\;\;\;\;re \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\

\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if re < -102000

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\cos im} \]
    4. Step-by-step derivation
      1. cos-lowering-cos.f643.1%

        \[\leadsto \mathsf{cos.f64}\left(im\right) \]
    5. Simplified3.1%

      \[\leadsto \color{blue}{\cos im} \]
    6. Taylor expanded in im around 0

      \[\leadsto \color{blue}{1 + {im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2} - \frac{1}{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}{24} \cdot {im}^{2} - \frac{1}{2}\right)\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left(\frac{1}{24} \cdot {im}^{2} - \frac{1}{2}\right)}\right)\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left(\color{blue}{\frac{1}{24} \cdot {im}^{2}} - \frac{1}{2}\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{\frac{1}{24} \cdot {im}^{2}} - \frac{1}{2}\right)\right)\right) \]
      5. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{1}{24} \cdot {im}^{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(im, im\right), \left(\frac{1}{24} \cdot {im}^{2} + \frac{-1}{2}\right)\right)\right) \]
      7. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{2} + \color{blue}{\frac{1}{24} \cdot {im}^{2}}\right)\right)\right) \]
      8. +-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(\frac{1}{24} \cdot {im}^{2}\right)}\right)\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left({im}^{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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(\left(im \cdot im\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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{\left(im \cdot \frac{1}{24}\right)}\right)\right)\right)\right) \]
      12. *-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 \frac{1}{24}\right)}\right)\right)\right)\right) \]
      13. *-lowering-*.f642.6%

        \[\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}{\frac{1}{24}}\right)\right)\right)\right)\right) \]
    8. Simplified2.6%

      \[\leadsto \color{blue}{1 + \left(im \cdot im\right) \cdot \left(-0.5 + im \cdot \left(im \cdot 0.041666666666666664\right)\right)} \]
    9. Taylor expanded in im around inf

      \[\leadsto \color{blue}{\frac{1}{24} \cdot {im}^{4}} \]
    10. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \color{blue}{\left({im}^{4}\right)}\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \left({im}^{\left(2 \cdot \color{blue}{2}\right)}\right)\right) \]
      3. pow-sqrN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left({im}^{2}\right)}\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left(im \cdot im\right), \left({\color{blue}{im}}^{2}\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({\color{blue}{im}}^{2}\right)\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(im \cdot \color{blue}{im}\right)\right)\right) \]
      8. *-lowering-*.f6446.1%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    11. Simplified46.1%

      \[\leadsto \color{blue}{0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)} \]

    if -102000 < re < 450

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{e^{re}} \]
    4. Step-by-step derivation
      1. exp-lowering-exp.f6458.3%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified58.3%

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re around 0

      \[\leadsto \color{blue}{1 + re \cdot \left(1 + \frac{1}{2} \cdot re\right)} \]
    7. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(re \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \color{blue}{\left(1 + \frac{1}{2} \cdot re\right)}\right)\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{2} \cdot re\right)}\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \left(re \cdot \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
      5. *-lowering-*.f6456.9%

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
    8. Simplified56.9%

      \[\leadsto \color{blue}{1 + re \cdot \left(1 + re \cdot 0.5\right)} \]

    if 450 < re < 6.2000000000000004e86

    1. Initial program 100.0%

      \[e^{re} \cdot \cos im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + re\right)}, \mathsf{cos.f64}\left(im\right)\right) \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\left(re + 1\right), \mathsf{cos.f64}\left(\color{blue}{im}\right)\right) \]
      2. +-lowering-+.f643.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{cos.f64}\left(\color{blue}{im}\right)\right) \]
    5. Simplified3.5%

      \[\leadsto \color{blue}{\left(re + 1\right)} \cdot \cos im \]
    6. Taylor expanded in im around 0

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \color{blue}{\left(1 + \frac{-1}{2} \cdot {im}^{2}\right)}\right) \]
    7. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {im}^{2}\right)}\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \left({im}^{2} \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \left(\left(im \cdot im\right) \cdot \frac{-1}{2}\right)\right)\right) \]
      4. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \left(im \cdot \color{blue}{\left(im \cdot \frac{-1}{2}\right)}\right)\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \left(im \cdot \left(\frac{-1}{2} \cdot \color{blue}{im}\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{2} \cdot im\right)}\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \left(im \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
      8. *-lowering-*.f6439.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
    8. Simplified39.3%

      \[\leadsto \left(re + 1\right) \cdot \color{blue}{\left(1 + im \cdot \left(im \cdot -0.5\right)\right)} \]
    9. Taylor expanded in re around inf

      \[\leadsto \mathsf{*.f64}\left(\color{blue}{re}, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
    10. Step-by-step derivation
      1. Simplified39.3%

        \[\leadsto \color{blue}{re} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right) \]

      if 6.2000000000000004e86 < re

      1. Initial program 100.0%

        \[e^{re} \cdot \cos im \]
      2. Add Preprocessing
      3. Taylor expanded in re around 0

        \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)\right)}, \mathsf{cos.f64}\left(im\right)\right) \]
      4. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)\right)\right), \mathsf{cos.f64}\left(\color{blue}{im}\right)\right) \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        3. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \left(re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        5. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{1}{6} \cdot re\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        6. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \left(re \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        7. *-lowering-*.f6490.0%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      5. Simplified90.0%

        \[\leadsto \color{blue}{\left(1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)} \cdot \cos im \]
      6. Taylor expanded in im around 0

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \color{blue}{\left(1 + \frac{-1}{2} \cdot {im}^{2}\right)}\right) \]
      7. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {im}^{2}\right)}\right)\right) \]
        2. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \left({im}^{2} \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right) \]
        3. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \left(\left(im \cdot im\right) \cdot \frac{-1}{2}\right)\right)\right) \]
        4. associate-*l*N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \left(im \cdot \color{blue}{\left(im \cdot \frac{-1}{2}\right)}\right)\right)\right) \]
        5. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \left(im \cdot \left(\frac{-1}{2} \cdot \color{blue}{im}\right)\right)\right)\right) \]
        6. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{2} \cdot im\right)}\right)\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \left(im \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
        8. *-lowering-*.f6481.3%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
      8. Simplified81.3%

        \[\leadsto \left(1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right) \cdot \color{blue}{\left(1 + im \cdot \left(im \cdot -0.5\right)\right)} \]
      9. Taylor expanded in re around inf

        \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left({re}^{3} \cdot \left(\frac{1}{6} + \left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right)\right)\right)}, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
      10. Step-by-step derivation
        1. cube-multN/A

          \[\leadsto \mathsf{*.f64}\left(\left(\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(\frac{1}{6} + \left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
        2. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\left(\left(re \cdot {re}^{2}\right) \cdot \left(\frac{1}{6} + \left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
        3. associate-*l*N/A

          \[\leadsto \mathsf{*.f64}\left(\left(re \cdot \left({re}^{2} \cdot \left(\frac{1}{6} + \left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right)\right)\right)\right), \mathsf{+.f64}\left(\color{blue}{1}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
        4. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\left(re \cdot \left({re}^{2} \cdot \left(\left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right) + \frac{1}{6}\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
        5. distribute-rgt-inN/A

          \[\leadsto \mathsf{*.f64}\left(\left(re \cdot \left(\left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right) \cdot {re}^{2} + \frac{1}{6} \cdot {re}^{2}\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
        6. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\left(re \cdot \left(\left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right) \cdot {re}^{2} + \frac{1}{6} \cdot \left(re \cdot re\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
        7. associate-*r*N/A

          \[\leadsto \mathsf{*.f64}\left(\left(re \cdot \left(\left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right) \cdot {re}^{2} + \left(\frac{1}{6} \cdot re\right) \cdot re\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\left(re \cdot \left({re}^{2} \cdot \left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right) + \left(\frac{1}{6} \cdot re\right) \cdot re\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
        9. distribute-rgt-outN/A

          \[\leadsto \mathsf{*.f64}\left(\left(\left({re}^{2} \cdot \left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right)\right) \cdot re + \left(\left(\frac{1}{6} \cdot re\right) \cdot re\right) \cdot re\right), \mathsf{+.f64}\left(\color{blue}{1}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
      11. Simplified81.3%

        \[\leadsto \color{blue}{\left(re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right) \]
      12. Taylor expanded in im around 0

        \[\leadsto \color{blue}{re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)} \]
      13. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(re, \color{blue}{\left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)}\right) \]
        2. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \color{blue}{\left(re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)}\right)\right) \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \color{blue}{\left(\frac{1}{2} + \frac{1}{6} \cdot re\right)}\right)\right)\right) \]
        4. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\left(\frac{1}{6} \cdot re\right)}\right)\right)\right)\right) \]
        5. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \left(re \cdot \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right) \]
        6. *-lowering-*.f6457.4%

          \[\leadsto \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right) \]
      14. Simplified57.4%

        \[\leadsto \color{blue}{re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)} \]
    11. Recombined 4 regimes into one program.
    12. Add Preprocessing

    Alternative 17: 48.7% accurate, 8.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -23:\\ \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;re \leq 3.6:\\ \;\;\;\;re + 1\\ \mathbf{elif}\;re \leq 1.42 \cdot 10^{+171}:\\ \;\;\;\;re \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(re \cdot 0.5\right)\\ \end{array} \end{array} \]
    (FPCore (re im)
     :precision binary64
     (if (<= re -23.0)
       (* 0.041666666666666664 (* (* im im) (* im im)))
       (if (<= re 3.6)
         (+ re 1.0)
         (if (<= re 1.42e+171)
           (* re (+ 1.0 (* im (* im -0.5))))
           (* re (* re 0.5))))))
    double code(double re, double im) {
    	double tmp;
    	if (re <= -23.0) {
    		tmp = 0.041666666666666664 * ((im * im) * (im * im));
    	} else if (re <= 3.6) {
    		tmp = re + 1.0;
    	} else if (re <= 1.42e+171) {
    		tmp = re * (1.0 + (im * (im * -0.5)));
    	} else {
    		tmp = re * (re * 0.5);
    	}
    	return tmp;
    }
    
    real(8) function code(re, im)
        real(8), intent (in) :: re
        real(8), intent (in) :: im
        real(8) :: tmp
        if (re <= (-23.0d0)) then
            tmp = 0.041666666666666664d0 * ((im * im) * (im * im))
        else if (re <= 3.6d0) then
            tmp = re + 1.0d0
        else if (re <= 1.42d+171) then
            tmp = re * (1.0d0 + (im * (im * (-0.5d0))))
        else
            tmp = re * (re * 0.5d0)
        end if
        code = tmp
    end function
    
    public static double code(double re, double im) {
    	double tmp;
    	if (re <= -23.0) {
    		tmp = 0.041666666666666664 * ((im * im) * (im * im));
    	} else if (re <= 3.6) {
    		tmp = re + 1.0;
    	} else if (re <= 1.42e+171) {
    		tmp = re * (1.0 + (im * (im * -0.5)));
    	} else {
    		tmp = re * (re * 0.5);
    	}
    	return tmp;
    }
    
    def code(re, im):
    	tmp = 0
    	if re <= -23.0:
    		tmp = 0.041666666666666664 * ((im * im) * (im * im))
    	elif re <= 3.6:
    		tmp = re + 1.0
    	elif re <= 1.42e+171:
    		tmp = re * (1.0 + (im * (im * -0.5)))
    	else:
    		tmp = re * (re * 0.5)
    	return tmp
    
    function code(re, im)
    	tmp = 0.0
    	if (re <= -23.0)
    		tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im)));
    	elseif (re <= 3.6)
    		tmp = Float64(re + 1.0);
    	elseif (re <= 1.42e+171)
    		tmp = Float64(re * Float64(1.0 + Float64(im * Float64(im * -0.5))));
    	else
    		tmp = Float64(re * Float64(re * 0.5));
    	end
    	return tmp
    end
    
    function tmp_2 = code(re, im)
    	tmp = 0.0;
    	if (re <= -23.0)
    		tmp = 0.041666666666666664 * ((im * im) * (im * im));
    	elseif (re <= 3.6)
    		tmp = re + 1.0;
    	elseif (re <= 1.42e+171)
    		tmp = re * (1.0 + (im * (im * -0.5)));
    	else
    		tmp = re * (re * 0.5);
    	end
    	tmp_2 = tmp;
    end
    
    code[re_, im_] := If[LessEqual[re, -23.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 3.6], N[(re + 1.0), $MachinePrecision], If[LessEqual[re, 1.42e+171], N[(re * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;re \leq -23:\\
    \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\
    
    \mathbf{elif}\;re \leq 3.6:\\
    \;\;\;\;re + 1\\
    
    \mathbf{elif}\;re \leq 1.42 \cdot 10^{+171}:\\
    \;\;\;\;re \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if re < -23

      1. Initial program 100.0%

        \[e^{re} \cdot \cos im \]
      2. Add Preprocessing
      3. Taylor expanded in re around 0

        \[\leadsto \color{blue}{\cos im} \]
      4. Step-by-step derivation
        1. cos-lowering-cos.f643.2%

          \[\leadsto \mathsf{cos.f64}\left(im\right) \]
      5. Simplified3.2%

        \[\leadsto \color{blue}{\cos im} \]
      6. Taylor expanded in im around 0

        \[\leadsto \color{blue}{1 + {im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2} - \frac{1}{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}{24} \cdot {im}^{2} - \frac{1}{2}\right)\right)}\right) \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left(\frac{1}{24} \cdot {im}^{2} - \frac{1}{2}\right)}\right)\right) \]
        3. unpow2N/A

          \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left(\color{blue}{\frac{1}{24} \cdot {im}^{2}} - \frac{1}{2}\right)\right)\right) \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{\frac{1}{24} \cdot {im}^{2}} - \frac{1}{2}\right)\right)\right) \]
        5. sub-negN/A

          \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{1}{24} \cdot {im}^{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(im, im\right), \left(\frac{1}{24} \cdot {im}^{2} + \frac{-1}{2}\right)\right)\right) \]
        7. +-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{2} + \color{blue}{\frac{1}{24} \cdot {im}^{2}}\right)\right)\right) \]
        8. +-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(\frac{1}{24} \cdot {im}^{2}\right)}\right)\right)\right) \]
        9. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left({im}^{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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(\left(im \cdot im\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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{\left(im \cdot \frac{1}{24}\right)}\right)\right)\right)\right) \]
        12. *-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 \frac{1}{24}\right)}\right)\right)\right)\right) \]
        13. *-lowering-*.f642.6%

          \[\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}{\frac{1}{24}}\right)\right)\right)\right)\right) \]
      8. Simplified2.6%

        \[\leadsto \color{blue}{1 + \left(im \cdot im\right) \cdot \left(-0.5 + im \cdot \left(im \cdot 0.041666666666666664\right)\right)} \]
      9. Taylor expanded in im around inf

        \[\leadsto \color{blue}{\frac{1}{24} \cdot {im}^{4}} \]
      10. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \color{blue}{\left({im}^{4}\right)}\right) \]
        2. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \left({im}^{\left(2 \cdot \color{blue}{2}\right)}\right)\right) \]
        3. pow-sqrN/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right)\right) \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left({im}^{2}\right)}\right)\right) \]
        5. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left(im \cdot im\right), \left({\color{blue}{im}}^{2}\right)\right)\right) \]
        6. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({\color{blue}{im}}^{2}\right)\right)\right) \]
        7. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(im \cdot \color{blue}{im}\right)\right)\right) \]
        8. *-lowering-*.f6444.6%

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
      11. Simplified44.6%

        \[\leadsto \color{blue}{0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)} \]

      if -23 < re < 3.60000000000000009

      1. Initial program 100.0%

        \[e^{re} \cdot \cos im \]
      2. Add Preprocessing
      3. Taylor expanded in im around 0

        \[\leadsto \color{blue}{e^{re}} \]
      4. Step-by-step derivation
        1. exp-lowering-exp.f6457.7%

          \[\leadsto \mathsf{exp.f64}\left(re\right) \]
      5. Simplified57.7%

        \[\leadsto \color{blue}{e^{re}} \]
      6. Taylor expanded in re around 0

        \[\leadsto \color{blue}{1 + re} \]
      7. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto re + \color{blue}{1} \]
        2. +-lowering-+.f6457.7%

          \[\leadsto \mathsf{+.f64}\left(re, \color{blue}{1}\right) \]
      8. Simplified57.7%

        \[\leadsto \color{blue}{re + 1} \]

      if 3.60000000000000009 < re < 1.4199999999999999e171

      1. Initial program 100.0%

        \[e^{re} \cdot \cos im \]
      2. Add Preprocessing
      3. Taylor expanded in re around 0

        \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + re\right)}, \mathsf{cos.f64}\left(im\right)\right) \]
      4. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\left(re + 1\right), \mathsf{cos.f64}\left(\color{blue}{im}\right)\right) \]
        2. +-lowering-+.f644.0%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{cos.f64}\left(\color{blue}{im}\right)\right) \]
      5. Simplified4.0%

        \[\leadsto \color{blue}{\left(re + 1\right)} \cdot \cos im \]
      6. Taylor expanded in im around 0

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \color{blue}{\left(1 + \frac{-1}{2} \cdot {im}^{2}\right)}\right) \]
      7. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {im}^{2}\right)}\right)\right) \]
        2. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \left({im}^{2} \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right) \]
        3. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \left(\left(im \cdot im\right) \cdot \frac{-1}{2}\right)\right)\right) \]
        4. associate-*l*N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \left(im \cdot \color{blue}{\left(im \cdot \frac{-1}{2}\right)}\right)\right)\right) \]
        5. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \left(im \cdot \left(\frac{-1}{2} \cdot \color{blue}{im}\right)\right)\right)\right) \]
        6. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{2} \cdot im\right)}\right)\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \left(im \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
        8. *-lowering-*.f6428.0%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
      8. Simplified28.0%

        \[\leadsto \left(re + 1\right) \cdot \color{blue}{\left(1 + im \cdot \left(im \cdot -0.5\right)\right)} \]
      9. Taylor expanded in re around inf

        \[\leadsto \mathsf{*.f64}\left(\color{blue}{re}, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
      10. Step-by-step derivation
        1. Simplified28.0%

          \[\leadsto \color{blue}{re} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right) \]

        if 1.4199999999999999e171 < re

        1. Initial program 100.0%

          \[e^{re} \cdot \cos im \]
        2. Add Preprocessing
        3. Taylor expanded in im around 0

          \[\leadsto \color{blue}{e^{re}} \]
        4. Step-by-step derivation
          1. exp-lowering-exp.f6468.0%

            \[\leadsto \mathsf{exp.f64}\left(re\right) \]
        5. Simplified68.0%

          \[\leadsto \color{blue}{e^{re}} \]
        6. Taylor expanded in re around 0

          \[\leadsto \color{blue}{1 + re \cdot \left(1 + \frac{1}{2} \cdot re\right)} \]
        7. Step-by-step derivation
          1. +-lowering-+.f64N/A

            \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(re \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \color{blue}{\left(1 + \frac{1}{2} \cdot re\right)}\right)\right) \]
          3. +-lowering-+.f64N/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{2} \cdot re\right)}\right)\right)\right) \]
          4. *-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \left(re \cdot \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
          5. *-lowering-*.f6468.0%

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
        8. Simplified68.0%

          \[\leadsto \color{blue}{1 + re \cdot \left(1 + re \cdot 0.5\right)} \]
        9. Taylor expanded in re around inf

          \[\leadsto \color{blue}{\frac{1}{2} \cdot {re}^{2}} \]
        10. Step-by-step derivation
          1. unpow2N/A

            \[\leadsto \frac{1}{2} \cdot \left(re \cdot \color{blue}{re}\right) \]
          2. associate-*r*N/A

            \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \color{blue}{re} \]
          3. *-commutativeN/A

            \[\leadsto re \cdot \color{blue}{\left(\frac{1}{2} \cdot re\right)} \]
          4. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(re, \color{blue}{\left(\frac{1}{2} \cdot re\right)}\right) \]
          5. *-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(re, \left(re \cdot \color{blue}{\frac{1}{2}}\right)\right) \]
          6. *-lowering-*.f6468.0%

            \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{2}}\right)\right) \]
        11. Simplified68.0%

          \[\leadsto \color{blue}{re \cdot \left(re \cdot 0.5\right)} \]
      11. Recombined 4 regimes into one program.
      12. Add Preprocessing

      Alternative 18: 48.5% accurate, 8.4× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -20:\\ \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;re \leq 460:\\ \;\;\;\;re + 1\\ \mathbf{elif}\;re \leq 1.42 \cdot 10^{+171}:\\ \;\;\;\;im \cdot \left(im \cdot \left(-0.5 + re \cdot -0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(re \cdot 0.5\right)\\ \end{array} \end{array} \]
      (FPCore (re im)
       :precision binary64
       (if (<= re -20.0)
         (* 0.041666666666666664 (* (* im im) (* im im)))
         (if (<= re 460.0)
           (+ re 1.0)
           (if (<= re 1.42e+171)
             (* im (* im (+ -0.5 (* re -0.5))))
             (* re (* re 0.5))))))
      double code(double re, double im) {
      	double tmp;
      	if (re <= -20.0) {
      		tmp = 0.041666666666666664 * ((im * im) * (im * im));
      	} else if (re <= 460.0) {
      		tmp = re + 1.0;
      	} else if (re <= 1.42e+171) {
      		tmp = im * (im * (-0.5 + (re * -0.5)));
      	} else {
      		tmp = re * (re * 0.5);
      	}
      	return tmp;
      }
      
      real(8) function code(re, im)
          real(8), intent (in) :: re
          real(8), intent (in) :: im
          real(8) :: tmp
          if (re <= (-20.0d0)) then
              tmp = 0.041666666666666664d0 * ((im * im) * (im * im))
          else if (re <= 460.0d0) then
              tmp = re + 1.0d0
          else if (re <= 1.42d+171) then
              tmp = im * (im * ((-0.5d0) + (re * (-0.5d0))))
          else
              tmp = re * (re * 0.5d0)
          end if
          code = tmp
      end function
      
      public static double code(double re, double im) {
      	double tmp;
      	if (re <= -20.0) {
      		tmp = 0.041666666666666664 * ((im * im) * (im * im));
      	} else if (re <= 460.0) {
      		tmp = re + 1.0;
      	} else if (re <= 1.42e+171) {
      		tmp = im * (im * (-0.5 + (re * -0.5)));
      	} else {
      		tmp = re * (re * 0.5);
      	}
      	return tmp;
      }
      
      def code(re, im):
      	tmp = 0
      	if re <= -20.0:
      		tmp = 0.041666666666666664 * ((im * im) * (im * im))
      	elif re <= 460.0:
      		tmp = re + 1.0
      	elif re <= 1.42e+171:
      		tmp = im * (im * (-0.5 + (re * -0.5)))
      	else:
      		tmp = re * (re * 0.5)
      	return tmp
      
      function code(re, im)
      	tmp = 0.0
      	if (re <= -20.0)
      		tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im)));
      	elseif (re <= 460.0)
      		tmp = Float64(re + 1.0);
      	elseif (re <= 1.42e+171)
      		tmp = Float64(im * Float64(im * Float64(-0.5 + Float64(re * -0.5))));
      	else
      		tmp = Float64(re * Float64(re * 0.5));
      	end
      	return tmp
      end
      
      function tmp_2 = code(re, im)
      	tmp = 0.0;
      	if (re <= -20.0)
      		tmp = 0.041666666666666664 * ((im * im) * (im * im));
      	elseif (re <= 460.0)
      		tmp = re + 1.0;
      	elseif (re <= 1.42e+171)
      		tmp = im * (im * (-0.5 + (re * -0.5)));
      	else
      		tmp = re * (re * 0.5);
      	end
      	tmp_2 = tmp;
      end
      
      code[re_, im_] := If[LessEqual[re, -20.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 460.0], N[(re + 1.0), $MachinePrecision], If[LessEqual[re, 1.42e+171], N[(im * N[(im * N[(-0.5 + N[(re * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;re \leq -20:\\
      \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\
      
      \mathbf{elif}\;re \leq 460:\\
      \;\;\;\;re + 1\\
      
      \mathbf{elif}\;re \leq 1.42 \cdot 10^{+171}:\\
      \;\;\;\;im \cdot \left(im \cdot \left(-0.5 + re \cdot -0.5\right)\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if re < -20

        1. Initial program 100.0%

          \[e^{re} \cdot \cos im \]
        2. Add Preprocessing
        3. Taylor expanded in re around 0

          \[\leadsto \color{blue}{\cos im} \]
        4. Step-by-step derivation
          1. cos-lowering-cos.f643.2%

            \[\leadsto \mathsf{cos.f64}\left(im\right) \]
        5. Simplified3.2%

          \[\leadsto \color{blue}{\cos im} \]
        6. Taylor expanded in im around 0

          \[\leadsto \color{blue}{1 + {im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2} - \frac{1}{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}{24} \cdot {im}^{2} - \frac{1}{2}\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left(\frac{1}{24} \cdot {im}^{2} - \frac{1}{2}\right)}\right)\right) \]
          3. unpow2N/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left(\color{blue}{\frac{1}{24} \cdot {im}^{2}} - \frac{1}{2}\right)\right)\right) \]
          4. *-lowering-*.f64N/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{\frac{1}{24} \cdot {im}^{2}} - \frac{1}{2}\right)\right)\right) \]
          5. sub-negN/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{1}{24} \cdot {im}^{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(im, im\right), \left(\frac{1}{24} \cdot {im}^{2} + \frac{-1}{2}\right)\right)\right) \]
          7. +-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{2} + \color{blue}{\frac{1}{24} \cdot {im}^{2}}\right)\right)\right) \]
          8. +-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(\frac{1}{24} \cdot {im}^{2}\right)}\right)\right)\right) \]
          9. *-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left({im}^{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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(\left(im \cdot im\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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{\left(im \cdot \frac{1}{24}\right)}\right)\right)\right)\right) \]
          12. *-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 \frac{1}{24}\right)}\right)\right)\right)\right) \]
          13. *-lowering-*.f642.6%

            \[\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}{\frac{1}{24}}\right)\right)\right)\right)\right) \]
        8. Simplified2.6%

          \[\leadsto \color{blue}{1 + \left(im \cdot im\right) \cdot \left(-0.5 + im \cdot \left(im \cdot 0.041666666666666664\right)\right)} \]
        9. Taylor expanded in im around inf

          \[\leadsto \color{blue}{\frac{1}{24} \cdot {im}^{4}} \]
        10. Step-by-step derivation
          1. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \color{blue}{\left({im}^{4}\right)}\right) \]
          2. metadata-evalN/A

            \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \left({im}^{\left(2 \cdot \color{blue}{2}\right)}\right)\right) \]
          3. pow-sqrN/A

            \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right)\right) \]
          4. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left({im}^{2}\right)}\right)\right) \]
          5. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left(im \cdot im\right), \left({\color{blue}{im}}^{2}\right)\right)\right) \]
          6. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({\color{blue}{im}}^{2}\right)\right)\right) \]
          7. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(im \cdot \color{blue}{im}\right)\right)\right) \]
          8. *-lowering-*.f6444.6%

            \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
        11. Simplified44.6%

          \[\leadsto \color{blue}{0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)} \]

        if -20 < re < 460

        1. Initial program 100.0%

          \[e^{re} \cdot \cos im \]
        2. Add Preprocessing
        3. Taylor expanded in im around 0

          \[\leadsto \color{blue}{e^{re}} \]
        4. Step-by-step derivation
          1. exp-lowering-exp.f6457.7%

            \[\leadsto \mathsf{exp.f64}\left(re\right) \]
        5. Simplified57.7%

          \[\leadsto \color{blue}{e^{re}} \]
        6. Taylor expanded in re around 0

          \[\leadsto \color{blue}{1 + re} \]
        7. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto re + \color{blue}{1} \]
          2. +-lowering-+.f6457.7%

            \[\leadsto \mathsf{+.f64}\left(re, \color{blue}{1}\right) \]
        8. Simplified57.7%

          \[\leadsto \color{blue}{re + 1} \]

        if 460 < re < 1.4199999999999999e171

        1. Initial program 100.0%

          \[e^{re} \cdot \cos im \]
        2. Add Preprocessing
        3. Taylor expanded in re around 0

          \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + re\right)}, \mathsf{cos.f64}\left(im\right)\right) \]
        4. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(\left(re + 1\right), \mathsf{cos.f64}\left(\color{blue}{im}\right)\right) \]
          2. +-lowering-+.f644.0%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{cos.f64}\left(\color{blue}{im}\right)\right) \]
        5. Simplified4.0%

          \[\leadsto \color{blue}{\left(re + 1\right)} \cdot \cos im \]
        6. Taylor expanded in im around 0

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \color{blue}{\left(1 + \frac{-1}{2} \cdot {im}^{2}\right)}\right) \]
        7. Step-by-step derivation
          1. +-lowering-+.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {im}^{2}\right)}\right)\right) \]
          2. *-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \left({im}^{2} \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right) \]
          3. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \left(\left(im \cdot im\right) \cdot \frac{-1}{2}\right)\right)\right) \]
          4. associate-*l*N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \left(im \cdot \color{blue}{\left(im \cdot \frac{-1}{2}\right)}\right)\right)\right) \]
          5. *-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \left(im \cdot \left(\frac{-1}{2} \cdot \color{blue}{im}\right)\right)\right)\right) \]
          6. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{2} \cdot im\right)}\right)\right)\right) \]
          7. *-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \left(im \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
          8. *-lowering-*.f6428.0%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
        8. Simplified28.0%

          \[\leadsto \left(re + 1\right) \cdot \color{blue}{\left(1 + im \cdot \left(im \cdot -0.5\right)\right)} \]
        9. Taylor expanded in im around inf

          \[\leadsto \color{blue}{\frac{-1}{2} \cdot \left({im}^{2} \cdot \left(1 + re\right)\right)} \]
        10. Step-by-step derivation
          1. associate-*r*N/A

            \[\leadsto \left(\frac{-1}{2} \cdot {im}^{2}\right) \cdot \color{blue}{\left(1 + re\right)} \]
          2. *-commutativeN/A

            \[\leadsto \left({im}^{2} \cdot \frac{-1}{2}\right) \cdot \left(\color{blue}{1} + re\right) \]
          3. associate-*r*N/A

            \[\leadsto {im}^{2} \cdot \color{blue}{\left(\frac{-1}{2} \cdot \left(1 + re\right)\right)} \]
          4. unpow2N/A

            \[\leadsto \left(im \cdot im\right) \cdot \left(\color{blue}{\frac{-1}{2}} \cdot \left(1 + re\right)\right) \]
          5. associate-*l*N/A

            \[\leadsto im \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{2} \cdot \left(1 + re\right)\right)\right)} \]
          6. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(im \cdot \left(\frac{-1}{2} \cdot \left(1 + re\right)\right)\right)}\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{2} \cdot \left(1 + re\right)\right)}\right)\right) \]
          8. distribute-lft-inN/A

            \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{2} \cdot 1 + \color{blue}{\frac{-1}{2} \cdot re}\right)\right)\right) \]
          9. metadata-evalN/A

            \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \left(\frac{-1}{2} + \color{blue}{\frac{-1}{2}} \cdot re\right)\right)\right) \]
          10. +-lowering-+.f64N/A

            \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{2}, \color{blue}{\left(\frac{-1}{2} \cdot re\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{2}, \left(re \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
          12. *-lowering-*.f6426.7%

            \[\leadsto \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
        11. Simplified26.7%

          \[\leadsto \color{blue}{im \cdot \left(im \cdot \left(-0.5 + re \cdot -0.5\right)\right)} \]

        if 1.4199999999999999e171 < re

        1. Initial program 100.0%

          \[e^{re} \cdot \cos im \]
        2. Add Preprocessing
        3. Taylor expanded in im around 0

          \[\leadsto \color{blue}{e^{re}} \]
        4. Step-by-step derivation
          1. exp-lowering-exp.f6468.0%

            \[\leadsto \mathsf{exp.f64}\left(re\right) \]
        5. Simplified68.0%

          \[\leadsto \color{blue}{e^{re}} \]
        6. Taylor expanded in re around 0

          \[\leadsto \color{blue}{1 + re \cdot \left(1 + \frac{1}{2} \cdot re\right)} \]
        7. Step-by-step derivation
          1. +-lowering-+.f64N/A

            \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(re \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \color{blue}{\left(1 + \frac{1}{2} \cdot re\right)}\right)\right) \]
          3. +-lowering-+.f64N/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{2} \cdot re\right)}\right)\right)\right) \]
          4. *-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \left(re \cdot \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
          5. *-lowering-*.f6468.0%

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
        8. Simplified68.0%

          \[\leadsto \color{blue}{1 + re \cdot \left(1 + re \cdot 0.5\right)} \]
        9. Taylor expanded in re around inf

          \[\leadsto \color{blue}{\frac{1}{2} \cdot {re}^{2}} \]
        10. Step-by-step derivation
          1. unpow2N/A

            \[\leadsto \frac{1}{2} \cdot \left(re \cdot \color{blue}{re}\right) \]
          2. associate-*r*N/A

            \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \color{blue}{re} \]
          3. *-commutativeN/A

            \[\leadsto re \cdot \color{blue}{\left(\frac{1}{2} \cdot re\right)} \]
          4. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(re, \color{blue}{\left(\frac{1}{2} \cdot re\right)}\right) \]
          5. *-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(re, \left(re \cdot \color{blue}{\frac{1}{2}}\right)\right) \]
          6. *-lowering-*.f6468.0%

            \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{2}}\right)\right) \]
        11. Simplified68.0%

          \[\leadsto \color{blue}{re \cdot \left(re \cdot 0.5\right)} \]
      3. Recombined 4 regimes into one program.
      4. Add Preprocessing

      Alternative 19: 52.6% accurate, 8.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -102000:\\ \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;re \leq 175:\\ \;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(0.16666666666666666 + \left(im \cdot im\right) \cdot -0.08333333333333333\right)\\ \end{array} \end{array} \]
      (FPCore (re im)
       :precision binary64
       (if (<= re -102000.0)
         (* 0.041666666666666664 (* (* im im) (* im im)))
         (if (<= re 175.0)
           (+ 1.0 (* re (+ 1.0 (* re 0.5))))
           (*
            (* re (* re re))
            (+ 0.16666666666666666 (* (* im im) -0.08333333333333333))))))
      double code(double re, double im) {
      	double tmp;
      	if (re <= -102000.0) {
      		tmp = 0.041666666666666664 * ((im * im) * (im * im));
      	} else if (re <= 175.0) {
      		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
      	} else {
      		tmp = (re * (re * re)) * (0.16666666666666666 + ((im * im) * -0.08333333333333333));
      	}
      	return tmp;
      }
      
      real(8) function code(re, im)
          real(8), intent (in) :: re
          real(8), intent (in) :: im
          real(8) :: tmp
          if (re <= (-102000.0d0)) then
              tmp = 0.041666666666666664d0 * ((im * im) * (im * im))
          else if (re <= 175.0d0) then
              tmp = 1.0d0 + (re * (1.0d0 + (re * 0.5d0)))
          else
              tmp = (re * (re * re)) * (0.16666666666666666d0 + ((im * im) * (-0.08333333333333333d0)))
          end if
          code = tmp
      end function
      
      public static double code(double re, double im) {
      	double tmp;
      	if (re <= -102000.0) {
      		tmp = 0.041666666666666664 * ((im * im) * (im * im));
      	} else if (re <= 175.0) {
      		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
      	} else {
      		tmp = (re * (re * re)) * (0.16666666666666666 + ((im * im) * -0.08333333333333333));
      	}
      	return tmp;
      }
      
      def code(re, im):
      	tmp = 0
      	if re <= -102000.0:
      		tmp = 0.041666666666666664 * ((im * im) * (im * im))
      	elif re <= 175.0:
      		tmp = 1.0 + (re * (1.0 + (re * 0.5)))
      	else:
      		tmp = (re * (re * re)) * (0.16666666666666666 + ((im * im) * -0.08333333333333333))
      	return tmp
      
      function code(re, im)
      	tmp = 0.0
      	if (re <= -102000.0)
      		tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im)));
      	elseif (re <= 175.0)
      		tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5))));
      	else
      		tmp = Float64(Float64(re * Float64(re * re)) * Float64(0.16666666666666666 + Float64(Float64(im * im) * -0.08333333333333333)));
      	end
      	return tmp
      end
      
      function tmp_2 = code(re, im)
      	tmp = 0.0;
      	if (re <= -102000.0)
      		tmp = 0.041666666666666664 * ((im * im) * (im * im));
      	elseif (re <= 175.0)
      		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
      	else
      		tmp = (re * (re * re)) * (0.16666666666666666 + ((im * im) * -0.08333333333333333));
      	end
      	tmp_2 = tmp;
      end
      
      code[re_, im_] := If[LessEqual[re, -102000.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 175.0], N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(0.16666666666666666 + N[(N[(im * im), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;re \leq -102000:\\
      \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\
      
      \mathbf{elif}\;re \leq 175:\\
      \;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(0.16666666666666666 + \left(im \cdot im\right) \cdot -0.08333333333333333\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if re < -102000

        1. Initial program 100.0%

          \[e^{re} \cdot \cos im \]
        2. Add Preprocessing
        3. Taylor expanded in re around 0

          \[\leadsto \color{blue}{\cos im} \]
        4. Step-by-step derivation
          1. cos-lowering-cos.f643.1%

            \[\leadsto \mathsf{cos.f64}\left(im\right) \]
        5. Simplified3.1%

          \[\leadsto \color{blue}{\cos im} \]
        6. Taylor expanded in im around 0

          \[\leadsto \color{blue}{1 + {im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2} - \frac{1}{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}{24} \cdot {im}^{2} - \frac{1}{2}\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left(\frac{1}{24} \cdot {im}^{2} - \frac{1}{2}\right)}\right)\right) \]
          3. unpow2N/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left(\color{blue}{\frac{1}{24} \cdot {im}^{2}} - \frac{1}{2}\right)\right)\right) \]
          4. *-lowering-*.f64N/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{\frac{1}{24} \cdot {im}^{2}} - \frac{1}{2}\right)\right)\right) \]
          5. sub-negN/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{1}{24} \cdot {im}^{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(im, im\right), \left(\frac{1}{24} \cdot {im}^{2} + \frac{-1}{2}\right)\right)\right) \]
          7. +-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{2} + \color{blue}{\frac{1}{24} \cdot {im}^{2}}\right)\right)\right) \]
          8. +-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(\frac{1}{24} \cdot {im}^{2}\right)}\right)\right)\right) \]
          9. *-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left({im}^{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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(\left(im \cdot im\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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{\left(im \cdot \frac{1}{24}\right)}\right)\right)\right)\right) \]
          12. *-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 \frac{1}{24}\right)}\right)\right)\right)\right) \]
          13. *-lowering-*.f642.6%

            \[\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}{\frac{1}{24}}\right)\right)\right)\right)\right) \]
        8. Simplified2.6%

          \[\leadsto \color{blue}{1 + \left(im \cdot im\right) \cdot \left(-0.5 + im \cdot \left(im \cdot 0.041666666666666664\right)\right)} \]
        9. Taylor expanded in im around inf

          \[\leadsto \color{blue}{\frac{1}{24} \cdot {im}^{4}} \]
        10. Step-by-step derivation
          1. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \color{blue}{\left({im}^{4}\right)}\right) \]
          2. metadata-evalN/A

            \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \left({im}^{\left(2 \cdot \color{blue}{2}\right)}\right)\right) \]
          3. pow-sqrN/A

            \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right)\right) \]
          4. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left({im}^{2}\right)}\right)\right) \]
          5. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left(im \cdot im\right), \left({\color{blue}{im}}^{2}\right)\right)\right) \]
          6. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({\color{blue}{im}}^{2}\right)\right)\right) \]
          7. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(im \cdot \color{blue}{im}\right)\right)\right) \]
          8. *-lowering-*.f6446.1%

            \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
        11. Simplified46.1%

          \[\leadsto \color{blue}{0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)} \]

        if -102000 < re < 175

        1. Initial program 100.0%

          \[e^{re} \cdot \cos im \]
        2. Add Preprocessing
        3. Taylor expanded in im around 0

          \[\leadsto \color{blue}{e^{re}} \]
        4. Step-by-step derivation
          1. exp-lowering-exp.f6458.3%

            \[\leadsto \mathsf{exp.f64}\left(re\right) \]
        5. Simplified58.3%

          \[\leadsto \color{blue}{e^{re}} \]
        6. Taylor expanded in re around 0

          \[\leadsto \color{blue}{1 + re \cdot \left(1 + \frac{1}{2} \cdot re\right)} \]
        7. Step-by-step derivation
          1. +-lowering-+.f64N/A

            \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(re \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \color{blue}{\left(1 + \frac{1}{2} \cdot re\right)}\right)\right) \]
          3. +-lowering-+.f64N/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{2} \cdot re\right)}\right)\right)\right) \]
          4. *-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \left(re \cdot \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
          5. *-lowering-*.f6456.9%

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
        8. Simplified56.9%

          \[\leadsto \color{blue}{1 + re \cdot \left(1 + re \cdot 0.5\right)} \]

        if 175 < re

        1. Initial program 100.0%

          \[e^{re} \cdot \cos im \]
        2. Add Preprocessing
        3. Taylor expanded in re around 0

          \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)\right)}, \mathsf{cos.f64}\left(im\right)\right) \]
        4. Step-by-step derivation
          1. +-lowering-+.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)\right)\right), \mathsf{cos.f64}\left(\color{blue}{im}\right)\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
          3. +-lowering-+.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \left(re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
          4. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
          5. +-lowering-+.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{1}{6} \cdot re\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
          6. *-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \left(re \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
          7. *-lowering-*.f6473.5%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        5. Simplified73.5%

          \[\leadsto \color{blue}{\left(1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)} \cdot \cos im \]
        6. Taylor expanded in im around 0

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \color{blue}{\left(1 + \frac{-1}{2} \cdot {im}^{2}\right)}\right) \]
        7. Step-by-step derivation
          1. +-lowering-+.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {im}^{2}\right)}\right)\right) \]
          2. *-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \left({im}^{2} \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right) \]
          3. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \left(\left(im \cdot im\right) \cdot \frac{-1}{2}\right)\right)\right) \]
          4. associate-*l*N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \left(im \cdot \color{blue}{\left(im \cdot \frac{-1}{2}\right)}\right)\right)\right) \]
          5. *-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \left(im \cdot \left(\frac{-1}{2} \cdot \color{blue}{im}\right)\right)\right)\right) \]
          6. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{2} \cdot im\right)}\right)\right)\right) \]
          7. *-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \left(im \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
          8. *-lowering-*.f6475.0%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
        8. Simplified75.0%

          \[\leadsto \left(1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right) \cdot \color{blue}{\left(1 + im \cdot \left(im \cdot -0.5\right)\right)} \]
        9. Taylor expanded in re around inf

          \[\leadsto \color{blue}{\frac{1}{6} \cdot \left({re}^{3} \cdot \left(1 + \frac{-1}{2} \cdot {im}^{2}\right)\right)} \]
        10. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \left({re}^{3} \cdot \left(1 + \frac{-1}{2} \cdot {im}^{2}\right)\right) \cdot \color{blue}{\frac{1}{6}} \]
          2. associate-*r*N/A

            \[\leadsto {re}^{3} \cdot \color{blue}{\left(\left(1 + \frac{-1}{2} \cdot {im}^{2}\right) \cdot \frac{1}{6}\right)} \]
          3. *-commutativeN/A

            \[\leadsto {re}^{3} \cdot \left(\frac{1}{6} \cdot \color{blue}{\left(1 + \frac{-1}{2} \cdot {im}^{2}\right)}\right) \]
          4. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\left({re}^{3}\right), \color{blue}{\left(\frac{1}{6} \cdot \left(1 + \frac{-1}{2} \cdot {im}^{2}\right)\right)}\right) \]
          5. cube-multN/A

            \[\leadsto \mathsf{*.f64}\left(\left(re \cdot \left(re \cdot re\right)\right), \left(\color{blue}{\frac{1}{6}} \cdot \left(1 + \frac{-1}{2} \cdot {im}^{2}\right)\right)\right) \]
          6. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(\left(re \cdot {re}^{2}\right), \left(\frac{1}{6} \cdot \left(1 + \frac{-1}{2} \cdot {im}^{2}\right)\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \left({re}^{2}\right)\right), \left(\color{blue}{\frac{1}{6}} \cdot \left(1 + \frac{-1}{2} \cdot {im}^{2}\right)\right)\right) \]
          8. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \left(re \cdot re\right)\right), \left(\frac{1}{6} \cdot \left(1 + \frac{-1}{2} \cdot {im}^{2}\right)\right)\right) \]
          9. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\right), \left(\frac{1}{6} \cdot \left(1 + \frac{-1}{2} \cdot {im}^{2}\right)\right)\right) \]
          10. distribute-lft-inN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\right), \left(\frac{1}{6} \cdot 1 + \color{blue}{\frac{1}{6} \cdot \left(\frac{-1}{2} \cdot {im}^{2}\right)}\right)\right) \]
          11. metadata-evalN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\right), \left(\frac{1}{6} + \color{blue}{\frac{1}{6}} \cdot \left(\frac{-1}{2} \cdot {im}^{2}\right)\right)\right) \]
          12. +-lowering-+.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\right), \mathsf{+.f64}\left(\frac{1}{6}, \color{blue}{\left(\frac{1}{6} \cdot \left(\frac{-1}{2} \cdot {im}^{2}\right)\right)}\right)\right) \]
          13. *-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\right), \mathsf{+.f64}\left(\frac{1}{6}, \left(\left(\frac{-1}{2} \cdot {im}^{2}\right) \cdot \color{blue}{\frac{1}{6}}\right)\right)\right) \]
          14. *-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\right), \mathsf{+.f64}\left(\frac{1}{6}, \left(\left({im}^{2} \cdot \frac{-1}{2}\right) \cdot \frac{1}{6}\right)\right)\right) \]
          15. associate-*l*N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\right), \mathsf{+.f64}\left(\frac{1}{6}, \left({im}^{2} \cdot \color{blue}{\left(\frac{-1}{2} \cdot \frac{1}{6}\right)}\right)\right)\right) \]
          16. metadata-evalN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\right), \mathsf{+.f64}\left(\frac{1}{6}, \left({im}^{2} \cdot \frac{-1}{12}\right)\right)\right) \]
          17. metadata-evalN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\right), \mathsf{+.f64}\left(\frac{1}{6}, \left({im}^{2} \cdot \left(\frac{1}{6} \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
          18. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\right), \mathsf{+.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left(\frac{1}{6} \cdot \frac{-1}{2}\right)}\right)\right)\right) \]
          19. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\right), \mathsf{+.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(\left(im \cdot im\right), \left(\color{blue}{\frac{1}{6}} \cdot \frac{-1}{2}\right)\right)\right)\right) \]
          20. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\right), \mathsf{+.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{\frac{1}{6}} \cdot \frac{-1}{2}\right)\right)\right)\right) \]
          21. metadata-eval75.0%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\right), \mathsf{+.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{12}\right)\right)\right) \]
        11. Simplified75.0%

          \[\leadsto \color{blue}{\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(0.16666666666666666 + \left(im \cdot im\right) \cdot -0.08333333333333333\right)} \]
      3. Recombined 3 regimes into one program.
      4. Add Preprocessing

      Alternative 20: 38.6% accurate, 11.9× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq 1.6 \cdot 10^{-35}:\\ \;\;\;\;1\\ \mathbf{elif}\;re \leq 1.42 \cdot 10^{+171}:\\ \;\;\;\;1 + im \cdot \left(im \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(re \cdot 0.5\right)\\ \end{array} \end{array} \]
      (FPCore (re im)
       :precision binary64
       (if (<= re 1.6e-35)
         1.0
         (if (<= re 1.42e+171) (+ 1.0 (* im (* im -0.5))) (* re (* re 0.5)))))
      double code(double re, double im) {
      	double tmp;
      	if (re <= 1.6e-35) {
      		tmp = 1.0;
      	} else if (re <= 1.42e+171) {
      		tmp = 1.0 + (im * (im * -0.5));
      	} else {
      		tmp = re * (re * 0.5);
      	}
      	return tmp;
      }
      
      real(8) function code(re, im)
          real(8), intent (in) :: re
          real(8), intent (in) :: im
          real(8) :: tmp
          if (re <= 1.6d-35) then
              tmp = 1.0d0
          else if (re <= 1.42d+171) then
              tmp = 1.0d0 + (im * (im * (-0.5d0)))
          else
              tmp = re * (re * 0.5d0)
          end if
          code = tmp
      end function
      
      public static double code(double re, double im) {
      	double tmp;
      	if (re <= 1.6e-35) {
      		tmp = 1.0;
      	} else if (re <= 1.42e+171) {
      		tmp = 1.0 + (im * (im * -0.5));
      	} else {
      		tmp = re * (re * 0.5);
      	}
      	return tmp;
      }
      
      def code(re, im):
      	tmp = 0
      	if re <= 1.6e-35:
      		tmp = 1.0
      	elif re <= 1.42e+171:
      		tmp = 1.0 + (im * (im * -0.5))
      	else:
      		tmp = re * (re * 0.5)
      	return tmp
      
      function code(re, im)
      	tmp = 0.0
      	if (re <= 1.6e-35)
      		tmp = 1.0;
      	elseif (re <= 1.42e+171)
      		tmp = Float64(1.0 + Float64(im * Float64(im * -0.5)));
      	else
      		tmp = Float64(re * Float64(re * 0.5));
      	end
      	return tmp
      end
      
      function tmp_2 = code(re, im)
      	tmp = 0.0;
      	if (re <= 1.6e-35)
      		tmp = 1.0;
      	elseif (re <= 1.42e+171)
      		tmp = 1.0 + (im * (im * -0.5));
      	else
      		tmp = re * (re * 0.5);
      	end
      	tmp_2 = tmp;
      end
      
      code[re_, im_] := If[LessEqual[re, 1.6e-35], 1.0, If[LessEqual[re, 1.42e+171], N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;re \leq 1.6 \cdot 10^{-35}:\\
      \;\;\;\;1\\
      
      \mathbf{elif}\;re \leq 1.42 \cdot 10^{+171}:\\
      \;\;\;\;1 + im \cdot \left(im \cdot -0.5\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if re < 1.5999999999999999e-35

        1. Initial program 100.0%

          \[e^{re} \cdot \cos im \]
        2. Add Preprocessing
        3. Taylor expanded in re around 0

          \[\leadsto \color{blue}{\cos im} \]
        4. Step-by-step derivation
          1. cos-lowering-cos.f6471.2%

            \[\leadsto \mathsf{cos.f64}\left(im\right) \]
        5. Simplified71.2%

          \[\leadsto \color{blue}{\cos im} \]
        6. Taylor expanded in im around 0

          \[\leadsto \color{blue}{1} \]
        7. Step-by-step derivation
          1. Simplified41.5%

            \[\leadsto \color{blue}{1} \]

          if 1.5999999999999999e-35 < re < 1.4199999999999999e171

          1. Initial program 100.0%

            \[e^{re} \cdot \cos im \]
          2. Add Preprocessing
          3. Taylor expanded in re around 0

            \[\leadsto \color{blue}{\cos im} \]
          4. Step-by-step derivation
            1. cos-lowering-cos.f6411.0%

              \[\leadsto \mathsf{cos.f64}\left(im\right) \]
          5. Simplified11.0%

            \[\leadsto \color{blue}{\cos im} \]
          6. Taylor expanded in im around 0

            \[\leadsto \color{blue}{1 + \frac{-1}{2} \cdot {im}^{2}} \]
          7. 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. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(1, \left({im}^{2} \cdot \color{blue}{\frac{-1}{2}}\right)\right) \]
            3. unpow2N/A

              \[\leadsto \mathsf{+.f64}\left(1, \left(\left(im \cdot im\right) \cdot \frac{-1}{2}\right)\right) \]
            4. associate-*l*N/A

              \[\leadsto \mathsf{+.f64}\left(1, \left(im \cdot \color{blue}{\left(im \cdot \frac{-1}{2}\right)}\right)\right) \]
            5. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(1, \left(im \cdot \left(\frac{-1}{2} \cdot \color{blue}{im}\right)\right)\right) \]
            6. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{2} \cdot im\right)}\right)\right) \]
            7. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \left(im \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right) \]
            8. *-lowering-*.f6423.7%

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\frac{-1}{2}}\right)\right)\right) \]
          8. Simplified23.7%

            \[\leadsto \color{blue}{1 + im \cdot \left(im \cdot -0.5\right)} \]

          if 1.4199999999999999e171 < re

          1. Initial program 100.0%

            \[e^{re} \cdot \cos im \]
          2. Add Preprocessing
          3. Taylor expanded in im around 0

            \[\leadsto \color{blue}{e^{re}} \]
          4. Step-by-step derivation
            1. exp-lowering-exp.f6468.0%

              \[\leadsto \mathsf{exp.f64}\left(re\right) \]
          5. Simplified68.0%

            \[\leadsto \color{blue}{e^{re}} \]
          6. Taylor expanded in re around 0

            \[\leadsto \color{blue}{1 + re \cdot \left(1 + \frac{1}{2} \cdot re\right)} \]
          7. Step-by-step derivation
            1. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(re \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \color{blue}{\left(1 + \frac{1}{2} \cdot re\right)}\right)\right) \]
            3. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{2} \cdot re\right)}\right)\right)\right) \]
            4. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \left(re \cdot \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
            5. *-lowering-*.f6468.0%

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
          8. Simplified68.0%

            \[\leadsto \color{blue}{1 + re \cdot \left(1 + re \cdot 0.5\right)} \]
          9. Taylor expanded in re around inf

            \[\leadsto \color{blue}{\frac{1}{2} \cdot {re}^{2}} \]
          10. Step-by-step derivation
            1. unpow2N/A

              \[\leadsto \frac{1}{2} \cdot \left(re \cdot \color{blue}{re}\right) \]
            2. associate-*r*N/A

              \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \color{blue}{re} \]
            3. *-commutativeN/A

              \[\leadsto re \cdot \color{blue}{\left(\frac{1}{2} \cdot re\right)} \]
            4. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(re, \color{blue}{\left(\frac{1}{2} \cdot re\right)}\right) \]
            5. *-commutativeN/A

              \[\leadsto \mathsf{*.f64}\left(re, \left(re \cdot \color{blue}{\frac{1}{2}}\right)\right) \]
            6. *-lowering-*.f6468.0%

              \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{2}}\right)\right) \]
          11. Simplified68.0%

            \[\leadsto \color{blue}{re \cdot \left(re \cdot 0.5\right)} \]
        8. Recombined 3 regimes into one program.
        9. Add Preprocessing

        Alternative 21: 47.8% accurate, 13.5× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -85:\\ \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;re \leq 1.25 \cdot 10^{+31}:\\ \;\;\;\;re + 1\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(re \cdot 0.5\right)\\ \end{array} \end{array} \]
        (FPCore (re im)
         :precision binary64
         (if (<= re -85.0)
           (* 0.041666666666666664 (* (* im im) (* im im)))
           (if (<= re 1.25e+31) (+ re 1.0) (* re (* re 0.5)))))
        double code(double re, double im) {
        	double tmp;
        	if (re <= -85.0) {
        		tmp = 0.041666666666666664 * ((im * im) * (im * im));
        	} else if (re <= 1.25e+31) {
        		tmp = re + 1.0;
        	} else {
        		tmp = re * (re * 0.5);
        	}
        	return tmp;
        }
        
        real(8) function code(re, im)
            real(8), intent (in) :: re
            real(8), intent (in) :: im
            real(8) :: tmp
            if (re <= (-85.0d0)) then
                tmp = 0.041666666666666664d0 * ((im * im) * (im * im))
            else if (re <= 1.25d+31) then
                tmp = re + 1.0d0
            else
                tmp = re * (re * 0.5d0)
            end if
            code = tmp
        end function
        
        public static double code(double re, double im) {
        	double tmp;
        	if (re <= -85.0) {
        		tmp = 0.041666666666666664 * ((im * im) * (im * im));
        	} else if (re <= 1.25e+31) {
        		tmp = re + 1.0;
        	} else {
        		tmp = re * (re * 0.5);
        	}
        	return tmp;
        }
        
        def code(re, im):
        	tmp = 0
        	if re <= -85.0:
        		tmp = 0.041666666666666664 * ((im * im) * (im * im))
        	elif re <= 1.25e+31:
        		tmp = re + 1.0
        	else:
        		tmp = re * (re * 0.5)
        	return tmp
        
        function code(re, im)
        	tmp = 0.0
        	if (re <= -85.0)
        		tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im)));
        	elseif (re <= 1.25e+31)
        		tmp = Float64(re + 1.0);
        	else
        		tmp = Float64(re * Float64(re * 0.5));
        	end
        	return tmp
        end
        
        function tmp_2 = code(re, im)
        	tmp = 0.0;
        	if (re <= -85.0)
        		tmp = 0.041666666666666664 * ((im * im) * (im * im));
        	elseif (re <= 1.25e+31)
        		tmp = re + 1.0;
        	else
        		tmp = re * (re * 0.5);
        	end
        	tmp_2 = tmp;
        end
        
        code[re_, im_] := If[LessEqual[re, -85.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.25e+31], N[(re + 1.0), $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;re \leq -85:\\
        \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\
        
        \mathbf{elif}\;re \leq 1.25 \cdot 10^{+31}:\\
        \;\;\;\;re + 1\\
        
        \mathbf{else}:\\
        \;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if re < -85

          1. Initial program 100.0%

            \[e^{re} \cdot \cos im \]
          2. Add Preprocessing
          3. Taylor expanded in re around 0

            \[\leadsto \color{blue}{\cos im} \]
          4. Step-by-step derivation
            1. cos-lowering-cos.f643.2%

              \[\leadsto \mathsf{cos.f64}\left(im\right) \]
          5. Simplified3.2%

            \[\leadsto \color{blue}{\cos im} \]
          6. Taylor expanded in im around 0

            \[\leadsto \color{blue}{1 + {im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2} - \frac{1}{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}{24} \cdot {im}^{2} - \frac{1}{2}\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left(\frac{1}{24} \cdot {im}^{2} - \frac{1}{2}\right)}\right)\right) \]
            3. unpow2N/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left(\color{blue}{\frac{1}{24} \cdot {im}^{2}} - \frac{1}{2}\right)\right)\right) \]
            4. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{\frac{1}{24} \cdot {im}^{2}} - \frac{1}{2}\right)\right)\right) \]
            5. sub-negN/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{1}{24} \cdot {im}^{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(im, im\right), \left(\frac{1}{24} \cdot {im}^{2} + \frac{-1}{2}\right)\right)\right) \]
            7. +-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{2} + \color{blue}{\frac{1}{24} \cdot {im}^{2}}\right)\right)\right) \]
            8. +-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(\frac{1}{24} \cdot {im}^{2}\right)}\right)\right)\right) \]
            9. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left({im}^{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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(\left(im \cdot im\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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{\left(im \cdot \frac{1}{24}\right)}\right)\right)\right)\right) \]
            12. *-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 \frac{1}{24}\right)}\right)\right)\right)\right) \]
            13. *-lowering-*.f642.6%

              \[\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}{\frac{1}{24}}\right)\right)\right)\right)\right) \]
          8. Simplified2.6%

            \[\leadsto \color{blue}{1 + \left(im \cdot im\right) \cdot \left(-0.5 + im \cdot \left(im \cdot 0.041666666666666664\right)\right)} \]
          9. Taylor expanded in im around inf

            \[\leadsto \color{blue}{\frac{1}{24} \cdot {im}^{4}} \]
          10. Step-by-step derivation
            1. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \color{blue}{\left({im}^{4}\right)}\right) \]
            2. metadata-evalN/A

              \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \left({im}^{\left(2 \cdot \color{blue}{2}\right)}\right)\right) \]
            3. pow-sqrN/A

              \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right)\right) \]
            4. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left({im}^{2}\right)}\right)\right) \]
            5. unpow2N/A

              \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left(im \cdot im\right), \left({\color{blue}{im}}^{2}\right)\right)\right) \]
            6. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({\color{blue}{im}}^{2}\right)\right)\right) \]
            7. unpow2N/A

              \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(im \cdot \color{blue}{im}\right)\right)\right) \]
            8. *-lowering-*.f6444.6%

              \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
          11. Simplified44.6%

            \[\leadsto \color{blue}{0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)} \]

          if -85 < re < 1.25000000000000007e31

          1. Initial program 100.0%

            \[e^{re} \cdot \cos im \]
          2. Add Preprocessing
          3. Taylor expanded in im around 0

            \[\leadsto \color{blue}{e^{re}} \]
          4. Step-by-step derivation
            1. exp-lowering-exp.f6456.1%

              \[\leadsto \mathsf{exp.f64}\left(re\right) \]
          5. Simplified56.1%

            \[\leadsto \color{blue}{e^{re}} \]
          6. Taylor expanded in re around 0

            \[\leadsto \color{blue}{1 + re} \]
          7. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto re + \color{blue}{1} \]
            2. +-lowering-+.f6456.1%

              \[\leadsto \mathsf{+.f64}\left(re, \color{blue}{1}\right) \]
          8. Simplified56.1%

            \[\leadsto \color{blue}{re + 1} \]

          if 1.25000000000000007e31 < re

          1. Initial program 100.0%

            \[e^{re} \cdot \cos im \]
          2. Add Preprocessing
          3. Taylor expanded in im around 0

            \[\leadsto \color{blue}{e^{re}} \]
          4. Step-by-step derivation
            1. exp-lowering-exp.f6466.0%

              \[\leadsto \mathsf{exp.f64}\left(re\right) \]
          5. Simplified66.0%

            \[\leadsto \color{blue}{e^{re}} \]
          6. Taylor expanded in re around 0

            \[\leadsto \color{blue}{1 + re \cdot \left(1 + \frac{1}{2} \cdot re\right)} \]
          7. Step-by-step derivation
            1. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(re \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \color{blue}{\left(1 + \frac{1}{2} \cdot re\right)}\right)\right) \]
            3. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{2} \cdot re\right)}\right)\right)\right) \]
            4. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \left(re \cdot \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
            5. *-lowering-*.f6435.8%

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
          8. Simplified35.8%

            \[\leadsto \color{blue}{1 + re \cdot \left(1 + re \cdot 0.5\right)} \]
          9. Taylor expanded in re around inf

            \[\leadsto \color{blue}{\frac{1}{2} \cdot {re}^{2}} \]
          10. Step-by-step derivation
            1. unpow2N/A

              \[\leadsto \frac{1}{2} \cdot \left(re \cdot \color{blue}{re}\right) \]
            2. associate-*r*N/A

              \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \color{blue}{re} \]
            3. *-commutativeN/A

              \[\leadsto re \cdot \color{blue}{\left(\frac{1}{2} \cdot re\right)} \]
            4. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(re, \color{blue}{\left(\frac{1}{2} \cdot re\right)}\right) \]
            5. *-commutativeN/A

              \[\leadsto \mathsf{*.f64}\left(re, \left(re \cdot \color{blue}{\frac{1}{2}}\right)\right) \]
            6. *-lowering-*.f6435.8%

              \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{2}}\right)\right) \]
          11. Simplified35.8%

            \[\leadsto \color{blue}{re \cdot \left(re \cdot 0.5\right)} \]
        3. Recombined 3 regimes into one program.
        4. Add Preprocessing

        Alternative 22: 47.8% accurate, 14.5× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -102000:\\ \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\ \end{array} \end{array} \]
        (FPCore (re im)
         :precision binary64
         (if (<= re -102000.0)
           (* 0.041666666666666664 (* (* im im) (* im im)))
           (+ 1.0 (* re (+ 1.0 (* re 0.5))))))
        double code(double re, double im) {
        	double tmp;
        	if (re <= -102000.0) {
        		tmp = 0.041666666666666664 * ((im * im) * (im * im));
        	} else {
        		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
        	}
        	return tmp;
        }
        
        real(8) function code(re, im)
            real(8), intent (in) :: re
            real(8), intent (in) :: im
            real(8) :: tmp
            if (re <= (-102000.0d0)) then
                tmp = 0.041666666666666664d0 * ((im * im) * (im * im))
            else
                tmp = 1.0d0 + (re * (1.0d0 + (re * 0.5d0)))
            end if
            code = tmp
        end function
        
        public static double code(double re, double im) {
        	double tmp;
        	if (re <= -102000.0) {
        		tmp = 0.041666666666666664 * ((im * im) * (im * im));
        	} else {
        		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
        	}
        	return tmp;
        }
        
        def code(re, im):
        	tmp = 0
        	if re <= -102000.0:
        		tmp = 0.041666666666666664 * ((im * im) * (im * im))
        	else:
        		tmp = 1.0 + (re * (1.0 + (re * 0.5)))
        	return tmp
        
        function code(re, im)
        	tmp = 0.0
        	if (re <= -102000.0)
        		tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im)));
        	else
        		tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5))));
        	end
        	return tmp
        end
        
        function tmp_2 = code(re, im)
        	tmp = 0.0;
        	if (re <= -102000.0)
        		tmp = 0.041666666666666664 * ((im * im) * (im * im));
        	else
        		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
        	end
        	tmp_2 = tmp;
        end
        
        code[re_, im_] := If[LessEqual[re, -102000.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;re \leq -102000:\\
        \;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if re < -102000

          1. Initial program 100.0%

            \[e^{re} \cdot \cos im \]
          2. Add Preprocessing
          3. Taylor expanded in re around 0

            \[\leadsto \color{blue}{\cos im} \]
          4. Step-by-step derivation
            1. cos-lowering-cos.f643.1%

              \[\leadsto \mathsf{cos.f64}\left(im\right) \]
          5. Simplified3.1%

            \[\leadsto \color{blue}{\cos im} \]
          6. Taylor expanded in im around 0

            \[\leadsto \color{blue}{1 + {im}^{2} \cdot \left(\frac{1}{24} \cdot {im}^{2} - \frac{1}{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}{24} \cdot {im}^{2} - \frac{1}{2}\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left(\frac{1}{24} \cdot {im}^{2} - \frac{1}{2}\right)}\right)\right) \]
            3. unpow2N/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(im \cdot im\right), \left(\color{blue}{\frac{1}{24} \cdot {im}^{2}} - \frac{1}{2}\right)\right)\right) \]
            4. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{\frac{1}{24} \cdot {im}^{2}} - \frac{1}{2}\right)\right)\right) \]
            5. sub-negN/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{1}{24} \cdot {im}^{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(im, im\right), \left(\frac{1}{24} \cdot {im}^{2} + \frac{-1}{2}\right)\right)\right) \]
            7. +-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{2} + \color{blue}{\frac{1}{24} \cdot {im}^{2}}\right)\right)\right) \]
            8. +-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(\frac{1}{24} \cdot {im}^{2}\right)}\right)\right)\right) \]
            9. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left({im}^{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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(\left(im \cdot im\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(im, im\right), \mathsf{+.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{\left(im \cdot \frac{1}{24}\right)}\right)\right)\right)\right) \]
            12. *-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 \frac{1}{24}\right)}\right)\right)\right)\right) \]
            13. *-lowering-*.f642.6%

              \[\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}{\frac{1}{24}}\right)\right)\right)\right)\right) \]
          8. Simplified2.6%

            \[\leadsto \color{blue}{1 + \left(im \cdot im\right) \cdot \left(-0.5 + im \cdot \left(im \cdot 0.041666666666666664\right)\right)} \]
          9. Taylor expanded in im around inf

            \[\leadsto \color{blue}{\frac{1}{24} \cdot {im}^{4}} \]
          10. Step-by-step derivation
            1. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \color{blue}{\left({im}^{4}\right)}\right) \]
            2. metadata-evalN/A

              \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \left({im}^{\left(2 \cdot \color{blue}{2}\right)}\right)\right) \]
            3. pow-sqrN/A

              \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right)\right) \]
            4. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left({im}^{2}\right)}\right)\right) \]
            5. unpow2N/A

              \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left(im \cdot im\right), \left({\color{blue}{im}}^{2}\right)\right)\right) \]
            6. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({\color{blue}{im}}^{2}\right)\right)\right) \]
            7. unpow2N/A

              \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(im \cdot \color{blue}{im}\right)\right)\right) \]
            8. *-lowering-*.f6446.1%

              \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
          11. Simplified46.1%

            \[\leadsto \color{blue}{0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)} \]

          if -102000 < re

          1. Initial program 100.0%

            \[e^{re} \cdot \cos im \]
          2. Add Preprocessing
          3. Taylor expanded in im around 0

            \[\leadsto \color{blue}{e^{re}} \]
          4. Step-by-step derivation
            1. exp-lowering-exp.f6459.2%

              \[\leadsto \mathsf{exp.f64}\left(re\right) \]
          5. Simplified59.2%

            \[\leadsto \color{blue}{e^{re}} \]
          6. Taylor expanded in re around 0

            \[\leadsto \color{blue}{1 + re \cdot \left(1 + \frac{1}{2} \cdot re\right)} \]
          7. Step-by-step derivation
            1. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(re \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \color{blue}{\left(1 + \frac{1}{2} \cdot re\right)}\right)\right) \]
            3. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{2} \cdot re\right)}\right)\right)\right) \]
            4. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \left(re \cdot \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
            5. *-lowering-*.f6450.2%

              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
          8. Simplified50.2%

            \[\leadsto \color{blue}{1 + re \cdot \left(1 + re \cdot 0.5\right)} \]
        3. Recombined 2 regimes into one program.
        4. Add Preprocessing

        Alternative 23: 38.3% accurate, 20.3× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq 1.25 \cdot 10^{+31}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(re \cdot 0.5\right)\\ \end{array} \end{array} \]
        (FPCore (re im)
         :precision binary64
         (if (<= re 1.25e+31) 1.0 (* re (* re 0.5))))
        double code(double re, double im) {
        	double tmp;
        	if (re <= 1.25e+31) {
        		tmp = 1.0;
        	} else {
        		tmp = re * (re * 0.5);
        	}
        	return tmp;
        }
        
        real(8) function code(re, im)
            real(8), intent (in) :: re
            real(8), intent (in) :: im
            real(8) :: tmp
            if (re <= 1.25d+31) then
                tmp = 1.0d0
            else
                tmp = re * (re * 0.5d0)
            end if
            code = tmp
        end function
        
        public static double code(double re, double im) {
        	double tmp;
        	if (re <= 1.25e+31) {
        		tmp = 1.0;
        	} else {
        		tmp = re * (re * 0.5);
        	}
        	return tmp;
        }
        
        def code(re, im):
        	tmp = 0
        	if re <= 1.25e+31:
        		tmp = 1.0
        	else:
        		tmp = re * (re * 0.5)
        	return tmp
        
        function code(re, im)
        	tmp = 0.0
        	if (re <= 1.25e+31)
        		tmp = 1.0;
        	else
        		tmp = Float64(re * Float64(re * 0.5));
        	end
        	return tmp
        end
        
        function tmp_2 = code(re, im)
        	tmp = 0.0;
        	if (re <= 1.25e+31)
        		tmp = 1.0;
        	else
        		tmp = re * (re * 0.5);
        	end
        	tmp_2 = tmp;
        end
        
        code[re_, im_] := If[LessEqual[re, 1.25e+31], 1.0, N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;re \leq 1.25 \cdot 10^{+31}:\\
        \;\;\;\;1\\
        
        \mathbf{else}:\\
        \;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if re < 1.25000000000000007e31

          1. Initial program 100.0%

            \[e^{re} \cdot \cos im \]
          2. Add Preprocessing
          3. Taylor expanded in re around 0

            \[\leadsto \color{blue}{\cos im} \]
          4. Step-by-step derivation
            1. cos-lowering-cos.f6470.2%

              \[\leadsto \mathsf{cos.f64}\left(im\right) \]
          5. Simplified70.2%

            \[\leadsto \color{blue}{\cos im} \]
          6. Taylor expanded in im around 0

            \[\leadsto \color{blue}{1} \]
          7. Step-by-step derivation
            1. Simplified41.2%

              \[\leadsto \color{blue}{1} \]

            if 1.25000000000000007e31 < re

            1. Initial program 100.0%

              \[e^{re} \cdot \cos im \]
            2. Add Preprocessing
            3. Taylor expanded in im around 0

              \[\leadsto \color{blue}{e^{re}} \]
            4. Step-by-step derivation
              1. exp-lowering-exp.f6466.0%

                \[\leadsto \mathsf{exp.f64}\left(re\right) \]
            5. Simplified66.0%

              \[\leadsto \color{blue}{e^{re}} \]
            6. Taylor expanded in re around 0

              \[\leadsto \color{blue}{1 + re \cdot \left(1 + \frac{1}{2} \cdot re\right)} \]
            7. Step-by-step derivation
              1. +-lowering-+.f64N/A

                \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(re \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)}\right) \]
              2. *-lowering-*.f64N/A

                \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \color{blue}{\left(1 + \frac{1}{2} \cdot re\right)}\right)\right) \]
              3. +-lowering-+.f64N/A

                \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{2} \cdot re\right)}\right)\right)\right) \]
              4. *-commutativeN/A

                \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \left(re \cdot \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
              5. *-lowering-*.f6435.8%

                \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
            8. Simplified35.8%

              \[\leadsto \color{blue}{1 + re \cdot \left(1 + re \cdot 0.5\right)} \]
            9. Taylor expanded in re around inf

              \[\leadsto \color{blue}{\frac{1}{2} \cdot {re}^{2}} \]
            10. Step-by-step derivation
              1. unpow2N/A

                \[\leadsto \frac{1}{2} \cdot \left(re \cdot \color{blue}{re}\right) \]
              2. associate-*r*N/A

                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \color{blue}{re} \]
              3. *-commutativeN/A

                \[\leadsto re \cdot \color{blue}{\left(\frac{1}{2} \cdot re\right)} \]
              4. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(re, \color{blue}{\left(\frac{1}{2} \cdot re\right)}\right) \]
              5. *-commutativeN/A

                \[\leadsto \mathsf{*.f64}\left(re, \left(re \cdot \color{blue}{\frac{1}{2}}\right)\right) \]
              6. *-lowering-*.f6435.8%

                \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{2}}\right)\right) \]
            11. Simplified35.8%

              \[\leadsto \color{blue}{re \cdot \left(re \cdot 0.5\right)} \]
          8. Recombined 2 regimes into one program.
          9. Add Preprocessing

          Alternative 24: 29.8% accurate, 67.7× speedup?

          \[\begin{array}{l} \\ re + 1 \end{array} \]
          (FPCore (re im) :precision binary64 (+ re 1.0))
          double code(double re, double im) {
          	return re + 1.0;
          }
          
          real(8) function code(re, im)
              real(8), intent (in) :: re
              real(8), intent (in) :: im
              code = re + 1.0d0
          end function
          
          public static double code(double re, double im) {
          	return re + 1.0;
          }
          
          def code(re, im):
          	return re + 1.0
          
          function code(re, im)
          	return Float64(re + 1.0)
          end
          
          function tmp = code(re, im)
          	tmp = re + 1.0;
          end
          
          code[re_, im_] := N[(re + 1.0), $MachinePrecision]
          
          \begin{array}{l}
          
          \\
          re + 1
          \end{array}
          
          Derivation
          1. Initial program 100.0%

            \[e^{re} \cdot \cos im \]
          2. Add Preprocessing
          3. Taylor expanded in im around 0

            \[\leadsto \color{blue}{e^{re}} \]
          4. Step-by-step derivation
            1. exp-lowering-exp.f6467.9%

              \[\leadsto \mathsf{exp.f64}\left(re\right) \]
          5. Simplified67.9%

            \[\leadsto \color{blue}{e^{re}} \]
          6. Taylor expanded in re around 0

            \[\leadsto \color{blue}{1 + re} \]
          7. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto re + \color{blue}{1} \]
            2. +-lowering-+.f6433.3%

              \[\leadsto \mathsf{+.f64}\left(re, \color{blue}{1}\right) \]
          8. Simplified33.3%

            \[\leadsto \color{blue}{re + 1} \]
          9. Add Preprocessing

          Alternative 25: 29.3% accurate, 203.0× speedup?

          \[\begin{array}{l} \\ 1 \end{array} \]
          (FPCore (re im) :precision binary64 1.0)
          double code(double re, double im) {
          	return 1.0;
          }
          
          real(8) function code(re, im)
              real(8), intent (in) :: re
              real(8), intent (in) :: im
              code = 1.0d0
          end function
          
          public static double code(double re, double im) {
          	return 1.0;
          }
          
          def code(re, im):
          	return 1.0
          
          function code(re, im)
          	return 1.0
          end
          
          function tmp = code(re, im)
          	tmp = 1.0;
          end
          
          code[re_, im_] := 1.0
          
          \begin{array}{l}
          
          \\
          1
          \end{array}
          
          Derivation
          1. Initial program 100.0%

            \[e^{re} \cdot \cos im \]
          2. Add Preprocessing
          3. Taylor expanded in re around 0

            \[\leadsto \color{blue}{\cos im} \]
          4. Step-by-step derivation
            1. cos-lowering-cos.f6456.3%

              \[\leadsto \mathsf{cos.f64}\left(im\right) \]
          5. Simplified56.3%

            \[\leadsto \color{blue}{\cos im} \]
          6. Taylor expanded in im around 0

            \[\leadsto \color{blue}{1} \]
          7. Step-by-step derivation
            1. Simplified33.1%

              \[\leadsto \color{blue}{1} \]
            2. Add Preprocessing

            Reproduce

            ?
            herbie shell --seed 2024160 
            (FPCore (re im)
              :name "math.exp on complex, real part"
              :precision binary64
              (* (exp re) (cos im)))