math.exp on complex, real part

Percentage Accurate: 100.0% → 100.0%
Time: 12.4s
Alternatives: 16
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 16 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.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;e^{re} \leq 0.99999995:\\ \;\;\;\;e^{re}\\ \mathbf{elif}\;e^{re} \leq 1:\\ \;\;\;\;\cos im \cdot \left(re + 1\right)\\ \mathbf{else}:\\ \;\;\;\;e^{re}\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= (exp re) 0.99999995)
   (exp re)
   (if (<= (exp re) 1.0) (* (cos im) (+ re 1.0)) (exp re))))
double code(double re, double im) {
	double tmp;
	if (exp(re) <= 0.99999995) {
		tmp = exp(re);
	} else if (exp(re) <= 1.0) {
		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.99999995d0) then
        tmp = exp(re)
    else if (exp(re) <= 1.0d0) 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.99999995) {
		tmp = Math.exp(re);
	} else if (Math.exp(re) <= 1.0) {
		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.99999995:
		tmp = math.exp(re)
	elif math.exp(re) <= 1.0:
		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.99999995)
		tmp = exp(re);
	elseif (exp(re) <= 1.0)
		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.99999995)
		tmp = exp(re);
	elseif (exp(re) <= 1.0)
		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.99999995], N[Exp[re], $MachinePrecision], If[LessEqual[N[Exp[re], $MachinePrecision], 1.0], 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.99999995:\\
\;\;\;\;e^{re}\\

\mathbf{elif}\;e^{re} \leq 1:\\
\;\;\;\;\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.999999949999999971 or 1 < (exp.f64 re)

    1. Initial program 100.0%

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

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

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

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

    if 0.999999949999999971 < (exp.f64 re) < 1

    1. Initial program 100.0%

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

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

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

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

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

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

Alternative 3: 92.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;e^{re} \leq 0.99999995:\\ \;\;\;\;e^{re}\\ \mathbf{elif}\;e^{re} \leq 1:\\ \;\;\;\;\cos im\\ \mathbf{else}:\\ \;\;\;\;e^{re}\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= (exp re) 0.99999995)
   (exp re)
   (if (<= (exp re) 1.0) (cos im) (exp re))))
double code(double re, double im) {
	double tmp;
	if (exp(re) <= 0.99999995) {
		tmp = exp(re);
	} else if (exp(re) <= 1.0) {
		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.99999995d0) then
        tmp = exp(re)
    else if (exp(re) <= 1.0d0) 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.99999995) {
		tmp = Math.exp(re);
	} else if (Math.exp(re) <= 1.0) {
		tmp = Math.cos(im);
	} else {
		tmp = Math.exp(re);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if math.exp(re) <= 0.99999995:
		tmp = math.exp(re)
	elif math.exp(re) <= 1.0:
		tmp = math.cos(im)
	else:
		tmp = math.exp(re)
	return tmp
function code(re, im)
	tmp = 0.0
	if (exp(re) <= 0.99999995)
		tmp = exp(re);
	elseif (exp(re) <= 1.0)
		tmp = cos(im);
	else
		tmp = exp(re);
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (exp(re) <= 0.99999995)
		tmp = exp(re);
	elseif (exp(re) <= 1.0)
		tmp = cos(im);
	else
		tmp = exp(re);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 0.99999995], N[Exp[re], $MachinePrecision], If[LessEqual[N[Exp[re], $MachinePrecision], 1.0], N[Cos[im], $MachinePrecision], N[Exp[re], $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

    if 0.999999949999999971 < (exp.f64 re) < 1

    1. Initial program 100.0%

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

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

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

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

Alternative 4: 73.8% accurate, 1.8× 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 -75000000:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\ \mathbf{elif}\;re \leq 1.2 \cdot 10^{-20}:\\ \;\;\;\;\cos im\\ \mathbf{elif}\;re \leq 3.6 \cdot 10^{+77}:\\ \;\;\;\;\left(1 + \frac{re \cdot \left(1 - t\_0 \cdot \left(re \cdot t\_1\right)\right)}{1 - t\_1}\right) \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(re + 1\right) + \frac{re \cdot \left(re \cdot \left(0.25 + \left(re \cdot re\right) \cdot -0.027777777777777776\right)\right)}{0.5 + re \cdot -0.16666666666666666}\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (+ 0.5 (* re 0.16666666666666666))) (t_1 (* re t_0)))
   (if (<= re -75000000.0)
     (* (* im im) (* (* im im) 0.041666666666666664))
     (if (<= re 1.2e-20)
       (cos im)
       (if (<= re 3.6e+77)
         (*
          (+ 1.0 (/ (* re (- 1.0 (* t_0 (* re t_1)))) (- 1.0 t_1)))
          (+ 1.0 (* im (* im -0.5))))
         (+
          (+ re 1.0)
          (/
           (* re (* re (+ 0.25 (* (* re re) -0.027777777777777776))))
           (+ 0.5 (* re -0.16666666666666666)))))))))
