math.exp on complex, real part

Percentage Accurate: 100.0% → 100.0%
Time: 21.3s
Alternatives: 26
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 26 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 100.0% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 1.0× speedup?

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

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

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

Alternative 2: 92.7% accurate, 0.6× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;e^{re}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (exp.f64 re) < 0.0200000000000000004 or 1.01000000000000001 < (exp.f64 re)

    1. Initial program 100.0%

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

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

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

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

    if 0.0200000000000000004 < (exp.f64 re) < 1.01000000000000001

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

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

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

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

Alternative 3: 92.1% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;e^{re} \leq 1.01:\\
\;\;\;\;\cos im\\

\mathbf{else}:\\
\;\;\;\;e^{re}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (exp.f64 re) < 0.0200000000000000004 or 1.01000000000000001 < (exp.f64 re)

    1. Initial program 100.0%

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

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

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

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

    if 0.0200000000000000004 < (exp.f64 re) < 1.01000000000000001

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

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

      \[\leadsto \color{blue}{\cos im} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 97.6% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
t_0 := 0.5 + re \cdot 0.16666666666666666\\
\mathbf{if}\;re \leq -0.065:\\
\;\;\;\;e^{re}\\

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

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

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


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

    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.065000000000000002 < re < 0.0126

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.0126 < 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} + \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. *-lowering-*.f64N/A

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

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

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

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

    if 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-*.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 \]
  3. Recombined 4 regimes into one program.
  4. Final simplification98.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -0.065:\\ \;\;\;\;e^{re}\\ \mathbf{elif}\;re \leq 0.0126:\\ \;\;\;\;\cos im \cdot \left(\left(re + 1\right) + \left(0.5 + re \cdot 0.16666666666666666\right) \cdot \left(re \cdot re\right)\right)\\ \mathbf{elif}\;re \leq 1.05 \cdot 10^{+103}:\\ \;\;\;\;e^{re} \cdot \left(1 + -0.5 \cdot \left(im \cdot im\right)\right)\\ \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 5: 97.6% 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.115:\\ \;\;\;\;e^{re}\\ \mathbf{elif}\;re \leq 0.0126:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 1.02 \cdot 10^{+103}:\\ \;\;\;\;e^{re} \cdot \left(1 + -0.5 \cdot \left(im \cdot im\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 (* re 0.16666666666666666)))))))))
   (if (<= re -0.115)
     (exp re)
     (if (<= re 0.0126)
       t_0
       (if (<= re 1.02e+103) (* (exp re) (+ 1.0 (* -0.5 (* im im)))) 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.115) {
		tmp = exp(re);
	} else if (re <= 0.0126) {
		tmp = t_0;
	} else if (re <= 1.02e+103) {
		tmp = exp(re) * (1.0 + (-0.5 * (im * im)));
	} 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.115d0)) then
        tmp = exp(re)
    else if (re <= 0.0126d0) then
        tmp = t_0
    else if (re <= 1.02d+103) then
        tmp = exp(re) * (1.0d0 + ((-0.5d0) * (im * im)))
    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.115) {
		tmp = Math.exp(re);
	} else if (re <= 0.0126) {
		tmp = t_0;
	} else if (re <= 1.02e+103) {
		tmp = Math.exp(re) * (1.0 + (-0.5 * (im * im)));
	} 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.115:
		tmp = math.exp(re)
	elif re <= 0.0126:
		tmp = t_0
	elif re <= 1.02e+103:
		tmp = math.exp(re) * (1.0 + (-0.5 * (im * im)))
	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.115)
		tmp = exp(re);
	elseif (re <= 0.0126)
		tmp = t_0;
	elseif (re <= 1.02e+103)
		tmp = Float64(exp(re) * Float64(1.0 + Float64(-0.5 * Float64(im * im))));
	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.115)
		tmp = exp(re);
	elseif (re <= 0.0126)
		tmp = t_0;
	elseif (re <= 1.02e+103)
		tmp = exp(re) * (1.0 + (-0.5 * (im * im)));
	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.115], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.0126], t$95$0, If[LessEqual[re, 1.02e+103], N[(N[Exp[re], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(im * im), $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 \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\
\mathbf{if}\;re \leq -0.115:\\
\;\;\;\;e^{re}\\

\mathbf{elif}\;re \leq 0.0126:\\
\;\;\;\;t\_0\\

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

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


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

    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.115000000000000005 < re < 0.0126 or 1.01999999999999991e103 < 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.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. Simplified99.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 \]

    if 0.0126 < re < 1.01999999999999991e103

    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. *-lowering-*.f64N/A

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -0.115:\\ \;\;\;\;e^{re}\\ \mathbf{elif}\;re \leq 0.0126:\\ \;\;\;\;\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.02 \cdot 10^{+103}:\\ \;\;\;\;e^{re} \cdot \left(1 + -0.5 \cdot \left(im \cdot im\right)\right)\\ \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 6: 96.3% 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.035:\\ \;\;\;\;e^{re}\\ \mathbf{elif}\;re \leq 0.01:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 1.85 \cdot 10^{+154}:\\ \;\;\;\;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)))))))
   (if (<= re -0.035)
     (exp re)
     (if (<= re 0.01) t_0 (if (<= re 1.85e+154) (exp re) 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.035) {
		tmp = exp(re);
	} else if (re <= 0.01) {
		tmp = t_0;
	} else if (re <= 1.85e+154) {
		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))))
    if (re <= (-0.035d0)) then
        tmp = exp(re)
    else if (re <= 0.01d0) then
        tmp = t_0
    else if (re <= 1.85d+154) 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))));
	double tmp;
	if (re <= -0.035) {
		tmp = Math.exp(re);
	} else if (re <= 0.01) {
		tmp = t_0;
	} else if (re <= 1.85e+154) {
		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))))
	tmp = 0
	if re <= -0.035:
		tmp = math.exp(re)
	elif re <= 0.01:
		tmp = t_0
	elif re <= 1.85e+154:
		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 * 0.5)))))
	tmp = 0.0
	if (re <= -0.035)
		tmp = exp(re);
	elseif (re <= 0.01)
		tmp = t_0;
	elseif (re <= 1.85e+154)
		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))));
	tmp = 0.0;
	if (re <= -0.035)
		tmp = exp(re);
	elseif (re <= 0.01)
		tmp = t_0;
	elseif (re <= 1.85e+154)
		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 * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.035], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.01], t$95$0, If[LessEqual[re, 1.85e+154], 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 0.5\right)\right)\\
\mathbf{if}\;re \leq -0.035:\\
\;\;\;\;e^{re}\\

\mathbf{elif}\;re \leq 0.01:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;re \leq 1.85 \cdot 10^{+154}:\\
\;\;\;\;e^{re}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if re < -0.035000000000000003 or 0.0100000000000000002 < re < 1.84999999999999997e154

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

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

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

    if -0.035000000000000003 < re < 0.0100000000000000002 or 1.84999999999999997e154 < 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.4%

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

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

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

Alternative 7: 93.3% accurate, 1.7× speedup?

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

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

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

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


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

    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.034000000000000002 < re < 0.0018500000000000001

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

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

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

    if 0.0018500000000000001 < 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. *-lowering-*.f64N/A

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

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

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

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

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

Alternative 8: 73.1% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(im \cdot im\right) \cdot \left(im \cdot im\right)\\ t_1 := \frac{-4}{im \cdot im}\\ \mathbf{if}\;re \leq -5.8 \cdot 10^{+202}:\\ \;\;\;\;\frac{1}{\frac{\left(-2 + t\_1\right) - \frac{8 + \frac{16}{im \cdot im}}{t\_0}}{im \cdot im}}\\ \mathbf{elif}\;re \leq -350:\\ \;\;\;\;\frac{1}{1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.25 + \left(im \cdot im\right) \cdot 0.125\right)\right)\right)}\\ \mathbf{elif}\;re \leq 9000000:\\ \;\;\;\;\cos im\\ \mathbf{elif}\;re \leq 7.5 \cdot 10^{+82}:\\ \;\;\;\;\left(1 - \left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.25\right)\right) \cdot \frac{\left(t\_1 + 2\right) + \frac{8}{t\_0}}{im \cdot im}\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.16666666666666666 \cdot \left(re \cdot re\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (* im im) (* im im))) (t_1 (/ -4.0 (* im im))))
   (if (<= re -5.8e+202)
     (/ 1.0 (/ (- (+ -2.0 t_1) (/ (+ 8.0 (/ 16.0 (* im im))) t_0)) (* im im)))
     (if (<= re -350.0)
       (/
        1.0
        (+
         1.0
         (* (* im im) (+ 0.5 (* im (* im (+ 0.25 (* (* im im) 0.125))))))))
       (if (<= re 9000000.0)
         (cos im)
         (if (<= re 7.5e+82)
           (*
            (- 1.0 (* (* im im) (* (* im im) 0.25)))
            (/ (+ (+ t_1 2.0) (/ 8.0 t_0)) (* im im)))
           (* re (* 0.16666666666666666 (* re re)))))))))
