math.exp on complex, real part

Percentage Accurate: 100.0% → 100.0%
Time: 14.2s
Alternatives: 20
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 20 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: 97.5% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos im \cdot \left(1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\ \mathbf{if}\;re \leq -0.026:\\ \;\;\;\;e^{re}\\ \mathbf{elif}\;re \leq 1.3 \cdot 10^{-8}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 1.05 \cdot 10^{+103}:\\ \;\;\;\;{e}^{re}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0
         (*
          (cos im)
          (+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666)))))))))
   (if (<= re -0.026)
     (exp re)
     (if (<= re 1.3e-8) t_0 (if (<= re 1.05e+103) (pow E re) t_0)))))
double code(double re, double im) {
	double t_0 = cos(im) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))));
	double tmp;
	if (re <= -0.026) {
		tmp = exp(re);
	} else if (re <= 1.3e-8) {
		tmp = t_0;
	} else if (re <= 1.05e+103) {
		tmp = pow(((double) M_E), re);
	} else {
		tmp = t_0;
	}
	return tmp;
}
public static double code(double re, double im) {
	double t_0 = Math.cos(im) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))));
	double tmp;
	if (re <= -0.026) {
		tmp = Math.exp(re);
	} else if (re <= 1.3e-8) {
		tmp = t_0;
	} else if (re <= 1.05e+103) {
		tmp = Math.pow(Math.E, re);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = math.cos(im) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))))
	tmp = 0
	if re <= -0.026:
		tmp = math.exp(re)
	elif re <= 1.3e-8:
		tmp = t_0
	elif re <= 1.05e+103:
		tmp = math.pow(math.e, re)
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(cos(im) * Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))))))
	tmp = 0.0
	if (re <= -0.026)
		tmp = exp(re);
	elseif (re <= 1.3e-8)
		tmp = t_0;
	elseif (re <= 1.05e+103)
		tmp = exp(1) ^ re;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = cos(im) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))));
	tmp = 0.0;
	if (re <= -0.026)
		tmp = exp(re);
	elseif (re <= 1.3e-8)
		tmp = t_0;
	elseif (re <= 1.05e+103)
		tmp = 2.71828182845904523536 ^ re;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$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]}, If[LessEqual[re, -0.026], N[Exp[re], $MachinePrecision], If[LessEqual[re, 1.3e-8], t$95$0, If[LessEqual[re, 1.05e+103], N[Power[E, re], $MachinePrecision], t$95$0]]]]
\begin{array}{l}

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

\mathbf{elif}\;re \leq 1.3 \cdot 10^{-8}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;re \leq 1.05 \cdot 10^{+103}:\\
\;\;\;\;{e}^{re}\\

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


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

    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.0259999999999999988 < re < 1.3000000000000001e-8 or 1.0500000000000001e103 < 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-*.f6499.9%

        \[\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.9%

      \[\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.3000000000000001e-8 < re < 1.0500000000000001e103

    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.f6475.9%

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

      \[\leadsto \color{blue}{e^{re}} \]
    6. Step-by-step derivation
      1. *-lft-identityN/A

        \[\leadsto e^{1 \cdot re} \]
      2. exp-prodN/A

        \[\leadsto {\left(e^{1}\right)}^{\color{blue}{re}} \]
      3. pow-lowering-pow.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\left(e^{1}\right), \color{blue}{re}\right) \]
      4. exp-lowering-exp.f6475.9%

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{exp.f64}\left(1\right), re\right) \]
    7. Applied egg-rr75.9%

      \[\leadsto \color{blue}{{\left(e^{1}\right)}^{re}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification97.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -0.026:\\ \;\;\;\;e^{re}\\ \mathbf{elif}\;re \leq 1.3 \cdot 10^{-8}:\\ \;\;\;\;\cos im \cdot \left(1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\ \mathbf{elif}\;re \leq 1.05 \cdot 10^{+103}:\\ \;\;\;\;{e}^{re}\\ \mathbf{else}:\\ \;\;\;\;\cos im \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 3: 97.5% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos im \cdot \left(1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\ \mathbf{if}\;re \leq -0.0074:\\ \;\;\;\;e^{re}\\ \mathbf{elif}\;re \leq 1.3 \cdot 10^{-8}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 1.05 \cdot 10^{+103}:\\ \;\;\;\;e^{re}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0
         (*
          (cos im)
          (+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666)))))))))
   (if (<= re -0.0074)
     (exp re)
     (if (<= re 1.3e-8) t_0 (if (<= re 1.05e+103) (exp re) t_0)))))
double code(double re, double im) {
	double t_0 = cos(im) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))));
	double tmp;
	if (re <= -0.0074) {
		tmp = exp(re);
	} else if (re <= 1.3e-8) {
		tmp = t_0;
	} else if (re <= 1.05e+103) {
		tmp = exp(re);
	} else {
		tmp = t_0;
	}
	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 = cos(im) * (1.0d0 + (re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0))))))
    if (re <= (-0.0074d0)) then
        tmp = exp(re)
    else if (re <= 1.3d-8) then
        tmp = t_0
    else if (re <= 1.05d+103) then
        tmp = exp(re)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = Math.cos(im) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))));
	double tmp;
	if (re <= -0.0074) {
		tmp = Math.exp(re);
	} else if (re <= 1.3e-8) {
		tmp = t_0;
	} else if (re <= 1.05e+103) {
		tmp = Math.exp(re);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = math.cos(im) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))))
	tmp = 0
	if re <= -0.0074:
		tmp = math.exp(re)
	elif re <= 1.3e-8:
		tmp = t_0
	elif re <= 1.05e+103:
		tmp = math.exp(re)
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(cos(im) * Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))))))
	tmp = 0.0
	if (re <= -0.0074)
		tmp = exp(re);
	elseif (re <= 1.3e-8)
		tmp = t_0;
	elseif (re <= 1.05e+103)
		tmp = exp(re);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = cos(im) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))));
	tmp = 0.0;
	if (re <= -0.0074)
		tmp = exp(re);
	elseif (re <= 1.3e-8)
		tmp = t_0;
	elseif (re <= 1.05e+103)
		tmp = exp(re);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$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]}, If[LessEqual[re, -0.0074], N[Exp[re], $MachinePrecision], If[LessEqual[re, 1.3e-8], t$95$0, If[LessEqual[re, 1.05e+103], N[Exp[re], $MachinePrecision], t$95$0]]]]
\begin{array}{l}

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

\mathbf{elif}\;re \leq 1.3 \cdot 10^{-8}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;re \leq 1.05 \cdot 10^{+103}:\\
\;\;\;\;e^{re}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if re < -0.0074000000000000003 or 1.3000000000000001e-8 < re < 1.0500000000000001e103

    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.f6492.8%

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

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

    if -0.0074000000000000003 < re < 1.3000000000000001e-8 or 1.0500000000000001e103 < 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-*.f6499.9%

        \[\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.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -0.0074:\\ \;\;\;\;e^{re}\\ \mathbf{elif}\;re \leq 1.3 \cdot 10^{-8}:\\ \;\;\;\;\cos im \cdot \left(1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\ \mathbf{elif}\;re \leq 1.05 \cdot 10^{+103}:\\ \;\;\;\;e^{re}\\ \mathbf{else}:\\ \;\;\;\;\cos im \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 4: 96.4% accurate, 1.6× speedup?

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

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

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

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

\mathbf{else}:\\
\;\;\;\;\cos im \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 < -0.0179999999999999986

    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.0179999999999999986 < re < 1.3000000000000001e-8

    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.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{cos.f64}\left(im\right)\right) \]
    5. Simplified99.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.3000000000000001e-8 < re < 1.8999999999999999e154

    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-*.f6475.0%

        \[\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. Simplified75.0%

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

    if 1.8999999999999999e154 < 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 + \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-*.f64100.0%

        \[\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. Simplified100.0%

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

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

Alternative 5: 96.1% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos im \cdot \left(1 + re \cdot \left(1 + re \cdot 0.5\right)\right)\\ \mathbf{if}\;re \leq -0.0042:\\ \;\;\;\;e^{re}\\ \mathbf{elif}\;re \leq 1.3 \cdot 10^{-8}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 10^{+150}:\\ \;\;\;\;e^{re} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (cos im) (+ 1.0 (* re (+ 1.0 (* re 0.5)))))))
   (if (<= re -0.0042)
     (exp re)
     (if (<= re 1.3e-8)
       t_0
       (if (<= re 1e+150) (* (exp re) (+ 1.0 (* im (* im -0.5)))) t_0)))))