double code(double re, double im) {
	double t_0 = 0.5 + (re * 0.16666666666666666);
	double t_1 = re * t_0;
	double tmp;
	if (re <= -75000000.0) {
		tmp = (im * im) * ((im * im) * 0.041666666666666664);
	} else if (re <= 1.2e-20) {
		tmp = cos(im);
	} else if (re <= 3.6e+77) {
		tmp = (1.0 + ((re * (1.0 - (t_0 * (re * t_1)))) / (1.0 - t_1))) * (1.0 + (im * (im * -0.5)));
	} else {
		tmp = (re + 1.0) + ((re * (re * (0.25 + ((re * re) * -0.027777777777777776)))) / (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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 0.5d0 + (re * 0.16666666666666666d0)
    t_1 = re * t_0
    if (re <= (-75000000.0d0)) then
        tmp = (im * im) * ((im * im) * 0.041666666666666664d0)
    else if (re <= 1.2d-20) then
        tmp = cos(im)
    else if (re <= 3.6d+77) then
        tmp = (1.0d0 + ((re * (1.0d0 - (t_0 * (re * t_1)))) / (1.0d0 - t_1))) * (1.0d0 + (im * (im * (-0.5d0))))
    else
        tmp = (re + 1.0d0) + ((re * (re * (0.25d0 + ((re * re) * (-0.027777777777777776d0))))) / (0.5d0 + (re * (-0.16666666666666666d0))))
    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 <= -75000000.0) {
		tmp = (im * im) * ((im * im) * 0.041666666666666664);
	} else if (re <= 1.2e-20) {
		tmp = Math.cos(im);
	} else if (re <= 3.6e+77) {
		tmp = (1.0 + ((re * (1.0 - (t_0 * (re * t_1)))) / (1.0 - t_1))) * (1.0 + (im * (im * -0.5)));
	} else {
		tmp = (re + 1.0) + ((re * (re * (0.25 + ((re * re) * -0.027777777777777776)))) / (0.5 + (re * -0.16666666666666666)));
	}
	return tmp;
}
def code(re, im):
	t_0 = 0.5 + (re * 0.16666666666666666)
	t_1 = re * t_0
	tmp = 0
	if re <= -75000000.0:
		tmp = (im * im) * ((im * im) * 0.041666666666666664)
	elif re <= 1.2e-20:
		tmp = math.cos(im)
	elif re <= 3.6e+77:
		tmp = (1.0 + ((re * (1.0 - (t_0 * (re * t_1)))) / (1.0 - t_1))) * (1.0 + (im * (im * -0.5)))
	else:
		tmp = (re + 1.0) + ((re * (re * (0.25 + ((re * re) * -0.027777777777777776)))) / (0.5 + (re * -0.16666666666666666)))
	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 <= -75000000.0)
		tmp = Float64(Float64(im * im) * Float64(Float64(im * im) * 0.041666666666666664));
	elseif (re <= 1.2e-20)
		tmp = cos(im);
	elseif (re <= 3.6e+77)
		tmp = Float64(Float64(1.0 + Float64(Float64(re * Float64(1.0 - Float64(t_0 * Float64(re * t_1)))) / Float64(1.0 - t_1))) * Float64(1.0 + Float64(im * Float64(im * -0.5))));
	else
		tmp = Float64(Float64(re + 1.0) + Float64(Float64(re * Float64(re * Float64(0.25 + Float64(Float64(re * re) * -0.027777777777777776)))) / Float64(0.5 + Float64(re * -0.16666666666666666))));
	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 <= -75000000.0)
		tmp = (im * im) * ((im * im) * 0.041666666666666664);
	elseif (re <= 1.2e-20)
		tmp = cos(im);
	elseif (re <= 3.6e+77)
		tmp = (1.0 + ((re * (1.0 - (t_0 * (re * t_1)))) / (1.0 - t_1))) * (1.0 + (im * (im * -0.5)));
	else
		tmp = (re + 1.0) + ((re * (re * (0.25 + ((re * re) * -0.027777777777777776)))) / (0.5 + (re * -0.16666666666666666)));
	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, -75000000.0], N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.2e-20], N[Cos[im], $MachinePrecision], If[LessEqual[re, 3.6e+77], N[(N[(1.0 + N[(N[(re * N[(1.0 - N[(t$95$0 * N[(re * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(re + 1.0), $MachinePrecision] + N[(N[(re * N[(re * N[(0.25 + N[(N[(re * re), $MachinePrecision] * -0.027777777777777776), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.5 + N[(re * -0.16666666666666666), $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 -75000000:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{1}{24}\right)\right) \]
      11. *-lowering-*.f6437.9%

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

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

    if -7.5e7 < re < 1.19999999999999996e-20

    1. Initial program 100.0%

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

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

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

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

    if 1.19999999999999996e-20 < re < 3.5999999999999998e77

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\left(\left(1 \cdot 1 - \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)\right) \cdot re\right), \left(1 - re \cdot \left(\frac{1}{2} + re \cdot \frac{1}{6}\right)\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{2}\right)\right)\right)\right) \]
    10. Applied egg-rr47.3%

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

    if 3.5999999999999998e77 < 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.f6474.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(1, re\right), \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)\right) \]
    10. Applied egg-rr65.5%

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

        \[\leadsto \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 \color{blue}{re}\right)\right) \]
      2. flip-+N/A

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -75000000:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\ \mathbf{elif}\;re \leq 1.2 \cdot 10^{-20}:\\ \;\;\;\;\cos im\\ \mathbf{elif}\;re \leq 3.6 \cdot 10^{+77}:\\ \;\;\;\;\left(1 + \frac{re \cdot \left(1 - \left(0.5 + re \cdot 0.16666666666666666\right) \cdot \left(re \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\right)}{1 - re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)}\right) \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(re + 1\right) + \frac{re \cdot \left(re \cdot \left(0.25 + \left(re \cdot re\right) \cdot -0.027777777777777776\right)\right)}{0.5 + re \cdot -0.16666666666666666}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 51.9% accurate, 5.2× speedup?

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

\\
\begin{array}{l}
t_0 := re \cdot \left(re \cdot re\right)\\
\mathbf{if}\;re \leq -75000000:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\

\mathbf{elif}\;re \leq 2.2 \cdot 10^{+107}:\\
\;\;\;\;\left(re + 1\right) + \frac{\left(re \cdot re\right) \cdot \left(0.125 + t\_0 \cdot 0.004629629629629629\right)}{0.25 + \left(re \cdot 0.16666666666666666\right) \cdot \left(re \cdot 0.16666666666666666 - 0.5\right)}\\

\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(0.16666666666666666 + \left(im \cdot im\right) \cdot -0.08333333333333333\right)\\


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{1}{24}\right)\right) \]
      11. *-lowering-*.f6437.9%

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

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

    if -7.5e7 < re < 2.2e107

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

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

      \[\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-*.f6444.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. Simplified44.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. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(1, re\right), \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)\right) \]
    10. Applied egg-rr44.9%

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(1, re\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{+.f64}\left(\frac{1}{8}, \left({\left(re \cdot \frac{1}{6}\right)}^{3}\right)\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2} + \left(\left(re \cdot \frac{1}{6}\right) \cdot \left(re \cdot \frac{1}{6}\right) - \frac{1}{2} \cdot \left(re \cdot \frac{1}{6}\right)\right)\right)\right)\right) \]
      9. unpow-prod-downN/A

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

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

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

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

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

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

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

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

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

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

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

    if 2.2e107 < re

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\right), \mathsf{+.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{\frac{1}{6}} \cdot \frac{-1}{2}\right)\right)\right)\right) \]
      21. metadata-eval73.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, re\right)\right), \mathsf{+.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{12}\right)\right)\right) \]
    11. Simplified73.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -75000000:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\ \mathbf{elif}\;re \leq 2.2 \cdot 10^{+107}:\\ \;\;\;\;\left(re + 1\right) + \frac{\left(re \cdot re\right) \cdot \left(0.125 + \left(re \cdot \left(re \cdot re\right)\right) \cdot 0.004629629629629629\right)}{0.25 + \left(re \cdot 0.16666666666666666\right) \cdot \left(re \cdot 0.16666666666666666 - 0.5\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(0.16666666666666666 + \left(im \cdot im\right) \cdot -0.08333333333333333\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 51.3% accurate, 7.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;re \leq -75000000:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{1}{24}\right)\right) \]
      11. *-lowering-*.f6437.9%

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

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

    if -7.5e7 < re

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(1, re\right), \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)\right) \]
    10. Applied egg-rr50.8%

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

        \[\leadsto \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 \color{blue}{re}\right)\right) \]
      2. flip-+N/A

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -75000000:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\ \mathbf{else}:\\ \;\;\;\;\left(re + 1\right) + \frac{re \cdot \left(re \cdot \left(0.25 + \left(re \cdot re\right) \cdot -0.027777777777777776\right)\right)}{0.5 + re \cdot -0.16666666666666666}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 49.8% accurate, 10.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;re \leq -75000000:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\