double code(double re, double im) {
	double t_0 = (im * im) * (im * im);
	double t_1 = -4.0 / (im * im);
	double tmp;
	if (re <= -5.8e+202) {
		tmp = 1.0 / (((-2.0 + t_1) - ((8.0 + (16.0 / (im * im))) / t_0)) / (im * im));
	} else if (re <= -350.0) {
		tmp = 1.0 / (1.0 + ((im * im) * (0.5 + (im * (im * (0.25 + ((im * im) * 0.125)))))));
	} else if (re <= 9000000.0) {
		tmp = cos(im);
	} else if (re <= 7.5e+82) {
		tmp = (1.0 - ((im * im) * ((im * im) * 0.25))) * (((t_1 + 2.0) + (8.0 / t_0)) / (im * im));
	} else {
		tmp = re * (0.16666666666666666 * (re * re));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (im * im) * (im * im)
    t_1 = (-4.0d0) / (im * im)
    if (re <= (-5.8d+202)) then
        tmp = 1.0d0 / ((((-2.0d0) + t_1) - ((8.0d0 + (16.0d0 / (im * im))) / t_0)) / (im * im))
    else if (re <= (-350.0d0)) then
        tmp = 1.0d0 / (1.0d0 + ((im * im) * (0.5d0 + (im * (im * (0.25d0 + ((im * im) * 0.125d0)))))))
    else if (re <= 9000000.0d0) then
        tmp = cos(im)
    else if (re <= 7.5d+82) then
        tmp = (1.0d0 - ((im * im) * ((im * im) * 0.25d0))) * (((t_1 + 2.0d0) + (8.0d0 / t_0)) / (im * im))
    else
        tmp = re * (0.16666666666666666d0 * (re * re))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = (im * im) * (im * im);
	double t_1 = -4.0 / (im * im);
	double tmp;
	if (re <= -5.8e+202) {
		tmp = 1.0 / (((-2.0 + t_1) - ((8.0 + (16.0 / (im * im))) / t_0)) / (im * im));
	} else if (re <= -350.0) {
		tmp = 1.0 / (1.0 + ((im * im) * (0.5 + (im * (im * (0.25 + ((im * im) * 0.125)))))));
	} else if (re <= 9000000.0) {
		tmp = Math.cos(im);
	} else if (re <= 7.5e+82) {
		tmp = (1.0 - ((im * im) * ((im * im) * 0.25))) * (((t_1 + 2.0) + (8.0 / t_0)) / (im * im));
	} else {
		tmp = re * (0.16666666666666666 * (re * re));
	}
	return tmp;
}
def code(re, im):
	t_0 = (im * im) * (im * im)
	t_1 = -4.0 / (im * im)
	tmp = 0
	if re <= -5.8e+202:
		tmp = 1.0 / (((-2.0 + t_1) - ((8.0 + (16.0 / (im * im))) / t_0)) / (im * im))
	elif re <= -350.0:
		tmp = 1.0 / (1.0 + ((im * im) * (0.5 + (im * (im * (0.25 + ((im * im) * 0.125)))))))
	elif re <= 9000000.0:
		tmp = math.cos(im)
	elif re <= 7.5e+82:
		tmp = (1.0 - ((im * im) * ((im * im) * 0.25))) * (((t_1 + 2.0) + (8.0 / t_0)) / (im * im))
	else:
		tmp = re * (0.16666666666666666 * (re * re))
	return tmp
function code(re, im)
	t_0 = Float64(Float64(im * im) * Float64(im * im))
	t_1 = Float64(-4.0 / Float64(im * im))
	tmp = 0.0
	if (re <= -5.8e+202)
		tmp = Float64(1.0 / Float64(Float64(Float64(-2.0 + t_1) - Float64(Float64(8.0 + Float64(16.0 / Float64(im * im))) / t_0)) / Float64(im * im)));
	elseif (re <= -350.0)
		tmp = Float64(1.0 / Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(im * Float64(im * Float64(0.25 + Float64(Float64(im * im) * 0.125))))))));
	elseif (re <= 9000000.0)
		tmp = cos(im);
	elseif (re <= 7.5e+82)
		tmp = Float64(Float64(1.0 - Float64(Float64(im * im) * Float64(Float64(im * im) * 0.25))) * Float64(Float64(Float64(t_1 + 2.0) + Float64(8.0 / t_0)) / Float64(im * im)));
	else
		tmp = Float64(re * Float64(0.16666666666666666 * Float64(re * re)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = (im * im) * (im * im);
	t_1 = -4.0 / (im * im);
	tmp = 0.0;
	if (re <= -5.8e+202)
		tmp = 1.0 / (((-2.0 + t_1) - ((8.0 + (16.0 / (im * im))) / t_0)) / (im * im));
	elseif (re <= -350.0)
		tmp = 1.0 / (1.0 + ((im * im) * (0.5 + (im * (im * (0.25 + ((im * im) * 0.125)))))));
	elseif (re <= 9000000.0)
		tmp = cos(im);
	elseif (re <= 7.5e+82)
		tmp = (1.0 - ((im * im) * ((im * im) * 0.25))) * (((t_1 + 2.0) + (8.0 / t_0)) / (im * im));
	else
		tmp = re * (0.16666666666666666 * (re * re));
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-4.0 / N[(im * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -5.8e+202], N[(1.0 / N[(N[(N[(-2.0 + t$95$1), $MachinePrecision] - N[(N[(8.0 + N[(16.0 / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, -350.0], N[(1.0 / N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(im * N[(im * N[(0.25 + N[(N[(im * im), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 9000000.0], N[Cos[im], $MachinePrecision], If[LessEqual[re, 7.5e+82], N[(N[(1.0 - N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(t$95$1 + 2.0), $MachinePrecision] + N[(8.0 / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(0.16666666666666666 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(im \cdot im\right) \cdot \left(im \cdot im\right)\\
t_1 := \frac{-4}{im \cdot im}\\
\mathbf{if}\;re \leq -5.8 \cdot 10^{+202}:\\
\;\;\;\;\frac{1}{\frac{\left(-2 + t\_1\right) - \frac{8 + \frac{16}{im \cdot im}}{t\_0}}{im \cdot im}}\\

\mathbf{elif}\;re \leq -350:\\
\;\;\;\;\frac{1}{1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.25 + \left(im \cdot im\right) \cdot 0.125\right)\right)\right)}\\

\mathbf{elif}\;re \leq 9000000:\\
\;\;\;\;\cos im\\

\mathbf{elif}\;re \leq 7.5 \cdot 10^{+82}:\\
\;\;\;\;\left(1 - \left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.25\right)\right) \cdot \frac{\left(t\_1 + 2\right) + \frac{8}{t\_0}}{im \cdot im}\\

\mathbf{else}:\\
\;\;\;\;re \cdot \left(0.16666666666666666 \cdot \left(re \cdot re\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if re < -5.7999999999999999e202

    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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(-1 \cdot \frac{8 + 16 \cdot \frac{1}{{im}^{2}}}{{im}^{4}} - \left(2 + 4 \cdot \frac{1}{{im}^{2}}\right)\right), \color{blue}{\left({im}^{2}\right)}\right)\right) \]
    13. Simplified59.6%

      \[\leadsto \frac{1}{\color{blue}{\frac{\left(-2 + \frac{-4}{im \cdot im}\right) - \frac{8 + \frac{16}{im \cdot im}}{\left(im \cdot im\right) \cdot \left(im \cdot im\right)}}{im \cdot im}}} \]

    if -5.7999999999999999e202 < re < -350

    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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{1}{8}\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f6450.6%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{1}{8}\right)\right)\right)\right)\right)\right)\right)\right) \]
    13. Simplified50.6%

      \[\leadsto \frac{1}{\color{blue}{1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.25 + \left(im \cdot im\right) \cdot 0.125\right)\right)\right)}} \]

    if -350 < re < 9e6

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

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

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

    if 9e6 < re < 7.4999999999999999e82

    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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. div-invN/A

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

        \[\leadsto \mathsf{*.f64}\left(\left(1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)\right), \color{blue}{\left(\frac{1}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}\right)}\right) \]
    10. Applied egg-rr9.6%

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{1}{4}\right)\right)\right), \mathsf{/.f64}\left(\left(\left(2 + \frac{8}{{im}^{4}}\right) - 4 \cdot \frac{1}{{im}^{2}}\right), \color{blue}{\left({im}^{2}\right)}\right)\right) \]
    13. Simplified57.1%

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

    if 7.4999999999999999e82 < 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.f6464.0%

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

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re 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-*.f6464.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. Simplified64.0%

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

      \[\leadsto \color{blue}{\frac{1}{6} \cdot {re}^{3}} \]
    10. Step-by-step derivation
      1. unpow3N/A

        \[\leadsto \frac{1}{6} \cdot \left(\left(re \cdot re\right) \cdot \color{blue}{re}\right) \]
      2. unpow2N/A

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

        \[\leadsto \left(\frac{1}{6} \cdot {re}^{2}\right) \cdot \color{blue}{re} \]
      4. unpow2N/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(re, \left(\frac{1}{6} \cdot \color{blue}{\left(re \cdot re\right)}\right)\right) \]
      9. unpow2N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(\frac{1}{6}, \left(re \cdot \color{blue}{re}\right)\right)\right) \]
      12. *-lowering-*.f6464.0%

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right) \]
    11. Simplified64.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -5.8 \cdot 10^{+202}:\\ \;\;\;\;\frac{1}{\frac{\left(-2 + \frac{-4}{im \cdot im}\right) - \frac{8 + \frac{16}{im \cdot im}}{\left(im \cdot im\right) \cdot \left(im \cdot im\right)}}{im \cdot im}}\\ \mathbf{elif}\;re \leq -350:\\ \;\;\;\;\frac{1}{1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.25 + \left(im \cdot im\right) \cdot 0.125\right)\right)\right)}\\ \mathbf{elif}\;re \leq 9000000:\\ \;\;\;\;\cos im\\ \mathbf{elif}\;re \leq 7.5 \cdot 10^{+82}:\\ \;\;\;\;\left(1 - \left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.25\right)\right) \cdot \frac{\left(\frac{-4}{im \cdot im} + 2\right) + \frac{8}{\left(im \cdot im\right) \cdot \left(im \cdot im\right)}}{im \cdot im}\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.16666666666666666 \cdot \left(re \cdot re\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 54.5% accurate, 3.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 + re \cdot 0.16666666666666666\\ t_1 := re \cdot t\_0\\ \mathbf{if}\;re \leq -1.25 \cdot 10^{+194}:\\ \;\;\;\;\frac{1}{\frac{\left(-2 + \frac{-4}{im \cdot im}\right) - \frac{8 + \frac{16}{im \cdot im}}{\left(im \cdot im\right) \cdot \left(im \cdot im\right)}}{im \cdot im}}\\ \mathbf{elif}\;re \leq -2:\\ \;\;\;\;\frac{1}{1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.25 + \left(im \cdot im\right) \cdot 0.125\right)\right)\right)}\\ \mathbf{elif}\;re \leq 2.8 \cdot 10^{+77}:\\ \;\;\;\;1 + \frac{re \cdot \left(1 + t\_1 \cdot \left(t\_0 \cdot \left(t\_0 \cdot \left(re \cdot re\right)\right)\right)\right)}{1 + t\_1 \cdot \left(t\_1 + -1\right)}\\ \mathbf{else}:\\ \;\;\;\;1 + re \cdot \left(1 + \frac{\frac{re \cdot \left(re \cdot \left(\left(re \cdot re\right) \cdot 0.027777777777777776 + -0.25\right)\right)}{re}}{re \cdot 0.16666666666666666 + -0.5}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (+ 0.5 (* re 0.16666666666666666))) (t_1 (* re t_0)))
   (if (<= re -1.25e+194)
     (/
      1.0
      (/
       (-
        (+ -2.0 (/ -4.0 (* im im)))
        (/ (+ 8.0 (/ 16.0 (* im im))) (* (* im im) (* im im))))
       (* im im)))
     (if (<= re -2.0)
       (/
        1.0
        (+
         1.0
         (* (* im im) (+ 0.5 (* im (* im (+ 0.25 (* (* im im) 0.125))))))))
       (if (<= re 2.8e+77)
         (+
          1.0
          (/
           (* re (+ 1.0 (* t_1 (* t_0 (* t_0 (* re re))))))
           (+ 1.0 (* t_1 (+ t_1 -1.0)))))
         (+
          1.0
          (*
           re
           (+
            1.0
            (/
             (/ (* re (* re (+ (* (* re re) 0.027777777777777776) -0.25))) re)
             (+ (* re 0.16666666666666666) -0.5))))))))))