double code(double re, double im) {
	double t_0 = cos(im) * (1.0 + (re * (1.0 + (re * 0.5))));
	double tmp;
	if (re <= -0.0042) {
		tmp = exp(re);
	} else if (re <= 1.3e-8) {
		tmp = t_0;
	} else if (re <= 1e+150) {
		tmp = exp(re) * (1.0 + (im * (im * -0.5)));
	} else {
		tmp = t_0;
	}
	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 = cos(im) * (1.0d0 + (re * (1.0d0 + (re * 0.5d0))))
    if (re <= (-0.0042d0)) then
        tmp = exp(re)
    else if (re <= 1.3d-8) then
        tmp = t_0
    else if (re <= 1d+150) then
        tmp = exp(re) * (1.0d0 + (im * (im * (-0.5d0))))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = Math.cos(im) * (1.0 + (re * (1.0 + (re * 0.5))));
	double tmp;
	if (re <= -0.0042) {
		tmp = Math.exp(re);
	} else if (re <= 1.3e-8) {
		tmp = t_0;
	} else if (re <= 1e+150) {
		tmp = Math.exp(re) * (1.0 + (im * (im * -0.5)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = math.cos(im) * (1.0 + (re * (1.0 + (re * 0.5))))
	tmp = 0
	if re <= -0.0042:
		tmp = math.exp(re)
	elif re <= 1.3e-8:
		tmp = t_0
	elif re <= 1e+150:
		tmp = math.exp(re) * (1.0 + (im * (im * -0.5)))
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(cos(im) * Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5)))))
	tmp = 0.0
	if (re <= -0.0042)
		tmp = exp(re);
	elseif (re <= 1.3e-8)
		tmp = t_0;
	elseif (re <= 1e+150)
		tmp = Float64(exp(re) * Float64(1.0 + Float64(im * Float64(im * -0.5))));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = cos(im) * (1.0 + (re * (1.0 + (re * 0.5))));
	tmp = 0.0;
	if (re <= -0.0042)
		tmp = exp(re);
	elseif (re <= 1.3e-8)
		tmp = t_0;
	elseif (re <= 1e+150)
		tmp = exp(re) * (1.0 + (im * (im * -0.5)));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[Cos[im], $MachinePrecision] * N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.0042], N[Exp[re], $MachinePrecision], If[LessEqual[re, 1.3e-8], t$95$0, If[LessEqual[re, 1e+150], N[(N[Exp[re], $MachinePrecision] * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

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

\mathbf{elif}\;re \leq 1.3 \cdot 10^{-8}:\\
\;\;\;\;t\_0\\

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

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


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

    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.00419999999999999974 < re < 1.3000000000000001e-8 or 9.99999999999999981e149 < 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 + \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.7%

        \[\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.7%

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

    if 1.3000000000000001e-8 < re < 9.99999999999999981e149

    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-*.f6475.0%

        \[\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. Simplified75.0%

      \[\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 simplification96.3%

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

Alternative 6: 93.4% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -0.0014:\\ \;\;\;\;e^{re}\\ \mathbf{elif}\;re \leq 1.3 \cdot 10^{-8}:\\ \;\;\;\;\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 (<= re -0.0014)
   (exp re)
   (if (<= re 1.3e-8)
     (* (cos im) (+ re 1.0))
     (* (exp re) (+ 1.0 (* im (* im -0.5)))))))
double code(double re, double im) {
	double tmp;
	if (re <= -0.0014) {
		tmp = exp(re);
	} else if (re <= 1.3e-8) {
		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 (re <= (-0.0014d0)) then
        tmp = exp(re)
    else if (re <= 1.3d-8) 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 (re <= -0.0014) {
		tmp = Math.exp(re);
	} else if (re <= 1.3e-8) {
		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 re <= -0.0014:
		tmp = math.exp(re)
	elif re <= 1.3e-8:
		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 (re <= -0.0014)
		tmp = exp(re);
	elseif (re <= 1.3e-8)
		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 (re <= -0.0014)
		tmp = exp(re);
	elseif (re <= 1.3e-8)
		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[re, -0.0014], N[Exp[re], $MachinePrecision], If[LessEqual[re, 1.3e-8], 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}\;re \leq -0.0014:\\
\;\;\;\;e^{re}\\

\mathbf{elif}\;re \leq 1.3 \cdot 10^{-8}:\\
\;\;\;\;\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 re < -0.00139999999999999999

    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.00139999999999999999 < re < 1.3000000000000001e-8

    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.3%

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

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

    if 1.3000000000000001e-8 < 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-*.f6477.9%

        \[\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. Simplified77.9%

      \[\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 simplification93.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -0.0014:\\ \;\;\;\;e^{re}\\ \mathbf{elif}\;re \leq 1.3 \cdot 10^{-8}:\\ \;\;\;\;\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 7: 93.6% accurate, 1.7× speedup?

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

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

\mathbf{elif}\;re \leq 1.3 \cdot 10^{-8}:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\

\mathbf{elif}\;re \leq 10^{+106}:\\
\;\;\;\;e^{re}\\

\mathbf{else}:\\
\;\;\;\;\left(1 + 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)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < -0.00139999999999999999 or 1.3000000000000001e-8 < re < 1.00000000000000009e106

    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.f6492.8%

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

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

    if -0.00139999999999999999 < re < 1.3000000000000001e-8

    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.3%

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

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

    if 1.00000000000000009e106 < 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-*.f6484.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. Simplified84.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)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification94.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -0.0014:\\ \;\;\;\;e^{re}\\ \mathbf{elif}\;re \leq 1.3 \cdot 10^{-8}:\\ \;\;\;\;\cos im \cdot \left(re + 1\right)\\ \mathbf{elif}\;re \leq 10^{+106}:\\ \;\;\;\;e^{re}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + 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)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 93.2% accurate, 1.7× speedup?

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

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

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

\mathbf{elif}\;re \leq 4.3 \cdot 10^{+105}:\\
\;\;\;\;e^{re}\\

\mathbf{else}:\\
\;\;\;\;\left(1 + 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)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < -0.00145 or 5.4e-10 < re < 4.3000000000000002e105

    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.f6492.8%

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

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

    if -0.00145 < re < 5.4e-10

    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.f6498.6%

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

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

    if 4.3000000000000002e105 < 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-*.f6484.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. Simplified84.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)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 9: 83.2% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -9.2 \cdot 10^{+102}:\\ \;\;\;\;\frac{1}{1 + re \cdot \left(-1 + re \cdot \left(0.5 + re \cdot -0.16666666666666666\right)\right)}\\ \mathbf{elif}\;re \leq -560:\\ \;\;\;\;\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot 0.041666666666666664\\ \mathbf{elif}\;re \leq 1.3 \cdot 10^{-8}:\\ \;\;\;\;\cos im\\ \mathbf{else}:\\ \;\;\;\;\left(1 + 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)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re -9.2e+102)
   (/ 1.0 (+ 1.0 (* re (+ -1.0 (* re (+ 0.5 (* re -0.16666666666666666)))))))
   (if (<= re -560.0)
     (* (* (* im im) (* im im)) 0.041666666666666664)
     (if (<= re 1.3e-8)
       (cos im)
       (*
        (+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666))))))
        (+ 1.0 (* im (* im -0.5))))))))