\mathbf{elif}\;re \leq 1.82:\\
\;\;\;\;re + 1\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{1}{24}\right)\right) \]
      11. *-lowering-*.f6437.9%

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

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

    if -7.5e7 < re < 1.82000000000000006

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

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

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

      \[\leadsto \color{blue}{1 + re} \]
    7. Step-by-step derivation
      1. +-lowering-+.f6449.3%

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

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

    if 1.82000000000000006 < 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.f6476.6%

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

      \[\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-*.f6453.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. Simplified53.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}{{re}^{3} \cdot \left(\frac{1}{6} + \frac{1}{2} \cdot \frac{1}{re}\right)} \]
    10. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 50.0% accurate, 11.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -75000000:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right) + \left(re + 1\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re -75000000.0)
   (* (* im im) (* (* im im) 0.041666666666666664))
   (+ (* re (* re (+ 0.5 (* re 0.16666666666666666)))) (+ re 1.0))))
double code(double re, double im) {
	double tmp;
	if (re <= -75000000.0) {
		tmp = (im * im) * ((im * im) * 0.041666666666666664);
	} else {
		tmp = (re * (re * (0.5 + (re * 0.16666666666666666)))) + (re + 1.0);
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= (-75000000.0d0)) then
        tmp = (im * im) * ((im * im) * 0.041666666666666664d0)
    else
        tmp = (re * (re * (0.5d0 + (re * 0.16666666666666666d0)))) + (re + 1.0d0)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= -75000000.0) {
		tmp = (im * im) * ((im * im) * 0.041666666666666664);
	} else {
		tmp = (re * (re * (0.5 + (re * 0.16666666666666666)))) + (re + 1.0);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= -75000000.0:
		tmp = (im * im) * ((im * im) * 0.041666666666666664)
	else:
		tmp = (re * (re * (0.5 + (re * 0.16666666666666666)))) + (re + 1.0)
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= -75000000.0)
		tmp = Float64(Float64(im * im) * Float64(Float64(im * im) * 0.041666666666666664));
	else
		tmp = Float64(Float64(re * Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))) + Float64(re + 1.0));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= -75000000.0)
		tmp = (im * im) * ((im * im) * 0.041666666666666664);
	else
		tmp = (re * (re * (0.5 + (re * 0.16666666666666666)))) + (re + 1.0);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, -75000000.0], N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision], N[(N[(re * N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(re + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq -75000000:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{1}{24}\right)\right) \]
      11. *-lowering-*.f6437.9%

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

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

    if -7.5e7 < re

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(1, re\right), \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)\right) \]
    10. Applied egg-rr50.8%

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

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