double code(double re, double im) {
	double t_0 = 0.5 + (re * 0.16666666666666666);
	double t_1 = re * t_0;
	double tmp;
	if (re <= -1.25e+194) {
		tmp = 1.0 / (((-2.0 + (-4.0 / (im * im))) - ((8.0 + (16.0 / (im * im))) / ((im * im) * (im * im)))) / (im * im));
	} else if (re <= -2.0) {
		tmp = 1.0 / (1.0 + ((im * im) * (0.5 + (im * (im * (0.25 + ((im * im) * 0.125)))))));
	} else if (re <= 2.8e+77) {
		tmp = 1.0 + ((re * (1.0 + (t_1 * (t_0 * (t_0 * (re * re)))))) / (1.0 + (t_1 * (t_1 + -1.0))));
	} else {
		tmp = 1.0 + (re * (1.0 + (((re * (re * (((re * re) * 0.027777777777777776) + -0.25))) / re) / ((re * 0.16666666666666666) + -0.5))));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 0.5d0 + (re * 0.16666666666666666d0)
    t_1 = re * t_0
    if (re <= (-1.25d+194)) then
        tmp = 1.0d0 / ((((-2.0d0) + ((-4.0d0) / (im * im))) - ((8.0d0 + (16.0d0 / (im * im))) / ((im * im) * (im * im)))) / (im * im))
    else if (re <= (-2.0d0)) then
        tmp = 1.0d0 / (1.0d0 + ((im * im) * (0.5d0 + (im * (im * (0.25d0 + ((im * im) * 0.125d0)))))))
    else if (re <= 2.8d+77) then
        tmp = 1.0d0 + ((re * (1.0d0 + (t_1 * (t_0 * (t_0 * (re * re)))))) / (1.0d0 + (t_1 * (t_1 + (-1.0d0)))))
    else
        tmp = 1.0d0 + (re * (1.0d0 + (((re * (re * (((re * re) * 0.027777777777777776d0) + (-0.25d0)))) / re) / ((re * 0.16666666666666666d0) + (-0.5d0)))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = 0.5 + (re * 0.16666666666666666);
	double t_1 = re * t_0;
	double tmp;
	if (re <= -1.25e+194) {
		tmp = 1.0 / (((-2.0 + (-4.0 / (im * im))) - ((8.0 + (16.0 / (im * im))) / ((im * im) * (im * im)))) / (im * im));
	} else if (re <= -2.0) {
		tmp = 1.0 / (1.0 + ((im * im) * (0.5 + (im * (im * (0.25 + ((im * im) * 0.125)))))));
	} else if (re <= 2.8e+77) {
		tmp = 1.0 + ((re * (1.0 + (t_1 * (t_0 * (t_0 * (re * re)))))) / (1.0 + (t_1 * (t_1 + -1.0))));
	} else {
		tmp = 1.0 + (re * (1.0 + (((re * (re * (((re * re) * 0.027777777777777776) + -0.25))) / re) / ((re * 0.16666666666666666) + -0.5))));
	}
	return tmp;
}
def code(re, im):
	t_0 = 0.5 + (re * 0.16666666666666666)
	t_1 = re * t_0
	tmp = 0
	if re <= -1.25e+194:
		tmp = 1.0 / (((-2.0 + (-4.0 / (im * im))) - ((8.0 + (16.0 / (im * im))) / ((im * im) * (im * im)))) / (im * im))
	elif re <= -2.0:
		tmp = 1.0 / (1.0 + ((im * im) * (0.5 + (im * (im * (0.25 + ((im * im) * 0.125)))))))
	elif re <= 2.8e+77:
		tmp = 1.0 + ((re * (1.0 + (t_1 * (t_0 * (t_0 * (re * re)))))) / (1.0 + (t_1 * (t_1 + -1.0))))
	else:
		tmp = 1.0 + (re * (1.0 + (((re * (re * (((re * re) * 0.027777777777777776) + -0.25))) / re) / ((re * 0.16666666666666666) + -0.5))))
	return tmp
function code(re, im)
	t_0 = Float64(0.5 + Float64(re * 0.16666666666666666))
	t_1 = Float64(re * t_0)
	tmp = 0.0
	if (re <= -1.25e+194)
		tmp = Float64(1.0 / Float64(Float64(Float64(-2.0 + Float64(-4.0 / Float64(im * im))) - Float64(Float64(8.0 + Float64(16.0 / Float64(im * im))) / Float64(Float64(im * im) * Float64(im * im)))) / Float64(im * im)));
	elseif (re <= -2.0)
		tmp = Float64(1.0 / Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(im * Float64(im * Float64(0.25 + Float64(Float64(im * im) * 0.125))))))));
	elseif (re <= 2.8e+77)
		tmp = Float64(1.0 + Float64(Float64(re * Float64(1.0 + Float64(t_1 * Float64(t_0 * Float64(t_0 * Float64(re * re)))))) / Float64(1.0 + Float64(t_1 * Float64(t_1 + -1.0)))));
	else
		tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(Float64(Float64(re * Float64(re * Float64(Float64(Float64(re * re) * 0.027777777777777776) + -0.25))) / re) / Float64(Float64(re * 0.16666666666666666) + -0.5)))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 0.5 + (re * 0.16666666666666666);
	t_1 = re * t_0;
	tmp = 0.0;
	if (re <= -1.25e+194)
		tmp = 1.0 / (((-2.0 + (-4.0 / (im * im))) - ((8.0 + (16.0 / (im * im))) / ((im * im) * (im * im)))) / (im * im));
	elseif (re <= -2.0)
		tmp = 1.0 / (1.0 + ((im * im) * (0.5 + (im * (im * (0.25 + ((im * im) * 0.125)))))));
	elseif (re <= 2.8e+77)
		tmp = 1.0 + ((re * (1.0 + (t_1 * (t_0 * (t_0 * (re * re)))))) / (1.0 + (t_1 * (t_1 + -1.0))));
	else
		tmp = 1.0 + (re * (1.0 + (((re * (re * (((re * re) * 0.027777777777777776) + -0.25))) / re) / ((re * 0.16666666666666666) + -0.5))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re * t$95$0), $MachinePrecision]}, If[LessEqual[re, -1.25e+194], N[(1.0 / N[(N[(N[(-2.0 + N[(-4.0 / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(8.0 + N[(16.0 / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, -2.0], N[(1.0 / N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(im * N[(im * N[(0.25 + N[(N[(im * im), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.8e+77], N[(1.0 + N[(N[(re * N[(1.0 + N[(t$95$1 * N[(t$95$0 * N[(t$95$0 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(t$95$1 * N[(t$95$1 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(re * N[(1.0 + N[(N[(N[(re * N[(re * N[(N[(N[(re * re), $MachinePrecision] * 0.027777777777777776), $MachinePrecision] + -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / re), $MachinePrecision] / N[(N[(re * 0.16666666666666666), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 + re \cdot 0.16666666666666666\\
t_1 := re \cdot t\_0\\
\mathbf{if}\;re \leq -1.25 \cdot 10^{+194}:\\
\;\;\;\;\frac{1}{\frac{\left(-2 + \frac{-4}{im \cdot im}\right) - \frac{8 + \frac{16}{im \cdot im}}{\left(im \cdot im\right) \cdot \left(im \cdot im\right)}}{im \cdot im}}\\

\mathbf{elif}\;re \leq -2:\\
\;\;\;\;\frac{1}{1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.25 + \left(im \cdot im\right) \cdot 0.125\right)\right)\right)}\\

\mathbf{elif}\;re \leq 2.8 \cdot 10^{+77}:\\
\;\;\;\;1 + \frac{re \cdot \left(1 + t\_1 \cdot \left(t\_0 \cdot \left(t\_0 \cdot \left(re \cdot re\right)\right)\right)\right)}{1 + t\_1 \cdot \left(t\_1 + -1\right)}\\

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


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

    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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(-1 \cdot \frac{8 + 16 \cdot \frac{1}{{im}^{2}}}{{im}^{4}} - \left(2 + 4 \cdot \frac{1}{{im}^{2}}\right)\right), \color{blue}{\left({im}^{2}\right)}\right)\right) \]
    13. Simplified59.6%

      \[\leadsto \frac{1}{\color{blue}{\frac{\left(-2 + \frac{-4}{im \cdot im}\right) - \frac{8 + \frac{16}{im \cdot im}}{\left(im \cdot im\right) \cdot \left(im \cdot im\right)}}{im \cdot im}}} \]

    if -1.24999999999999997e194 < re < -2

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

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

      \[\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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{1}{8}\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f6449.8%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{1}{8}\right)\right)\right)\right)\right)\right)\right)\right) \]
    13. Simplified49.8%

      \[\leadsto \frac{1}{\color{blue}{1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.25 + \left(im \cdot im\right) \cdot 0.125\right)\right)\right)}} \]

    if -2 < re < 2.8e77

    1. Initial program 100.0%

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

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

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

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re 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-*.f6445.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. Simplified45.6%

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

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

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

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

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

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

    if 2.8e77 < 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.f6464.7%

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

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re 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-*.f6462.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 1 + re \cdot \left(1 + \color{blue}{\frac{\left(\left(re \cdot re\right) \cdot 0.027777777777777776\right) \cdot \left(re \cdot re\right) - 0.25 \cdot \left(re \cdot re\right)}{re \cdot \left(re \cdot 0.16666666666666666\right) - re \cdot 0.5}}\right) \]
    11. Step-by-step derivation
      1. distribute-lft-out--N/A

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

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

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{\left(\left(re \cdot re\right) \cdot \frac{1}{36}\right) \cdot \left(re \cdot re\right) - \frac{1}{4} \cdot \left(re \cdot re\right)}{re}\right), \color{blue}{\left(re \cdot \frac{1}{6} - \frac{1}{2}\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(\mathsf{/.f64}\left(\left(\left(\left(re \cdot re\right) \cdot \frac{1}{36}\right) \cdot \left(re \cdot re\right) - \frac{1}{4} \cdot \left(re \cdot re\right)\right), re\right), \left(\color{blue}{re \cdot \frac{1}{6}} - \frac{1}{2}\right)\right)\right)\right)\right) \]
      5. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -1.25 \cdot 10^{+194}:\\ \;\;\;\;\frac{1}{\frac{\left(-2 + \frac{-4}{im \cdot im}\right) - \frac{8 + \frac{16}{im \cdot im}}{\left(im \cdot im\right) \cdot \left(im \cdot im\right)}}{im \cdot im}}\\ \mathbf{elif}\;re \leq -2:\\ \;\;\;\;\frac{1}{1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.25 + \left(im \cdot im\right) \cdot 0.125\right)\right)\right)}\\ \mathbf{elif}\;re \leq 2.8 \cdot 10^{+77}:\\ \;\;\;\;1 + \frac{re \cdot \left(1 + \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right) \cdot \left(\left(0.5 + re \cdot 0.16666666666666666\right) \cdot \left(\left(0.5 + re \cdot 0.16666666666666666\right) \cdot \left(re \cdot re\right)\right)\right)\right)}{1 + \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right) \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right) + -1\right)}\\ \mathbf{else}:\\ \;\;\;\;1 + re \cdot \left(1 + \frac{\frac{re \cdot \left(re \cdot \left(\left(re \cdot re\right) \cdot 0.027777777777777776 + -0.25\right)\right)}{re}}{re \cdot 0.16666666666666666 + -0.5}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 52.6% accurate, 5.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -4.8 \cdot 10^{+207}:\\ \;\;\;\;\frac{1}{\frac{\left(-2 + \frac{-4}{im \cdot im}\right) - \frac{8 + \frac{16}{im \cdot im}}{\left(im \cdot im\right) \cdot \left(im \cdot im\right)}}{im \cdot im}}\\ \mathbf{elif}\;re \leq -1.6:\\ \;\;\;\;\frac{1}{1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.25 + \left(im \cdot im\right) \cdot 0.125\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;1 + re \cdot \left(1 + \frac{\frac{re \cdot \left(re \cdot \left(\left(re \cdot re\right) \cdot 0.027777777777777776 + -0.25\right)\right)}{re}}{re \cdot 0.16666666666666666 + -0.5}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re -4.8e+207)
   (/
    1.0
    (/
     (-
      (+ -2.0 (/ -4.0 (* im im)))
      (/ (+ 8.0 (/ 16.0 (* im im))) (* (* im im) (* im im))))
     (* im im)))
   (if (<= re -1.6)
     (/
      1.0
      (+ 1.0 (* (* im im) (+ 0.5 (* im (* im (+ 0.25 (* (* im im) 0.125))))))))
     (+
      1.0
      (*
       re
       (+
        1.0
        (/
         (/ (* re (* re (+ (* (* re re) 0.027777777777777776) -0.25))) re)
         (+ (* re 0.16666666666666666) -0.5))))))))
double code(double re, double im) {
	double tmp;
	if (re <= -4.8e+207) {
		tmp = 1.0 / (((-2.0 + (-4.0 / (im * im))) - ((8.0 + (16.0 / (im * im))) / ((im * im) * (im * im)))) / (im * im));
	} else if (re <= -1.6) {
		tmp = 1.0 / (1.0 + ((im * im) * (0.5 + (im * (im * (0.25 + ((im * im) * 0.125)))))));
	} else {
		tmp = 1.0 + (re * (1.0 + (((re * (re * (((re * re) * 0.027777777777777776) + -0.25))) / re) / ((re * 0.16666666666666666) + -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.8d+207)) then
        tmp = 1.0d0 / ((((-2.0d0) + ((-4.0d0) / (im * im))) - ((8.0d0 + (16.0d0 / (im * im))) / ((im * im) * (im * im)))) / (im * im))
    else if (re <= (-1.6d0)) then
        tmp = 1.0d0 / (1.0d0 + ((im * im) * (0.5d0 + (im * (im * (0.25d0 + ((im * im) * 0.125d0)))))))
    else
        tmp = 1.0d0 + (re * (1.0d0 + (((re * (re * (((re * re) * 0.027777777777777776d0) + (-0.25d0)))) / re) / ((re * 0.16666666666666666d0) + (-0.5d0)))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= -4.8e+207) {
		tmp = 1.0 / (((-2.0 + (-4.0 / (im * im))) - ((8.0 + (16.0 / (im * im))) / ((im * im) * (im * im)))) / (im * im));
	} else if (re <= -1.6) {
		tmp = 1.0 / (1.0 + ((im * im) * (0.5 + (im * (im * (0.25 + ((im * im) * 0.125)))))));
	} else {
		tmp = 1.0 + (re * (1.0 + (((re * (re * (((re * re) * 0.027777777777777776) + -0.25))) / re) / ((re * 0.16666666666666666) + -0.5))));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= -4.8e+207:
		tmp = 1.0 / (((-2.0 + (-4.0 / (im * im))) - ((8.0 + (16.0 / (im * im))) / ((im * im) * (im * im)))) / (im * im))
	elif re <= -1.6:
		tmp = 1.0 / (1.0 + ((im * im) * (0.5 + (im * (im * (0.25 + ((im * im) * 0.125)))))))
	else:
		tmp = 1.0 + (re * (1.0 + (((re * (re * (((re * re) * 0.027777777777777776) + -0.25))) / re) / ((re * 0.16666666666666666) + -0.5))))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= -4.8e+207)
		tmp = Float64(1.0 / Float64(Float64(Float64(-2.0 + Float64(-4.0 / Float64(im * im))) - Float64(Float64(8.0 + Float64(16.0 / Float64(im * im))) / Float64(Float64(im * im) * Float64(im * im)))) / Float64(im * im)));
	elseif (re <= -1.6)
		tmp = Float64(1.0 / Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(im * Float64(im * Float64(0.25 + Float64(Float64(im * im) * 0.125))))))));
	else
		tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(Float64(Float64(re * Float64(re * Float64(Float64(Float64(re * re) * 0.027777777777777776) + -0.25))) / re) / Float64(Float64(re * 0.16666666666666666) + -0.5)))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= -4.8e+207)
		tmp = 1.0 / (((-2.0 + (-4.0 / (im * im))) - ((8.0 + (16.0 / (im * im))) / ((im * im) * (im * im)))) / (im * im));
	elseif (re <= -1.6)
		tmp = 1.0 / (1.0 + ((im * im) * (0.5 + (im * (im * (0.25 + ((im * im) * 0.125)))))));
	else
		tmp = 1.0 + (re * (1.0 + (((re * (re * (((re * re) * 0.027777777777777776) + -0.25))) / re) / ((re * 0.16666666666666666) + -0.5))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, -4.8e+207], N[(1.0 / N[(N[(N[(-2.0 + N[(-4.0 / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(8.0 + N[(16.0 / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, -1.6], N[(1.0 / N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(im * N[(im * N[(0.25 + N[(N[(im * im), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(re * N[(1.0 + N[(N[(N[(re * N[(re * N[(N[(N[(re * re), $MachinePrecision] * 0.027777777777777776), $MachinePrecision] + -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / re), $MachinePrecision] / N[(N[(re * 0.16666666666666666), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq -4.8 \cdot 10^{+207}:\\
\;\;\;\;\frac{1}{\frac{\left(-2 + \frac{-4}{im \cdot im}\right) - \frac{8 + \frac{16}{im \cdot im}}{\left(im \cdot im\right) \cdot \left(im \cdot im\right)}}{im \cdot im}}\\

\mathbf{elif}\;re \leq -1.6:\\
\;\;\;\;\frac{1}{1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.25 + \left(im \cdot im\right) \cdot 0.125\right)\right)\right)}\\

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


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

    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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(-1 \cdot \frac{8 + 16 \cdot \frac{1}{{im}^{2}}}{{im}^{4}} - \left(2 + 4 \cdot \frac{1}{{im}^{2}}\right)\right), \color{blue}{\left({im}^{2}\right)}\right)\right) \]
    13. Simplified59.6%

      \[\leadsto \frac{1}{\color{blue}{\frac{\left(-2 + \frac{-4}{im \cdot im}\right) - \frac{8 + \frac{16}{im \cdot im}}{\left(im \cdot im\right) \cdot \left(im \cdot im\right)}}{im \cdot im}}} \]

    if -4.8000000000000002e207 < re < -1.6000000000000001

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

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

      \[\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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{1}{8}\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f6449.8%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{1}{8}\right)\right)\right)\right)\right)\right)\right)\right) \]
    13. Simplified49.8%

      \[\leadsto \frac{1}{\color{blue}{1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.25 + \left(im \cdot im\right) \cdot 0.125\right)\right)\right)}} \]

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

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

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re 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-*.f6450.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 1 + re \cdot \left(1 + \color{blue}{\frac{\left(\left(re \cdot re\right) \cdot 0.027777777777777776\right) \cdot \left(re \cdot re\right) - 0.25 \cdot \left(re \cdot re\right)}{re \cdot \left(re \cdot 0.16666666666666666\right) - re \cdot 0.5}}\right) \]
    11. Step-by-step derivation
      1. distribute-lft-out--N/A

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

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

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{\left(\left(re \cdot re\right) \cdot \frac{1}{36}\right) \cdot \left(re \cdot re\right) - \frac{1}{4} \cdot \left(re \cdot re\right)}{re}\right), \color{blue}{\left(re \cdot \frac{1}{6} - \frac{1}{2}\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(\mathsf{/.f64}\left(\left(\left(\left(re \cdot re\right) \cdot \frac{1}{36}\right) \cdot \left(re \cdot re\right) - \frac{1}{4} \cdot \left(re \cdot re\right)\right), re\right), \left(\color{blue}{re \cdot \frac{1}{6}} - \frac{1}{2}\right)\right)\right)\right)\right) \]
      5. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 52.3% accurate, 5.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -2.25 \cdot 10^{+207}:\\ \;\;\;\;\frac{1}{\frac{-2 - \frac{4 + \frac{8}{im \cdot im}}{im \cdot im}}{im \cdot im}}\\ \mathbf{elif}\;re \leq -1.8:\\ \;\;\;\;\frac{1}{1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.25 + \left(im \cdot im\right) \cdot 0.125\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;1 + re \cdot \left(1 + \frac{\frac{re \cdot \left(re \cdot \left(\left(re \cdot re\right) \cdot 0.027777777777777776 + -0.25\right)\right)}{re}}{re \cdot 0.16666666666666666 + -0.5}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re -2.25e+207)
   (/ 1.0 (/ (- -2.0 (/ (+ 4.0 (/ 8.0 (* im im))) (* im im))) (* im im)))
   (if (<= re -1.8)
     (/
      1.0
      (+ 1.0 (* (* im im) (+ 0.5 (* im (* im (+ 0.25 (* (* im im) 0.125))))))))
     (+
      1.0
      (*
       re
       (+
        1.0
        (/
         (/ (* re (* re (+ (* (* re re) 0.027777777777777776) -0.25))) re)
         (+ (* re 0.16666666666666666) -0.5))))))))
double code(double re, double im) {
	double tmp;
	if (re <= -2.25e+207) {
		tmp = 1.0 / ((-2.0 - ((4.0 + (8.0 / (im * im))) / (im * im))) / (im * im));
	} else if (re <= -1.8) {
		tmp = 1.0 / (1.0 + ((im * im) * (0.5 + (im * (im * (0.25 + ((im * im) * 0.125)))))));
	} else {
		tmp = 1.0 + (re * (1.0 + (((re * (re * (((re * re) * 0.027777777777777776) + -0.25))) / re) / ((re * 0.16666666666666666) + -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 <= (-2.25d+207)) then
        tmp = 1.0d0 / (((-2.0d0) - ((4.0d0 + (8.0d0 / (im * im))) / (im * im))) / (im * im))
    else if (re <= (-1.8d0)) then
        tmp = 1.0d0 / (1.0d0 + ((im * im) * (0.5d0 + (im * (im * (0.25d0 + ((im * im) * 0.125d0)))))))
    else
        tmp = 1.0d0 + (re * (1.0d0 + (((re * (re * (((re * re) * 0.027777777777777776d0) + (-0.25d0)))) / re) / ((re * 0.16666666666666666d0) + (-0.5d0)))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= -2.25e+207) {
		tmp = 1.0 / ((-2.0 - ((4.0 + (8.0 / (im * im))) / (im * im))) / (im * im));
	} else if (re <= -1.8) {
		tmp = 1.0 / (1.0 + ((im * im) * (0.5 + (im * (im * (0.25 + ((im * im) * 0.125)))))));
	} else {
		tmp = 1.0 + (re * (1.0 + (((re * (re * (((re * re) * 0.027777777777777776) + -0.25))) / re) / ((re * 0.16666666666666666) + -0.5))));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= -2.25e+207:
		tmp = 1.0 / ((-2.0 - ((4.0 + (8.0 / (im * im))) / (im * im))) / (im * im))
	elif re <= -1.8:
		tmp = 1.0 / (1.0 + ((im * im) * (0.5 + (im * (im * (0.25 + ((im * im) * 0.125)))))))
	else:
		tmp = 1.0 + (re * (1.0 + (((re * (re * (((re * re) * 0.027777777777777776) + -0.25))) / re) / ((re * 0.16666666666666666) + -0.5))))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= -2.25e+207)
		tmp = Float64(1.0 / Float64(Float64(-2.0 - Float64(Float64(4.0 + Float64(8.0 / Float64(im * im))) / Float64(im * im))) / Float64(im * im)));
	elseif (re <= -1.8)
		tmp = Float64(1.0 / Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(im * Float64(im * Float64(0.25 + Float64(Float64(im * im) * 0.125))))))));
	else
		tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(Float64(Float64(re * Float64(re * Float64(Float64(Float64(re * re) * 0.027777777777777776) + -0.25))) / re) / Float64(Float64(re * 0.16666666666666666) + -0.5)))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= -2.25e+207)
		tmp = 1.0 / ((-2.0 - ((4.0 + (8.0 / (im * im))) / (im * im))) / (im * im));
	elseif (re <= -1.8)
		tmp = 1.0 / (1.0 + ((im * im) * (0.5 + (im * (im * (0.25 + ((im * im) * 0.125)))))));
	else
		tmp = 1.0 + (re * (1.0 + (((re * (re * (((re * re) * 0.027777777777777776) + -0.25))) / re) / ((re * 0.16666666666666666) + -0.5))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, -2.25e+207], N[(1.0 / N[(N[(-2.0 - N[(N[(4.0 + N[(8.0 / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, -1.8], N[(1.0 / N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(im * N[(im * N[(0.25 + N[(N[(im * im), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(re * N[(1.0 + N[(N[(N[(re * N[(re * N[(N[(N[(re * re), $MachinePrecision] * 0.027777777777777776), $MachinePrecision] + -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / re), $MachinePrecision] / N[(N[(re * 0.16666666666666666), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq -2.25 \cdot 10^{+207}:\\
\;\;\;\;\frac{1}{\frac{-2 - \frac{4 + \frac{8}{im \cdot im}}{im \cdot im}}{im \cdot im}}\\

\mathbf{elif}\;re \leq -1.8:\\
\;\;\;\;\frac{1}{1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.25 + \left(im \cdot im\right) \cdot 0.125\right)\right)\right)}\\

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


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

    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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(-2 + \left(\mathsf{neg}\left(\frac{4 + 8 \cdot \frac{1}{{im}^{2}}}{{im}^{2}}\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      6. unsub-negN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{+.f64}\left(4, \mathsf{/.f64}\left(8, \left({im}^{2}\right)\right)\right), \left({im}^{2}\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      13. unpow2N/A

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{+.f64}\left(4, \mathsf{/.f64}\left(8, \mathsf{*.f64}\left(im, im\right)\right)\right), \left({im}^{2}\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      15. unpow2N/A

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{+.f64}\left(4, \mathsf{/.f64}\left(8, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{*.f64}\left(im, im\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      17. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{+.f64}\left(4, \mathsf{/.f64}\left(8, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{*.f64}\left(im, im\right)\right)\right), \left(im \cdot \color{blue}{im}\right)\right)\right) \]
    13. Simplified56.4%

      \[\leadsto \frac{1}{\color{blue}{\frac{-2 - \frac{4 + \frac{8}{im \cdot im}}{im \cdot im}}{im \cdot im}}} \]

    if -2.25000000000000002e207 < re < -1.80000000000000004

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

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

      \[\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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{1}{8}\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f6449.8%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{1}{8}\right)\right)\right)\right)\right)\right)\right)\right) \]
    13. Simplified49.8%

      \[\leadsto \frac{1}{\color{blue}{1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.25 + \left(im \cdot im\right) \cdot 0.125\right)\right)\right)}} \]

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

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

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re 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-*.f6450.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 1 + re \cdot \left(1 + \color{blue}{\frac{\left(\left(re \cdot re\right) \cdot 0.027777777777777776\right) \cdot \left(re \cdot re\right) - 0.25 \cdot \left(re \cdot re\right)}{re \cdot \left(re \cdot 0.16666666666666666\right) - re \cdot 0.5}}\right) \]
    11. Step-by-step derivation
      1. distribute-lft-out--N/A

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

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

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{\left(\left(re \cdot re\right) \cdot \frac{1}{36}\right) \cdot \left(re \cdot re\right) - \frac{1}{4} \cdot \left(re \cdot re\right)}{re}\right), \color{blue}{\left(re \cdot \frac{1}{6} - \frac{1}{2}\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(\mathsf{/.f64}\left(\left(\left(\left(re \cdot re\right) \cdot \frac{1}{36}\right) \cdot \left(re \cdot re\right) - \frac{1}{4} \cdot \left(re \cdot re\right)\right), re\right), \left(\color{blue}{re \cdot \frac{1}{6}} - \frac{1}{2}\right)\right)\right)\right)\right) \]
      5. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 50.9% accurate, 6.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -8.6 \cdot 10^{+191}:\\ \;\;\;\;\frac{1}{\frac{-2 - \frac{4 + \frac{8}{im \cdot im}}{im \cdot im}}{im \cdot im}}\\ \mathbf{elif}\;re \leq -1.8:\\ \;\;\;\;\frac{1}{1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.25 + \left(im \cdot im\right) \cdot 0.125\right)\right)\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 -8.6e+191)
   (/ 1.0 (/ (- -2.0 (/ (+ 4.0 (/ 8.0 (* im im))) (* im im))) (* im im)))
   (if (<= re -1.8)
     (/
      1.0
      (+ 1.0 (* (* im im) (+ 0.5 (* im (* im (+ 0.25 (* (* im im) 0.125))))))))
     (+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666)))))))))
double code(double re, double im) {
	double tmp;
	if (re <= -8.6e+191) {
		tmp = 1.0 / ((-2.0 - ((4.0 + (8.0 / (im * im))) / (im * im))) / (im * im));
	} else if (re <= -1.8) {
		tmp = 1.0 / (1.0 + ((im * im) * (0.5 + (im * (im * (0.25 + ((im * im) * 0.125)))))));
	} 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 <= (-8.6d+191)) then
        tmp = 1.0d0 / (((-2.0d0) - ((4.0d0 + (8.0d0 / (im * im))) / (im * im))) / (im * im))
    else if (re <= (-1.8d0)) then
        tmp = 1.0d0 / (1.0d0 + ((im * im) * (0.5d0 + (im * (im * (0.25d0 + ((im * im) * 0.125d0)))))))
    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 <= -8.6e+191) {
		tmp = 1.0 / ((-2.0 - ((4.0 + (8.0 / (im * im))) / (im * im))) / (im * im));
	} else if (re <= -1.8) {
		tmp = 1.0 / (1.0 + ((im * im) * (0.5 + (im * (im * (0.25 + ((im * im) * 0.125)))))));
	} else {
		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= -8.6e+191:
		tmp = 1.0 / ((-2.0 - ((4.0 + (8.0 / (im * im))) / (im * im))) / (im * im))
	elif re <= -1.8:
		tmp = 1.0 / (1.0 + ((im * im) * (0.5 + (im * (im * (0.25 + ((im * im) * 0.125)))))))
	else:
		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= -8.6e+191)
		tmp = Float64(1.0 / Float64(Float64(-2.0 - Float64(Float64(4.0 + Float64(8.0 / Float64(im * im))) / Float64(im * im))) / Float64(im * im)));
	elseif (re <= -1.8)
		tmp = Float64(1.0 / Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(im * Float64(im * Float64(0.25 + Float64(Float64(im * im) * 0.125))))))));
	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 <= -8.6e+191)
		tmp = 1.0 / ((-2.0 - ((4.0 + (8.0 / (im * im))) / (im * im))) / (im * im));
	elseif (re <= -1.8)
		tmp = 1.0 / (1.0 + ((im * im) * (0.5 + (im * (im * (0.25 + ((im * im) * 0.125)))))));
	else
		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, -8.6e+191], N[(1.0 / N[(N[(-2.0 - N[(N[(4.0 + N[(8.0 / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, -1.8], N[(1.0 / N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(im * N[(im * N[(0.25 + N[(N[(im * im), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq -8.6 \cdot 10^{+191}:\\
\;\;\;\;\frac{1}{\frac{-2 - \frac{4 + \frac{8}{im \cdot im}}{im \cdot im}}{im \cdot im}}\\

\mathbf{elif}\;re \leq -1.8:\\
\;\;\;\;\frac{1}{1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.25 + \left(im \cdot im\right) \cdot 0.125\right)\right)\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 < -8.5999999999999995e191

    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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(-2 + \left(\mathsf{neg}\left(\frac{4 + 8 \cdot \frac{1}{{im}^{2}}}{{im}^{2}}\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      6. unsub-negN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{+.f64}\left(4, \mathsf{/.f64}\left(8, \left({im}^{2}\right)\right)\right), \left({im}^{2}\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      13. unpow2N/A

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{+.f64}\left(4, \mathsf{/.f64}\left(8, \mathsf{*.f64}\left(im, im\right)\right)\right), \left({im}^{2}\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      15. unpow2N/A

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{+.f64}\left(4, \mathsf{/.f64}\left(8, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{*.f64}\left(im, im\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      17. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{+.f64}\left(4, \mathsf{/.f64}\left(8, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{*.f64}\left(im, im\right)\right)\right), \left(im \cdot \color{blue}{im}\right)\right)\right) \]
    13. Simplified56.4%

      \[\leadsto \frac{1}{\color{blue}{\frac{-2 - \frac{4 + \frac{8}{im \cdot im}}{im \cdot im}}{im \cdot im}}} \]

    if -8.5999999999999995e191 < re < -1.80000000000000004

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

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

      \[\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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{1}{8}\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f6449.8%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{1}{8}\right)\right)\right)\right)\right)\right)\right)\right) \]
    13. Simplified49.8%

      \[\leadsto \frac{1}{\color{blue}{1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.25 + \left(im \cdot im\right) \cdot 0.125\right)\right)\right)}} \]

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

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

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re 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-*.f6450.4%

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

      \[\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: 47.4% accurate, 7.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;re \leq -1.65 \cdot 10^{+207}:\\
\;\;\;\;\frac{1}{\frac{-2}{im \cdot im}}\\

\mathbf{elif}\;re \leq -4.4:\\
\;\;\;\;\frac{1}{1 + 0.5 \cdot \left(im \cdot im\right)}\\

\mathbf{elif}\;re \leq 1.8:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\

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


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

    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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(-2, \left(im \cdot \color{blue}{im}\right)\right)\right) \]
      3. *-lowering-*.f6439.9%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    13. Simplified39.9%

      \[\leadsto \frac{1}{\color{blue}{\frac{-2}{im \cdot im}}} \]

    if -1.65e207 < re < -4.4000000000000004

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

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

      \[\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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right)\right) \]
    13. Simplified32.7%

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

    if -4.4000000000000004 < re < 1.80000000000000004

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

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

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

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

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

    if 1.80000000000000004 < 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.f6470.1%

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

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re 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-*.f6448.8%

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

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

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

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

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

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

        \[\leadsto re \cdot \left({re}^{2} \cdot \left(\left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right) + \color{blue}{\frac{1}{6}}\right)\right) \]
      5. distribute-lft-inN/A

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

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

        \[\leadsto re \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{1}{re}\right) \cdot {re}^{2} + {re}^{2} \cdot \frac{1}{{re}^{2}}\right) + {\color{blue}{re}}^{2} \cdot \frac{1}{6}\right) \]
      8. unpow2N/A

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

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

        \[\leadsto re \cdot \left(\left(\left(\frac{1}{2} \cdot \left(\frac{1}{re} \cdot re\right)\right) \cdot re + {re}^{2} \cdot \frac{1}{{re}^{2}}\right) + {re}^{2} \cdot \frac{1}{6}\right) \]
      11. lft-mult-inverseN/A

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

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

        \[\leadsto re \cdot \left(\left(\frac{1}{2} \cdot re + {re}^{2} \cdot \frac{1}{{re}^{2}}\right) + \frac{1}{6} \cdot \color{blue}{{re}^{2}}\right) \]
      14. unpow2N/A

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

        \[\leadsto re \cdot \left(\left(\frac{1}{2} \cdot re + {re}^{2} \cdot \frac{1}{{re}^{2}}\right) + \left(\frac{1}{6} \cdot re\right) \cdot \color{blue}{re}\right) \]
      16. sum3-defineN/A

        \[\leadsto re \cdot \mathsf{sum3}\left(\left(\frac{1}{2} \cdot re\right), \color{blue}{\left({re}^{2} \cdot \frac{1}{{re}^{2}}\right)}, \left(\left(\frac{1}{6} \cdot re\right) \cdot re\right)\right) \]
    11. Simplified48.8%

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

Alternative 14: 50.4% accurate, 8.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -6 \cdot 10^{+193}:\\ \;\;\;\;\frac{1}{\frac{-2 - \frac{4 + \frac{8}{im \cdot im}}{im \cdot im}}{im \cdot im}}\\ \mathbf{elif}\;re \leq -1.6:\\ \;\;\;\;\frac{1}{1 + im \cdot \left(im \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.25\right)\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 -6e+193)
   (/ 1.0 (/ (- -2.0 (/ (+ 4.0 (/ 8.0 (* im im))) (* im im))) (* im im)))
   (if (<= re -1.6)
     (/ 1.0 (+ 1.0 (* im (* im (+ 0.5 (* (* im im) 0.25))))))
     (+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666)))))))))
double code(double re, double im) {
	double tmp;
	if (re <= -6e+193) {
		tmp = 1.0 / ((-2.0 - ((4.0 + (8.0 / (im * im))) / (im * im))) / (im * im));
	} else if (re <= -1.6) {
		tmp = 1.0 / (1.0 + (im * (im * (0.5 + ((im * im) * 0.25)))));
	} 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 <= (-6d+193)) then
        tmp = 1.0d0 / (((-2.0d0) - ((4.0d0 + (8.0d0 / (im * im))) / (im * im))) / (im * im))
    else if (re <= (-1.6d0)) then
        tmp = 1.0d0 / (1.0d0 + (im * (im * (0.5d0 + ((im * im) * 0.25d0)))))
    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 <= -6e+193) {
		tmp = 1.0 / ((-2.0 - ((4.0 + (8.0 / (im * im))) / (im * im))) / (im * im));
	} else if (re <= -1.6) {
		tmp = 1.0 / (1.0 + (im * (im * (0.5 + ((im * im) * 0.25)))));
	} else {
		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= -6e+193:
		tmp = 1.0 / ((-2.0 - ((4.0 + (8.0 / (im * im))) / (im * im))) / (im * im))
	elif re <= -1.6:
		tmp = 1.0 / (1.0 + (im * (im * (0.5 + ((im * im) * 0.25)))))
	else:
		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= -6e+193)
		tmp = Float64(1.0 / Float64(Float64(-2.0 - Float64(Float64(4.0 + Float64(8.0 / Float64(im * im))) / Float64(im * im))) / Float64(im * im)));
	elseif (re <= -1.6)
		tmp = Float64(1.0 / Float64(1.0 + Float64(im * Float64(im * Float64(0.5 + Float64(Float64(im * im) * 0.25))))));
	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 <= -6e+193)
		tmp = 1.0 / ((-2.0 - ((4.0 + (8.0 / (im * im))) / (im * im))) / (im * im));
	elseif (re <= -1.6)
		tmp = 1.0 / (1.0 + (im * (im * (0.5 + ((im * im) * 0.25)))));
	else
		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, -6e+193], N[(1.0 / N[(N[(-2.0 - N[(N[(4.0 + N[(8.0 / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, -1.6], N[(1.0 / N[(1.0 + N[(im * N[(im * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq -6 \cdot 10^{+193}:\\
\;\;\;\;\frac{1}{\frac{-2 - \frac{4 + \frac{8}{im \cdot im}}{im \cdot im}}{im \cdot im}}\\

\mathbf{elif}\;re \leq -1.6:\\
\;\;\;\;\frac{1}{1 + im \cdot \left(im \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.25\right)\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 < -6e193

    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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(-2 + \left(\mathsf{neg}\left(\frac{4 + 8 \cdot \frac{1}{{im}^{2}}}{{im}^{2}}\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      6. unsub-negN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{+.f64}\left(4, \mathsf{/.f64}\left(8, \left({im}^{2}\right)\right)\right), \left({im}^{2}\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      13. unpow2N/A

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{+.f64}\left(4, \mathsf{/.f64}\left(8, \mathsf{*.f64}\left(im, im\right)\right)\right), \left({im}^{2}\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      15. unpow2N/A

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{+.f64}\left(4, \mathsf{/.f64}\left(8, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{*.f64}\left(im, im\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      17. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{+.f64}\left(4, \mathsf{/.f64}\left(8, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{*.f64}\left(im, im\right)\right)\right), \left(im \cdot \color{blue}{im}\right)\right)\right) \]
    13. Simplified56.4%

      \[\leadsto \frac{1}{\color{blue}{\frac{-2 - \frac{4 + \frac{8}{im \cdot im}}{im \cdot im}}{im \cdot im}}} \]

    if -6e193 < re < -1.6000000000000001

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

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

      \[\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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{1}{4}\right)\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f6449.7%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{1}{4}\right)\right)\right)\right)\right)\right) \]
    13. Simplified49.7%

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

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

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

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re 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-*.f6450.4%

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

      \[\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 15: 50.1% accurate, 8.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -9.5 \cdot 10^{+202}:\\ \;\;\;\;\frac{1}{\frac{-2 + \frac{-4}{im \cdot im}}{im \cdot im}}\\ \mathbf{elif}\;re \leq -1.6:\\ \;\;\;\;\frac{1}{1 + im \cdot \left(im \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.25\right)\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 -9.5e+202)
   (/ 1.0 (/ (+ -2.0 (/ -4.0 (* im im))) (* im im)))
   (if (<= re -1.6)
     (/ 1.0 (+ 1.0 (* im (* im (+ 0.5 (* (* im im) 0.25))))))
     (+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666)))))))))
double code(double re, double im) {
	double tmp;
	if (re <= -9.5e+202) {
		tmp = 1.0 / ((-2.0 + (-4.0 / (im * im))) / (im * im));
	} else if (re <= -1.6) {
		tmp = 1.0 / (1.0 + (im * (im * (0.5 + ((im * im) * 0.25)))));
	} 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 <= (-9.5d+202)) then
        tmp = 1.0d0 / (((-2.0d0) + ((-4.0d0) / (im * im))) / (im * im))
    else if (re <= (-1.6d0)) then
        tmp = 1.0d0 / (1.0d0 + (im * (im * (0.5d0 + ((im * im) * 0.25d0)))))
    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 <= -9.5e+202) {
		tmp = 1.0 / ((-2.0 + (-4.0 / (im * im))) / (im * im));
	} else if (re <= -1.6) {
		tmp = 1.0 / (1.0 + (im * (im * (0.5 + ((im * im) * 0.25)))));
	} else {
		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= -9.5e+202:
		tmp = 1.0 / ((-2.0 + (-4.0 / (im * im))) / (im * im))
	elif re <= -1.6:
		tmp = 1.0 / (1.0 + (im * (im * (0.5 + ((im * im) * 0.25)))))
	else:
		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= -9.5e+202)
		tmp = Float64(1.0 / Float64(Float64(-2.0 + Float64(-4.0 / Float64(im * im))) / Float64(im * im)));
	elseif (re <= -1.6)
		tmp = Float64(1.0 / Float64(1.0 + Float64(im * Float64(im * Float64(0.5 + Float64(Float64(im * im) * 0.25))))));
	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 <= -9.5e+202)
		tmp = 1.0 / ((-2.0 + (-4.0 / (im * im))) / (im * im));
	elseif (re <= -1.6)
		tmp = 1.0 / (1.0 + (im * (im * (0.5 + ((im * im) * 0.25)))));
	else
		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, -9.5e+202], N[(1.0 / N[(N[(-2.0 + N[(-4.0 / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, -1.6], N[(1.0 / N[(1.0 + N[(im * N[(im * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq -9.5 \cdot 10^{+202}:\\
\;\;\;\;\frac{1}{\frac{-2 + \frac{-4}{im \cdot im}}{im \cdot im}}\\

\mathbf{elif}\;re \leq -1.6:\\
\;\;\;\;\frac{1}{1 + im \cdot \left(im \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.25\right)\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 < -9.50000000000000059e202

    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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(-1 \cdot \frac{2 + 4 \cdot \frac{1}{{im}^{2}}}{{im}^{2}}\right)}\right) \]
    12. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\mathsf{neg}\left(\frac{2 + 4 \cdot \frac{1}{{im}^{2}}}{{im}^{2}}\right)\right)\right) \]
      2. distribute-neg-fracN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(-2, \left(\mathsf{neg}\left(\frac{4}{{im}^{2}}\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      9. distribute-neg-fracN/A

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\mathsf{neg}\left(4\right)\right), \left({im}^{2}\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      11. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(-4, \left({im}^{2}\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      12. unpow2N/A

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(-4, \mathsf{*.f64}\left(im, im\right)\right)\right), \left(im \cdot \color{blue}{im}\right)\right)\right) \]
      15. *-lowering-*.f6449.9%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(-4, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    13. Simplified49.9%

      \[\leadsto \frac{1}{\color{blue}{\frac{-2 + \frac{-4}{im \cdot im}}{im \cdot im}}} \]

    if -9.50000000000000059e202 < re < -1.6000000000000001

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

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

      \[\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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{1}{4}\right)\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f6449.7%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{1}{4}\right)\right)\right)\right)\right)\right) \]
    13. Simplified49.7%

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

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

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

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re 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-*.f6450.4%

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

      \[\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 16: 47.3% accurate, 8.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;re \leq -5.5 \cdot 10^{+192}:\\
\;\;\;\;\frac{1}{\frac{-2}{im \cdot im}}\\

\mathbf{elif}\;re \leq -4.4:\\
\;\;\;\;\frac{1}{1 + 0.5 \cdot \left(im \cdot im\right)}\\

\mathbf{elif}\;re \leq 2.8:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\

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


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

    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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(-2, \left(im \cdot \color{blue}{im}\right)\right)\right) \]
      3. *-lowering-*.f6439.9%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    13. Simplified39.9%

      \[\leadsto \frac{1}{\color{blue}{\frac{-2}{im \cdot im}}} \]

    if -5.49999999999999966e192 < re < -4.4000000000000004

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

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

      \[\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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right)\right) \]
    13. Simplified32.7%

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

    if -4.4000000000000004 < re < 2.7999999999999998

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

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

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

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

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

    if 2.7999999999999998 < 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.f6470.1%

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

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re 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-*.f6448.8%

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

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

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

        \[\leadsto \left(\left(re \cdot re\right) \cdot re\right) \cdot \left(\color{blue}{\frac{1}{6}} + \frac{1}{2} \cdot \frac{1}{re}\right) \]
      2. unpow2N/A

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

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

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

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

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

        \[\leadsto \left(re \cdot re\right) \cdot \left(\frac{1}{2} \cdot \left(\frac{1}{re} \cdot re\right) + \color{blue}{\frac{1}{6}} \cdot re\right) \]
      8. lft-mult-inverseN/A

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

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

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

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

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

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

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

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

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

Alternative 17: 47.4% accurate, 8.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;re \leq -1.7 \cdot 10^{+195}:\\
\;\;\;\;\frac{1}{\frac{-2}{im \cdot im}}\\

\mathbf{elif}\;re \leq -1.55:\\
\;\;\;\;\frac{1}{1 + 0.5 \cdot \left(im \cdot im\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 < -1.70000000000000005e195

    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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(-2, \left(im \cdot \color{blue}{im}\right)\right)\right) \]
      3. *-lowering-*.f6439.9%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    13. Simplified39.9%

      \[\leadsto \frac{1}{\color{blue}{\frac{-2}{im \cdot im}}} \]

    if -1.70000000000000005e195 < re < -1.55000000000000004

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

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

      \[\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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right)\right) \]
    13. Simplified32.7%

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

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

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

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re 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-*.f6450.4%

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

      \[\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 18: 47.2% accurate, 9.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;re \leq -3.1 \cdot 10^{+195}:\\
\;\;\;\;\frac{1}{\frac{-2}{im \cdot im}}\\

\mathbf{elif}\;re \leq -0.9:\\
\;\;\;\;\frac{1}{1 + 0.5 \cdot \left(im \cdot im\right)}\\

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


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

    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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(-2, \left(im \cdot \color{blue}{im}\right)\right)\right) \]
      3. *-lowering-*.f6439.9%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    13. Simplified39.9%

      \[\leadsto \frac{1}{\color{blue}{\frac{-2}{im \cdot im}}} \]

    if -3.1000000000000002e195 < re < -0.900000000000000022

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

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

      \[\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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(1 + \frac{1}{2} \cdot {im}^{2}\right)}\right) \]
    12. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{2} \cdot {im}^{2}\right)}\right)\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left({im}^{2}\right)}\right)\right)\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \left(im \cdot \color{blue}{im}\right)\right)\right)\right) \]
      4. *-lowering-*.f6432.7%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right)\right) \]
    13. Simplified32.7%

      \[\leadsto \frac{1}{\color{blue}{1 + 0.5 \cdot \left(im \cdot im\right)}} \]

    if -0.900000000000000022 < 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.4%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified58.4%

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re 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-*.f6450.4%

        \[\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. Simplified50.4%

      \[\leadsto \color{blue}{1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)} \]
    9. Taylor expanded in re around inf

      \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \color{blue}{\left(\frac{1}{6} \cdot re\right)}\right)\right)\right)\right) \]
    10. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \left(re \cdot \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right) \]
      2. *-lowering-*.f6450.3%

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right) \]
    11. Simplified50.3%

      \[\leadsto 1 + re \cdot \left(1 + re \cdot \color{blue}{\left(re \cdot 0.16666666666666666\right)}\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 19: 47.4% accurate, 10.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -500:\\ \;\;\;\;\frac{1}{\frac{-2}{im \cdot im}}\\ \mathbf{elif}\;re \leq 3.1:\\ \;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re -500.0)
   (/ 1.0 (/ -2.0 (* im im)))
   (if (<= re 3.1)
     (+ 1.0 (* re (+ 1.0 (* re 0.5))))
     (* re (* re (+ 0.5 (* re 0.16666666666666666)))))))
double code(double re, double im) {
	double tmp;
	if (re <= -500.0) {
		tmp = 1.0 / (-2.0 / (im * im));
	} else if (re <= 3.1) {
		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
	} else {
		tmp = re * (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 <= (-500.0d0)) then
        tmp = 1.0d0 / ((-2.0d0) / (im * im))
    else if (re <= 3.1d0) then
        tmp = 1.0d0 + (re * (1.0d0 + (re * 0.5d0)))
    else
        tmp = re * (re * (0.5d0 + (re * 0.16666666666666666d0)))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= -500.0) {
		tmp = 1.0 / (-2.0 / (im * im));
	} else if (re <= 3.1) {
		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
	} else {
		tmp = re * (re * (0.5 + (re * 0.16666666666666666)));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= -500.0:
		tmp = 1.0 / (-2.0 / (im * im))
	elif re <= 3.1:
		tmp = 1.0 + (re * (1.0 + (re * 0.5)))
	else:
		tmp = re * (re * (0.5 + (re * 0.16666666666666666)))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= -500.0)
		tmp = Float64(1.0 / Float64(-2.0 / Float64(im * im)));
	elseif (re <= 3.1)
		tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5))));
	else
		tmp = Float64(re * Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= -500.0)
		tmp = 1.0 / (-2.0 / (im * im));
	elseif (re <= 3.1)
		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
	else
		tmp = re * (re * (0.5 + (re * 0.16666666666666666)));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, -500.0], N[(1.0 / N[(-2.0 / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 3.1], N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq -500:\\
\;\;\;\;\frac{1}{\frac{-2}{im \cdot im}}\\

\mathbf{elif}\;re \leq 3.1:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\

\mathbf{else}:\\
\;\;\;\;re \cdot \left(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 < -500

    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. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \color{blue}{\left({im}^{2}\right)}\right)\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{im}\right)\right)\right) \]
      4. *-lowering-*.f642.5%

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    8. Simplified2.5%

      \[\leadsto \color{blue}{1 + -0.5 \cdot \left(im \cdot im\right)} \]
    9. Step-by-step derivation
      1. flip-+N/A

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}\right)}\right) \]
      4. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{1}{\color{blue}{\frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}}}\right)\right) \]
      5. flip-+N/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{1}{1 + \color{blue}{\frac{-1}{2} \cdot \left(im \cdot im\right)}}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \color{blue}{\left(1 + \frac{-1}{2} \cdot \left(im \cdot im\right)\right)}\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}\right)\right)\right) \]
      8. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left(\left(\frac{-1}{2} \cdot im\right) \cdot \color{blue}{im}\right)\right)\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left(im \cdot \color{blue}{\left(\frac{-1}{2} \cdot im\right)}\right)\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{2} \cdot im\right)}\right)\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \left(im \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f642.5%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\frac{-1}{2}}\right)\right)\right)\right)\right) \]
    10. Applied egg-rr2.5%

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{1 + im \cdot \left(im \cdot -0.5\right)}}} \]
    11. Taylor expanded in im around inf

      \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{-2}{{im}^{2}}\right)}\right) \]
    12. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(-2, \color{blue}{\left({im}^{2}\right)}\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(-2, \left(im \cdot \color{blue}{im}\right)\right)\right) \]
      3. *-lowering-*.f6430.0%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    13. Simplified30.0%

      \[\leadsto \frac{1}{\color{blue}{\frac{-2}{im \cdot im}}} \]

    if -500 < re < 3.10000000000000009

    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.f6452.1%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified52.1%

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re around 0

      \[\leadsto \color{blue}{1 + re \cdot \left(1 + \frac{1}{2} \cdot re\right)} \]
    7. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(re \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \color{blue}{\left(1 + \frac{1}{2} \cdot re\right)}\right)\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{2} \cdot re\right)}\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \left(re \cdot \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
      5. *-lowering-*.f6450.9%

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
    8. Simplified50.9%

      \[\leadsto \color{blue}{1 + re \cdot \left(1 + re \cdot 0.5\right)} \]

    if 3.10000000000000009 < 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.f6470.1%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified70.1%

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re 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-*.f6448.8%

        \[\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. Simplified48.8%

      \[\leadsto \color{blue}{1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)} \]
    9. Taylor expanded in re around inf

      \[\leadsto \color{blue}{{re}^{3} \cdot \left(\frac{1}{6} + \frac{1}{2} \cdot \frac{1}{re}\right)} \]
    10. Step-by-step derivation
      1. unpow3N/A

        \[\leadsto \left(\left(re \cdot re\right) \cdot re\right) \cdot \left(\color{blue}{\frac{1}{6}} + \frac{1}{2} \cdot \frac{1}{re}\right) \]
      2. unpow2N/A

        \[\leadsto \left({re}^{2} \cdot re\right) \cdot \left(\frac{1}{6} + \frac{1}{2} \cdot \frac{1}{re}\right) \]
      3. associate-*l*N/A

        \[\leadsto {re}^{2} \cdot \color{blue}{\left(re \cdot \left(\frac{1}{6} + \frac{1}{2} \cdot \frac{1}{re}\right)\right)} \]
      4. unpow2N/A

        \[\leadsto \left(re \cdot re\right) \cdot \left(\color{blue}{re} \cdot \left(\frac{1}{6} + \frac{1}{2} \cdot \frac{1}{re}\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \left(re \cdot re\right) \cdot \left(re \cdot \left(\frac{1}{2} \cdot \frac{1}{re} + \color{blue}{\frac{1}{6}}\right)\right) \]
      6. distribute-rgt-inN/A

        \[\leadsto \left(re \cdot re\right) \cdot \left(\left(\frac{1}{2} \cdot \frac{1}{re}\right) \cdot re + \color{blue}{\frac{1}{6} \cdot re}\right) \]
      7. associate-*l*N/A

        \[\leadsto \left(re \cdot re\right) \cdot \left(\frac{1}{2} \cdot \left(\frac{1}{re} \cdot re\right) + \color{blue}{\frac{1}{6}} \cdot re\right) \]
      8. lft-mult-inverseN/A

        \[\leadsto \left(re \cdot re\right) \cdot \left(\frac{1}{2} \cdot 1 + \frac{1}{6} \cdot re\right) \]
      9. metadata-evalN/A

        \[\leadsto \left(re \cdot re\right) \cdot \left(\frac{1}{2} + \color{blue}{\frac{1}{6}} \cdot re\right) \]
      10. associate-*r*N/A

        \[\leadsto re \cdot \color{blue}{\left(re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)} \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(re, \color{blue}{\left(re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)}\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \color{blue}{\left(\frac{1}{2} + \frac{1}{6} \cdot re\right)}\right)\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\left(\frac{1}{6} \cdot re\right)}\right)\right)\right) \]
      14. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \left(re \cdot \color{blue}{\frac{1}{6}}\right)\right)\right)\right) \]
      15. *-lowering-*.f6448.8%

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{6}}\right)\right)\right)\right) \]
    11. Simplified48.8%

      \[\leadsto \color{blue}{re \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 20: 47.3% accurate, 10.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -4.4:\\ \;\;\;\;\frac{1}{\frac{-2}{im \cdot im}}\\ \mathbf{elif}\;re \leq 1.9:\\ \;\;\;\;re + 1\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re -4.4)
   (/ 1.0 (/ -2.0 (* im im)))
   (if (<= re 1.9)
     (+ re 1.0)
     (* re (* re (+ 0.5 (* re 0.16666666666666666)))))))