double code(double re, double im) {
	double tmp;
	if (re <= -9.2e+102) {
		tmp = 1.0 / (1.0 + (re * (-1.0 + (re * (0.5 + (re * -0.16666666666666666))))));
	} else if (re <= -560.0) {
		tmp = ((im * im) * (im * im)) * 0.041666666666666664;
	} else if (re <= 1.3e-8) {
		tmp = cos(im);
	} else {
		tmp = (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))) * (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 (re <= (-9.2d+102)) then
        tmp = 1.0d0 / (1.0d0 + (re * ((-1.0d0) + (re * (0.5d0 + (re * (-0.16666666666666666d0)))))))
    else if (re <= (-560.0d0)) then
        tmp = ((im * im) * (im * im)) * 0.041666666666666664d0
    else if (re <= 1.3d-8) then
        tmp = cos(im)
    else
        tmp = (1.0d0 + (re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0)))))) * (1.0d0 + (im * (im * (-0.5d0))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= -9.2e+102) {
		tmp = 1.0 / (1.0 + (re * (-1.0 + (re * (0.5 + (re * -0.16666666666666666))))));
	} else if (re <= -560.0) {
		tmp = ((im * im) * (im * im)) * 0.041666666666666664;
	} else if (re <= 1.3e-8) {
		tmp = Math.cos(im);
	} else {
		tmp = (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))) * (1.0 + (im * (im * -0.5)));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= -9.2e+102:
		tmp = 1.0 / (1.0 + (re * (-1.0 + (re * (0.5 + (re * -0.16666666666666666))))))
	elif re <= -560.0:
		tmp = ((im * im) * (im * im)) * 0.041666666666666664
	elif re <= 1.3e-8:
		tmp = math.cos(im)
	else:
		tmp = (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))) * (1.0 + (im * (im * -0.5)))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= -9.2e+102)
		tmp = Float64(1.0 / Float64(1.0 + Float64(re * Float64(-1.0 + Float64(re * Float64(0.5 + Float64(re * -0.16666666666666666)))))));
	elseif (re <= -560.0)
		tmp = Float64(Float64(Float64(im * im) * Float64(im * im)) * 0.041666666666666664);
	elseif (re <= 1.3e-8)
		tmp = cos(im);
	else
		tmp = Float64(Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))))) * Float64(1.0 + Float64(im * Float64(im * -0.5))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= -9.2e+102)
		tmp = 1.0 / (1.0 + (re * (-1.0 + (re * (0.5 + (re * -0.16666666666666666))))));
	elseif (re <= -560.0)
		tmp = ((im * im) * (im * im)) * 0.041666666666666664;
	elseif (re <= 1.3e-8)
		tmp = cos(im);
	else
		tmp = (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))) * (1.0 + (im * (im * -0.5)));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, -9.2e+102], N[(1.0 / N[(1.0 + N[(re * N[(-1.0 + N[(re * N[(0.5 + N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, -560.0], N[(N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] * 0.041666666666666664), $MachinePrecision], If[LessEqual[re, 1.3e-8], N[Cos[im], $MachinePrecision], N[(N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq -9.2 \cdot 10^{+102}:\\
\;\;\;\;\frac{1}{1 + re \cdot \left(-1 + re \cdot \left(0.5 + re \cdot -0.16666666666666666\right)\right)}\\

\mathbf{elif}\;re \leq -560:\\
\;\;\;\;\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot 0.041666666666666664\\

\mathbf{elif}\;re \leq 1.3 \cdot 10^{-8}:\\
\;\;\;\;\cos im\\

\mathbf{else}:\\
\;\;\;\;\left(1 + 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)\\


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

    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-*.f641.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. Simplified1.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. Step-by-step derivation
      1. flip-+N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \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)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      12. *-lowering-*.f641.6%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \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)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
    7. Applied egg-rr1.6%

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      10. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
    10. Simplified100.0%

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \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)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \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)\right)\right) \]
      9. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{/.f64}\left(1, \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 \color{blue}{\frac{-1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{/.f64}\left(1, \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, \color{blue}{\frac{-1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
    13. Simplified100.0%

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

    if -9.1999999999999995e102 < re < -560

    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-+.f642.8%

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
      5. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
      6. metadata-evalN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
      10. unpow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, im\right)\right), \color{blue}{\frac{1}{24}}\right) \]
    13. Step-by-step derivation
      1. Simplified53.9%

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

      if -560 < re < 1.3000000000000001e-8

      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.f6498.6%

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

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

      if 1.3000000000000001e-8 < 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-*.f6468.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. Simplified68.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-*.f6463.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. Simplified63.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)} \]
    14. Recombined 4 regimes into one program.
    15. Add Preprocessing

    Alternative 10: 60.8% accurate, 5.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\ \mathbf{if}\;re \leq -1 \cdot 10^{+103}:\\ \;\;\;\;\frac{1}{1 + re \cdot \left(-1 + re \cdot \left(0.5 + re \cdot -0.16666666666666666\right)\right)}\\ \mathbf{elif}\;re \leq -0.00135:\\ \;\;\;\;\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(re \cdot 0.041666666666666664\right)\\ \mathbf{elif}\;re \leq 4 \cdot 10^{+19}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\ \end{array} \end{array} \]
    (FPCore (re im)
     :precision binary64
     (let* ((t_0 (+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666))))))))
       (if (<= re -1e+103)
         (/ 1.0 (+ 1.0 (* re (+ -1.0 (* re (+ 0.5 (* re -0.16666666666666666)))))))
         (if (<= re -0.00135)
           (* (* (* im im) (* im im)) (* re 0.041666666666666664))
           (if (<= re 4e+19) t_0 (* t_0 (+ 1.0 (* im (* im -0.5)))))))))
    double code(double re, double im) {
    	double t_0 = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
    	double tmp;
    	if (re <= -1e+103) {
    		tmp = 1.0 / (1.0 + (re * (-1.0 + (re * (0.5 + (re * -0.16666666666666666))))));
    	} else if (re <= -0.00135) {
    		tmp = ((im * im) * (im * im)) * (re * 0.041666666666666664);
    	} else if (re <= 4e+19) {
    		tmp = t_0;
    	} else {
    		tmp = t_0 * (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) :: t_0
        real(8) :: tmp
        t_0 = 1.0d0 + (re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0)))))
        if (re <= (-1d+103)) then
            tmp = 1.0d0 / (1.0d0 + (re * ((-1.0d0) + (re * (0.5d0 + (re * (-0.16666666666666666d0)))))))
        else if (re <= (-0.00135d0)) then
            tmp = ((im * im) * (im * im)) * (re * 0.041666666666666664d0)
        else if (re <= 4d+19) then
            tmp = t_0
        else
            tmp = t_0 * (1.0d0 + (im * (im * (-0.5d0))))
        end if
        code = tmp
    end function
    
    public static double code(double re, double im) {
    	double t_0 = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
    	double tmp;
    	if (re <= -1e+103) {
    		tmp = 1.0 / (1.0 + (re * (-1.0 + (re * (0.5 + (re * -0.16666666666666666))))));
    	} else if (re <= -0.00135) {
    		tmp = ((im * im) * (im * im)) * (re * 0.041666666666666664);
    	} else if (re <= 4e+19) {
    		tmp = t_0;
    	} else {
    		tmp = t_0 * (1.0 + (im * (im * -0.5)));
    	}
    	return tmp;
    }
    
    def code(re, im):
    	t_0 = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))
    	tmp = 0
    	if re <= -1e+103:
    		tmp = 1.0 / (1.0 + (re * (-1.0 + (re * (0.5 + (re * -0.16666666666666666))))))
    	elif re <= -0.00135:
    		tmp = ((im * im) * (im * im)) * (re * 0.041666666666666664)
    	elif re <= 4e+19:
    		tmp = t_0
    	else:
    		tmp = t_0 * (1.0 + (im * (im * -0.5)))
    	return tmp
    
    function code(re, im)
    	t_0 = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666))))))
    	tmp = 0.0
    	if (re <= -1e+103)
    		tmp = Float64(1.0 / Float64(1.0 + Float64(re * Float64(-1.0 + Float64(re * Float64(0.5 + Float64(re * -0.16666666666666666)))))));
    	elseif (re <= -0.00135)
    		tmp = Float64(Float64(Float64(im * im) * Float64(im * im)) * Float64(re * 0.041666666666666664));
    	elseif (re <= 4e+19)
    		tmp = t_0;
    	else
    		tmp = Float64(t_0 * Float64(1.0 + Float64(im * Float64(im * -0.5))));
    	end
    	return tmp
    end
    
    function tmp_2 = code(re, im)
    	t_0 = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
    	tmp = 0.0;
    	if (re <= -1e+103)
    		tmp = 1.0 / (1.0 + (re * (-1.0 + (re * (0.5 + (re * -0.16666666666666666))))));
    	elseif (re <= -0.00135)
    		tmp = ((im * im) * (im * im)) * (re * 0.041666666666666664);
    	elseif (re <= 4e+19)
    		tmp = t_0;
    	else
    		tmp = t_0 * (1.0 + (im * (im * -0.5)));
    	end
    	tmp_2 = tmp;
    end
    
    code[re_, im_] := Block[{t$95$0 = N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -1e+103], N[(1.0 / N[(1.0 + N[(re * N[(-1.0 + N[(re * N[(0.5 + N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, -0.00135], N[(N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(re * 0.041666666666666664), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 4e+19], t$95$0, N[(t$95$0 * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := 1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\
    \mathbf{if}\;re \leq -1 \cdot 10^{+103}:\\
    \;\;\;\;\frac{1}{1 + re \cdot \left(-1 + re \cdot \left(0.5 + re \cdot -0.16666666666666666\right)\right)}\\
    
    \mathbf{elif}\;re \leq -0.00135:\\
    \;\;\;\;\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(re \cdot 0.041666666666666664\right)\\
    
    \mathbf{elif}\;re \leq 4 \cdot 10^{+19}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0 \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if re < -1e103

      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-*.f641.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. Simplified1.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. Step-by-step derivation
        1. flip-+N/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \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)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        12. *-lowering-*.f641.6%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \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)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      7. Applied egg-rr1.6%

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

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

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        7. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        8. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        9. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        10. *-lowering-*.f64100.0%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      10. Simplified100.0%

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \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)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \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)\right)\right) \]
        9. +-lowering-+.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(1, \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 \color{blue}{\frac{-1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
        11. *-lowering-*.f64100.0%

          \[\leadsto \mathsf{/.f64}\left(1, \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, \color{blue}{\frac{-1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
      13. Simplified100.0%

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

      if -1e103 < re < -0.0013500000000000001

      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-+.f645.3%

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        3. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        5. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        6. metadata-evalN/A

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        8. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        9. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        10. unpow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, im\right)\right), \mathsf{*.f64}\left(\frac{1}{24}, \left(re + \color{blue}{1}\right)\right)\right) \]
        14. +-lowering-+.f6450.9%

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, im\right)\right), \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{24}}\right)\right) \]
      14. Simplified51.0%

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

      if -0.0013500000000000001 < re < 4e19

      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-*.f6496.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. Simplified96.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 \color{blue}{1 + re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)} \]
      7. Step-by-step derivation
        1. +-lowering-+.f64N/A

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

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

          \[\leadsto \mathsf{+.f64}\left(1, \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)\right) \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(1, \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)\right) \]
        5. +-lowering-+.f64N/A

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

          \[\leadsto \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 \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right) \]
        7. *-lowering-*.f6451.6%

          \[\leadsto \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, \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right) \]
      8. Simplified51.6%

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

      if 4e19 < 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.9%

          \[\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.9%

        \[\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-*.f6468.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. Simplified68.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)} \]
    3. Recombined 4 regimes into one program.
    4. Add Preprocessing

    Alternative 11: 58.6% accurate, 6.3× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -1 \cdot 10^{+103}:\\ \;\;\;\;\frac{1}{1 + re \cdot \left(-1 + re \cdot \left(0.5 + re \cdot -0.16666666666666666\right)\right)}\\ \mathbf{elif}\;re \leq -0.00135:\\ \;\;\;\;\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(re \cdot 0.041666666666666664\right)\\ \mathbf{elif}\;re \leq 3 \cdot 10^{+23}:\\ \;\;\;\;1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\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} \end{array} \]
    (FPCore (re im)
     :precision binary64
     (if (<= re -1e+103)
       (/ 1.0 (+ 1.0 (* re (+ -1.0 (* re (+ 0.5 (* re -0.16666666666666666)))))))
       (if (<= re -0.00135)
         (* (* (* im im) (* im im)) (* re 0.041666666666666664))
         (if (<= re 3e+23)
           (+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666))))))
           (* (+ 1.0 (* im (* im -0.5))) (+ 1.0 (* re (+ 1.0 (* re 0.5)))))))))
    double code(double re, double im) {
    	double tmp;
    	if (re <= -1e+103) {
    		tmp = 1.0 / (1.0 + (re * (-1.0 + (re * (0.5 + (re * -0.16666666666666666))))));
    	} else if (re <= -0.00135) {
    		tmp = ((im * im) * (im * im)) * (re * 0.041666666666666664);
    	} else if (re <= 3e+23) {
    		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
    	} else {
    		tmp = (1.0 + (im * (im * -0.5))) * (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 <= (-1d+103)) then
            tmp = 1.0d0 / (1.0d0 + (re * ((-1.0d0) + (re * (0.5d0 + (re * (-0.16666666666666666d0)))))))
        else if (re <= (-0.00135d0)) then
            tmp = ((im * im) * (im * im)) * (re * 0.041666666666666664d0)
        else if (re <= 3d+23) then
            tmp = 1.0d0 + (re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0)))))
        else
            tmp = (1.0d0 + (im * (im * (-0.5d0)))) * (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 <= -1e+103) {
    		tmp = 1.0 / (1.0 + (re * (-1.0 + (re * (0.5 + (re * -0.16666666666666666))))));
    	} else if (re <= -0.00135) {
    		tmp = ((im * im) * (im * im)) * (re * 0.041666666666666664);
    	} else if (re <= 3e+23) {
    		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
    	} else {
    		tmp = (1.0 + (im * (im * -0.5))) * (1.0 + (re * (1.0 + (re * 0.5))));
    	}
    	return tmp;
    }
    
    def code(re, im):
    	tmp = 0
    	if re <= -1e+103:
    		tmp = 1.0 / (1.0 + (re * (-1.0 + (re * (0.5 + (re * -0.16666666666666666))))))
    	elif re <= -0.00135:
    		tmp = ((im * im) * (im * im)) * (re * 0.041666666666666664)
    	elif re <= 3e+23:
    		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))
    	else:
    		tmp = (1.0 + (im * (im * -0.5))) * (1.0 + (re * (1.0 + (re * 0.5))))
    	return tmp
    
    function code(re, im)
    	tmp = 0.0
    	if (re <= -1e+103)
    		tmp = Float64(1.0 / Float64(1.0 + Float64(re * Float64(-1.0 + Float64(re * Float64(0.5 + Float64(re * -0.16666666666666666)))))));
    	elseif (re <= -0.00135)
    		tmp = Float64(Float64(Float64(im * im) * Float64(im * im)) * Float64(re * 0.041666666666666664));
    	elseif (re <= 3e+23)
    		tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666))))));
    	else
    		tmp = Float64(Float64(1.0 + Float64(im * Float64(im * -0.5))) * 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 <= -1e+103)
    		tmp = 1.0 / (1.0 + (re * (-1.0 + (re * (0.5 + (re * -0.16666666666666666))))));
    	elseif (re <= -0.00135)
    		tmp = ((im * im) * (im * im)) * (re * 0.041666666666666664);
    	elseif (re <= 3e+23)
    		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
    	else
    		tmp = (1.0 + (im * (im * -0.5))) * (1.0 + (re * (1.0 + (re * 0.5))));
    	end
    	tmp_2 = tmp;
    end
    
    code[re_, im_] := If[LessEqual[re, -1e+103], N[(1.0 / N[(1.0 + N[(re * N[(-1.0 + N[(re * N[(0.5 + N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, -0.00135], N[(N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(re * 0.041666666666666664), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 3e+23], N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $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 * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;re \leq -1 \cdot 10^{+103}:\\
    \;\;\;\;\frac{1}{1 + re \cdot \left(-1 + re \cdot \left(0.5 + re \cdot -0.16666666666666666\right)\right)}\\
    
    \mathbf{elif}\;re \leq -0.00135:\\
    \;\;\;\;\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(re \cdot 0.041666666666666664\right)\\
    
    \mathbf{elif}\;re \leq 3 \cdot 10^{+23}:\\
    \;\;\;\;1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\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}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if re < -1e103

      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-*.f641.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. Simplified1.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. Step-by-step derivation
        1. flip-+N/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \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)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        12. *-lowering-*.f641.6%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \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)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      7. Applied egg-rr1.6%

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

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

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        7. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        8. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        9. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        10. *-lowering-*.f64100.0%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      10. Simplified100.0%

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \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)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \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)\right)\right) \]
        9. +-lowering-+.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(1, \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 \color{blue}{\frac{-1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
        11. *-lowering-*.f64100.0%

          \[\leadsto \mathsf{/.f64}\left(1, \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, \color{blue}{\frac{-1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
      13. Simplified100.0%

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

      if -1e103 < re < -0.0013500000000000001

      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-+.f645.3%

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        3. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        5. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        6. metadata-evalN/A

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        8. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        9. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        10. unpow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, im\right)\right), \mathsf{*.f64}\left(\frac{1}{24}, \left(re + \color{blue}{1}\right)\right)\right) \]
        14. +-lowering-+.f6450.9%

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, im\right)\right), \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{24}}\right)\right) \]
      14. Simplified51.0%

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

      if -0.0013500000000000001 < re < 3.0000000000000001e23

      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-*.f6495.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. Simplified95.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 \color{blue}{1 + re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)} \]
      7. Step-by-step derivation
        1. +-lowering-+.f64N/A

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

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

          \[\leadsto \mathsf{+.f64}\left(1, \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)\right) \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(1, \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)\right) \]
        5. +-lowering-+.f64N/A

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

          \[\leadsto \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 \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right) \]
        7. *-lowering-*.f6451.2%

          \[\leadsto \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, \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right) \]
      8. Simplified51.2%

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

      if 3.0000000000000001e23 < 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-*.f6480.0%

          \[\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. Simplified80.0%

        \[\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-*.f6458.1%

          \[\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. Simplified58.1%

        \[\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.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -1 \cdot 10^{+103}:\\ \;\;\;\;\frac{1}{1 + re \cdot \left(-1 + re \cdot \left(0.5 + re \cdot -0.16666666666666666\right)\right)}\\ \mathbf{elif}\;re \leq -0.00135:\\ \;\;\;\;\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(re \cdot 0.041666666666666664\right)\\ \mathbf{elif}\;re \leq 3 \cdot 10^{+23}:\\ \;\;\;\;1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\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: 59.7% accurate, 8.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -1 \cdot 10^{+103}:\\ \;\;\;\;\frac{1}{1 + re \cdot \left(-1 + re \cdot \left(0.5 + re \cdot -0.16666666666666666\right)\right)}\\ \mathbf{elif}\;re \leq -0.00135:\\ \;\;\;\;\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(re \cdot 0.041666666666666664\right)\\ \mathbf{else}:\\ \;\;\;\;1 + 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 -1e+103)
       (/ 1.0 (+ 1.0 (* re (+ -1.0 (* re (+ 0.5 (* re -0.16666666666666666)))))))
       (if (<= re -0.00135)
         (* (* (* im im) (* im im)) (* re 0.041666666666666664))
         (+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666)))))))))
    double code(double re, double im) {
    	double tmp;
    	if (re <= -1e+103) {
    		tmp = 1.0 / (1.0 + (re * (-1.0 + (re * (0.5 + (re * -0.16666666666666666))))));
    	} else if (re <= -0.00135) {
    		tmp = ((im * im) * (im * im)) * (re * 0.041666666666666664);
    	} else {
    		tmp = 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 <= (-1d+103)) then
            tmp = 1.0d0 / (1.0d0 + (re * ((-1.0d0) + (re * (0.5d0 + (re * (-0.16666666666666666d0)))))))
        else if (re <= (-0.00135d0)) then
            tmp = ((im * im) * (im * im)) * (re * 0.041666666666666664d0)
        else
            tmp = 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 <= -1e+103) {
    		tmp = 1.0 / (1.0 + (re * (-1.0 + (re * (0.5 + (re * -0.16666666666666666))))));
    	} else if (re <= -0.00135) {
    		tmp = ((im * im) * (im * im)) * (re * 0.041666666666666664);
    	} else {
    		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
    	}
    	return tmp;
    }
    
    def code(re, im):
    	tmp = 0
    	if re <= -1e+103:
    		tmp = 1.0 / (1.0 + (re * (-1.0 + (re * (0.5 + (re * -0.16666666666666666))))))
    	elif re <= -0.00135:
    		tmp = ((im * im) * (im * im)) * (re * 0.041666666666666664)
    	else:
    		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))
    	return tmp
    
    function code(re, im)
    	tmp = 0.0
    	if (re <= -1e+103)
    		tmp = Float64(1.0 / Float64(1.0 + Float64(re * Float64(-1.0 + Float64(re * Float64(0.5 + Float64(re * -0.16666666666666666)))))));
    	elseif (re <= -0.00135)
    		tmp = Float64(Float64(Float64(im * im) * Float64(im * im)) * Float64(re * 0.041666666666666664));
    	else
    		tmp = 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 <= -1e+103)
    		tmp = 1.0 / (1.0 + (re * (-1.0 + (re * (0.5 + (re * -0.16666666666666666))))));
    	elseif (re <= -0.00135)
    		tmp = ((im * im) * (im * im)) * (re * 0.041666666666666664);
    	else
    		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
    	end
    	tmp_2 = tmp;
    end
    
    code[re_, im_] := If[LessEqual[re, -1e+103], N[(1.0 / N[(1.0 + N[(re * N[(-1.0 + N[(re * N[(0.5 + N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, -0.00135], N[(N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(re * 0.041666666666666664), $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]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;re \leq -1 \cdot 10^{+103}:\\
    \;\;\;\;\frac{1}{1 + re \cdot \left(-1 + re \cdot \left(0.5 + re \cdot -0.16666666666666666\right)\right)}\\
    
    \mathbf{elif}\;re \leq -0.00135:\\
    \;\;\;\;\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(re \cdot 0.041666666666666664\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if re < -1e103

      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-*.f641.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. Simplified1.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. Step-by-step derivation
        1. flip-+N/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \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)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        12. *-lowering-*.f641.6%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \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)\right)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      7. Applied egg-rr1.6%

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

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

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        7. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        8. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        9. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
        10. *-lowering-*.f64100.0%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \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)\right), \mathsf{cos.f64}\left(im\right)\right) \]
      10. Simplified100.0%

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \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)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \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)\right)\right) \]
        9. +-lowering-+.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(1, \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 \color{blue}{\frac{-1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
        11. *-lowering-*.f64100.0%

          \[\leadsto \mathsf{/.f64}\left(1, \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, \color{blue}{\frac{-1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
      13. Simplified100.0%

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

      if -1e103 < re < -0.0013500000000000001

      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-+.f645.3%

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        3. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        5. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        6. metadata-evalN/A

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        8. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        9. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        10. unpow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, im\right)\right), \mathsf{*.f64}\left(\frac{1}{24}, \left(re + \color{blue}{1}\right)\right)\right) \]
        14. +-lowering-+.f6450.9%

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, im\right)\right), \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{24}}\right)\right) \]
      14. Simplified51.0%

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

      if -0.0013500000000000001 < 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-*.f6489.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{cos.f64}\left(im\right)\right) \]
      5. Simplified89.3%

        \[\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 \color{blue}{1 + re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)} \]
      7. Step-by-step derivation
        1. +-lowering-+.f64N/A

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

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

          \[\leadsto \mathsf{+.f64}\left(1, \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)\right) \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(1, \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)\right) \]
        5. +-lowering-+.f64N/A

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

          \[\leadsto \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 \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right) \]
        7. *-lowering-*.f6451.2%

          \[\leadsto \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, \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right) \]
      8. Simplified51.2%

        \[\leadsto \color{blue}{1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)} \]
    3. Recombined 3 regimes into one program.
    4. Add Preprocessing

    Alternative 13: 42.4% accurate, 10.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -4.8:\\ \;\;\;\;\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot 0.041666666666666664\\ \mathbf{elif}\;re \leq 1.76 \cdot 10^{+19}:\\ \;\;\;\;re + 1\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\ \end{array} \end{array} \]
    (FPCore (re im)
     :precision binary64
     (if (<= re -4.8)
       (* (* (* im im) (* im im)) 0.041666666666666664)
       (if (<= re 1.76e+19) (+ re 1.0) (* re (+ 1.0 (* im (* im -0.5)))))))
    double code(double re, double im) {
    	double tmp;
    	if (re <= -4.8) {
    		tmp = ((im * im) * (im * im)) * 0.041666666666666664;
    	} else if (re <= 1.76e+19) {
    		tmp = re + 1.0;
    	} else {
    		tmp = 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 (re <= (-4.8d0)) then
            tmp = ((im * im) * (im * im)) * 0.041666666666666664d0
        else if (re <= 1.76d+19) then
            tmp = re + 1.0d0
        else
            tmp = re * (1.0d0 + (im * (im * (-0.5d0))))
        end if
        code = tmp
    end function
    
    public static double code(double re, double im) {
    	double tmp;
    	if (re <= -4.8) {
    		tmp = ((im * im) * (im * im)) * 0.041666666666666664;
    	} else if (re <= 1.76e+19) {
    		tmp = re + 1.0;
    	} else {
    		tmp = re * (1.0 + (im * (im * -0.5)));
    	}
    	return tmp;
    }
    
    def code(re, im):
    	tmp = 0
    	if re <= -4.8:
    		tmp = ((im * im) * (im * im)) * 0.041666666666666664
    	elif re <= 1.76e+19:
    		tmp = re + 1.0
    	else:
    		tmp = re * (1.0 + (im * (im * -0.5)))
    	return tmp
    
    function code(re, im)
    	tmp = 0.0
    	if (re <= -4.8)
    		tmp = Float64(Float64(Float64(im * im) * Float64(im * im)) * 0.041666666666666664);
    	elseif (re <= 1.76e+19)
    		tmp = Float64(re + 1.0);
    	else
    		tmp = Float64(re * Float64(1.0 + Float64(im * Float64(im * -0.5))));
    	end
    	return tmp
    end
    
    function tmp_2 = code(re, im)
    	tmp = 0.0;
    	if (re <= -4.8)
    		tmp = ((im * im) * (im * im)) * 0.041666666666666664;
    	elseif (re <= 1.76e+19)
    		tmp = re + 1.0;
    	else
    		tmp = re * (1.0 + (im * (im * -0.5)));
    	end
    	tmp_2 = tmp;
    end
    
    code[re_, im_] := If[LessEqual[re, -4.8], N[(N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] * 0.041666666666666664), $MachinePrecision], If[LessEqual[re, 1.76e+19], N[(re + 1.0), $MachinePrecision], N[(re * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;re \leq -4.8:\\
    \;\;\;\;\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot 0.041666666666666664\\
    
    \mathbf{elif}\;re \leq 1.76 \cdot 10^{+19}:\\
    \;\;\;\;re + 1\\
    
    \mathbf{else}:\\
    \;\;\;\;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 re < -4.79999999999999982

      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-+.f642.3%

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        3. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        5. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        6. metadata-evalN/A

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        8. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        9. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
        10. unpow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, im\right)\right), \color{blue}{\frac{1}{24}}\right) \]
      13. Step-by-step derivation
        1. Simplified42.5%

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

        if -4.79999999999999982 < re < 1.76e19

        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.f6454.5%

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

          \[\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-+.f6451.1%

            \[\leadsto \mathsf{+.f64}\left(re, \color{blue}{1}\right) \]
        8. Simplified51.1%

          \[\leadsto \color{blue}{re + 1} \]

        if 1.76e19 < 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\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-+.f645.9%

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

          \[\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.2%

            \[\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.2%

          \[\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.2%

            \[\leadsto \color{blue}{re} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right) \]
        11. Recombined 3 regimes into one program.
        12. Add Preprocessing

        Alternative 14: 36.0% accurate, 10.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -0.00135:\\ \;\;\;\;im \cdot \left(im \cdot \left(-0.5 + re \cdot -0.5\right)\right)\\ \mathbf{elif}\;re \leq 9.5 \cdot 10^{+19}:\\ \;\;\;\;re + 1\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\ \end{array} \end{array} \]
        (FPCore (re im)
         :precision binary64
         (if (<= re -0.00135)
           (* im (* im (+ -0.5 (* re -0.5))))
           (if (<= re 9.5e+19) (+ re 1.0) (* re (+ 1.0 (* im (* im -0.5)))))))
        double code(double re, double im) {
        	double tmp;
        	if (re <= -0.00135) {
        		tmp = im * (im * (-0.5 + (re * -0.5)));
        	} else if (re <= 9.5e+19) {
        		tmp = re + 1.0;
        	} else {
        		tmp = 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 (re <= (-0.00135d0)) then
                tmp = im * (im * ((-0.5d0) + (re * (-0.5d0))))
            else if (re <= 9.5d+19) then
                tmp = re + 1.0d0
            else
                tmp = re * (1.0d0 + (im * (im * (-0.5d0))))
            end if
            code = tmp
        end function
        
        public static double code(double re, double im) {
        	double tmp;
        	if (re <= -0.00135) {
        		tmp = im * (im * (-0.5 + (re * -0.5)));
        	} else if (re <= 9.5e+19) {
        		tmp = re + 1.0;
        	} else {
        		tmp = re * (1.0 + (im * (im * -0.5)));
        	}
        	return tmp;
        }
        
        def code(re, im):
        	tmp = 0
        	if re <= -0.00135:
        		tmp = im * (im * (-0.5 + (re * -0.5)))
        	elif re <= 9.5e+19:
        		tmp = re + 1.0
        	else:
        		tmp = re * (1.0 + (im * (im * -0.5)))
        	return tmp
        
        function code(re, im)
        	tmp = 0.0
        	if (re <= -0.00135)
        		tmp = Float64(im * Float64(im * Float64(-0.5 + Float64(re * -0.5))));
        	elseif (re <= 9.5e+19)
        		tmp = Float64(re + 1.0);
        	else
        		tmp = Float64(re * Float64(1.0 + Float64(im * Float64(im * -0.5))));
        	end
        	return tmp
        end
        
        function tmp_2 = code(re, im)
        	tmp = 0.0;
        	if (re <= -0.00135)
        		tmp = im * (im * (-0.5 + (re * -0.5)));
        	elseif (re <= 9.5e+19)
        		tmp = re + 1.0;
        	else
        		tmp = re * (1.0 + (im * (im * -0.5)));
        	end
        	tmp_2 = tmp;
        end
        
        code[re_, im_] := If[LessEqual[re, -0.00135], N[(im * N[(im * N[(-0.5 + N[(re * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 9.5e+19], N[(re + 1.0), $MachinePrecision], N[(re * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;re \leq -0.00135:\\
        \;\;\;\;im \cdot \left(im \cdot \left(-0.5 + re \cdot -0.5\right)\right)\\
        
        \mathbf{elif}\;re \leq 9.5 \cdot 10^{+19}:\\
        \;\;\;\;re + 1\\
        
        \mathbf{else}:\\
        \;\;\;\;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 re < -0.0013500000000000001

          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.1%

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

            \[\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-*.f642.1%

              \[\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. Simplified2.1%

            \[\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-rgt-inN/A

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

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

              \[\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. Simplified12.9%

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

          if -0.0013500000000000001 < re < 9.5e19

          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.f6455.2%

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

            \[\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-+.f6451.1%

              \[\leadsto \mathsf{+.f64}\left(re, \color{blue}{1}\right) \]
          8. Simplified51.1%

            \[\leadsto \color{blue}{re + 1} \]

          if 9.5e19 < 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\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-+.f645.9%

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

            \[\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.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. Simplified28.6%

            \[\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.6%

              \[\leadsto \color{blue}{re} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right) \]
          11. Recombined 3 regimes into one program.
          12. Add Preprocessing

          Alternative 15: 35.5% accurate, 10.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := im \cdot \left(im \cdot \left(-0.5 + re \cdot -0.5\right)\right)\\ \mathbf{if}\;re \leq -0.00135:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 9.5 \cdot 10^{+19}:\\ \;\;\;\;re + 1\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
          (FPCore (re im)
           :precision binary64
           (let* ((t_0 (* im (* im (+ -0.5 (* re -0.5))))))
             (if (<= re -0.00135) t_0 (if (<= re 9.5e+19) (+ re 1.0) t_0))))
          double code(double re, double im) {
          	double t_0 = im * (im * (-0.5 + (re * -0.5)));
          	double tmp;
          	if (re <= -0.00135) {
          		tmp = t_0;
          	} else if (re <= 9.5e+19) {
          		tmp = re + 1.0;
          	} else {
          		tmp = t_0;
          	}
          	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 = im * (im * ((-0.5d0) + (re * (-0.5d0))))
              if (re <= (-0.00135d0)) then
                  tmp = t_0
              else if (re <= 9.5d+19) then
                  tmp = re + 1.0d0
              else
                  tmp = t_0
              end if
              code = tmp
          end function
          
          public static double code(double re, double im) {
          	double t_0 = im * (im * (-0.5 + (re * -0.5)));
          	double tmp;
          	if (re <= -0.00135) {
          		tmp = t_0;
          	} else if (re <= 9.5e+19) {
          		tmp = re + 1.0;
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          def code(re, im):
          	t_0 = im * (im * (-0.5 + (re * -0.5)))
          	tmp = 0
          	if re <= -0.00135:
          		tmp = t_0
          	elif re <= 9.5e+19:
          		tmp = re + 1.0
          	else:
          		tmp = t_0
          	return tmp
          
          function code(re, im)
          	t_0 = Float64(im * Float64(im * Float64(-0.5 + Float64(re * -0.5))))
          	tmp = 0.0
          	if (re <= -0.00135)
          		tmp = t_0;
          	elseif (re <= 9.5e+19)
          		tmp = Float64(re + 1.0);
          	else
          		tmp = t_0;
          	end
          	return tmp
          end
          
          function tmp_2 = code(re, im)
          	t_0 = im * (im * (-0.5 + (re * -0.5)));
          	tmp = 0.0;
          	if (re <= -0.00135)
          		tmp = t_0;
          	elseif (re <= 9.5e+19)
          		tmp = re + 1.0;
          	else
          		tmp = t_0;
          	end
          	tmp_2 = tmp;
          end
          
          code[re_, im_] := Block[{t$95$0 = N[(im * N[(im * N[(-0.5 + N[(re * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.00135], t$95$0, If[LessEqual[re, 9.5e+19], N[(re + 1.0), $MachinePrecision], t$95$0]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := im \cdot \left(im \cdot \left(-0.5 + re \cdot -0.5\right)\right)\\
          \mathbf{if}\;re \leq -0.00135:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;re \leq 9.5 \cdot 10^{+19}:\\
          \;\;\;\;re + 1\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if re < -0.0013500000000000001 or 9.5e19 < 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\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.5%

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \mathsf{cos.f64}\left(\color{blue}{im}\right)\right) \]
            5. Simplified4.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-*.f6415.7%

                \[\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. Simplified15.7%

              \[\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-rgt-inN/A

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

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

                \[\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. Simplified19.6%

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

            if -0.0013500000000000001 < re < 9.5e19

            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.f6455.2%

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

              \[\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-+.f6451.1%

                \[\leadsto \mathsf{+.f64}\left(re, \color{blue}{1}\right) \]
            8. Simplified51.1%

              \[\leadsto \color{blue}{re + 1} \]
          3. Recombined 2 regimes into one program.
          4. Add Preprocessing

          Alternative 16: 49.5% accurate, 11.3× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -6.8:\\ \;\;\;\;\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot 0.041666666666666664\\ \mathbf{else}:\\ \;\;\;\;1 + 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 -6.8)
             (* (* (* im im) (* im im)) 0.041666666666666664)
             (+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666))))))))
          double code(double re, double im) {
          	double tmp;
          	if (re <= -6.8) {
          		tmp = ((im * im) * (im * im)) * 0.041666666666666664;
          	} else {
          		tmp = 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 <= (-6.8d0)) then
                  tmp = ((im * im) * (im * im)) * 0.041666666666666664d0
              else
                  tmp = 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 <= -6.8) {
          		tmp = ((im * im) * (im * im)) * 0.041666666666666664;
          	} else {
          		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
          	}
          	return tmp;
          }
          
          def code(re, im):
          	tmp = 0
          	if re <= -6.8:
          		tmp = ((im * im) * (im * im)) * 0.041666666666666664
          	else:
          		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))
          	return tmp
          
          function code(re, im)
          	tmp = 0.0
          	if (re <= -6.8)
          		tmp = Float64(Float64(Float64(im * im) * Float64(im * im)) * 0.041666666666666664);
          	else
          		tmp = 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 <= -6.8)
          		tmp = ((im * im) * (im * im)) * 0.041666666666666664;
          	else
          		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
          	end
          	tmp_2 = tmp;
          end
          
          code[re_, im_] := If[LessEqual[re, -6.8], N[(N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] * 0.041666666666666664), $MachinePrecision], N[(1.0 + 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 -6.8:\\
          \;\;\;\;\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot 0.041666666666666664\\
          
          \mathbf{else}:\\
          \;\;\;\;1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if re < -6.79999999999999982

            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-+.f642.3%

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

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

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
              3. unpow2N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
              4. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
              5. sub-negN/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
              6. metadata-evalN/A

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

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
              8. +-lowering-+.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
              9. *-commutativeN/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
              10. unpow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, im\right)\right), \color{blue}{\frac{1}{24}}\right) \]
            13. Step-by-step derivation
              1. Simplified42.5%

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

              if -6.79999999999999982 < 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-*.f6489.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{cos.f64}\left(im\right)\right) \]
              5. Simplified89.3%

                \[\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 \color{blue}{1 + re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)} \]
              7. Step-by-step derivation
                1. +-lowering-+.f64N/A

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

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

                  \[\leadsto \mathsf{+.f64}\left(1, \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)\right) \]
                4. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{+.f64}\left(1, \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)\right) \]
                5. +-lowering-+.f64N/A

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

                  \[\leadsto \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 \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right) \]
                7. *-lowering-*.f6451.0%

                  \[\leadsto \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, \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right) \]
              8. Simplified51.0%

                \[\leadsto \color{blue}{1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)} \]
            14. Recombined 2 regimes into one program.
            15. Add Preprocessing

            Alternative 17: 46.6% accurate, 14.5× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -410:\\ \;\;\;\;\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot 0.041666666666666664\\ \mathbf{else}:\\ \;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\ \end{array} \end{array} \]
            (FPCore (re im)
             :precision binary64
             (if (<= re -410.0)
               (* (* (* im im) (* im im)) 0.041666666666666664)
               (+ 1.0 (* re (+ 1.0 (* re 0.5))))))
            double code(double re, double im) {
            	double tmp;
            	if (re <= -410.0) {
            		tmp = ((im * im) * (im * im)) * 0.041666666666666664;
            	} 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 <= (-410.0d0)) then
                    tmp = ((im * im) * (im * im)) * 0.041666666666666664d0
                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 <= -410.0) {
            		tmp = ((im * im) * (im * im)) * 0.041666666666666664;
            	} else {
            		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
            	}
            	return tmp;
            }
            
            def code(re, im):
            	tmp = 0
            	if re <= -410.0:
            		tmp = ((im * im) * (im * im)) * 0.041666666666666664
            	else:
            		tmp = 1.0 + (re * (1.0 + (re * 0.5)))
            	return tmp
            
            function code(re, im)
            	tmp = 0.0
            	if (re <= -410.0)
            		tmp = Float64(Float64(Float64(im * im) * Float64(im * im)) * 0.041666666666666664);
            	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 <= -410.0)
            		tmp = ((im * im) * (im * im)) * 0.041666666666666664;
            	else
            		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
            	end
            	tmp_2 = tmp;
            end
            
            code[re_, im_] := If[LessEqual[re, -410.0], N[(N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] * 0.041666666666666664), $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 -410:\\
            \;\;\;\;\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot 0.041666666666666664\\
            
            \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 < -410

              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-+.f642.3%

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

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

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
                3. unpow2N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
                4. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
                5. sub-negN/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
                6. metadata-evalN/A

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

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
                8. +-lowering-+.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
                9. *-commutativeN/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(re, 1\right), \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)\right) \]
                10. unpow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(im, im\right)\right), \color{blue}{\frac{1}{24}}\right) \]
              13. Step-by-step derivation
                1. Simplified42.5%

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

                if -410 < 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.f6458.9%

                    \[\leadsto \mathsf{exp.f64}\left(re\right) \]
                5. Simplified58.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-*.f6447.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. Simplified47.6%

                  \[\leadsto \color{blue}{1 + re \cdot \left(1 + re \cdot 0.5\right)} \]
              14. Recombined 2 regimes into one program.
              15. Add Preprocessing

              Alternative 18: 31.2% accurate, 16.9× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq 9.5 \cdot 10^{+19}:\\ \;\;\;\;re + 1\\ \mathbf{else}:\\ \;\;\;\;1 + im \cdot \left(im \cdot -0.5\right)\\ \end{array} \end{array} \]
              (FPCore (re im)
               :precision binary64
               (if (<= re 9.5e+19) (+ re 1.0) (+ 1.0 (* im (* im -0.5)))))
              double code(double re, double im) {
              	double tmp;
              	if (re <= 9.5e+19) {
              		tmp = re + 1.0;
              	} else {
              		tmp = 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 (re <= 9.5d+19) then
                      tmp = re + 1.0d0
                  else
                      tmp = 1.0d0 + (im * (im * (-0.5d0)))
                  end if
                  code = tmp
              end function
              
              public static double code(double re, double im) {
              	double tmp;
              	if (re <= 9.5e+19) {
              		tmp = re + 1.0;
              	} else {
              		tmp = 1.0 + (im * (im * -0.5));
              	}
              	return tmp;
              }
              
              def code(re, im):
              	tmp = 0
              	if re <= 9.5e+19:
              		tmp = re + 1.0
              	else:
              		tmp = 1.0 + (im * (im * -0.5))
              	return tmp
              
              function code(re, im)
              	tmp = 0.0
              	if (re <= 9.5e+19)
              		tmp = Float64(re + 1.0);
              	else
              		tmp = Float64(1.0 + Float64(im * Float64(im * -0.5)));
              	end
              	return tmp
              end
              
              function tmp_2 = code(re, im)
              	tmp = 0.0;
              	if (re <= 9.5e+19)
              		tmp = re + 1.0;
              	else
              		tmp = 1.0 + (im * (im * -0.5));
              	end
              	tmp_2 = tmp;
              end
              
              code[re_, im_] := If[LessEqual[re, 9.5e+19], N[(re + 1.0), $MachinePrecision], N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;re \leq 9.5 \cdot 10^{+19}:\\
              \;\;\;\;re + 1\\
              
              \mathbf{else}:\\
              \;\;\;\;1 + im \cdot \left(im \cdot -0.5\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if re < 9.5e19

                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.7%

                    \[\leadsto \mathsf{exp.f64}\left(re\right) \]
                5. Simplified67.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-+.f6436.9%

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

                  \[\leadsto \color{blue}{re + 1} \]

                if 9.5e19 < re

                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 + \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-*.f6419.1%

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

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

              Alternative 19: 29.0% 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-+.f6429.2%

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

                \[\leadsto \color{blue}{re + 1} \]
              9. Add Preprocessing

              Alternative 20: 28.6% 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.f6452.7%

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

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

                \[\leadsto \color{blue}{1} \]
              7. Step-by-step derivation
                1. Simplified28.7%

                  \[\leadsto \color{blue}{1} \]
                2. Add Preprocessing

                Reproduce

                ?
                herbie shell --seed 2024158 
                (FPCore (re im)
                  :name "math.exp on complex, real part"
                  :precision binary64
                  (* (exp re) (cos im)))