Alternative 9: 50.0% accurate, 11.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -75000000:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\ \mathbf{else}:\\ \;\;\;\;1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re -75000000.0)
   (* (* im im) (* (* im im) 0.041666666666666664))
   (+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666))))))))
double code(double re, double im) {
	double tmp;
	if (re <= -75000000.0) {
		tmp = (im * im) * ((im * im) * 0.041666666666666664);
	} else {
		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= (-75000000.0d0)) then
        tmp = (im * im) * ((im * im) * 0.041666666666666664d0)
    else
        tmp = 1.0d0 + (re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0)))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= -75000000.0) {
		tmp = (im * im) * ((im * im) * 0.041666666666666664);
	} else {
		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= -75000000.0:
		tmp = (im * im) * ((im * im) * 0.041666666666666664)
	else:
		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= -75000000.0)
		tmp = Float64(Float64(im * im) * Float64(Float64(im * im) * 0.041666666666666664));
	else
		tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666))))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= -75000000.0)
		tmp = (im * im) * ((im * im) * 0.041666666666666664);
	else
		tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, -75000000.0], N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq -75000000:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{1}{24}\right)\right) \]
      11. *-lowering-*.f6437.9%

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

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

    if -7.5e7 < re

    1. Initial program 100.0%

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

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

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

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

      \[\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 10: 49.8% accurate, 11.9× speedup?

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

\mathbf{elif}\;re \leq 2.8:\\
\;\;\;\;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 < -7.5e7

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{1}{24}\right)\right) \]
      11. *-lowering-*.f6437.9%

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

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

    if -7.5e7 < 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.f6452.0%

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

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

      \[\leadsto \color{blue}{1 + re} \]
    7. Step-by-step derivation
      1. +-lowering-+.f6449.3%

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

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

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

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

      \[\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-*.f6453.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. Simplified53.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. *-commutativeN/A

        \[\leadsto {re}^{3} \cdot \color{blue}{\frac{1}{6}} \]
      2. cube-multN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -75000000:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\ \mathbf{elif}\;re \leq 2.8:\\ \;\;\;\;re + 1\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.16666666666666666 \cdot \left(re \cdot re\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 49.8% accurate, 12.7× speedup?

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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{1}{24}\right)\right) \]
      11. *-lowering-*.f6437.9%

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

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

    if -7.5e7 < re

    1. Initial program 100.0%

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

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

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

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

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

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