double code(double re, double im) {
	double tmp;
	if (re <= -4.4) {
		tmp = 1.0 / (-2.0 / (im * im));
	} else if (re <= 1.9) {
		tmp = re + 1.0;
	} else {
		tmp = re * (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 <= (-4.4d0)) then
        tmp = 1.0d0 / ((-2.0d0) / (im * im))
    else if (re <= 1.9d0) then
        tmp = re + 1.0d0
    else
        tmp = re * (re * (0.5d0 + (re * 0.16666666666666666d0)))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= -4.4) {
		tmp = 1.0 / (-2.0 / (im * im));
	} else if (re <= 1.9) {
		tmp = re + 1.0;
	} else {
		tmp = re * (re * (0.5 + (re * 0.16666666666666666)));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= -4.4:
		tmp = 1.0 / (-2.0 / (im * im))
	elif re <= 1.9:
		tmp = re + 1.0
	else:
		tmp = re * (re * (0.5 + (re * 0.16666666666666666)))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= -4.4)
		tmp = Float64(1.0 / Float64(-2.0 / Float64(im * im)));
	elseif (re <= 1.9)
		tmp = Float64(re + 1.0);
	else
		tmp = Float64(re * Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= -4.4)
		tmp = 1.0 / (-2.0 / (im * im));
	elseif (re <= 1.9)
		tmp = re + 1.0;
	else
		tmp = re * (re * (0.5 + (re * 0.16666666666666666)));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, -4.4], N[(1.0 / N[(-2.0 / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.9], N[(re + 1.0), $MachinePrecision], N[(re * N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq -4.4:\\
\;\;\;\;\frac{1}{\frac{-2}{im \cdot im}}\\

\mathbf{elif}\;re \leq 1.9:\\
\;\;\;\;re + 1\\

\mathbf{else}:\\
\;\;\;\;re \cdot \left(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 < -4.4000000000000004

    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.3%

        \[\leadsto \mathsf{cos.f64}\left(im\right) \]
    5. Simplified3.3%

      \[\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. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \color{blue}{\left({im}^{2}\right)}\right)\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{im}\right)\right)\right) \]
      4. *-lowering-*.f642.7%

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    8. Simplified2.7%

      \[\leadsto \color{blue}{1 + -0.5 \cdot \left(im \cdot im\right)} \]
    9. Step-by-step derivation
      1. flip-+N/A

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}\right)}\right) \]
      4. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{1}{\color{blue}{\frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}}}\right)\right) \]
      5. flip-+N/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{1}{1 + \color{blue}{\frac{-1}{2} \cdot \left(im \cdot im\right)}}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \color{blue}{\left(1 + \frac{-1}{2} \cdot \left(im \cdot im\right)\right)}\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}\right)\right)\right) \]
      8. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left(\left(\frac{-1}{2} \cdot im\right) \cdot \color{blue}{im}\right)\right)\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left(im \cdot \color{blue}{\left(\frac{-1}{2} \cdot im\right)}\right)\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{2} \cdot im\right)}\right)\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \left(im \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f642.7%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\frac{-1}{2}}\right)\right)\right)\right)\right) \]
    10. Applied egg-rr2.7%

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{1 + im \cdot \left(im \cdot -0.5\right)}}} \]
    11. Taylor expanded in im around inf

      \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{-2}{{im}^{2}}\right)}\right) \]
    12. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(-2, \color{blue}{\left({im}^{2}\right)}\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(-2, \left(im \cdot \color{blue}{im}\right)\right)\right) \]
      3. *-lowering-*.f6429.6%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    13. Simplified29.6%

      \[\leadsto \frac{1}{\color{blue}{\frac{-2}{im \cdot im}}} \]

    if -4.4000000000000004 < re < 1.8999999999999999

    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.f6451.6%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified51.6%

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re around 0

      \[\leadsto \color{blue}{1 + re} \]
    7. Step-by-step derivation
      1. +-lowering-+.f6451.1%

        \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{re}\right) \]
    8. Simplified51.1%

      \[\leadsto \color{blue}{1 + re} \]

    if 1.8999999999999999 < 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.f6470.1%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified70.1%

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re 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-*.f6448.8%

        \[\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. Simplified48.8%

      \[\leadsto \color{blue}{1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)} \]
    9. Taylor expanded in re around inf

      \[\leadsto \color{blue}{{re}^{3} \cdot \left(\frac{1}{6} + \frac{1}{2} \cdot \frac{1}{re}\right)} \]
    10. Step-by-step derivation
      1. unpow3N/A

        \[\leadsto \left(\left(re \cdot re\right) \cdot re\right) \cdot \left(\color{blue}{\frac{1}{6}} + \frac{1}{2} \cdot \frac{1}{re}\right) \]
      2. unpow2N/A

        \[\leadsto \left({re}^{2} \cdot re\right) \cdot \left(\frac{1}{6} + \frac{1}{2} \cdot \frac{1}{re}\right) \]
      3. associate-*l*N/A

        \[\leadsto {re}^{2} \cdot \color{blue}{\left(re \cdot \left(\frac{1}{6} + \frac{1}{2} \cdot \frac{1}{re}\right)\right)} \]
      4. unpow2N/A

        \[\leadsto \left(re \cdot re\right) \cdot \left(\color{blue}{re} \cdot \left(\frac{1}{6} + \frac{1}{2} \cdot \frac{1}{re}\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \left(re \cdot re\right) \cdot \left(re \cdot \left(\frac{1}{2} \cdot \frac{1}{re} + \color{blue}{\frac{1}{6}}\right)\right) \]
      6. distribute-rgt-inN/A

        \[\leadsto \left(re \cdot re\right) \cdot \left(\left(\frac{1}{2} \cdot \frac{1}{re}\right) \cdot re + \color{blue}{\frac{1}{6} \cdot re}\right) \]
      7. associate-*l*N/A

        \[\leadsto \left(re \cdot re\right) \cdot \left(\frac{1}{2} \cdot \left(\frac{1}{re} \cdot re\right) + \color{blue}{\frac{1}{6}} \cdot re\right) \]
      8. lft-mult-inverseN/A

        \[\leadsto \left(re \cdot re\right) \cdot \left(\frac{1}{2} \cdot 1 + \frac{1}{6} \cdot re\right) \]
      9. metadata-evalN/A

        \[\leadsto \left(re \cdot re\right) \cdot \left(\frac{1}{2} + \color{blue}{\frac{1}{6}} \cdot re\right) \]
      10. associate-*r*N/A

        \[\leadsto re \cdot \color{blue}{\left(re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)} \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(re, \color{blue}{\left(re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)}\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \color{blue}{\left(\frac{1}{2} + \frac{1}{6} \cdot re\right)}\right)\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\left(\frac{1}{6} \cdot re\right)}\right)\right)\right) \]
      14. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \left(re \cdot \color{blue}{\frac{1}{6}}\right)\right)\right)\right) \]
      15. *-lowering-*.f6448.8%

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{6}}\right)\right)\right)\right) \]
    11. Simplified48.8%

      \[\leadsto \color{blue}{re \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification44.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -4.4:\\ \;\;\;\;\frac{1}{\frac{-2}{im \cdot im}}\\ \mathbf{elif}\;re \leq 1.9:\\ \;\;\;\;re + 1\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 21: 50.2% accurate, 11.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -4.4:\\ \;\;\;\;\frac{1}{\frac{-2 + \frac{-4}{im \cdot im}}{im \cdot im}}\\ \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 -4.4)
   (/ 1.0 (/ (+ -2.0 (/ -4.0 (* im im))) (* im im)))
   (+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666))))))))