Alternative 12: 47.2% accurate, 14.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -75000000:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\ \mathbf{else}:\\ \;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re -75000000.0)
   (* (* im im) (* (* im im) 0.041666666666666664))
   (+ 1.0 (* re (+ 1.0 (* re 0.5))))))
double code(double re, double im) {
	double tmp;
	if (re <= -75000000.0) {
		tmp = (im * im) * ((im * im) * 0.041666666666666664);
	} else {
		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= (-75000000.0d0)) then
        tmp = (im * im) * ((im * im) * 0.041666666666666664d0)
    else
        tmp = 1.0d0 + (re * (1.0d0 + (re * 0.5d0)))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= -75000000.0) {
		tmp = (im * im) * ((im * im) * 0.041666666666666664);
	} else {
		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= -75000000.0:
		tmp = (im * im) * ((im * im) * 0.041666666666666664)
	else:
		tmp = 1.0 + (re * (1.0 + (re * 0.5)))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= -75000000.0)
		tmp = Float64(Float64(im * im) * Float64(Float64(im * im) * 0.041666666666666664));
	else
		tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= -75000000.0)
		tmp = (im * im) * ((im * im) * 0.041666666666666664);
	else
		tmp = 1.0 + (re * (1.0 + (re * 0.5)));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, -75000000.0], N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq -75000000:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{1}{24}\right)\right) \]
      11. *-lowering-*.f6437.9%

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

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

    if -7.5e7 < re

    1. Initial program 100.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -75000000:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\ \mathbf{else}:\\ \;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 41.2% accurate, 16.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq 2.8:\\ \;\;\;\;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 2.8) (+ re 1.0) (* re (* 0.16666666666666666 (* re re)))))