double code(double re, double im) {
	double tmp;
	if (re <= -4.4) {
		tmp = 1.0 / ((-2.0 + (-4.0 / (im * im))) / (im * im));
	} 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 <= (-4.4d0)) then
        tmp = 1.0d0 / (((-2.0d0) + ((-4.0d0) / (im * im))) / (im * im))
    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 <= -4.4) {
		tmp = 1.0 / ((-2.0 + (-4.0 / (im * im))) / (im * im));
	} else {
		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= -4.4:
		tmp = 1.0 / ((-2.0 + (-4.0 / (im * im))) / (im * im))
	else:
		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= -4.4)
		tmp = Float64(1.0 / Float64(Float64(-2.0 + Float64(-4.0 / Float64(im * im))) / Float64(im * im)));
	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 <= -4.4)
		tmp = 1.0 / ((-2.0 + (-4.0 / (im * im))) / (im * im));
	else
		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, -4.4], N[(1.0 / N[(N[(-2.0 + N[(-4.0 / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq -4.4:\\
\;\;\;\;\frac{1}{\frac{-2 + \frac{-4}{im \cdot im}}{im \cdot im}}\\

\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 < -4.4000000000000004

    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.3%

        \[\leadsto \mathsf{cos.f64}\left(im\right) \]
    5. Simplified3.3%

      \[\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. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \color{blue}{\left({im}^{2}\right)}\right)\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{im}\right)\right)\right) \]
      4. *-lowering-*.f642.7%

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    8. Simplified2.7%

      \[\leadsto \color{blue}{1 + -0.5 \cdot \left(im \cdot im\right)} \]
    9. Step-by-step derivation
      1. flip-+N/A

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}\right)}\right) \]
      4. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{1}{\color{blue}{\frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}}}\right)\right) \]
      5. flip-+N/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{1}{1 + \color{blue}{\frac{-1}{2} \cdot \left(im \cdot im\right)}}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \color{blue}{\left(1 + \frac{-1}{2} \cdot \left(im \cdot im\right)\right)}\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}\right)\right)\right) \]
      8. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left(\left(\frac{-1}{2} \cdot im\right) \cdot \color{blue}{im}\right)\right)\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left(im \cdot \color{blue}{\left(\frac{-1}{2} \cdot im\right)}\right)\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{2} \cdot im\right)}\right)\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \left(im \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f642.7%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\frac{-1}{2}}\right)\right)\right)\right)\right) \]
    10. Applied egg-rr2.7%

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{1 + im \cdot \left(im \cdot -0.5\right)}}} \]
    11. Taylor expanded in im around inf

      \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(-1 \cdot \frac{2 + 4 \cdot \frac{1}{{im}^{2}}}{{im}^{2}}\right)}\right) \]
    12. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\mathsf{neg}\left(\frac{2 + 4 \cdot \frac{1}{{im}^{2}}}{{im}^{2}}\right)\right)\right) \]
      2. distribute-neg-fracN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\mathsf{neg}\left(\left(2 + 4 \cdot \frac{1}{{im}^{2}}\right)\right)}{\color{blue}{{im}^{2}}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\left(2 + 4 \cdot \frac{1}{{im}^{2}}\right)\right)\right), \color{blue}{\left({im}^{2}\right)}\right)\right) \]
      4. distribute-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\left(\mathsf{neg}\left(2\right)\right) + \left(\mathsf{neg}\left(4 \cdot \frac{1}{{im}^{2}}\right)\right)\right), \left({\color{blue}{im}}^{2}\right)\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(-2 + \left(\mathsf{neg}\left(4 \cdot \frac{1}{{im}^{2}}\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(-2, \left(\mathsf{neg}\left(4 \cdot \frac{1}{{im}^{2}}\right)\right)\right), \left({\color{blue}{im}}^{2}\right)\right)\right) \]
      7. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(-2, \left(\mathsf{neg}\left(\frac{4 \cdot 1}{{im}^{2}}\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      8. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(-2, \left(\mathsf{neg}\left(\frac{4}{{im}^{2}}\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      9. distribute-neg-fracN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(-2, \left(\frac{\mathsf{neg}\left(4\right)}{{im}^{2}}\right)\right), \left({im}^{2}\right)\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\mathsf{neg}\left(4\right)\right), \left({im}^{2}\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      11. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(-4, \left({im}^{2}\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(-4, \left(im \cdot im\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(-4, \mathsf{*.f64}\left(im, im\right)\right)\right), \left({im}^{2}\right)\right)\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(-4, \mathsf{*.f64}\left(im, im\right)\right)\right), \left(im \cdot \color{blue}{im}\right)\right)\right) \]
      15. *-lowering-*.f6440.1%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(-4, \mathsf{*.f64}\left(im, im\right)\right)\right), \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    13. Simplified40.1%

      \[\leadsto \frac{1}{\color{blue}{\frac{-2 + \frac{-4}{im \cdot im}}{im \cdot im}}} \]

    if -4.4000000000000004 < 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.4%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified58.4%

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re 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-*.f6450.4%

        \[\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. Simplified50.4%

      \[\leadsto \color{blue}{1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 22: 47.3% accurate, 11.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -4.4:\\ \;\;\;\;\frac{1}{\frac{-2}{im \cdot im}}\\ \mathbf{elif}\;re \leq 2.9:\\ \;\;\;\;re + 1\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.16666666666666666 \cdot \left(re \cdot re\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re -4.4)
   (/ 1.0 (/ -2.0 (* im im)))
   (if (<= re 2.9) (+ re 1.0) (* re (* 0.16666666666666666 (* re re))))))
double code(double re, double im) {
	double tmp;
	if (re <= -4.4) {
		tmp = 1.0 / (-2.0 / (im * im));
	} else if (re <= 2.9) {
		tmp = re + 1.0;
	} else {
		tmp = re * (0.16666666666666666 * (re * re));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= (-4.4d0)) then
        tmp = 1.0d0 / ((-2.0d0) / (im * im))
    else if (re <= 2.9d0) then
        tmp = re + 1.0d0
    else
        tmp = re * (0.16666666666666666d0 * (re * re))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= -4.4) {
		tmp = 1.0 / (-2.0 / (im * im));
	} else if (re <= 2.9) {
		tmp = re + 1.0;
	} else {
		tmp = re * (0.16666666666666666 * (re * re));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= -4.4:
		tmp = 1.0 / (-2.0 / (im * im))
	elif re <= 2.9:
		tmp = re + 1.0
	else:
		tmp = re * (0.16666666666666666 * (re * re))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= -4.4)
		tmp = Float64(1.0 / Float64(-2.0 / Float64(im * im)));
	elseif (re <= 2.9)
		tmp = Float64(re + 1.0);
	else
		tmp = Float64(re * Float64(0.16666666666666666 * Float64(re * re)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= -4.4)
		tmp = 1.0 / (-2.0 / (im * im));
	elseif (re <= 2.9)
		tmp = re + 1.0;
	else
		tmp = re * (0.16666666666666666 * (re * re));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, -4.4], N[(1.0 / N[(-2.0 / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.9], N[(re + 1.0), $MachinePrecision], N[(re * N[(0.16666666666666666 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq -4.4:\\
\;\;\;\;\frac{1}{\frac{-2}{im \cdot im}}\\

\mathbf{elif}\;re \leq 2.9:\\
\;\;\;\;re + 1\\

\mathbf{else}:\\
\;\;\;\;re \cdot \left(0.16666666666666666 \cdot \left(re \cdot re\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < -4.4000000000000004

    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.3%

        \[\leadsto \mathsf{cos.f64}\left(im\right) \]
    5. Simplified3.3%

      \[\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. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \color{blue}{\left({im}^{2}\right)}\right)\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{im}\right)\right)\right) \]
      4. *-lowering-*.f642.7%

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    8. Simplified2.7%

      \[\leadsto \color{blue}{1 + -0.5 \cdot \left(im \cdot im\right)} \]
    9. Step-by-step derivation
      1. flip-+N/A

        \[\leadsto \frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{\color{blue}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}\right)}\right) \]
      4. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{1}{\color{blue}{\frac{1 \cdot 1 - \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}{1 - \frac{-1}{2} \cdot \left(im \cdot im\right)}}}\right)\right) \]
      5. flip-+N/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{1}{1 + \color{blue}{\frac{-1}{2} \cdot \left(im \cdot im\right)}}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \color{blue}{\left(1 + \frac{-1}{2} \cdot \left(im \cdot im\right)\right)}\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot \left(im \cdot im\right)\right)}\right)\right)\right) \]
      8. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left(\left(\frac{-1}{2} \cdot im\right) \cdot \color{blue}{im}\right)\right)\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left(im \cdot \color{blue}{\left(\frac{-1}{2} \cdot im\right)}\right)\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{2} \cdot im\right)}\right)\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \left(im \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f642.7%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\frac{-1}{2}}\right)\right)\right)\right)\right) \]
    10. Applied egg-rr2.7%

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{1 + im \cdot \left(im \cdot -0.5\right)}}} \]
    11. Taylor expanded in im around inf

      \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{-2}{{im}^{2}}\right)}\right) \]
    12. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(-2, \color{blue}{\left({im}^{2}\right)}\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(-2, \left(im \cdot \color{blue}{im}\right)\right)\right) \]
      3. *-lowering-*.f6429.6%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    13. Simplified29.6%

      \[\leadsto \frac{1}{\color{blue}{\frac{-2}{im \cdot im}}} \]

    if -4.4000000000000004 < re < 2.89999999999999991

    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.f6451.6%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified51.6%

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re around 0

      \[\leadsto \color{blue}{1 + re} \]
    7. Step-by-step derivation
      1. +-lowering-+.f6451.1%

        \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{re}\right) \]
    8. Simplified51.1%

      \[\leadsto \color{blue}{1 + re} \]

    if 2.89999999999999991 < 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.f6470.1%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified70.1%

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re 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-*.f6448.8%

        \[\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. Simplified48.8%

      \[\leadsto \color{blue}{1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)} \]
    9. Taylor expanded in re around inf

      \[\leadsto \color{blue}{\frac{1}{6} \cdot {re}^{3}} \]
    10. Step-by-step derivation
      1. unpow3N/A

        \[\leadsto \frac{1}{6} \cdot \left(\left(re \cdot re\right) \cdot \color{blue}{re}\right) \]
      2. unpow2N/A

        \[\leadsto \frac{1}{6} \cdot \left({re}^{2} \cdot re\right) \]
      3. associate-*r*N/A

        \[\leadsto \left(\frac{1}{6} \cdot {re}^{2}\right) \cdot \color{blue}{re} \]
      4. unpow2N/A

        \[\leadsto \left(\frac{1}{6} \cdot \left(re \cdot re\right)\right) \cdot re \]
      5. associate-*r*N/A

        \[\leadsto \left(\left(\frac{1}{6} \cdot re\right) \cdot re\right) \cdot re \]
      6. *-commutativeN/A

        \[\leadsto re \cdot \color{blue}{\left(\left(\frac{1}{6} \cdot re\right) \cdot re\right)} \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(re, \color{blue}{\left(\left(\frac{1}{6} \cdot re\right) \cdot re\right)}\right) \]
      8. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(re, \left(\frac{1}{6} \cdot \color{blue}{\left(re \cdot re\right)}\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(re, \left(\frac{1}{6} \cdot {re}^{\color{blue}{2}}\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(\frac{1}{6}, \color{blue}{\left({re}^{2}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(\frac{1}{6}, \left(re \cdot \color{blue}{re}\right)\right)\right) \]
      12. *-lowering-*.f6448.8%

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right) \]
    11. Simplified48.8%

      \[\leadsto \color{blue}{re \cdot \left(0.16666666666666666 \cdot \left(re \cdot re\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification44.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -4.4:\\ \;\;\;\;\frac{1}{\frac{-2}{im \cdot im}}\\ \mathbf{elif}\;re \leq 2.9:\\ \;\;\;\;re + 1\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.16666666666666666 \cdot \left(re \cdot re\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 23: 47.2% accurate, 11.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -4.4:\\ \;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\ \mathbf{elif}\;re \leq 2.9:\\ \;\;\;\;re + 1\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.16666666666666666 \cdot \left(re \cdot re\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re -4.4)
   (* -0.5 (* im im))
   (if (<= re 2.9) (+ re 1.0) (* re (* 0.16666666666666666 (* re re))))))
double code(double re, double im) {
	double tmp;
	if (re <= -4.4) {
		tmp = -0.5 * (im * im);
	} else if (re <= 2.9) {
		tmp = re + 1.0;
	} else {
		tmp = re * (0.16666666666666666 * (re * re));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= (-4.4d0)) then
        tmp = (-0.5d0) * (im * im)
    else if (re <= 2.9d0) then
        tmp = re + 1.0d0
    else
        tmp = re * (0.16666666666666666d0 * (re * re))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= -4.4) {
		tmp = -0.5 * (im * im);
	} else if (re <= 2.9) {
		tmp = re + 1.0;
	} else {
		tmp = re * (0.16666666666666666 * (re * re));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= -4.4:
		tmp = -0.5 * (im * im)
	elif re <= 2.9:
		tmp = re + 1.0
	else:
		tmp = re * (0.16666666666666666 * (re * re))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= -4.4)
		tmp = Float64(-0.5 * Float64(im * im));
	elseif (re <= 2.9)
		tmp = Float64(re + 1.0);
	else
		tmp = Float64(re * Float64(0.16666666666666666 * Float64(re * re)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= -4.4)
		tmp = -0.5 * (im * im);
	elseif (re <= 2.9)
		tmp = re + 1.0;
	else
		tmp = re * (0.16666666666666666 * (re * re));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, -4.4], N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.9], N[(re + 1.0), $MachinePrecision], N[(re * N[(0.16666666666666666 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq -4.4:\\
\;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\

\mathbf{elif}\;re \leq 2.9:\\
\;\;\;\;re + 1\\

\mathbf{else}:\\
\;\;\;\;re \cdot \left(0.16666666666666666 \cdot \left(re \cdot re\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < -4.4000000000000004

    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.3%

        \[\leadsto \mathsf{cos.f64}\left(im\right) \]
    5. Simplified3.3%

      \[\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. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \color{blue}{\left({im}^{2}\right)}\right)\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{im}\right)\right)\right) \]
      4. *-lowering-*.f642.7%

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    8. Simplified2.7%

      \[\leadsto \color{blue}{1 + -0.5 \cdot \left(im \cdot im\right)} \]
    9. Taylor expanded in im around inf

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot {im}^{2}} \]
    10. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{-1}{2}, \color{blue}{\left({im}^{2}\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{im}\right)\right) \]
      3. *-lowering-*.f6428.2%

        \[\leadsto \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right) \]
    11. Simplified28.2%

      \[\leadsto \color{blue}{-0.5 \cdot \left(im \cdot im\right)} \]

    if -4.4000000000000004 < re < 2.89999999999999991

    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.f6451.6%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified51.6%

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re around 0

      \[\leadsto \color{blue}{1 + re} \]
    7. Step-by-step derivation
      1. +-lowering-+.f6451.1%

        \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{re}\right) \]
    8. Simplified51.1%

      \[\leadsto \color{blue}{1 + re} \]

    if 2.89999999999999991 < 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.f6470.1%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified70.1%

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re 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-*.f6448.8%

        \[\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. Simplified48.8%

      \[\leadsto \color{blue}{1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)} \]
    9. Taylor expanded in re around inf

      \[\leadsto \color{blue}{\frac{1}{6} \cdot {re}^{3}} \]
    10. Step-by-step derivation
      1. unpow3N/A

        \[\leadsto \frac{1}{6} \cdot \left(\left(re \cdot re\right) \cdot \color{blue}{re}\right) \]
      2. unpow2N/A

        \[\leadsto \frac{1}{6} \cdot \left({re}^{2} \cdot re\right) \]
      3. associate-*r*N/A

        \[\leadsto \left(\frac{1}{6} \cdot {re}^{2}\right) \cdot \color{blue}{re} \]
      4. unpow2N/A

        \[\leadsto \left(\frac{1}{6} \cdot \left(re \cdot re\right)\right) \cdot re \]
      5. associate-*r*N/A

        \[\leadsto \left(\left(\frac{1}{6} \cdot re\right) \cdot re\right) \cdot re \]
      6. *-commutativeN/A

        \[\leadsto re \cdot \color{blue}{\left(\left(\frac{1}{6} \cdot re\right) \cdot re\right)} \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(re, \color{blue}{\left(\left(\frac{1}{6} \cdot re\right) \cdot re\right)}\right) \]
      8. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(re, \left(\frac{1}{6} \cdot \color{blue}{\left(re \cdot re\right)}\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(re, \left(\frac{1}{6} \cdot {re}^{\color{blue}{2}}\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(\frac{1}{6}, \color{blue}{\left({re}^{2}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(\frac{1}{6}, \left(re \cdot \color{blue}{re}\right)\right)\right) \]
      12. *-lowering-*.f6448.8%

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right) \]
    11. Simplified48.8%

      \[\leadsto \color{blue}{re \cdot \left(0.16666666666666666 \cdot \left(re \cdot re\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification44.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -4.4:\\ \;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\ \mathbf{elif}\;re \leq 2.9:\\ \;\;\;\;re + 1\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.16666666666666666 \cdot \left(re \cdot re\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 24: 38.2% accurate, 13.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -0.5 \cdot \left(im \cdot im\right)\\ \mathbf{if}\;re \leq -4.4:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 7000000:\\ \;\;\;\;re + 1\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* -0.5 (* im im))))
   (if (<= re -4.4) t_0 (if (<= re 7000000.0) (+ re 1.0) t_0))))
double code(double re, double im) {
	double t_0 = -0.5 * (im * im);
	double tmp;
	if (re <= -4.4) {
		tmp = t_0;
	} else if (re <= 7000000.0) {
		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 = (-0.5d0) * (im * im)
    if (re <= (-4.4d0)) then
        tmp = t_0
    else if (re <= 7000000.0d0) 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 = -0.5 * (im * im);
	double tmp;
	if (re <= -4.4) {
		tmp = t_0;
	} else if (re <= 7000000.0) {
		tmp = re + 1.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = -0.5 * (im * im)
	tmp = 0
	if re <= -4.4:
		tmp = t_0
	elif re <= 7000000.0:
		tmp = re + 1.0
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(-0.5 * Float64(im * im))
	tmp = 0.0
	if (re <= -4.4)
		tmp = t_0;
	elseif (re <= 7000000.0)
		tmp = Float64(re + 1.0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = -0.5 * (im * im);
	tmp = 0.0;
	if (re <= -4.4)
		tmp = t_0;
	elseif (re <= 7000000.0)
		tmp = re + 1.0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -4.4], t$95$0, If[LessEqual[re, 7000000.0], N[(re + 1.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -0.5 \cdot \left(im \cdot im\right)\\
\mathbf{if}\;re \leq -4.4:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;re \leq 7000000:\\
\;\;\;\;re + 1\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if re < -4.4000000000000004 or 7e6 < 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.2%

        \[\leadsto \mathsf{cos.f64}\left(im\right) \]
    5. Simplified3.2%

      \[\leadsto \color{blue}{\cos im} \]
    6. Taylor expanded in im around 0

      \[\leadsto \color{blue}{1 + \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. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \color{blue}{\left({im}^{2}\right)}\right)\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{im}\right)\right)\right) \]
      4. *-lowering-*.f6411.9%

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right)\right) \]
    8. Simplified11.9%

      \[\leadsto \color{blue}{1 + -0.5 \cdot \left(im \cdot im\right)} \]
    9. Taylor expanded in im around inf

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot {im}^{2}} \]
    10. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{-1}{2}, \color{blue}{\left({im}^{2}\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{-1}{2}, \left(im \cdot \color{blue}{im}\right)\right) \]
      3. *-lowering-*.f6425.0%

        \[\leadsto \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(im, \color{blue}{im}\right)\right) \]
    11. Simplified25.0%

      \[\leadsto \color{blue}{-0.5 \cdot \left(im \cdot im\right)} \]

    if -4.4000000000000004 < re < 7e6

    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.f6452.5%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified52.5%

      \[\leadsto \color{blue}{e^{re}} \]
    6. Taylor expanded in re around 0

      \[\leadsto \color{blue}{1 + re} \]
    7. Step-by-step derivation
      1. +-lowering-+.f6450.3%

        \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{re}\right) \]
    8. Simplified50.3%

      \[\leadsto \color{blue}{1 + re} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification36.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -4.4:\\ \;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\ \mathbf{elif}\;re \leq 7000000:\\ \;\;\;\;re + 1\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 25: 29.5% 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.f6470.3%

      \[\leadsto \mathsf{exp.f64}\left(re\right) \]
  5. Simplified70.3%

    \[\leadsto \color{blue}{e^{re}} \]
  6. Taylor expanded in re around 0

    \[\leadsto \color{blue}{1 + re} \]
  7. Step-by-step derivation
    1. +-lowering-+.f6424.7%

      \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{re}\right) \]
  8. Simplified24.7%

    \[\leadsto \color{blue}{1 + re} \]
  9. Final simplification24.7%

    \[\leadsto re + 1 \]
  10. Add Preprocessing

Alternative 26: 28.9% 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 im around 0

    \[\leadsto \color{blue}{e^{re}} \]
  4. Step-by-step derivation
    1. exp-lowering-exp.f6470.3%

      \[\leadsto \mathsf{exp.f64}\left(re\right) \]
  5. Simplified70.3%

    \[\leadsto \color{blue}{e^{re}} \]
  6. Taylor expanded in re around 0

    \[\leadsto \color{blue}{1} \]
  7. Step-by-step derivation
    1. Simplified24.6%

      \[\leadsto \color{blue}{1} \]
    2. Add Preprocessing

    Reproduce

    ?
    herbie shell --seed 2024150 
    (FPCore (re im)
      :name "math.exp on complex, real part"
      :precision binary64
      (* (exp re) (cos im)))