double code(double re, double im) {
	double tmp;
	if (re <= 2.8) {
		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 <= 2.8d0) 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 <= 2.8) {
		tmp = re + 1.0;
	} else {
		tmp = re * (0.16666666666666666 * (re * re));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= 2.8:
		tmp = re + 1.0
	else:
		tmp = re * (0.16666666666666666 * (re * re))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= 2.8)
		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 <= 2.8)
		tmp = re + 1.0;
	else
		tmp = re * (0.16666666666666666 * (re * re));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, 2.8], 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 2.8:\\
\;\;\;\;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 2 regimes
  2. if 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.f6465.7%

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

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

      \[\leadsto \color{blue}{1 + re} \]
    7. Step-by-step derivation
      1. +-lowering-+.f6435.8%

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

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

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

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

      \[\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-*.f6453.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. Simplified53.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. *-commutativeN/A

        \[\leadsto {re}^{3} \cdot \color{blue}{\frac{1}{6}} \]
      2. cube-multN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 2.8:\\ \;\;\;\;re + 1\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.16666666666666666 \cdot \left(re \cdot re\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 38.5% accurate, 20.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq 2.3:\\ \;\;\;\;re + 1\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(re \cdot 0.5\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re 2.3) (+ re 1.0) (* re (* re 0.5))))
double code(double re, double im) {
	double tmp;
	if (re <= 2.3) {
		tmp = re + 1.0;
	} else {
		tmp = re * (re * 0.5);
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= 2.3d0) then
        tmp = re + 1.0d0
    else
        tmp = re * (re * 0.5d0)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= 2.3) {
		tmp = re + 1.0;
	} else {
		tmp = re * (re * 0.5);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= 2.3:
		tmp = re + 1.0
	else:
		tmp = re * (re * 0.5)
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= 2.3)
		tmp = Float64(re + 1.0);
	else
		tmp = Float64(re * Float64(re * 0.5));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= 2.3)
		tmp = re + 1.0;
	else
		tmp = re * (re * 0.5);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, 2.3], N[(re + 1.0), $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.3:\\
\;\;\;\;re + 1\\

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


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

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

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

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

      \[\leadsto \color{blue}{1 + re} \]
    7. Step-by-step derivation
      1. +-lowering-+.f6435.8%

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

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

    if 2.2999999999999998 < 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.f6476.6%

        \[\leadsto \mathsf{exp.f64}\left(re\right) \]
    5. Simplified76.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. *-lowering-*.f6448.3%

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(re, \mathsf{*.f64}\left(re, \color{blue}{\frac{1}{2}}\right)\right) \]
    11. Simplified48.3%

      \[\leadsto \color{blue}{re \cdot \left(re \cdot 0.5\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification39.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 2.3:\\ \;\;\;\;re + 1\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(re \cdot 0.5\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 29.2% 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.f6468.4%

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

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

    \[\leadsto \color{blue}{1 + re} \]
  7. Step-by-step derivation
    1. +-lowering-+.f6428.0%

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

    \[\leadsto \color{blue}{1 + re} \]
  9. Final simplification28.0%

    \[\leadsto re + 1 \]
  10. Add Preprocessing

Alternative 16: 28.7% accurate, 203.0× speedup?

\[\begin{array}{l} \\ 1 \end{array} \]
(FPCore (re im) :precision binary64 1.0)
double code(double re, double im) {
	return 1.0;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    code = 1.0d0
end function
public static double code(double re, double im) {
	return 1.0;
}
def code(re, im):
	return 1.0
function code(re, im)
	return 1.0
end
function tmp = code(re, im)
	tmp = 1.0;
end
code[re_, im_] := 1.0
\begin{array}{l}

\\
1
\end{array}
Derivation
  1. Initial program 100.0%

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

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

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

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

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

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

    Reproduce

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