math.exp on complex, imaginary part

Percentage Accurate: 100.0% → 100.0%
Time: 8.1s
Alternatives: 14
Speedup: 1.0×

Specification

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

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

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

Alternative 1: 100.0% accurate, 1.0× speedup?

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

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

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

Alternative 2: 93.0% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_0 := e^{re} \cdot im\\
\mathbf{if}\;e^{re} \leq 0.995:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;e^{re} \leq 2:\\
\;\;\;\;im + re \cdot im\\

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


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

    1. Initial program 100.0%

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

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

    if 0.994999999999999996 < (exp.f64 re) < 1

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \sin im} \]
    4. Step-by-step derivation
      1. distribute-rgt1-in100.0%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    5. Simplified100.0%

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

    if 1 < (exp.f64 re) < 2

    1. Initial program 98.4%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 100.0%

      \[\leadsto \color{blue}{im + im \cdot re} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification93.0%

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

Alternative 3: 92.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{re} \cdot im\\ \mathbf{if}\;e^{re} \leq 0.995:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;e^{re} \leq 1:\\ \;\;\;\;\sin im\\ \mathbf{elif}\;e^{re} \leq 2:\\ \;\;\;\;im + re \cdot im\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (exp re) im)))
   (if (<= (exp re) 0.995)
     t_0
     (if (<= (exp re) 1.0)
       (sin im)
       (if (<= (exp re) 2.0) (+ im (* re im)) t_0)))))
double code(double re, double im) {
	double t_0 = exp(re) * im;
	double tmp;
	if (exp(re) <= 0.995) {
		tmp = t_0;
	} else if (exp(re) <= 1.0) {
		tmp = sin(im);
	} else if (exp(re) <= 2.0) {
		tmp = im + (re * im);
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = exp(re) * im
    if (exp(re) <= 0.995d0) then
        tmp = t_0
    else if (exp(re) <= 1.0d0) then
        tmp = sin(im)
    else if (exp(re) <= 2.0d0) then
        tmp = im + (re * im)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = Math.exp(re) * im;
	double tmp;
	if (Math.exp(re) <= 0.995) {
		tmp = t_0;
	} else if (Math.exp(re) <= 1.0) {
		tmp = Math.sin(im);
	} else if (Math.exp(re) <= 2.0) {
		tmp = im + (re * im);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = math.exp(re) * im
	tmp = 0
	if math.exp(re) <= 0.995:
		tmp = t_0
	elif math.exp(re) <= 1.0:
		tmp = math.sin(im)
	elif math.exp(re) <= 2.0:
		tmp = im + (re * im)
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(exp(re) * im)
	tmp = 0.0
	if (exp(re) <= 0.995)
		tmp = t_0;
	elseif (exp(re) <= 1.0)
		tmp = sin(im);
	elseif (exp(re) <= 2.0)
		tmp = Float64(im + Float64(re * im));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = exp(re) * im;
	tmp = 0.0;
	if (exp(re) <= 0.995)
		tmp = t_0;
	elseif (exp(re) <= 1.0)
		tmp = sin(im);
	elseif (exp(re) <= 2.0)
		tmp = im + (re * im);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * im), $MachinePrecision]}, If[LessEqual[N[Exp[re], $MachinePrecision], 0.995], t$95$0, If[LessEqual[N[Exp[re], $MachinePrecision], 1.0], N[Sin[im], $MachinePrecision], If[LessEqual[N[Exp[re], $MachinePrecision], 2.0], N[(im + N[(re * im), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := e^{re} \cdot im\\
\mathbf{if}\;e^{re} \leq 0.995:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;e^{re} \leq 2:\\
\;\;\;\;im + re \cdot im\\

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


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

    1. Initial program 100.0%

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

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

    if 0.994999999999999996 < (exp.f64 re) < 1

    1. Initial program 100.0%

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

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

    if 1 < (exp.f64 re) < 2

    1. Initial program 98.4%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 100.0%

      \[\leadsto \color{blue}{im + im \cdot re} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification92.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{re} \leq 0.995:\\ \;\;\;\;e^{re} \cdot im\\ \mathbf{elif}\;e^{re} \leq 1:\\ \;\;\;\;\sin im\\ \mathbf{elif}\;e^{re} \leq 2:\\ \;\;\;\;im + re \cdot im\\ \mathbf{else}:\\ \;\;\;\;e^{re} \cdot im\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 67.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\\ t_1 := im + re \cdot \left(im + im \cdot t\_0\right)\\ t_2 := im + im \cdot \left(re \cdot \left(1 + t\_0\right)\right)\\ t_3 := im + re \cdot \left(im + re \cdot \left(\left(re \cdot im\right) \cdot 0.16666666666666666\right)\right)\\ \mathbf{if}\;re \leq -4.5 \cdot 10^{+126}:\\ \;\;\;\;re \cdot \frac{im}{re}\\ \mathbf{elif}\;re \leq 4.9 \cdot 10^{-30}:\\ \;\;\;\;\sin im\\ \mathbf{elif}\;re \leq 2050000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;re \leq 19000000:\\ \;\;\;\;\sin im\\ \mathbf{elif}\;re \leq 22000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;re \leq 2 \cdot 10^{+29}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;re \leq 3.8 \cdot 10^{+47}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;re \leq 1.4 \cdot 10^{+49}:\\ \;\;\;\;\sin im\\ \mathbf{elif}\;re \leq 10^{+59}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;re \leq 2 \cdot 10^{+60}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+60}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;re \leq 9 \cdot 10^{+67}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;re \leq 9.5 \cdot 10^{+67}:\\ \;\;\;\;\sin im\\ \mathbf{elif}\;re \leq 9.2 \cdot 10^{+72}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;re \leq 9.5 \cdot 10^{+72}:\\ \;\;\;\;\sin im\\ \mathbf{elif}\;re \leq 7.2 \cdot 10^{+91}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;re \leq 7.2 \cdot 10^{+92}:\\ \;\;\;\;\sin im\\ \mathbf{elif}\;re \leq 1.65 \cdot 10^{+133}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;re \leq 1.7 \cdot 10^{+133}:\\ \;\;\;\;\sin im\\ \mathbf{elif}\;re \leq 6.2 \cdot 10^{+153}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+158} \lor \neg \left(re \leq 5 \cdot 10^{+197}\right) \land \left(re \leq 3.2 \cdot 10^{+203} \lor \neg \left(re \leq 2.3 \cdot 10^{+246}\right) \land \left(re \leq 2.35 \cdot 10^{+246} \lor \neg \left(re \leq 1.08 \cdot 10^{+248}\right) \land \left(re \leq 1.8 \cdot 10^{+252} \lor \neg \left(re \leq 7.2 \cdot 10^{+299}\right) \land re \leq 7.5 \cdot 10^{+299}\right)\right)\right):\\ \;\;\;\;\sin im\\ \mathbf{else}:\\ \;\;\;\;im + im \cdot \left(re \cdot \left(1 + re \cdot 0.5\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* re (+ 0.5 (* re 0.16666666666666666))))
        (t_1 (+ im (* re (+ im (* im t_0)))))
        (t_2 (+ im (* im (* re (+ 1.0 t_0)))))
        (t_3 (+ im (* re (+ im (* re (* (* re im) 0.16666666666666666)))))))
   (if (<= re -4.5e+126)
     (* re (/ im re))
     (if (<= re 4.9e-30)
       (sin im)
       (if (<= re 2050000.0)
         t_1
         (if (<= re 19000000.0)
           (sin im)
           (if (<= re 22000000.0)
             t_1
             (if (<= re 2e+29)
               t_2
               (if (<= re 3.8e+47)
                 t_3
                 (if (<= re 1.4e+49)
                   (sin im)
                   (if (<= re 1e+59)
                     t_1
                     (if (<= re 2e+60)
                       t_3
                       (if (<= re 5e+60)
                         t_1
                         (if (<= re 9e+67)
                           t_3
                           (if (<= re 9.5e+67)
                             (sin im)
                             (if (<= re 9.2e+72)
                               t_3
                               (if (<= re 9.5e+72)
                                 (sin im)
                                 (if (<= re 7.2e+91)
                                   t_1
                                   (if (<= re 7.2e+92)
                                     (sin im)
                                     (if (<= re 1.65e+133)
                                       t_2
                                       (if (<= re 1.7e+133)
                                         (sin im)
                                         (if (<= re 6.2e+153)
                                           t_2
                                           (if (or (<= re 5e+158)
                                                   (and (not (<= re 5e+197))
                                                        (or (<= re 3.2e+203)
                                                            (and (not
                                                                  (<=
                                                                   re
                                                                   2.3e+246))
                                                                 (or (<=
                                                                      re
                                                                      2.35e+246)
                                                                     (and (not
                                                                           (<=
                                                                            re
                                                                            1.08e+248))
                                                                          (or (<=
                                                                               re
                                                                               1.8e+252)
                                                                              (and (not
                                                                                    (<=
                                                                                     re
                                                                                     7.2e+299))
                                                                                   (<=
                                                                                    re
                                                                                    7.5e+299)))))))))
                                             (sin im)
                                             (+
                                              im
                                              (*
                                               im
                                               (*
                                                re
                                                (+
                                                 1.0
                                                 (*
                                                  re
                                                  0.5))))))))))))))))))))))))))))
double code(double re, double im) {
	double t_0 = re * (0.5 + (re * 0.16666666666666666));
	double t_1 = im + (re * (im + (im * t_0)));
	double t_2 = im + (im * (re * (1.0 + t_0)));
	double t_3 = im + (re * (im + (re * ((re * im) * 0.16666666666666666))));
	double tmp;
	if (re <= -4.5e+126) {
		tmp = re * (im / re);
	} else if (re <= 4.9e-30) {
		tmp = sin(im);
	} else if (re <= 2050000.0) {
		tmp = t_1;
	} else if (re <= 19000000.0) {
		tmp = sin(im);
	} else if (re <= 22000000.0) {
		tmp = t_1;
	} else if (re <= 2e+29) {
		tmp = t_2;
	} else if (re <= 3.8e+47) {
		tmp = t_3;
	} else if (re <= 1.4e+49) {
		tmp = sin(im);
	} else if (re <= 1e+59) {
		tmp = t_1;
	} else if (re <= 2e+60) {
		tmp = t_3;
	} else if (re <= 5e+60) {
		tmp = t_1;
	} else if (re <= 9e+67) {
		tmp = t_3;
	} else if (re <= 9.5e+67) {
		tmp = sin(im);
	} else if (re <= 9.2e+72) {
		tmp = t_3;
	} else if (re <= 9.5e+72) {
		tmp = sin(im);
	} else if (re <= 7.2e+91) {
		tmp = t_1;
	} else if (re <= 7.2e+92) {
		tmp = sin(im);
	} else if (re <= 1.65e+133) {
		tmp = t_2;
	} else if (re <= 1.7e+133) {
		tmp = sin(im);
	} else if (re <= 6.2e+153) {
		tmp = t_2;
	} else if ((re <= 5e+158) || (!(re <= 5e+197) && ((re <= 3.2e+203) || (!(re <= 2.3e+246) && ((re <= 2.35e+246) || (!(re <= 1.08e+248) && ((re <= 1.8e+252) || (!(re <= 7.2e+299) && (re <= 7.5e+299))))))))) {
		tmp = sin(im);
	} else {
		tmp = im + (im * (re * (1.0 + (re * 0.5))));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = re * (0.5d0 + (re * 0.16666666666666666d0))
    t_1 = im + (re * (im + (im * t_0)))
    t_2 = im + (im * (re * (1.0d0 + t_0)))
    t_3 = im + (re * (im + (re * ((re * im) * 0.16666666666666666d0))))
    if (re <= (-4.5d+126)) then
        tmp = re * (im / re)
    else if (re <= 4.9d-30) then
        tmp = sin(im)
    else if (re <= 2050000.0d0) then
        tmp = t_1
    else if (re <= 19000000.0d0) then
        tmp = sin(im)
    else if (re <= 22000000.0d0) then
        tmp = t_1
    else if (re <= 2d+29) then
        tmp = t_2
    else if (re <= 3.8d+47) then
        tmp = t_3
    else if (re <= 1.4d+49) then
        tmp = sin(im)
    else if (re <= 1d+59) then
        tmp = t_1
    else if (re <= 2d+60) then
        tmp = t_3
    else if (re <= 5d+60) then
        tmp = t_1
    else if (re <= 9d+67) then
        tmp = t_3
    else if (re <= 9.5d+67) then
        tmp = sin(im)
    else if (re <= 9.2d+72) then
        tmp = t_3
    else if (re <= 9.5d+72) then
        tmp = sin(im)
    else if (re <= 7.2d+91) then
        tmp = t_1
    else if (re <= 7.2d+92) then
        tmp = sin(im)
    else if (re <= 1.65d+133) then
        tmp = t_2
    else if (re <= 1.7d+133) then
        tmp = sin(im)
    else if (re <= 6.2d+153) then
        tmp = t_2
    else if ((re <= 5d+158) .or. (.not. (re <= 5d+197)) .and. (re <= 3.2d+203) .or. (.not. (re <= 2.3d+246)) .and. (re <= 2.35d+246) .or. (.not. (re <= 1.08d+248)) .and. (re <= 1.8d+252) .or. (.not. (re <= 7.2d+299)) .and. (re <= 7.5d+299)) then
        tmp = sin(im)
    else
        tmp = im + (im * (re * (1.0d0 + (re * 0.5d0))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = re * (0.5 + (re * 0.16666666666666666));
	double t_1 = im + (re * (im + (im * t_0)));
	double t_2 = im + (im * (re * (1.0 + t_0)));
	double t_3 = im + (re * (im + (re * ((re * im) * 0.16666666666666666))));
	double tmp;
	if (re <= -4.5e+126) {
		tmp = re * (im / re);
	} else if (re <= 4.9e-30) {
		tmp = Math.sin(im);
	} else if (re <= 2050000.0) {
		tmp = t_1;
	} else if (re <= 19000000.0) {
		tmp = Math.sin(im);
	} else if (re <= 22000000.0) {
		tmp = t_1;
	} else if (re <= 2e+29) {
		tmp = t_2;
	} else if (re <= 3.8e+47) {
		tmp = t_3;
	} else if (re <= 1.4e+49) {
		tmp = Math.sin(im);
	} else if (re <= 1e+59) {
		tmp = t_1;
	} else if (re <= 2e+60) {
		tmp = t_3;
	} else if (re <= 5e+60) {
		tmp = t_1;
	} else if (re <= 9e+67) {
		tmp = t_3;
	} else if (re <= 9.5e+67) {
		tmp = Math.sin(im);
	} else if (re <= 9.2e+72) {
		tmp = t_3;
	} else if (re <= 9.5e+72) {
		tmp = Math.sin(im);
	} else if (re <= 7.2e+91) {
		tmp = t_1;
	} else if (re <= 7.2e+92) {
		tmp = Math.sin(im);
	} else if (re <= 1.65e+133) {
		tmp = t_2;
	} else if (re <= 1.7e+133) {
		tmp = Math.sin(im);
	} else if (re <= 6.2e+153) {
		tmp = t_2;
	} else if ((re <= 5e+158) || (!(re <= 5e+197) && ((re <= 3.2e+203) || (!(re <= 2.3e+246) && ((re <= 2.35e+246) || (!(re <= 1.08e+248) && ((re <= 1.8e+252) || (!(re <= 7.2e+299) && (re <= 7.5e+299))))))))) {
		tmp = Math.sin(im);
	} else {
		tmp = im + (im * (re * (1.0 + (re * 0.5))));
	}
	return tmp;
}
def code(re, im):
	t_0 = re * (0.5 + (re * 0.16666666666666666))
	t_1 = im + (re * (im + (im * t_0)))
	t_2 = im + (im * (re * (1.0 + t_0)))
	t_3 = im + (re * (im + (re * ((re * im) * 0.16666666666666666))))
	tmp = 0
	if re <= -4.5e+126:
		tmp = re * (im / re)
	elif re <= 4.9e-30:
		tmp = math.sin(im)
	elif re <= 2050000.0:
		tmp = t_1
	elif re <= 19000000.0:
		tmp = math.sin(im)
	elif re <= 22000000.0:
		tmp = t_1
	elif re <= 2e+29:
		tmp = t_2
	elif re <= 3.8e+47:
		tmp = t_3
	elif re <= 1.4e+49:
		tmp = math.sin(im)
	elif re <= 1e+59:
		tmp = t_1
	elif re <= 2e+60:
		tmp = t_3
	elif re <= 5e+60:
		tmp = t_1
	elif re <= 9e+67:
		tmp = t_3
	elif re <= 9.5e+67:
		tmp = math.sin(im)
	elif re <= 9.2e+72:
		tmp = t_3
	elif re <= 9.5e+72:
		tmp = math.sin(im)
	elif re <= 7.2e+91:
		tmp = t_1
	elif re <= 7.2e+92:
		tmp = math.sin(im)
	elif re <= 1.65e+133:
		tmp = t_2
	elif re <= 1.7e+133:
		tmp = math.sin(im)
	elif re <= 6.2e+153:
		tmp = t_2
	elif (re <= 5e+158) or (not (re <= 5e+197) and ((re <= 3.2e+203) or (not (re <= 2.3e+246) and ((re <= 2.35e+246) or (not (re <= 1.08e+248) and ((re <= 1.8e+252) or (not (re <= 7.2e+299) and (re <= 7.5e+299)))))))):
		tmp = math.sin(im)
	else:
		tmp = im + (im * (re * (1.0 + (re * 0.5))))
	return tmp
function code(re, im)
	t_0 = Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))
	t_1 = Float64(im + Float64(re * Float64(im + Float64(im * t_0))))
	t_2 = Float64(im + Float64(im * Float64(re * Float64(1.0 + t_0))))
	t_3 = Float64(im + Float64(re * Float64(im + Float64(re * Float64(Float64(re * im) * 0.16666666666666666)))))
	tmp = 0.0
	if (re <= -4.5e+126)
		tmp = Float64(re * Float64(im / re));
	elseif (re <= 4.9e-30)
		tmp = sin(im);
	elseif (re <= 2050000.0)
		tmp = t_1;
	elseif (re <= 19000000.0)
		tmp = sin(im);
	elseif (re <= 22000000.0)
		tmp = t_1;
	elseif (re <= 2e+29)
		tmp = t_2;
	elseif (re <= 3.8e+47)
		tmp = t_3;
	elseif (re <= 1.4e+49)
		tmp = sin(im);
	elseif (re <= 1e+59)
		tmp = t_1;
	elseif (re <= 2e+60)
		tmp = t_3;
	elseif (re <= 5e+60)
		tmp = t_1;
	elseif (re <= 9e+67)
		tmp = t_3;
	elseif (re <= 9.5e+67)
		tmp = sin(im);
	elseif (re <= 9.2e+72)
		tmp = t_3;
	elseif (re <= 9.5e+72)
		tmp = sin(im);
	elseif (re <= 7.2e+91)
		tmp = t_1;
	elseif (re <= 7.2e+92)
		tmp = sin(im);
	elseif (re <= 1.65e+133)
		tmp = t_2;
	elseif (re <= 1.7e+133)
		tmp = sin(im);
	elseif (re <= 6.2e+153)
		tmp = t_2;
	elseif ((re <= 5e+158) || (!(re <= 5e+197) && ((re <= 3.2e+203) || (!(re <= 2.3e+246) && ((re <= 2.35e+246) || (!(re <= 1.08e+248) && ((re <= 1.8e+252) || (!(re <= 7.2e+299) && (re <= 7.5e+299)))))))))
		tmp = sin(im);
	else
		tmp = Float64(im + Float64(im * Float64(re * Float64(1.0 + Float64(re * 0.5)))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = re * (0.5 + (re * 0.16666666666666666));
	t_1 = im + (re * (im + (im * t_0)));
	t_2 = im + (im * (re * (1.0 + t_0)));
	t_3 = im + (re * (im + (re * ((re * im) * 0.16666666666666666))));
	tmp = 0.0;
	if (re <= -4.5e+126)
		tmp = re * (im / re);
	elseif (re <= 4.9e-30)
		tmp = sin(im);
	elseif (re <= 2050000.0)
		tmp = t_1;
	elseif (re <= 19000000.0)
		tmp = sin(im);
	elseif (re <= 22000000.0)
		tmp = t_1;
	elseif (re <= 2e+29)
		tmp = t_2;
	elseif (re <= 3.8e+47)
		tmp = t_3;
	elseif (re <= 1.4e+49)
		tmp = sin(im);
	elseif (re <= 1e+59)
		tmp = t_1;
	elseif (re <= 2e+60)
		tmp = t_3;
	elseif (re <= 5e+60)
		tmp = t_1;
	elseif (re <= 9e+67)
		tmp = t_3;
	elseif (re <= 9.5e+67)
		tmp = sin(im);
	elseif (re <= 9.2e+72)
		tmp = t_3;
	elseif (re <= 9.5e+72)
		tmp = sin(im);
	elseif (re <= 7.2e+91)
		tmp = t_1;
	elseif (re <= 7.2e+92)
		tmp = sin(im);
	elseif (re <= 1.65e+133)
		tmp = t_2;
	elseif (re <= 1.7e+133)
		tmp = sin(im);
	elseif (re <= 6.2e+153)
		tmp = t_2;
	elseif ((re <= 5e+158) || (~((re <= 5e+197)) && ((re <= 3.2e+203) || (~((re <= 2.3e+246)) && ((re <= 2.35e+246) || (~((re <= 1.08e+248)) && ((re <= 1.8e+252) || (~((re <= 7.2e+299)) && (re <= 7.5e+299)))))))))
		tmp = sin(im);
	else
		tmp = im + (im * (re * (1.0 + (re * 0.5))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(im + N[(re * N[(im + N[(im * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(im + N[(im * N[(re * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(im + N[(re * N[(im + N[(re * N[(N[(re * im), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -4.5e+126], N[(re * N[(im / re), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 4.9e-30], N[Sin[im], $MachinePrecision], If[LessEqual[re, 2050000.0], t$95$1, If[LessEqual[re, 19000000.0], N[Sin[im], $MachinePrecision], If[LessEqual[re, 22000000.0], t$95$1, If[LessEqual[re, 2e+29], t$95$2, If[LessEqual[re, 3.8e+47], t$95$3, If[LessEqual[re, 1.4e+49], N[Sin[im], $MachinePrecision], If[LessEqual[re, 1e+59], t$95$1, If[LessEqual[re, 2e+60], t$95$3, If[LessEqual[re, 5e+60], t$95$1, If[LessEqual[re, 9e+67], t$95$3, If[LessEqual[re, 9.5e+67], N[Sin[im], $MachinePrecision], If[LessEqual[re, 9.2e+72], t$95$3, If[LessEqual[re, 9.5e+72], N[Sin[im], $MachinePrecision], If[LessEqual[re, 7.2e+91], t$95$1, If[LessEqual[re, 7.2e+92], N[Sin[im], $MachinePrecision], If[LessEqual[re, 1.65e+133], t$95$2, If[LessEqual[re, 1.7e+133], N[Sin[im], $MachinePrecision], If[LessEqual[re, 6.2e+153], t$95$2, If[Or[LessEqual[re, 5e+158], And[N[Not[LessEqual[re, 5e+197]], $MachinePrecision], Or[LessEqual[re, 3.2e+203], And[N[Not[LessEqual[re, 2.3e+246]], $MachinePrecision], Or[LessEqual[re, 2.35e+246], And[N[Not[LessEqual[re, 1.08e+248]], $MachinePrecision], Or[LessEqual[re, 1.8e+252], And[N[Not[LessEqual[re, 7.2e+299]], $MachinePrecision], LessEqual[re, 7.5e+299]]]]]]]]], N[Sin[im], $MachinePrecision], N[(im + N[(im * N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]]]]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\\
t_1 := im + re \cdot \left(im + im \cdot t\_0\right)\\
t_2 := im + im \cdot \left(re \cdot \left(1 + t\_0\right)\right)\\
t_3 := im + re \cdot \left(im + re \cdot \left(\left(re \cdot im\right) \cdot 0.16666666666666666\right)\right)\\
\mathbf{if}\;re \leq -4.5 \cdot 10^{+126}:\\
\;\;\;\;re \cdot \frac{im}{re}\\

\mathbf{elif}\;re \leq 4.9 \cdot 10^{-30}:\\
\;\;\;\;\sin im\\

\mathbf{elif}\;re \leq 2050000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;re \leq 19000000:\\
\;\;\;\;\sin im\\

\mathbf{elif}\;re \leq 22000000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;re \leq 2 \cdot 10^{+29}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;re \leq 3.8 \cdot 10^{+47}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;re \leq 1.4 \cdot 10^{+49}:\\
\;\;\;\;\sin im\\

\mathbf{elif}\;re \leq 10^{+59}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;re \leq 2 \cdot 10^{+60}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;re \leq 5 \cdot 10^{+60}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;re \leq 9 \cdot 10^{+67}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;re \leq 9.5 \cdot 10^{+67}:\\
\;\;\;\;\sin im\\

\mathbf{elif}\;re \leq 9.2 \cdot 10^{+72}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;re \leq 9.5 \cdot 10^{+72}:\\
\;\;\;\;\sin im\\

\mathbf{elif}\;re \leq 7.2 \cdot 10^{+91}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;re \leq 7.2 \cdot 10^{+92}:\\
\;\;\;\;\sin im\\

\mathbf{elif}\;re \leq 1.65 \cdot 10^{+133}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;re \leq 1.7 \cdot 10^{+133}:\\
\;\;\;\;\sin im\\

\mathbf{elif}\;re \leq 6.2 \cdot 10^{+153}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;re \leq 5 \cdot 10^{+158} \lor \neg \left(re \leq 5 \cdot 10^{+197}\right) \land \left(re \leq 3.2 \cdot 10^{+203} \lor \neg \left(re \leq 2.3 \cdot 10^{+246}\right) \land \left(re \leq 2.35 \cdot 10^{+246} \lor \neg \left(re \leq 1.08 \cdot 10^{+248}\right) \land \left(re \leq 1.8 \cdot 10^{+252} \lor \neg \left(re \leq 7.2 \cdot 10^{+299}\right) \land re \leq 7.5 \cdot 10^{+299}\right)\right)\right):\\
\;\;\;\;\sin im\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if re < -4.49999999999999974e126

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \sin im} \]
    4. Step-by-step derivation
      1. distribute-rgt1-in2.5%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    5. Simplified2.5%

      \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    6. Taylor expanded in re around inf 2.5%

      \[\leadsto \color{blue}{re \cdot \left(\sin im + \frac{\sin im}{re}\right)} \]
    7. Taylor expanded in im around 0 2.3%

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

      \[\leadsto re \cdot \color{blue}{\frac{im}{re}} \]

    if -4.49999999999999974e126 < re < 4.89999999999999971e-30 or 2.05e6 < re < 1.9e7 or 3.8000000000000003e47 < re < 1.3999999999999999e49 or 8.9999999999999997e67 < re < 9.5000000000000002e67 or 9.199999999999999e72 < re < 9.50000000000000054e72 or 7.2e91 < re < 7.2e92 or 1.65e133 < re < 1.69999999999999994e133 or 6.2e153 < re < 4.9999999999999996e158 or 5.00000000000000009e197 < re < 3.1999999999999997e203 or 2.30000000000000014e246 < re < 2.34999999999999988e246 or 1.08e248 < re < 1.7999999999999999e252 or 7.20000000000000008e299 < re < 7.50000000000000039e299

    1. Initial program 100.0%

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

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

    if 4.89999999999999971e-30 < re < 2.05e6 or 1.9e7 < re < 2.2e7 or 1.3999999999999999e49 < re < 9.99999999999999972e58 or 1.9999999999999999e60 < re < 4.99999999999999975e60 or 9.50000000000000054e72 < re < 7.2e91

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 44.7%

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

      \[\leadsto im + re \cdot \left(im + \color{blue}{im \cdot \left(re \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutative44.7%

        \[\leadsto im + re \cdot \left(im + im \cdot \left(re \cdot \left(0.5 + \color{blue}{re \cdot 0.16666666666666666}\right)\right)\right) \]
    7. Simplified44.7%

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

    if 2.2e7 < re < 1.99999999999999983e29 or 7.2e92 < re < 1.65e133 or 1.69999999999999994e133 < re < 6.2e153

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 43.6%

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

      \[\leadsto im + \color{blue}{im \cdot \left(re \cdot \left(1 + re \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\right)} \]
    6. Step-by-step derivation
      1. *-commutative67.5%

        \[\leadsto im + im \cdot \left(re \cdot \left(1 + re \cdot \left(0.5 + \color{blue}{re \cdot 0.16666666666666666}\right)\right)\right) \]
    7. Simplified67.5%

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

    if 1.99999999999999983e29 < re < 3.8000000000000003e47 or 9.99999999999999972e58 < re < 1.9999999999999999e60 or 4.99999999999999975e60 < re < 8.9999999999999997e67 or 9.5000000000000002e67 < re < 9.199999999999999e72

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 4.2%

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

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

    if 4.9999999999999996e158 < re < 5.00000000000000009e197 or 3.1999999999999997e203 < re < 2.30000000000000014e246 or 2.34999999999999988e246 < re < 1.08e248 or 1.7999999999999999e252 < re < 7.20000000000000008e299 or 7.50000000000000039e299 < re

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 78.7%

      \[\leadsto \color{blue}{im + re \cdot \left(im + 0.5 \cdot \left(im \cdot re\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutative78.7%

        \[\leadsto im + re \cdot \left(im + \color{blue}{\left(im \cdot re\right) \cdot 0.5}\right) \]
    6. Simplified78.7%

      \[\leadsto \color{blue}{im + re \cdot \left(im + \left(im \cdot re\right) \cdot 0.5\right)} \]
    7. Taylor expanded in im around 0 100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -4.5 \cdot 10^{+126}:\\ \;\;\;\;re \cdot \frac{im}{re}\\ \mathbf{elif}\;re \leq 4.9 \cdot 10^{-30}:\\ \;\;\;\;\sin im\\ \mathbf{elif}\;re \leq 2050000:\\ \;\;\;\;im + re \cdot \left(im + im \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\ \mathbf{elif}\;re \leq 19000000:\\ \;\;\;\;\sin im\\ \mathbf{elif}\;re \leq 22000000:\\ \;\;\;\;im + re \cdot \left(im + im \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\ \mathbf{elif}\;re \leq 2 \cdot 10^{+29}:\\ \;\;\;\;im + im \cdot \left(re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\ \mathbf{elif}\;re \leq 3.8 \cdot 10^{+47}:\\ \;\;\;\;im + re \cdot \left(im + re \cdot \left(\left(re \cdot im\right) \cdot 0.16666666666666666\right)\right)\\ \mathbf{elif}\;re \leq 1.4 \cdot 10^{+49}:\\ \;\;\;\;\sin im\\ \mathbf{elif}\;re \leq 10^{+59}:\\ \;\;\;\;im + re \cdot \left(im + im \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\ \mathbf{elif}\;re \leq 2 \cdot 10^{+60}:\\ \;\;\;\;im + re \cdot \left(im + re \cdot \left(\left(re \cdot im\right) \cdot 0.16666666666666666\right)\right)\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+60}:\\ \;\;\;\;im + re \cdot \left(im + im \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\ \mathbf{elif}\;re \leq 9 \cdot 10^{+67}:\\ \;\;\;\;im + re \cdot \left(im + re \cdot \left(\left(re \cdot im\right) \cdot 0.16666666666666666\right)\right)\\ \mathbf{elif}\;re \leq 9.5 \cdot 10^{+67}:\\ \;\;\;\;\sin im\\ \mathbf{elif}\;re \leq 9.2 \cdot 10^{+72}:\\ \;\;\;\;im + re \cdot \left(im + re \cdot \left(\left(re \cdot im\right) \cdot 0.16666666666666666\right)\right)\\ \mathbf{elif}\;re \leq 9.5 \cdot 10^{+72}:\\ \;\;\;\;\sin im\\ \mathbf{elif}\;re \leq 7.2 \cdot 10^{+91}:\\ \;\;\;\;im + re \cdot \left(im + im \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\ \mathbf{elif}\;re \leq 7.2 \cdot 10^{+92}:\\ \;\;\;\;\sin im\\ \mathbf{elif}\;re \leq 1.65 \cdot 10^{+133}:\\ \;\;\;\;im + im \cdot \left(re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\ \mathbf{elif}\;re \leq 1.7 \cdot 10^{+133}:\\ \;\;\;\;\sin im\\ \mathbf{elif}\;re \leq 6.2 \cdot 10^{+153}:\\ \;\;\;\;im + im \cdot \left(re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+158} \lor \neg \left(re \leq 5 \cdot 10^{+197}\right) \land \left(re \leq 3.2 \cdot 10^{+203} \lor \neg \left(re \leq 2.3 \cdot 10^{+246}\right) \land \left(re \leq 2.35 \cdot 10^{+246} \lor \neg \left(re \leq 1.08 \cdot 10^{+248}\right) \land \left(re \leq 1.8 \cdot 10^{+252} \lor \neg \left(re \leq 7.2 \cdot 10^{+299}\right) \land re \leq 7.5 \cdot 10^{+299}\right)\right)\right):\\ \;\;\;\;\sin im\\ \mathbf{else}:\\ \;\;\;\;im + im \cdot \left(re \cdot \left(1 + re \cdot 0.5\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 34.9% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := re \cdot \frac{im}{re}\\ t_1 := re \cdot \left(im + \frac{im}{re}\right)\\ t_2 := im + re \cdot im\\ t_3 := re \cdot \left(im \cdot \left(1 + \frac{1}{re}\right)\right)\\ \mathbf{if}\;re \leq -18:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+197}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;re \leq 3.2 \cdot 10^{+203}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 10^{+209}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;re \leq 2 \cdot 10^{+211}:\\ \;\;\;\;re \cdot im\\ \mathbf{elif}\;re \leq 10^{+214}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;re \leq 2.3 \cdot 10^{+246}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;re \leq 2.35 \cdot 10^{+246}:\\ \;\;\;\;im\\ \mathbf{elif}\;re \leq 1.08 \cdot 10^{+248}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;re \leq 1.8 \cdot 10^{+252}:\\ \;\;\;\;im\\ \mathbf{elif}\;re \leq 10^{+268}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+272}:\\ \;\;\;\;re \cdot im\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+278}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;re \leq 7.2 \cdot 10^{+299}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;re \leq 7.5 \cdot 10^{+299}:\\ \;\;\;\;im\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* re (/ im re)))
        (t_1 (* re (+ im (/ im re))))
        (t_2 (+ im (* re im)))
        (t_3 (* re (* im (+ 1.0 (/ 1.0 re))))))
   (if (<= re -18.0)
     t_0
     (if (<= re 5e+197)
       t_2
       (if (<= re 3.2e+203)
         t_0
         (if (<= re 1e+209)
           t_2
           (if (<= re 2e+211)
             (* re im)
             (if (<= re 1e+214)
               t_2
               (if (<= re 2.3e+246)
                 t_3
                 (if (<= re 2.35e+246)
                   im
                   (if (<= re 1.08e+248)
                     t_1
                     (if (<= re 1.8e+252)
                       im
                       (if (<= re 1e+268)
                         t_3
                         (if (<= re 5e+272)
                           (* re im)
                           (if (<= re 5e+278)
                             t_1
                             (if (<= re 7.2e+299)
                               t_3
                               (if (<= re 7.5e+299) im t_1)))))))))))))))))
double code(double re, double im) {
	double t_0 = re * (im / re);
	double t_1 = re * (im + (im / re));
	double t_2 = im + (re * im);
	double t_3 = re * (im * (1.0 + (1.0 / re)));
	double tmp;
	if (re <= -18.0) {
		tmp = t_0;
	} else if (re <= 5e+197) {
		tmp = t_2;
	} else if (re <= 3.2e+203) {
		tmp = t_0;
	} else if (re <= 1e+209) {
		tmp = t_2;
	} else if (re <= 2e+211) {
		tmp = re * im;
	} else if (re <= 1e+214) {
		tmp = t_2;
	} else if (re <= 2.3e+246) {
		tmp = t_3;
	} else if (re <= 2.35e+246) {
		tmp = im;
	} else if (re <= 1.08e+248) {
		tmp = t_1;
	} else if (re <= 1.8e+252) {
		tmp = im;
	} else if (re <= 1e+268) {
		tmp = t_3;
	} else if (re <= 5e+272) {
		tmp = re * im;
	} else if (re <= 5e+278) {
		tmp = t_1;
	} else if (re <= 7.2e+299) {
		tmp = t_3;
	} else if (re <= 7.5e+299) {
		tmp = im;
	} else {
		tmp = t_1;
	}
	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) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = re * (im / re)
    t_1 = re * (im + (im / re))
    t_2 = im + (re * im)
    t_3 = re * (im * (1.0d0 + (1.0d0 / re)))
    if (re <= (-18.0d0)) then
        tmp = t_0
    else if (re <= 5d+197) then
        tmp = t_2
    else if (re <= 3.2d+203) then
        tmp = t_0
    else if (re <= 1d+209) then
        tmp = t_2
    else if (re <= 2d+211) then
        tmp = re * im
    else if (re <= 1d+214) then
        tmp = t_2
    else if (re <= 2.3d+246) then
        tmp = t_3
    else if (re <= 2.35d+246) then
        tmp = im
    else if (re <= 1.08d+248) then
        tmp = t_1
    else if (re <= 1.8d+252) then
        tmp = im
    else if (re <= 1d+268) then
        tmp = t_3
    else if (re <= 5d+272) then
        tmp = re * im
    else if (re <= 5d+278) then
        tmp = t_1
    else if (re <= 7.2d+299) then
        tmp = t_3
    else if (re <= 7.5d+299) then
        tmp = im
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = re * (im / re);
	double t_1 = re * (im + (im / re));
	double t_2 = im + (re * im);
	double t_3 = re * (im * (1.0 + (1.0 / re)));
	double tmp;
	if (re <= -18.0) {
		tmp = t_0;
	} else if (re <= 5e+197) {
		tmp = t_2;
	} else if (re <= 3.2e+203) {
		tmp = t_0;
	} else if (re <= 1e+209) {
		tmp = t_2;
	} else if (re <= 2e+211) {
		tmp = re * im;
	} else if (re <= 1e+214) {
		tmp = t_2;
	} else if (re <= 2.3e+246) {
		tmp = t_3;
	} else if (re <= 2.35e+246) {
		tmp = im;
	} else if (re <= 1.08e+248) {
		tmp = t_1;
	} else if (re <= 1.8e+252) {
		tmp = im;
	} else if (re <= 1e+268) {
		tmp = t_3;
	} else if (re <= 5e+272) {
		tmp = re * im;
	} else if (re <= 5e+278) {
		tmp = t_1;
	} else if (re <= 7.2e+299) {
		tmp = t_3;
	} else if (re <= 7.5e+299) {
		tmp = im;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(re, im):
	t_0 = re * (im / re)
	t_1 = re * (im + (im / re))
	t_2 = im + (re * im)
	t_3 = re * (im * (1.0 + (1.0 / re)))
	tmp = 0
	if re <= -18.0:
		tmp = t_0
	elif re <= 5e+197:
		tmp = t_2
	elif re <= 3.2e+203:
		tmp = t_0
	elif re <= 1e+209:
		tmp = t_2
	elif re <= 2e+211:
		tmp = re * im
	elif re <= 1e+214:
		tmp = t_2
	elif re <= 2.3e+246:
		tmp = t_3
	elif re <= 2.35e+246:
		tmp = im
	elif re <= 1.08e+248:
		tmp = t_1
	elif re <= 1.8e+252:
		tmp = im
	elif re <= 1e+268:
		tmp = t_3
	elif re <= 5e+272:
		tmp = re * im
	elif re <= 5e+278:
		tmp = t_1
	elif re <= 7.2e+299:
		tmp = t_3
	elif re <= 7.5e+299:
		tmp = im
	else:
		tmp = t_1
	return tmp
function code(re, im)
	t_0 = Float64(re * Float64(im / re))
	t_1 = Float64(re * Float64(im + Float64(im / re)))
	t_2 = Float64(im + Float64(re * im))
	t_3 = Float64(re * Float64(im * Float64(1.0 + Float64(1.0 / re))))
	tmp = 0.0
	if (re <= -18.0)
		tmp = t_0;
	elseif (re <= 5e+197)
		tmp = t_2;
	elseif (re <= 3.2e+203)
		tmp = t_0;
	elseif (re <= 1e+209)
		tmp = t_2;
	elseif (re <= 2e+211)
		tmp = Float64(re * im);
	elseif (re <= 1e+214)
		tmp = t_2;
	elseif (re <= 2.3e+246)
		tmp = t_3;
	elseif (re <= 2.35e+246)
		tmp = im;
	elseif (re <= 1.08e+248)
		tmp = t_1;
	elseif (re <= 1.8e+252)
		tmp = im;
	elseif (re <= 1e+268)
		tmp = t_3;
	elseif (re <= 5e+272)
		tmp = Float64(re * im);
	elseif (re <= 5e+278)
		tmp = t_1;
	elseif (re <= 7.2e+299)
		tmp = t_3;
	elseif (re <= 7.5e+299)
		tmp = im;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = re * (im / re);
	t_1 = re * (im + (im / re));
	t_2 = im + (re * im);
	t_3 = re * (im * (1.0 + (1.0 / re)));
	tmp = 0.0;
	if (re <= -18.0)
		tmp = t_0;
	elseif (re <= 5e+197)
		tmp = t_2;
	elseif (re <= 3.2e+203)
		tmp = t_0;
	elseif (re <= 1e+209)
		tmp = t_2;
	elseif (re <= 2e+211)
		tmp = re * im;
	elseif (re <= 1e+214)
		tmp = t_2;
	elseif (re <= 2.3e+246)
		tmp = t_3;
	elseif (re <= 2.35e+246)
		tmp = im;
	elseif (re <= 1.08e+248)
		tmp = t_1;
	elseif (re <= 1.8e+252)
		tmp = im;
	elseif (re <= 1e+268)
		tmp = t_3;
	elseif (re <= 5e+272)
		tmp = re * im;
	elseif (re <= 5e+278)
		tmp = t_1;
	elseif (re <= 7.2e+299)
		tmp = t_3;
	elseif (re <= 7.5e+299)
		tmp = im;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(im / re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re * N[(im + N[(im / re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(im + N[(re * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(re * N[(im * N[(1.0 + N[(1.0 / re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -18.0], t$95$0, If[LessEqual[re, 5e+197], t$95$2, If[LessEqual[re, 3.2e+203], t$95$0, If[LessEqual[re, 1e+209], t$95$2, If[LessEqual[re, 2e+211], N[(re * im), $MachinePrecision], If[LessEqual[re, 1e+214], t$95$2, If[LessEqual[re, 2.3e+246], t$95$3, If[LessEqual[re, 2.35e+246], im, If[LessEqual[re, 1.08e+248], t$95$1, If[LessEqual[re, 1.8e+252], im, If[LessEqual[re, 1e+268], t$95$3, If[LessEqual[re, 5e+272], N[(re * im), $MachinePrecision], If[LessEqual[re, 5e+278], t$95$1, If[LessEqual[re, 7.2e+299], t$95$3, If[LessEqual[re, 7.5e+299], im, t$95$1]]]]]]]]]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := re \cdot \frac{im}{re}\\
t_1 := re \cdot \left(im + \frac{im}{re}\right)\\
t_2 := im + re \cdot im\\
t_3 := re \cdot \left(im \cdot \left(1 + \frac{1}{re}\right)\right)\\
\mathbf{if}\;re \leq -18:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;re \leq 5 \cdot 10^{+197}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;re \leq 3.2 \cdot 10^{+203}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;re \leq 10^{+209}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;re \leq 2 \cdot 10^{+211}:\\
\;\;\;\;re \cdot im\\

\mathbf{elif}\;re \leq 10^{+214}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;re \leq 2.3 \cdot 10^{+246}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;re \leq 2.35 \cdot 10^{+246}:\\
\;\;\;\;im\\

\mathbf{elif}\;re \leq 1.08 \cdot 10^{+248}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;re \leq 1.8 \cdot 10^{+252}:\\
\;\;\;\;im\\

\mathbf{elif}\;re \leq 10^{+268}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;re \leq 5 \cdot 10^{+272}:\\
\;\;\;\;re \cdot im\\

\mathbf{elif}\;re \leq 5 \cdot 10^{+278}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;re \leq 7.2 \cdot 10^{+299}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;re \leq 7.5 \cdot 10^{+299}:\\
\;\;\;\;im\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if re < -18 or 5.00000000000000009e197 < re < 3.1999999999999997e203

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \sin im} \]
    4. Step-by-step derivation
      1. distribute-rgt1-in2.9%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    5. Simplified2.9%

      \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    6. Taylor expanded in re around inf 2.9%

      \[\leadsto \color{blue}{re \cdot \left(\sin im + \frac{\sin im}{re}\right)} \]
    7. Taylor expanded in im around 0 2.5%

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

      \[\leadsto re \cdot \color{blue}{\frac{im}{re}} \]

    if -18 < re < 5.00000000000000009e197 or 3.1999999999999997e203 < re < 1.0000000000000001e209 or 1.9999999999999999e211 < re < 9.9999999999999995e213

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 37.0%

      \[\leadsto \color{blue}{im + im \cdot re} \]

    if 1.0000000000000001e209 < re < 1.9999999999999999e211 or 9.9999999999999997e267 < re < 4.99999999999999973e272

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \sin im} \]
    4. Step-by-step derivation
      1. distribute-rgt1-in4.7%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    5. Simplified4.7%

      \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    6. Taylor expanded in re around inf 4.7%

      \[\leadsto \color{blue}{re \cdot \sin im} \]
    7. Taylor expanded in im around 0 4.7%

      \[\leadsto \color{blue}{im \cdot re} \]

    if 9.9999999999999995e213 < re < 2.30000000000000014e246 or 1.7999999999999999e252 < re < 9.9999999999999997e267 or 5.00000000000000029e278 < re < 7.20000000000000008e299

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \sin im} \]
    4. Step-by-step derivation
      1. distribute-rgt1-in5.6%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    5. Simplified5.6%

      \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    6. Taylor expanded in re around inf 5.6%

      \[\leadsto \color{blue}{re \cdot \left(\sin im + \frac{\sin im}{re}\right)} \]
    7. Taylor expanded in im around 0 40.5%

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

    if 2.30000000000000014e246 < re < 2.34999999999999988e246 or 1.08e248 < re < 1.7999999999999999e252 or 7.20000000000000008e299 < re < 7.50000000000000039e299

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 0.2%

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

    if 2.34999999999999988e246 < re < 1.08e248 or 4.99999999999999973e272 < re < 5.00000000000000029e278 or 7.50000000000000039e299 < re

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \sin im} \]
    4. Step-by-step derivation
      1. distribute-rgt1-in6.7%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    5. Simplified6.7%

      \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    6. Taylor expanded in re around inf 6.7%

      \[\leadsto \color{blue}{re \cdot \left(\sin im + \frac{\sin im}{re}\right)} \]
    7. Taylor expanded in im around 0 23.9%

      \[\leadsto re \cdot \color{blue}{\left(im \cdot \left(1 + \frac{1}{re}\right)\right)} \]
    8. Step-by-step derivation
      1. distribute-rgt-in23.9%

        \[\leadsto re \cdot \color{blue}{\left(1 \cdot im + \frac{1}{re} \cdot im\right)} \]
      2. *-lft-identity23.9%

        \[\leadsto re \cdot \left(\color{blue}{im} + \frac{1}{re} \cdot im\right) \]
      3. associate-*l/23.9%

        \[\leadsto re \cdot \left(im + \color{blue}{\frac{1 \cdot im}{re}}\right) \]
      4. *-lft-identity23.9%

        \[\leadsto re \cdot \left(im + \frac{\color{blue}{im}}{re}\right) \]
    9. Simplified23.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -18:\\ \;\;\;\;re \cdot \frac{im}{re}\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+197}:\\ \;\;\;\;im + re \cdot im\\ \mathbf{elif}\;re \leq 3.2 \cdot 10^{+203}:\\ \;\;\;\;re \cdot \frac{im}{re}\\ \mathbf{elif}\;re \leq 10^{+209}:\\ \;\;\;\;im + re \cdot im\\ \mathbf{elif}\;re \leq 2 \cdot 10^{+211}:\\ \;\;\;\;re \cdot im\\ \mathbf{elif}\;re \leq 10^{+214}:\\ \;\;\;\;im + re \cdot im\\ \mathbf{elif}\;re \leq 2.3 \cdot 10^{+246}:\\ \;\;\;\;re \cdot \left(im \cdot \left(1 + \frac{1}{re}\right)\right)\\ \mathbf{elif}\;re \leq 2.35 \cdot 10^{+246}:\\ \;\;\;\;im\\ \mathbf{elif}\;re \leq 1.08 \cdot 10^{+248}:\\ \;\;\;\;re \cdot \left(im + \frac{im}{re}\right)\\ \mathbf{elif}\;re \leq 1.8 \cdot 10^{+252}:\\ \;\;\;\;im\\ \mathbf{elif}\;re \leq 10^{+268}:\\ \;\;\;\;re \cdot \left(im \cdot \left(1 + \frac{1}{re}\right)\right)\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+272}:\\ \;\;\;\;re \cdot im\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+278}:\\ \;\;\;\;re \cdot \left(im + \frac{im}{re}\right)\\ \mathbf{elif}\;re \leq 7.2 \cdot 10^{+299}:\\ \;\;\;\;re \cdot \left(im \cdot \left(1 + \frac{1}{re}\right)\right)\\ \mathbf{elif}\;re \leq 7.5 \cdot 10^{+299}:\\ \;\;\;\;im\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(im + \frac{im}{re}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 42.3% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := im + im \cdot \left(re \cdot \left(1 + re \cdot 0.5\right)\right)\\ t_1 := re \cdot \frac{im}{re}\\ t_2 := im + re \cdot \left(im + re \cdot \left(\left(re \cdot im\right) \cdot 0.16666666666666666\right)\right)\\ \mathbf{if}\;re \leq -2:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;re \leq 2.4 \cdot 10^{+112}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 1.65 \cdot 10^{+133}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;re \leq 1.7 \cdot 10^{+133}:\\ \;\;\;\;im\\ \mathbf{elif}\;re \leq 6.2 \cdot 10^{+153}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+158}:\\ \;\;\;\;im\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+197}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 3.2 \cdot 10^{+203}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;re \leq 2.3 \cdot 10^{+246} \lor \neg \left(re \leq 2.35 \cdot 10^{+246}\right) \land \left(re \leq 1.08 \cdot 10^{+248} \lor \neg \left(re \leq 1.8 \cdot 10^{+252}\right) \land \left(re \leq 7.2 \cdot 10^{+299} \lor \neg \left(re \leq 7.5 \cdot 10^{+299}\right)\right)\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;im\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (+ im (* im (* re (+ 1.0 (* re 0.5))))))
        (t_1 (* re (/ im re)))
        (t_2 (+ im (* re (+ im (* re (* (* re im) 0.16666666666666666)))))))
   (if (<= re -2.0)
     t_1
     (if (<= re 2.4e+112)
       t_0
       (if (<= re 1.65e+133)
         t_2
         (if (<= re 1.7e+133)
           im
           (if (<= re 6.2e+153)
             t_2
             (if (<= re 5e+158)
               im
               (if (<= re 5e+197)
                 t_0
                 (if (<= re 3.2e+203)
                   t_1
                   (if (or (<= re 2.3e+246)
                           (and (not (<= re 2.35e+246))
                                (or (<= re 1.08e+248)
                                    (and (not (<= re 1.8e+252))
                                         (or (<= re 7.2e+299)
                                             (not (<= re 7.5e+299)))))))
                     t_0
                     im)))))))))))
double code(double re, double im) {
	double t_0 = im + (im * (re * (1.0 + (re * 0.5))));
	double t_1 = re * (im / re);
	double t_2 = im + (re * (im + (re * ((re * im) * 0.16666666666666666))));
	double tmp;
	if (re <= -2.0) {
		tmp = t_1;
	} else if (re <= 2.4e+112) {
		tmp = t_0;
	} else if (re <= 1.65e+133) {
		tmp = t_2;
	} else if (re <= 1.7e+133) {
		tmp = im;
	} else if (re <= 6.2e+153) {
		tmp = t_2;
	} else if (re <= 5e+158) {
		tmp = im;
	} else if (re <= 5e+197) {
		tmp = t_0;
	} else if (re <= 3.2e+203) {
		tmp = t_1;
	} else if ((re <= 2.3e+246) || (!(re <= 2.35e+246) && ((re <= 1.08e+248) || (!(re <= 1.8e+252) && ((re <= 7.2e+299) || !(re <= 7.5e+299)))))) {
		tmp = t_0;
	} else {
		tmp = im;
	}
	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) :: t_2
    real(8) :: tmp
    t_0 = im + (im * (re * (1.0d0 + (re * 0.5d0))))
    t_1 = re * (im / re)
    t_2 = im + (re * (im + (re * ((re * im) * 0.16666666666666666d0))))
    if (re <= (-2.0d0)) then
        tmp = t_1
    else if (re <= 2.4d+112) then
        tmp = t_0
    else if (re <= 1.65d+133) then
        tmp = t_2
    else if (re <= 1.7d+133) then
        tmp = im
    else if (re <= 6.2d+153) then
        tmp = t_2
    else if (re <= 5d+158) then
        tmp = im
    else if (re <= 5d+197) then
        tmp = t_0
    else if (re <= 3.2d+203) then
        tmp = t_1
    else if ((re <= 2.3d+246) .or. (.not. (re <= 2.35d+246)) .and. (re <= 1.08d+248) .or. (.not. (re <= 1.8d+252)) .and. (re <= 7.2d+299) .or. (.not. (re <= 7.5d+299))) then
        tmp = t_0
    else
        tmp = im
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = im + (im * (re * (1.0 + (re * 0.5))));
	double t_1 = re * (im / re);
	double t_2 = im + (re * (im + (re * ((re * im) * 0.16666666666666666))));
	double tmp;
	if (re <= -2.0) {
		tmp = t_1;
	} else if (re <= 2.4e+112) {
		tmp = t_0;
	} else if (re <= 1.65e+133) {
		tmp = t_2;
	} else if (re <= 1.7e+133) {
		tmp = im;
	} else if (re <= 6.2e+153) {
		tmp = t_2;
	} else if (re <= 5e+158) {
		tmp = im;
	} else if (re <= 5e+197) {
		tmp = t_0;
	} else if (re <= 3.2e+203) {
		tmp = t_1;
	} else if ((re <= 2.3e+246) || (!(re <= 2.35e+246) && ((re <= 1.08e+248) || (!(re <= 1.8e+252) && ((re <= 7.2e+299) || !(re <= 7.5e+299)))))) {
		tmp = t_0;
	} else {
		tmp = im;
	}
	return tmp;
}
def code(re, im):
	t_0 = im + (im * (re * (1.0 + (re * 0.5))))
	t_1 = re * (im / re)
	t_2 = im + (re * (im + (re * ((re * im) * 0.16666666666666666))))
	tmp = 0
	if re <= -2.0:
		tmp = t_1
	elif re <= 2.4e+112:
		tmp = t_0
	elif re <= 1.65e+133:
		tmp = t_2
	elif re <= 1.7e+133:
		tmp = im
	elif re <= 6.2e+153:
		tmp = t_2
	elif re <= 5e+158:
		tmp = im
	elif re <= 5e+197:
		tmp = t_0
	elif re <= 3.2e+203:
		tmp = t_1
	elif (re <= 2.3e+246) or (not (re <= 2.35e+246) and ((re <= 1.08e+248) or (not (re <= 1.8e+252) and ((re <= 7.2e+299) or not (re <= 7.5e+299))))):
		tmp = t_0
	else:
		tmp = im
	return tmp
function code(re, im)
	t_0 = Float64(im + Float64(im * Float64(re * Float64(1.0 + Float64(re * 0.5)))))
	t_1 = Float64(re * Float64(im / re))
	t_2 = Float64(im + Float64(re * Float64(im + Float64(re * Float64(Float64(re * im) * 0.16666666666666666)))))
	tmp = 0.0
	if (re <= -2.0)
		tmp = t_1;
	elseif (re <= 2.4e+112)
		tmp = t_0;
	elseif (re <= 1.65e+133)
		tmp = t_2;
	elseif (re <= 1.7e+133)
		tmp = im;
	elseif (re <= 6.2e+153)
		tmp = t_2;
	elseif (re <= 5e+158)
		tmp = im;
	elseif (re <= 5e+197)
		tmp = t_0;
	elseif (re <= 3.2e+203)
		tmp = t_1;
	elseif ((re <= 2.3e+246) || (!(re <= 2.35e+246) && ((re <= 1.08e+248) || (!(re <= 1.8e+252) && ((re <= 7.2e+299) || !(re <= 7.5e+299))))))
		tmp = t_0;
	else
		tmp = im;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = im + (im * (re * (1.0 + (re * 0.5))));
	t_1 = re * (im / re);
	t_2 = im + (re * (im + (re * ((re * im) * 0.16666666666666666))));
	tmp = 0.0;
	if (re <= -2.0)
		tmp = t_1;
	elseif (re <= 2.4e+112)
		tmp = t_0;
	elseif (re <= 1.65e+133)
		tmp = t_2;
	elseif (re <= 1.7e+133)
		tmp = im;
	elseif (re <= 6.2e+153)
		tmp = t_2;
	elseif (re <= 5e+158)
		tmp = im;
	elseif (re <= 5e+197)
		tmp = t_0;
	elseif (re <= 3.2e+203)
		tmp = t_1;
	elseif ((re <= 2.3e+246) || (~((re <= 2.35e+246)) && ((re <= 1.08e+248) || (~((re <= 1.8e+252)) && ((re <= 7.2e+299) || ~((re <= 7.5e+299)))))))
		tmp = t_0;
	else
		tmp = im;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(im + N[(im * N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re * N[(im / re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(im + N[(re * N[(im + N[(re * N[(N[(re * im), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -2.0], t$95$1, If[LessEqual[re, 2.4e+112], t$95$0, If[LessEqual[re, 1.65e+133], t$95$2, If[LessEqual[re, 1.7e+133], im, If[LessEqual[re, 6.2e+153], t$95$2, If[LessEqual[re, 5e+158], im, If[LessEqual[re, 5e+197], t$95$0, If[LessEqual[re, 3.2e+203], t$95$1, If[Or[LessEqual[re, 2.3e+246], And[N[Not[LessEqual[re, 2.35e+246]], $MachinePrecision], Or[LessEqual[re, 1.08e+248], And[N[Not[LessEqual[re, 1.8e+252]], $MachinePrecision], Or[LessEqual[re, 7.2e+299], N[Not[LessEqual[re, 7.5e+299]], $MachinePrecision]]]]]], t$95$0, im]]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := im + im \cdot \left(re \cdot \left(1 + re \cdot 0.5\right)\right)\\
t_1 := re \cdot \frac{im}{re}\\
t_2 := im + re \cdot \left(im + re \cdot \left(\left(re \cdot im\right) \cdot 0.16666666666666666\right)\right)\\
\mathbf{if}\;re \leq -2:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;re \leq 2.4 \cdot 10^{+112}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;re \leq 1.65 \cdot 10^{+133}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;re \leq 1.7 \cdot 10^{+133}:\\
\;\;\;\;im\\

\mathbf{elif}\;re \leq 6.2 \cdot 10^{+153}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;re \leq 5 \cdot 10^{+158}:\\
\;\;\;\;im\\

\mathbf{elif}\;re \leq 5 \cdot 10^{+197}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;re \leq 3.2 \cdot 10^{+203}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;re \leq 2.3 \cdot 10^{+246} \lor \neg \left(re \leq 2.35 \cdot 10^{+246}\right) \land \left(re \leq 1.08 \cdot 10^{+248} \lor \neg \left(re \leq 1.8 \cdot 10^{+252}\right) \land \left(re \leq 7.2 \cdot 10^{+299} \lor \neg \left(re \leq 7.5 \cdot 10^{+299}\right)\right)\right):\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;im\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if re < -2 or 5.00000000000000009e197 < re < 3.1999999999999997e203

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \sin im} \]
    4. Step-by-step derivation
      1. distribute-rgt1-in2.8%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    5. Simplified2.8%

      \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    6. Taylor expanded in re around inf 2.8%

      \[\leadsto \color{blue}{re \cdot \left(\sin im + \frac{\sin im}{re}\right)} \]
    7. Taylor expanded in im around 0 2.5%

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

      \[\leadsto re \cdot \color{blue}{\frac{im}{re}} \]

    if -2 < re < 2.4e112 or 4.9999999999999996e158 < re < 5.00000000000000009e197 or 3.1999999999999997e203 < re < 2.30000000000000014e246 or 2.34999999999999988e246 < re < 1.08e248 or 1.7999999999999999e252 < re < 7.20000000000000008e299 or 7.50000000000000039e299 < re

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 46.3%

      \[\leadsto \color{blue}{im + re \cdot \left(im + 0.5 \cdot \left(im \cdot re\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutative46.3%

        \[\leadsto im + re \cdot \left(im + \color{blue}{\left(im \cdot re\right) \cdot 0.5}\right) \]
    6. Simplified46.3%

      \[\leadsto \color{blue}{im + re \cdot \left(im + \left(im \cdot re\right) \cdot 0.5\right)} \]
    7. Taylor expanded in im around 0 48.9%

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

    if 2.4e112 < re < 1.65e133 or 1.69999999999999994e133 < re < 6.2e153

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 52.3%

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

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

    if 1.65e133 < re < 1.69999999999999994e133 or 6.2e153 < re < 4.9999999999999996e158 or 2.30000000000000014e246 < re < 2.34999999999999988e246 or 1.08e248 < re < 1.7999999999999999e252 or 7.20000000000000008e299 < re < 7.50000000000000039e299

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 0.2%

      \[\leadsto \color{blue}{im} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification42.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -2:\\ \;\;\;\;re \cdot \frac{im}{re}\\ \mathbf{elif}\;re \leq 2.4 \cdot 10^{+112}:\\ \;\;\;\;im + im \cdot \left(re \cdot \left(1 + re \cdot 0.5\right)\right)\\ \mathbf{elif}\;re \leq 1.65 \cdot 10^{+133}:\\ \;\;\;\;im + re \cdot \left(im + re \cdot \left(\left(re \cdot im\right) \cdot 0.16666666666666666\right)\right)\\ \mathbf{elif}\;re \leq 1.7 \cdot 10^{+133}:\\ \;\;\;\;im\\ \mathbf{elif}\;re \leq 6.2 \cdot 10^{+153}:\\ \;\;\;\;im + re \cdot \left(im + re \cdot \left(\left(re \cdot im\right) \cdot 0.16666666666666666\right)\right)\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+158}:\\ \;\;\;\;im\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+197}:\\ \;\;\;\;im + im \cdot \left(re \cdot \left(1 + re \cdot 0.5\right)\right)\\ \mathbf{elif}\;re \leq 3.2 \cdot 10^{+203}:\\ \;\;\;\;re \cdot \frac{im}{re}\\ \mathbf{elif}\;re \leq 2.3 \cdot 10^{+246} \lor \neg \left(re \leq 2.35 \cdot 10^{+246}\right) \land \left(re \leq 1.08 \cdot 10^{+248} \lor \neg \left(re \leq 1.8 \cdot 10^{+252}\right) \land \left(re \leq 7.2 \cdot 10^{+299} \lor \neg \left(re \leq 7.5 \cdot 10^{+299}\right)\right)\right):\\ \;\;\;\;im + im \cdot \left(re \cdot \left(1 + re \cdot 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;im\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 44.3% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := im + im \cdot \left(re \cdot \left(1 + re \cdot 0.5\right)\right)\\ t_1 := re \cdot \frac{im}{re}\\ t_2 := im + im \cdot \left(re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\ \mathbf{if}\;re \leq -18:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;re \leq 1.65 \cdot 10^{+133}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;re \leq 1.7 \cdot 10^{+133}:\\ \;\;\;\;im\\ \mathbf{elif}\;re \leq 6.2 \cdot 10^{+153}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+158}:\\ \;\;\;\;im\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+197}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 3.2 \cdot 10^{+203}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;re \leq 2.3 \cdot 10^{+246} \lor \neg \left(re \leq 2.35 \cdot 10^{+246}\right) \land \left(re \leq 1.08 \cdot 10^{+248} \lor \neg \left(re \leq 1.8 \cdot 10^{+252}\right) \land \left(re \leq 7.2 \cdot 10^{+299} \lor \neg \left(re \leq 7.5 \cdot 10^{+299}\right)\right)\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;im\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (+ im (* im (* re (+ 1.0 (* re 0.5))))))
        (t_1 (* re (/ im re)))
        (t_2
         (+
          im
          (* im (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666)))))))))
   (if (<= re -18.0)
     t_1
     (if (<= re 1.65e+133)
       t_2
       (if (<= re 1.7e+133)
         im
         (if (<= re 6.2e+153)
           t_2
           (if (<= re 5e+158)
             im
             (if (<= re 5e+197)
               t_0
               (if (<= re 3.2e+203)
                 t_1
                 (if (or (<= re 2.3e+246)
                         (and (not (<= re 2.35e+246))
                              (or (<= re 1.08e+248)
                                  (and (not (<= re 1.8e+252))
                                       (or (<= re 7.2e+299)
                                           (not (<= re 7.5e+299)))))))
                   t_0
                   im))))))))))
double code(double re, double im) {
	double t_0 = im + (im * (re * (1.0 + (re * 0.5))));
	double t_1 = re * (im / re);
	double t_2 = im + (im * (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))));
	double tmp;
	if (re <= -18.0) {
		tmp = t_1;
	} else if (re <= 1.65e+133) {
		tmp = t_2;
	} else if (re <= 1.7e+133) {
		tmp = im;
	} else if (re <= 6.2e+153) {
		tmp = t_2;
	} else if (re <= 5e+158) {
		tmp = im;
	} else if (re <= 5e+197) {
		tmp = t_0;
	} else if (re <= 3.2e+203) {
		tmp = t_1;
	} else if ((re <= 2.3e+246) || (!(re <= 2.35e+246) && ((re <= 1.08e+248) || (!(re <= 1.8e+252) && ((re <= 7.2e+299) || !(re <= 7.5e+299)))))) {
		tmp = t_0;
	} else {
		tmp = im;
	}
	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) :: t_2
    real(8) :: tmp
    t_0 = im + (im * (re * (1.0d0 + (re * 0.5d0))))
    t_1 = re * (im / re)
    t_2 = im + (im * (re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0))))))
    if (re <= (-18.0d0)) then
        tmp = t_1
    else if (re <= 1.65d+133) then
        tmp = t_2
    else if (re <= 1.7d+133) then
        tmp = im
    else if (re <= 6.2d+153) then
        tmp = t_2
    else if (re <= 5d+158) then
        tmp = im
    else if (re <= 5d+197) then
        tmp = t_0
    else if (re <= 3.2d+203) then
        tmp = t_1
    else if ((re <= 2.3d+246) .or. (.not. (re <= 2.35d+246)) .and. (re <= 1.08d+248) .or. (.not. (re <= 1.8d+252)) .and. (re <= 7.2d+299) .or. (.not. (re <= 7.5d+299))) then
        tmp = t_0
    else
        tmp = im
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = im + (im * (re * (1.0 + (re * 0.5))));
	double t_1 = re * (im / re);
	double t_2 = im + (im * (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))));
	double tmp;
	if (re <= -18.0) {
		tmp = t_1;
	} else if (re <= 1.65e+133) {
		tmp = t_2;
	} else if (re <= 1.7e+133) {
		tmp = im;
	} else if (re <= 6.2e+153) {
		tmp = t_2;
	} else if (re <= 5e+158) {
		tmp = im;
	} else if (re <= 5e+197) {
		tmp = t_0;
	} else if (re <= 3.2e+203) {
		tmp = t_1;
	} else if ((re <= 2.3e+246) || (!(re <= 2.35e+246) && ((re <= 1.08e+248) || (!(re <= 1.8e+252) && ((re <= 7.2e+299) || !(re <= 7.5e+299)))))) {
		tmp = t_0;
	} else {
		tmp = im;
	}
	return tmp;
}
def code(re, im):
	t_0 = im + (im * (re * (1.0 + (re * 0.5))))
	t_1 = re * (im / re)
	t_2 = im + (im * (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))))
	tmp = 0
	if re <= -18.0:
		tmp = t_1
	elif re <= 1.65e+133:
		tmp = t_2
	elif re <= 1.7e+133:
		tmp = im
	elif re <= 6.2e+153:
		tmp = t_2
	elif re <= 5e+158:
		tmp = im
	elif re <= 5e+197:
		tmp = t_0
	elif re <= 3.2e+203:
		tmp = t_1
	elif (re <= 2.3e+246) or (not (re <= 2.35e+246) and ((re <= 1.08e+248) or (not (re <= 1.8e+252) and ((re <= 7.2e+299) or not (re <= 7.5e+299))))):
		tmp = t_0
	else:
		tmp = im
	return tmp
function code(re, im)
	t_0 = Float64(im + Float64(im * Float64(re * Float64(1.0 + Float64(re * 0.5)))))
	t_1 = Float64(re * Float64(im / re))
	t_2 = Float64(im + Float64(im * Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))))))
	tmp = 0.0
	if (re <= -18.0)
		tmp = t_1;
	elseif (re <= 1.65e+133)
		tmp = t_2;
	elseif (re <= 1.7e+133)
		tmp = im;
	elseif (re <= 6.2e+153)
		tmp = t_2;
	elseif (re <= 5e+158)
		tmp = im;
	elseif (re <= 5e+197)
		tmp = t_0;
	elseif (re <= 3.2e+203)
		tmp = t_1;
	elseif ((re <= 2.3e+246) || (!(re <= 2.35e+246) && ((re <= 1.08e+248) || (!(re <= 1.8e+252) && ((re <= 7.2e+299) || !(re <= 7.5e+299))))))
		tmp = t_0;
	else
		tmp = im;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = im + (im * (re * (1.0 + (re * 0.5))));
	t_1 = re * (im / re);
	t_2 = im + (im * (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))));
	tmp = 0.0;
	if (re <= -18.0)
		tmp = t_1;
	elseif (re <= 1.65e+133)
		tmp = t_2;
	elseif (re <= 1.7e+133)
		tmp = im;
	elseif (re <= 6.2e+153)
		tmp = t_2;
	elseif (re <= 5e+158)
		tmp = im;
	elseif (re <= 5e+197)
		tmp = t_0;
	elseif (re <= 3.2e+203)
		tmp = t_1;
	elseif ((re <= 2.3e+246) || (~((re <= 2.35e+246)) && ((re <= 1.08e+248) || (~((re <= 1.8e+252)) && ((re <= 7.2e+299) || ~((re <= 7.5e+299)))))))
		tmp = t_0;
	else
		tmp = im;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(im + N[(im * N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re * N[(im / re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(im + N[(im * N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -18.0], t$95$1, If[LessEqual[re, 1.65e+133], t$95$2, If[LessEqual[re, 1.7e+133], im, If[LessEqual[re, 6.2e+153], t$95$2, If[LessEqual[re, 5e+158], im, If[LessEqual[re, 5e+197], t$95$0, If[LessEqual[re, 3.2e+203], t$95$1, If[Or[LessEqual[re, 2.3e+246], And[N[Not[LessEqual[re, 2.35e+246]], $MachinePrecision], Or[LessEqual[re, 1.08e+248], And[N[Not[LessEqual[re, 1.8e+252]], $MachinePrecision], Or[LessEqual[re, 7.2e+299], N[Not[LessEqual[re, 7.5e+299]], $MachinePrecision]]]]]], t$95$0, im]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := im + im \cdot \left(re \cdot \left(1 + re \cdot 0.5\right)\right)\\
t_1 := re \cdot \frac{im}{re}\\
t_2 := im + im \cdot \left(re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\
\mathbf{if}\;re \leq -18:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;re \leq 1.65 \cdot 10^{+133}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;re \leq 1.7 \cdot 10^{+133}:\\
\;\;\;\;im\\

\mathbf{elif}\;re \leq 6.2 \cdot 10^{+153}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;re \leq 5 \cdot 10^{+158}:\\
\;\;\;\;im\\

\mathbf{elif}\;re \leq 5 \cdot 10^{+197}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;re \leq 3.2 \cdot 10^{+203}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;re \leq 2.3 \cdot 10^{+246} \lor \neg \left(re \leq 2.35 \cdot 10^{+246}\right) \land \left(re \leq 1.08 \cdot 10^{+248} \lor \neg \left(re \leq 1.8 \cdot 10^{+252}\right) \land \left(re \leq 7.2 \cdot 10^{+299} \lor \neg \left(re \leq 7.5 \cdot 10^{+299}\right)\right)\right):\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;im\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if re < -18 or 5.00000000000000009e197 < re < 3.1999999999999997e203

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \sin im} \]
    4. Step-by-step derivation
      1. distribute-rgt1-in2.9%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    5. Simplified2.9%

      \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    6. Taylor expanded in re around inf 2.9%

      \[\leadsto \color{blue}{re \cdot \left(\sin im + \frac{\sin im}{re}\right)} \]
    7. Taylor expanded in im around 0 2.5%

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

      \[\leadsto re \cdot \color{blue}{\frac{im}{re}} \]

    if -18 < re < 1.65e133 or 1.69999999999999994e133 < re < 6.2e153

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 41.8%

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

      \[\leadsto im + \color{blue}{im \cdot \left(re \cdot \left(1 + re \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\right)} \]
    6. Step-by-step derivation
      1. *-commutative43.5%

        \[\leadsto im + im \cdot \left(re \cdot \left(1 + re \cdot \left(0.5 + \color{blue}{re \cdot 0.16666666666666666}\right)\right)\right) \]
    7. Simplified43.5%

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

    if 1.65e133 < re < 1.69999999999999994e133 or 6.2e153 < re < 4.9999999999999996e158 or 2.30000000000000014e246 < re < 2.34999999999999988e246 or 1.08e248 < re < 1.7999999999999999e252 or 7.20000000000000008e299 < re < 7.50000000000000039e299

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 0.2%

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

    if 4.9999999999999996e158 < re < 5.00000000000000009e197 or 3.1999999999999997e203 < re < 2.30000000000000014e246 or 2.34999999999999988e246 < re < 1.08e248 or 1.7999999999999999e252 < re < 7.20000000000000008e299 or 7.50000000000000039e299 < re

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 78.7%

      \[\leadsto \color{blue}{im + re \cdot \left(im + 0.5 \cdot \left(im \cdot re\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutative78.7%

        \[\leadsto im + re \cdot \left(im + \color{blue}{\left(im \cdot re\right) \cdot 0.5}\right) \]
    6. Simplified78.7%

      \[\leadsto \color{blue}{im + re \cdot \left(im + \left(im \cdot re\right) \cdot 0.5\right)} \]
    7. Taylor expanded in im around 0 100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -18:\\ \;\;\;\;re \cdot \frac{im}{re}\\ \mathbf{elif}\;re \leq 1.65 \cdot 10^{+133}:\\ \;\;\;\;im + im \cdot \left(re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\ \mathbf{elif}\;re \leq 1.7 \cdot 10^{+133}:\\ \;\;\;\;im\\ \mathbf{elif}\;re \leq 6.2 \cdot 10^{+153}:\\ \;\;\;\;im + im \cdot \left(re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+158}:\\ \;\;\;\;im\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+197}:\\ \;\;\;\;im + im \cdot \left(re \cdot \left(1 + re \cdot 0.5\right)\right)\\ \mathbf{elif}\;re \leq 3.2 \cdot 10^{+203}:\\ \;\;\;\;re \cdot \frac{im}{re}\\ \mathbf{elif}\;re \leq 2.3 \cdot 10^{+246} \lor \neg \left(re \leq 2.35 \cdot 10^{+246}\right) \land \left(re \leq 1.08 \cdot 10^{+248} \lor \neg \left(re \leq 1.8 \cdot 10^{+252}\right) \land \left(re \leq 7.2 \cdot 10^{+299} \lor \neg \left(re \leq 7.5 \cdot 10^{+299}\right)\right)\right):\\ \;\;\;\;im + im \cdot \left(re \cdot \left(1 + re \cdot 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;im\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 41.8% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := re \cdot \frac{im}{re}\\ t_1 := im + im \cdot \left(re \cdot \left(1 + re \cdot 0.5\right)\right)\\ \mathbf{if}\;re \leq -2:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 1.65 \cdot 10^{+133}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;re \leq 1.7 \cdot 10^{+133}:\\ \;\;\;\;im\\ \mathbf{elif}\;re \leq 6.2 \cdot 10^{+153}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+158}:\\ \;\;\;\;im\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+197}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;re \leq 3.2 \cdot 10^{+203}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 2.3 \cdot 10^{+246} \lor \neg \left(re \leq 2.35 \cdot 10^{+246}\right) \land \left(re \leq 1.08 \cdot 10^{+248} \lor \neg \left(re \leq 1.8 \cdot 10^{+252}\right) \land \left(re \leq 7.2 \cdot 10^{+299} \lor \neg \left(re \leq 7.5 \cdot 10^{+299}\right)\right)\right):\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;im\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* re (/ im re))) (t_1 (+ im (* im (* re (+ 1.0 (* re 0.5)))))))
   (if (<= re -2.0)
     t_0
     (if (<= re 1.65e+133)
       t_1
       (if (<= re 1.7e+133)
         im
         (if (<= re 6.2e+153)
           t_1
           (if (<= re 5e+158)
             im
             (if (<= re 5e+197)
               t_1
               (if (<= re 3.2e+203)
                 t_0
                 (if (or (<= re 2.3e+246)
                         (and (not (<= re 2.35e+246))
                              (or (<= re 1.08e+248)
                                  (and (not (<= re 1.8e+252))
                                       (or (<= re 7.2e+299)
                                           (not (<= re 7.5e+299)))))))
                   t_1
                   im))))))))))
double code(double re, double im) {
	double t_0 = re * (im / re);
	double t_1 = im + (im * (re * (1.0 + (re * 0.5))));
	double tmp;
	if (re <= -2.0) {
		tmp = t_0;
	} else if (re <= 1.65e+133) {
		tmp = t_1;
	} else if (re <= 1.7e+133) {
		tmp = im;
	} else if (re <= 6.2e+153) {
		tmp = t_1;
	} else if (re <= 5e+158) {
		tmp = im;
	} else if (re <= 5e+197) {
		tmp = t_1;
	} else if (re <= 3.2e+203) {
		tmp = t_0;
	} else if ((re <= 2.3e+246) || (!(re <= 2.35e+246) && ((re <= 1.08e+248) || (!(re <= 1.8e+252) && ((re <= 7.2e+299) || !(re <= 7.5e+299)))))) {
		tmp = t_1;
	} else {
		tmp = im;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = re * (im / re)
    t_1 = im + (im * (re * (1.0d0 + (re * 0.5d0))))
    if (re <= (-2.0d0)) then
        tmp = t_0
    else if (re <= 1.65d+133) then
        tmp = t_1
    else if (re <= 1.7d+133) then
        tmp = im
    else if (re <= 6.2d+153) then
        tmp = t_1
    else if (re <= 5d+158) then
        tmp = im
    else if (re <= 5d+197) then
        tmp = t_1
    else if (re <= 3.2d+203) then
        tmp = t_0
    else if ((re <= 2.3d+246) .or. (.not. (re <= 2.35d+246)) .and. (re <= 1.08d+248) .or. (.not. (re <= 1.8d+252)) .and. (re <= 7.2d+299) .or. (.not. (re <= 7.5d+299))) then
        tmp = t_1
    else
        tmp = im
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = re * (im / re);
	double t_1 = im + (im * (re * (1.0 + (re * 0.5))));
	double tmp;
	if (re <= -2.0) {
		tmp = t_0;
	} else if (re <= 1.65e+133) {
		tmp = t_1;
	} else if (re <= 1.7e+133) {
		tmp = im;
	} else if (re <= 6.2e+153) {
		tmp = t_1;
	} else if (re <= 5e+158) {
		tmp = im;
	} else if (re <= 5e+197) {
		tmp = t_1;
	} else if (re <= 3.2e+203) {
		tmp = t_0;
	} else if ((re <= 2.3e+246) || (!(re <= 2.35e+246) && ((re <= 1.08e+248) || (!(re <= 1.8e+252) && ((re <= 7.2e+299) || !(re <= 7.5e+299)))))) {
		tmp = t_1;
	} else {
		tmp = im;
	}
	return tmp;
}
def code(re, im):
	t_0 = re * (im / re)
	t_1 = im + (im * (re * (1.0 + (re * 0.5))))
	tmp = 0
	if re <= -2.0:
		tmp = t_0
	elif re <= 1.65e+133:
		tmp = t_1
	elif re <= 1.7e+133:
		tmp = im
	elif re <= 6.2e+153:
		tmp = t_1
	elif re <= 5e+158:
		tmp = im
	elif re <= 5e+197:
		tmp = t_1
	elif re <= 3.2e+203:
		tmp = t_0
	elif (re <= 2.3e+246) or (not (re <= 2.35e+246) and ((re <= 1.08e+248) or (not (re <= 1.8e+252) and ((re <= 7.2e+299) or not (re <= 7.5e+299))))):
		tmp = t_1
	else:
		tmp = im
	return tmp
function code(re, im)
	t_0 = Float64(re * Float64(im / re))
	t_1 = Float64(im + Float64(im * Float64(re * Float64(1.0 + Float64(re * 0.5)))))
	tmp = 0.0
	if (re <= -2.0)
		tmp = t_0;
	elseif (re <= 1.65e+133)
		tmp = t_1;
	elseif (re <= 1.7e+133)
		tmp = im;
	elseif (re <= 6.2e+153)
		tmp = t_1;
	elseif (re <= 5e+158)
		tmp = im;
	elseif (re <= 5e+197)
		tmp = t_1;
	elseif (re <= 3.2e+203)
		tmp = t_0;
	elseif ((re <= 2.3e+246) || (!(re <= 2.35e+246) && ((re <= 1.08e+248) || (!(re <= 1.8e+252) && ((re <= 7.2e+299) || !(re <= 7.5e+299))))))
		tmp = t_1;
	else
		tmp = im;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = re * (im / re);
	t_1 = im + (im * (re * (1.0 + (re * 0.5))));
	tmp = 0.0;
	if (re <= -2.0)
		tmp = t_0;
	elseif (re <= 1.65e+133)
		tmp = t_1;
	elseif (re <= 1.7e+133)
		tmp = im;
	elseif (re <= 6.2e+153)
		tmp = t_1;
	elseif (re <= 5e+158)
		tmp = im;
	elseif (re <= 5e+197)
		tmp = t_1;
	elseif (re <= 3.2e+203)
		tmp = t_0;
	elseif ((re <= 2.3e+246) || (~((re <= 2.35e+246)) && ((re <= 1.08e+248) || (~((re <= 1.8e+252)) && ((re <= 7.2e+299) || ~((re <= 7.5e+299)))))))
		tmp = t_1;
	else
		tmp = im;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(im / re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(im + N[(im * N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -2.0], t$95$0, If[LessEqual[re, 1.65e+133], t$95$1, If[LessEqual[re, 1.7e+133], im, If[LessEqual[re, 6.2e+153], t$95$1, If[LessEqual[re, 5e+158], im, If[LessEqual[re, 5e+197], t$95$1, If[LessEqual[re, 3.2e+203], t$95$0, If[Or[LessEqual[re, 2.3e+246], And[N[Not[LessEqual[re, 2.35e+246]], $MachinePrecision], Or[LessEqual[re, 1.08e+248], And[N[Not[LessEqual[re, 1.8e+252]], $MachinePrecision], Or[LessEqual[re, 7.2e+299], N[Not[LessEqual[re, 7.5e+299]], $MachinePrecision]]]]]], t$95$1, im]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;re \leq 1.65 \cdot 10^{+133}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;re \leq 1.7 \cdot 10^{+133}:\\
\;\;\;\;im\\

\mathbf{elif}\;re \leq 6.2 \cdot 10^{+153}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;re \leq 5 \cdot 10^{+158}:\\
\;\;\;\;im\\

\mathbf{elif}\;re \leq 5 \cdot 10^{+197}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;re \leq 3.2 \cdot 10^{+203}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;re \leq 2.3 \cdot 10^{+246} \lor \neg \left(re \leq 2.35 \cdot 10^{+246}\right) \land \left(re \leq 1.08 \cdot 10^{+248} \lor \neg \left(re \leq 1.8 \cdot 10^{+252}\right) \land \left(re \leq 7.2 \cdot 10^{+299} \lor \neg \left(re \leq 7.5 \cdot 10^{+299}\right)\right)\right):\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;im\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < -2 or 5.00000000000000009e197 < re < 3.1999999999999997e203

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \sin im} \]
    4. Step-by-step derivation
      1. distribute-rgt1-in2.8%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    5. Simplified2.8%

      \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    6. Taylor expanded in re around inf 2.8%

      \[\leadsto \color{blue}{re \cdot \left(\sin im + \frac{\sin im}{re}\right)} \]
    7. Taylor expanded in im around 0 2.5%

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

      \[\leadsto re \cdot \color{blue}{\frac{im}{re}} \]

    if -2 < re < 1.65e133 or 1.69999999999999994e133 < re < 6.2e153 or 4.9999999999999996e158 < re < 5.00000000000000009e197 or 3.1999999999999997e203 < re < 2.30000000000000014e246 or 2.34999999999999988e246 < re < 1.08e248 or 1.7999999999999999e252 < re < 7.20000000000000008e299 or 7.50000000000000039e299 < re

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 46.0%

      \[\leadsto \color{blue}{im + re \cdot \left(im + 0.5 \cdot \left(im \cdot re\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutative46.0%

        \[\leadsto im + re \cdot \left(im + \color{blue}{\left(im \cdot re\right) \cdot 0.5}\right) \]
    6. Simplified46.0%

      \[\leadsto \color{blue}{im + re \cdot \left(im + \left(im \cdot re\right) \cdot 0.5\right)} \]
    7. Taylor expanded in im around 0 48.5%

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

    if 1.65e133 < re < 1.69999999999999994e133 or 6.2e153 < re < 4.9999999999999996e158 or 2.30000000000000014e246 < re < 2.34999999999999988e246 or 1.08e248 < re < 1.7999999999999999e252 or 7.20000000000000008e299 < re < 7.50000000000000039e299

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 0.2%

      \[\leadsto \color{blue}{im} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification42.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -2:\\ \;\;\;\;re \cdot \frac{im}{re}\\ \mathbf{elif}\;re \leq 1.65 \cdot 10^{+133}:\\ \;\;\;\;im + im \cdot \left(re \cdot \left(1 + re \cdot 0.5\right)\right)\\ \mathbf{elif}\;re \leq 1.7 \cdot 10^{+133}:\\ \;\;\;\;im\\ \mathbf{elif}\;re \leq 6.2 \cdot 10^{+153}:\\ \;\;\;\;im + im \cdot \left(re \cdot \left(1 + re \cdot 0.5\right)\right)\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+158}:\\ \;\;\;\;im\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+197}:\\ \;\;\;\;im + im \cdot \left(re \cdot \left(1 + re \cdot 0.5\right)\right)\\ \mathbf{elif}\;re \leq 3.2 \cdot 10^{+203}:\\ \;\;\;\;re \cdot \frac{im}{re}\\ \mathbf{elif}\;re \leq 2.3 \cdot 10^{+246} \lor \neg \left(re \leq 2.35 \cdot 10^{+246}\right) \land \left(re \leq 1.08 \cdot 10^{+248} \lor \neg \left(re \leq 1.8 \cdot 10^{+252}\right) \land \left(re \leq 7.2 \cdot 10^{+299} \lor \neg \left(re \leq 7.5 \cdot 10^{+299}\right)\right)\right):\\ \;\;\;\;im + im \cdot \left(re \cdot \left(1 + re \cdot 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;im\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 34.9% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := re \cdot \left(im + \frac{im}{re}\right)\\ t_1 := re \cdot \frac{im}{re}\\ t_2 := im + re \cdot im\\ \mathbf{if}\;re \leq -18:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+197}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;re \leq 3.2 \cdot 10^{+203}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;re \leq 10^{+209}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;re \leq 2 \cdot 10^{+211}:\\ \;\;\;\;re \cdot im\\ \mathbf{elif}\;re \leq 2.3 \cdot 10^{+246}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;re \leq 2.35 \cdot 10^{+246}:\\ \;\;\;\;im\\ \mathbf{elif}\;re \leq 1.08 \cdot 10^{+248}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 1.8 \cdot 10^{+252}:\\ \;\;\;\;im\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+272}:\\ \;\;\;\;re \cdot im\\ \mathbf{elif}\;re \leq 7.2 \cdot 10^{+299} \lor \neg \left(re \leq 7.5 \cdot 10^{+299}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;im\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* re (+ im (/ im re))))
        (t_1 (* re (/ im re)))
        (t_2 (+ im (* re im))))
   (if (<= re -18.0)
     t_1
     (if (<= re 5e+197)
       t_2
       (if (<= re 3.2e+203)
         t_1
         (if (<= re 1e+209)
           t_2
           (if (<= re 2e+211)
             (* re im)
             (if (<= re 2.3e+246)
               t_2
               (if (<= re 2.35e+246)
                 im
                 (if (<= re 1.08e+248)
                   t_0
                   (if (<= re 1.8e+252)
                     im
                     (if (<= re 5e+272)
                       (* re im)
                       (if (or (<= re 7.2e+299) (not (<= re 7.5e+299)))
                         t_0
                         im)))))))))))))
double code(double re, double im) {
	double t_0 = re * (im + (im / re));
	double t_1 = re * (im / re);
	double t_2 = im + (re * im);
	double tmp;
	if (re <= -18.0) {
		tmp = t_1;
	} else if (re <= 5e+197) {
		tmp = t_2;
	} else if (re <= 3.2e+203) {
		tmp = t_1;
	} else if (re <= 1e+209) {
		tmp = t_2;
	} else if (re <= 2e+211) {
		tmp = re * im;
	} else if (re <= 2.3e+246) {
		tmp = t_2;
	} else if (re <= 2.35e+246) {
		tmp = im;
	} else if (re <= 1.08e+248) {
		tmp = t_0;
	} else if (re <= 1.8e+252) {
		tmp = im;
	} else if (re <= 5e+272) {
		tmp = re * im;
	} else if ((re <= 7.2e+299) || !(re <= 7.5e+299)) {
		tmp = t_0;
	} else {
		tmp = im;
	}
	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) :: t_2
    real(8) :: tmp
    t_0 = re * (im + (im / re))
    t_1 = re * (im / re)
    t_2 = im + (re * im)
    if (re <= (-18.0d0)) then
        tmp = t_1
    else if (re <= 5d+197) then
        tmp = t_2
    else if (re <= 3.2d+203) then
        tmp = t_1
    else if (re <= 1d+209) then
        tmp = t_2
    else if (re <= 2d+211) then
        tmp = re * im
    else if (re <= 2.3d+246) then
        tmp = t_2
    else if (re <= 2.35d+246) then
        tmp = im
    else if (re <= 1.08d+248) then
        tmp = t_0
    else if (re <= 1.8d+252) then
        tmp = im
    else if (re <= 5d+272) then
        tmp = re * im
    else if ((re <= 7.2d+299) .or. (.not. (re <= 7.5d+299))) then
        tmp = t_0
    else
        tmp = im
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = re * (im + (im / re));
	double t_1 = re * (im / re);
	double t_2 = im + (re * im);
	double tmp;
	if (re <= -18.0) {
		tmp = t_1;
	} else if (re <= 5e+197) {
		tmp = t_2;
	} else if (re <= 3.2e+203) {
		tmp = t_1;
	} else if (re <= 1e+209) {
		tmp = t_2;
	} else if (re <= 2e+211) {
		tmp = re * im;
	} else if (re <= 2.3e+246) {
		tmp = t_2;
	} else if (re <= 2.35e+246) {
		tmp = im;
	} else if (re <= 1.08e+248) {
		tmp = t_0;
	} else if (re <= 1.8e+252) {
		tmp = im;
	} else if (re <= 5e+272) {
		tmp = re * im;
	} else if ((re <= 7.2e+299) || !(re <= 7.5e+299)) {
		tmp = t_0;
	} else {
		tmp = im;
	}
	return tmp;
}
def code(re, im):
	t_0 = re * (im + (im / re))
	t_1 = re * (im / re)
	t_2 = im + (re * im)
	tmp = 0
	if re <= -18.0:
		tmp = t_1
	elif re <= 5e+197:
		tmp = t_2
	elif re <= 3.2e+203:
		tmp = t_1
	elif re <= 1e+209:
		tmp = t_2
	elif re <= 2e+211:
		tmp = re * im
	elif re <= 2.3e+246:
		tmp = t_2
	elif re <= 2.35e+246:
		tmp = im
	elif re <= 1.08e+248:
		tmp = t_0
	elif re <= 1.8e+252:
		tmp = im
	elif re <= 5e+272:
		tmp = re * im
	elif (re <= 7.2e+299) or not (re <= 7.5e+299):
		tmp = t_0
	else:
		tmp = im
	return tmp
function code(re, im)
	t_0 = Float64(re * Float64(im + Float64(im / re)))
	t_1 = Float64(re * Float64(im / re))
	t_2 = Float64(im + Float64(re * im))
	tmp = 0.0
	if (re <= -18.0)
		tmp = t_1;
	elseif (re <= 5e+197)
		tmp = t_2;
	elseif (re <= 3.2e+203)
		tmp = t_1;
	elseif (re <= 1e+209)
		tmp = t_2;
	elseif (re <= 2e+211)
		tmp = Float64(re * im);
	elseif (re <= 2.3e+246)
		tmp = t_2;
	elseif (re <= 2.35e+246)
		tmp = im;
	elseif (re <= 1.08e+248)
		tmp = t_0;
	elseif (re <= 1.8e+252)
		tmp = im;
	elseif (re <= 5e+272)
		tmp = Float64(re * im);
	elseif ((re <= 7.2e+299) || !(re <= 7.5e+299))
		tmp = t_0;
	else
		tmp = im;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = re * (im + (im / re));
	t_1 = re * (im / re);
	t_2 = im + (re * im);
	tmp = 0.0;
	if (re <= -18.0)
		tmp = t_1;
	elseif (re <= 5e+197)
		tmp = t_2;
	elseif (re <= 3.2e+203)
		tmp = t_1;
	elseif (re <= 1e+209)
		tmp = t_2;
	elseif (re <= 2e+211)
		tmp = re * im;
	elseif (re <= 2.3e+246)
		tmp = t_2;
	elseif (re <= 2.35e+246)
		tmp = im;
	elseif (re <= 1.08e+248)
		tmp = t_0;
	elseif (re <= 1.8e+252)
		tmp = im;
	elseif (re <= 5e+272)
		tmp = re * im;
	elseif ((re <= 7.2e+299) || ~((re <= 7.5e+299)))
		tmp = t_0;
	else
		tmp = im;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(im + N[(im / re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re * N[(im / re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(im + N[(re * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -18.0], t$95$1, If[LessEqual[re, 5e+197], t$95$2, If[LessEqual[re, 3.2e+203], t$95$1, If[LessEqual[re, 1e+209], t$95$2, If[LessEqual[re, 2e+211], N[(re * im), $MachinePrecision], If[LessEqual[re, 2.3e+246], t$95$2, If[LessEqual[re, 2.35e+246], im, If[LessEqual[re, 1.08e+248], t$95$0, If[LessEqual[re, 1.8e+252], im, If[LessEqual[re, 5e+272], N[(re * im), $MachinePrecision], If[Or[LessEqual[re, 7.2e+299], N[Not[LessEqual[re, 7.5e+299]], $MachinePrecision]], t$95$0, im]]]]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := re \cdot \left(im + \frac{im}{re}\right)\\
t_1 := re \cdot \frac{im}{re}\\
t_2 := im + re \cdot im\\
\mathbf{if}\;re \leq -18:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;re \leq 5 \cdot 10^{+197}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;re \leq 3.2 \cdot 10^{+203}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;re \leq 10^{+209}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;re \leq 2 \cdot 10^{+211}:\\
\;\;\;\;re \cdot im\\

\mathbf{elif}\;re \leq 2.3 \cdot 10^{+246}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;re \leq 2.35 \cdot 10^{+246}:\\
\;\;\;\;im\\

\mathbf{elif}\;re \leq 1.08 \cdot 10^{+248}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;re \leq 1.8 \cdot 10^{+252}:\\
\;\;\;\;im\\

\mathbf{elif}\;re \leq 5 \cdot 10^{+272}:\\
\;\;\;\;re \cdot im\\

\mathbf{elif}\;re \leq 7.2 \cdot 10^{+299} \lor \neg \left(re \leq 7.5 \cdot 10^{+299}\right):\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;im\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if re < -18 or 5.00000000000000009e197 < re < 3.1999999999999997e203

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \sin im} \]
    4. Step-by-step derivation
      1. distribute-rgt1-in2.9%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    5. Simplified2.9%

      \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    6. Taylor expanded in re around inf 2.9%

      \[\leadsto \color{blue}{re \cdot \left(\sin im + \frac{\sin im}{re}\right)} \]
    7. Taylor expanded in im around 0 2.5%

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

      \[\leadsto re \cdot \color{blue}{\frac{im}{re}} \]

    if -18 < re < 5.00000000000000009e197 or 3.1999999999999997e203 < re < 1.0000000000000001e209 or 1.9999999999999999e211 < re < 2.30000000000000014e246

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 36.8%

      \[\leadsto \color{blue}{im + im \cdot re} \]

    if 1.0000000000000001e209 < re < 1.9999999999999999e211 or 1.7999999999999999e252 < re < 4.99999999999999973e272

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \sin im} \]
    4. Step-by-step derivation
      1. distribute-rgt1-in5.7%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    5. Simplified5.7%

      \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    6. Taylor expanded in re around inf 5.7%

      \[\leadsto \color{blue}{re \cdot \sin im} \]
    7. Taylor expanded in im around 0 42.9%

      \[\leadsto \color{blue}{im \cdot re} \]

    if 2.30000000000000014e246 < re < 2.34999999999999988e246 or 1.08e248 < re < 1.7999999999999999e252 or 7.20000000000000008e299 < re < 7.50000000000000039e299

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 0.2%

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

    if 2.34999999999999988e246 < re < 1.08e248 or 4.99999999999999973e272 < re < 7.20000000000000008e299 or 7.50000000000000039e299 < re

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \sin im} \]
    4. Step-by-step derivation
      1. distribute-rgt1-in6.3%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    5. Simplified6.3%

      \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    6. Taylor expanded in re around inf 6.3%

      \[\leadsto \color{blue}{re \cdot \left(\sin im + \frac{\sin im}{re}\right)} \]
    7. Taylor expanded in im around 0 20.7%

      \[\leadsto re \cdot \color{blue}{\left(im \cdot \left(1 + \frac{1}{re}\right)\right)} \]
    8. Step-by-step derivation
      1. distribute-rgt-in20.7%

        \[\leadsto re \cdot \color{blue}{\left(1 \cdot im + \frac{1}{re} \cdot im\right)} \]
      2. *-lft-identity20.7%

        \[\leadsto re \cdot \left(\color{blue}{im} + \frac{1}{re} \cdot im\right) \]
      3. associate-*l/20.7%

        \[\leadsto re \cdot \left(im + \color{blue}{\frac{1 \cdot im}{re}}\right) \]
      4. *-lft-identity20.7%

        \[\leadsto re \cdot \left(im + \frac{\color{blue}{im}}{re}\right) \]
    9. Simplified20.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -18:\\ \;\;\;\;re \cdot \frac{im}{re}\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+197}:\\ \;\;\;\;im + re \cdot im\\ \mathbf{elif}\;re \leq 3.2 \cdot 10^{+203}:\\ \;\;\;\;re \cdot \frac{im}{re}\\ \mathbf{elif}\;re \leq 10^{+209}:\\ \;\;\;\;im + re \cdot im\\ \mathbf{elif}\;re \leq 2 \cdot 10^{+211}:\\ \;\;\;\;re \cdot im\\ \mathbf{elif}\;re \leq 2.3 \cdot 10^{+246}:\\ \;\;\;\;im + re \cdot im\\ \mathbf{elif}\;re \leq 2.35 \cdot 10^{+246}:\\ \;\;\;\;im\\ \mathbf{elif}\;re \leq 1.08 \cdot 10^{+248}:\\ \;\;\;\;re \cdot \left(im + \frac{im}{re}\right)\\ \mathbf{elif}\;re \leq 1.8 \cdot 10^{+252}:\\ \;\;\;\;im\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+272}:\\ \;\;\;\;re \cdot im\\ \mathbf{elif}\;re \leq 7.2 \cdot 10^{+299} \lor \neg \left(re \leq 7.5 \cdot 10^{+299}\right):\\ \;\;\;\;re \cdot \left(im + \frac{im}{re}\right)\\ \mathbf{else}:\\ \;\;\;\;im\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 34.9% accurate, 3.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := re \cdot \frac{im}{re}\\ t_1 := im + re \cdot im\\ \mathbf{if}\;re \leq -18:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+197}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;re \leq 3.2 \cdot 10^{+203}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 10^{+209}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;re \leq 2 \cdot 10^{+211}:\\ \;\;\;\;re \cdot im\\ \mathbf{elif}\;re \leq 2.3 \cdot 10^{+246}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;re \leq 2.35 \cdot 10^{+246} \lor \neg \left(re \leq 1.08 \cdot 10^{+248}\right) \land \left(re \leq 1.8 \cdot 10^{+252} \lor \neg \left(re \leq 7.2 \cdot 10^{+299}\right) \land re \leq 7.5 \cdot 10^{+299}\right):\\ \;\;\;\;im\\ \mathbf{else}:\\ \;\;\;\;re \cdot im\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* re (/ im re))) (t_1 (+ im (* re im))))
   (if (<= re -18.0)
     t_0
     (if (<= re 5e+197)
       t_1
       (if (<= re 3.2e+203)
         t_0
         (if (<= re 1e+209)
           t_1
           (if (<= re 2e+211)
             (* re im)
             (if (<= re 2.3e+246)
               t_1
               (if (or (<= re 2.35e+246)
                       (and (not (<= re 1.08e+248))
                            (or (<= re 1.8e+252)
                                (and (not (<= re 7.2e+299))
                                     (<= re 7.5e+299)))))
                 im
                 (* re im))))))))))
double code(double re, double im) {
	double t_0 = re * (im / re);
	double t_1 = im + (re * im);
	double tmp;
	if (re <= -18.0) {
		tmp = t_0;
	} else if (re <= 5e+197) {
		tmp = t_1;
	} else if (re <= 3.2e+203) {
		tmp = t_0;
	} else if (re <= 1e+209) {
		tmp = t_1;
	} else if (re <= 2e+211) {
		tmp = re * im;
	} else if (re <= 2.3e+246) {
		tmp = t_1;
	} else if ((re <= 2.35e+246) || (!(re <= 1.08e+248) && ((re <= 1.8e+252) || (!(re <= 7.2e+299) && (re <= 7.5e+299))))) {
		tmp = im;
	} else {
		tmp = re * im;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = re * (im / re)
    t_1 = im + (re * im)
    if (re <= (-18.0d0)) then
        tmp = t_0
    else if (re <= 5d+197) then
        tmp = t_1
    else if (re <= 3.2d+203) then
        tmp = t_0
    else if (re <= 1d+209) then
        tmp = t_1
    else if (re <= 2d+211) then
        tmp = re * im
    else if (re <= 2.3d+246) then
        tmp = t_1
    else if ((re <= 2.35d+246) .or. (.not. (re <= 1.08d+248)) .and. (re <= 1.8d+252) .or. (.not. (re <= 7.2d+299)) .and. (re <= 7.5d+299)) then
        tmp = im
    else
        tmp = re * im
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = re * (im / re);
	double t_1 = im + (re * im);
	double tmp;
	if (re <= -18.0) {
		tmp = t_0;
	} else if (re <= 5e+197) {
		tmp = t_1;
	} else if (re <= 3.2e+203) {
		tmp = t_0;
	} else if (re <= 1e+209) {
		tmp = t_1;
	} else if (re <= 2e+211) {
		tmp = re * im;
	} else if (re <= 2.3e+246) {
		tmp = t_1;
	} else if ((re <= 2.35e+246) || (!(re <= 1.08e+248) && ((re <= 1.8e+252) || (!(re <= 7.2e+299) && (re <= 7.5e+299))))) {
		tmp = im;
	} else {
		tmp = re * im;
	}
	return tmp;
}
def code(re, im):
	t_0 = re * (im / re)
	t_1 = im + (re * im)
	tmp = 0
	if re <= -18.0:
		tmp = t_0
	elif re <= 5e+197:
		tmp = t_1
	elif re <= 3.2e+203:
		tmp = t_0
	elif re <= 1e+209:
		tmp = t_1
	elif re <= 2e+211:
		tmp = re * im
	elif re <= 2.3e+246:
		tmp = t_1
	elif (re <= 2.35e+246) or (not (re <= 1.08e+248) and ((re <= 1.8e+252) or (not (re <= 7.2e+299) and (re <= 7.5e+299)))):
		tmp = im
	else:
		tmp = re * im
	return tmp
function code(re, im)
	t_0 = Float64(re * Float64(im / re))
	t_1 = Float64(im + Float64(re * im))
	tmp = 0.0
	if (re <= -18.0)
		tmp = t_0;
	elseif (re <= 5e+197)
		tmp = t_1;
	elseif (re <= 3.2e+203)
		tmp = t_0;
	elseif (re <= 1e+209)
		tmp = t_1;
	elseif (re <= 2e+211)
		tmp = Float64(re * im);
	elseif (re <= 2.3e+246)
		tmp = t_1;
	elseif ((re <= 2.35e+246) || (!(re <= 1.08e+248) && ((re <= 1.8e+252) || (!(re <= 7.2e+299) && (re <= 7.5e+299)))))
		tmp = im;
	else
		tmp = Float64(re * im);
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = re * (im / re);
	t_1 = im + (re * im);
	tmp = 0.0;
	if (re <= -18.0)
		tmp = t_0;
	elseif (re <= 5e+197)
		tmp = t_1;
	elseif (re <= 3.2e+203)
		tmp = t_0;
	elseif (re <= 1e+209)
		tmp = t_1;
	elseif (re <= 2e+211)
		tmp = re * im;
	elseif (re <= 2.3e+246)
		tmp = t_1;
	elseif ((re <= 2.35e+246) || (~((re <= 1.08e+248)) && ((re <= 1.8e+252) || (~((re <= 7.2e+299)) && (re <= 7.5e+299)))))
		tmp = im;
	else
		tmp = re * im;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(im / re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(im + N[(re * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -18.0], t$95$0, If[LessEqual[re, 5e+197], t$95$1, If[LessEqual[re, 3.2e+203], t$95$0, If[LessEqual[re, 1e+209], t$95$1, If[LessEqual[re, 2e+211], N[(re * im), $MachinePrecision], If[LessEqual[re, 2.3e+246], t$95$1, If[Or[LessEqual[re, 2.35e+246], And[N[Not[LessEqual[re, 1.08e+248]], $MachinePrecision], Or[LessEqual[re, 1.8e+252], And[N[Not[LessEqual[re, 7.2e+299]], $MachinePrecision], LessEqual[re, 7.5e+299]]]]], im, N[(re * im), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := re \cdot \frac{im}{re}\\
t_1 := im + re \cdot im\\
\mathbf{if}\;re \leq -18:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;re \leq 5 \cdot 10^{+197}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;re \leq 3.2 \cdot 10^{+203}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;re \leq 10^{+209}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;re \leq 2 \cdot 10^{+211}:\\
\;\;\;\;re \cdot im\\

\mathbf{elif}\;re \leq 2.3 \cdot 10^{+246}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;re \leq 2.35 \cdot 10^{+246} \lor \neg \left(re \leq 1.08 \cdot 10^{+248}\right) \land \left(re \leq 1.8 \cdot 10^{+252} \lor \neg \left(re \leq 7.2 \cdot 10^{+299}\right) \land re \leq 7.5 \cdot 10^{+299}\right):\\
\;\;\;\;im\\

\mathbf{else}:\\
\;\;\;\;re \cdot im\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if re < -18 or 5.00000000000000009e197 < re < 3.1999999999999997e203

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \sin im} \]
    4. Step-by-step derivation
      1. distribute-rgt1-in2.9%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    5. Simplified2.9%

      \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    6. Taylor expanded in re around inf 2.9%

      \[\leadsto \color{blue}{re \cdot \left(\sin im + \frac{\sin im}{re}\right)} \]
    7. Taylor expanded in im around 0 2.5%

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

      \[\leadsto re \cdot \color{blue}{\frac{im}{re}} \]

    if -18 < re < 5.00000000000000009e197 or 3.1999999999999997e203 < re < 1.0000000000000001e209 or 1.9999999999999999e211 < re < 2.30000000000000014e246

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 36.8%

      \[\leadsto \color{blue}{im + im \cdot re} \]

    if 1.0000000000000001e209 < re < 1.9999999999999999e211 or 2.34999999999999988e246 < re < 1.08e248 or 1.7999999999999999e252 < re < 7.20000000000000008e299 or 7.50000000000000039e299 < re

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \sin im} \]
    4. Step-by-step derivation
      1. distribute-rgt1-in6.0%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    5. Simplified6.0%

      \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    6. Taylor expanded in re around inf 6.0%

      \[\leadsto \color{blue}{re \cdot \sin im} \]
    7. Taylor expanded in im around 0 30.8%

      \[\leadsto \color{blue}{im \cdot re} \]

    if 2.30000000000000014e246 < re < 2.34999999999999988e246 or 1.08e248 < re < 1.7999999999999999e252 or 7.20000000000000008e299 < re < 7.50000000000000039e299

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 0.2%

      \[\leadsto \color{blue}{im} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification34.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -18:\\ \;\;\;\;re \cdot \frac{im}{re}\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+197}:\\ \;\;\;\;im + re \cdot im\\ \mathbf{elif}\;re \leq 3.2 \cdot 10^{+203}:\\ \;\;\;\;re \cdot \frac{im}{re}\\ \mathbf{elif}\;re \leq 10^{+209}:\\ \;\;\;\;im + re \cdot im\\ \mathbf{elif}\;re \leq 2 \cdot 10^{+211}:\\ \;\;\;\;re \cdot im\\ \mathbf{elif}\;re \leq 2.3 \cdot 10^{+246}:\\ \;\;\;\;im + re \cdot im\\ \mathbf{elif}\;re \leq 2.35 \cdot 10^{+246} \lor \neg \left(re \leq 1.08 \cdot 10^{+248}\right) \land \left(re \leq 1.8 \cdot 10^{+252} \lor \neg \left(re \leq 7.2 \cdot 10^{+299}\right) \land re \leq 7.5 \cdot 10^{+299}\right):\\ \;\;\;\;im\\ \mathbf{else}:\\ \;\;\;\;re \cdot im\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 34.5% accurate, 4.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := re \cdot \frac{im}{re}\\ \mathbf{if}\;re \leq 1:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+197}:\\ \;\;\;\;re \cdot im\\ \mathbf{elif}\;re \leq 3.2 \cdot 10^{+203}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 2.3 \cdot 10^{+246} \lor \neg \left(re \leq 2.35 \cdot 10^{+246}\right) \land \left(re \leq 1.08 \cdot 10^{+248} \lor \neg \left(re \leq 1.8 \cdot 10^{+252}\right) \land \left(re \leq 7.2 \cdot 10^{+299} \lor \neg \left(re \leq 7.5 \cdot 10^{+299}\right)\right)\right):\\ \;\;\;\;re \cdot im\\ \mathbf{else}:\\ \;\;\;\;im\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* re (/ im re))))
   (if (<= re 1.0)
     t_0
     (if (<= re 5e+197)
       (* re im)
       (if (<= re 3.2e+203)
         t_0
         (if (or (<= re 2.3e+246)
                 (and (not (<= re 2.35e+246))
                      (or (<= re 1.08e+248)
                          (and (not (<= re 1.8e+252))
                               (or (<= re 7.2e+299) (not (<= re 7.5e+299)))))))
           (* re im)
           im))))))
double code(double re, double im) {
	double t_0 = re * (im / re);
	double tmp;
	if (re <= 1.0) {
		tmp = t_0;
	} else if (re <= 5e+197) {
		tmp = re * im;
	} else if (re <= 3.2e+203) {
		tmp = t_0;
	} else if ((re <= 2.3e+246) || (!(re <= 2.35e+246) && ((re <= 1.08e+248) || (!(re <= 1.8e+252) && ((re <= 7.2e+299) || !(re <= 7.5e+299)))))) {
		tmp = re * im;
	} else {
		tmp = im;
	}
	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 * (im / re)
    if (re <= 1.0d0) then
        tmp = t_0
    else if (re <= 5d+197) then
        tmp = re * im
    else if (re <= 3.2d+203) then
        tmp = t_0
    else if ((re <= 2.3d+246) .or. (.not. (re <= 2.35d+246)) .and. (re <= 1.08d+248) .or. (.not. (re <= 1.8d+252)) .and. (re <= 7.2d+299) .or. (.not. (re <= 7.5d+299))) then
        tmp = re * im
    else
        tmp = im
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = re * (im / re);
	double tmp;
	if (re <= 1.0) {
		tmp = t_0;
	} else if (re <= 5e+197) {
		tmp = re * im;
	} else if (re <= 3.2e+203) {
		tmp = t_0;
	} else if ((re <= 2.3e+246) || (!(re <= 2.35e+246) && ((re <= 1.08e+248) || (!(re <= 1.8e+252) && ((re <= 7.2e+299) || !(re <= 7.5e+299)))))) {
		tmp = re * im;
	} else {
		tmp = im;
	}
	return tmp;
}
def code(re, im):
	t_0 = re * (im / re)
	tmp = 0
	if re <= 1.0:
		tmp = t_0
	elif re <= 5e+197:
		tmp = re * im
	elif re <= 3.2e+203:
		tmp = t_0
	elif (re <= 2.3e+246) or (not (re <= 2.35e+246) and ((re <= 1.08e+248) or (not (re <= 1.8e+252) and ((re <= 7.2e+299) or not (re <= 7.5e+299))))):
		tmp = re * im
	else:
		tmp = im
	return tmp
function code(re, im)
	t_0 = Float64(re * Float64(im / re))
	tmp = 0.0
	if (re <= 1.0)
		tmp = t_0;
	elseif (re <= 5e+197)
		tmp = Float64(re * im);
	elseif (re <= 3.2e+203)
		tmp = t_0;
	elseif ((re <= 2.3e+246) || (!(re <= 2.35e+246) && ((re <= 1.08e+248) || (!(re <= 1.8e+252) && ((re <= 7.2e+299) || !(re <= 7.5e+299))))))
		tmp = Float64(re * im);
	else
		tmp = im;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = re * (im / re);
	tmp = 0.0;
	if (re <= 1.0)
		tmp = t_0;
	elseif (re <= 5e+197)
		tmp = re * im;
	elseif (re <= 3.2e+203)
		tmp = t_0;
	elseif ((re <= 2.3e+246) || (~((re <= 2.35e+246)) && ((re <= 1.08e+248) || (~((re <= 1.8e+252)) && ((re <= 7.2e+299) || ~((re <= 7.5e+299)))))))
		tmp = re * im;
	else
		tmp = im;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(im / re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, 1.0], t$95$0, If[LessEqual[re, 5e+197], N[(re * im), $MachinePrecision], If[LessEqual[re, 3.2e+203], t$95$0, If[Or[LessEqual[re, 2.3e+246], And[N[Not[LessEqual[re, 2.35e+246]], $MachinePrecision], Or[LessEqual[re, 1.08e+248], And[N[Not[LessEqual[re, 1.8e+252]], $MachinePrecision], Or[LessEqual[re, 7.2e+299], N[Not[LessEqual[re, 7.5e+299]], $MachinePrecision]]]]]], N[(re * im), $MachinePrecision], im]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := re \cdot \frac{im}{re}\\
\mathbf{if}\;re \leq 1:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;re \leq 5 \cdot 10^{+197}:\\
\;\;\;\;re \cdot im\\

\mathbf{elif}\;re \leq 3.2 \cdot 10^{+203}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;re \leq 2.3 \cdot 10^{+246} \lor \neg \left(re \leq 2.35 \cdot 10^{+246}\right) \land \left(re \leq 1.08 \cdot 10^{+248} \lor \neg \left(re \leq 1.8 \cdot 10^{+252}\right) \land \left(re \leq 7.2 \cdot 10^{+299} \lor \neg \left(re \leq 7.5 \cdot 10^{+299}\right)\right)\right):\\
\;\;\;\;re \cdot im\\

\mathbf{else}:\\
\;\;\;\;im\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < 1 or 5.00000000000000009e197 < re < 3.1999999999999997e203

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \sin im} \]
    4. Step-by-step derivation
      1. distribute-rgt1-in66.9%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    5. Simplified66.9%

      \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    6. Taylor expanded in re around inf 66.3%

      \[\leadsto \color{blue}{re \cdot \left(\sin im + \frac{\sin im}{re}\right)} \]
    7. Taylor expanded in im around 0 32.0%

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

      \[\leadsto re \cdot \color{blue}{\frac{im}{re}} \]

    if 1 < re < 5.00000000000000009e197 or 3.1999999999999997e203 < re < 2.30000000000000014e246 or 2.34999999999999988e246 < re < 1.08e248 or 1.7999999999999999e252 < re < 7.20000000000000008e299 or 7.50000000000000039e299 < re

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \sin im} \]
    4. Step-by-step derivation
      1. distribute-rgt1-in3.9%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    5. Simplified3.9%

      \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    6. Taylor expanded in re around inf 3.9%

      \[\leadsto \color{blue}{re \cdot \sin im} \]
    7. Taylor expanded in im around 0 15.9%

      \[\leadsto \color{blue}{im \cdot re} \]

    if 2.30000000000000014e246 < re < 2.34999999999999988e246 or 1.08e248 < re < 1.7999999999999999e252 or 7.20000000000000008e299 < re < 7.50000000000000039e299

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 0.2%

      \[\leadsto \color{blue}{im} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification33.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 1:\\ \;\;\;\;re \cdot \frac{im}{re}\\ \mathbf{elif}\;re \leq 5 \cdot 10^{+197}:\\ \;\;\;\;re \cdot im\\ \mathbf{elif}\;re \leq 3.2 \cdot 10^{+203}:\\ \;\;\;\;re \cdot \frac{im}{re}\\ \mathbf{elif}\;re \leq 2.3 \cdot 10^{+246} \lor \neg \left(re \leq 2.35 \cdot 10^{+246}\right) \land \left(re \leq 1.08 \cdot 10^{+248} \lor \neg \left(re \leq 1.8 \cdot 10^{+252}\right) \land \left(re \leq 7.2 \cdot 10^{+299} \lor \neg \left(re \leq 7.5 \cdot 10^{+299}\right)\right)\right):\\ \;\;\;\;re \cdot im\\ \mathbf{else}:\\ \;\;\;\;im\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 29.6% accurate, 5.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq 1 \lor \neg \left(re \leq 2.3 \cdot 10^{+246}\right) \land \left(re \leq 2.35 \cdot 10^{+246} \lor \neg \left(re \leq 1.08 \cdot 10^{+248}\right) \land \left(re \leq 1.8 \cdot 10^{+252} \lor \neg \left(re \leq 7.2 \cdot 10^{+299}\right) \land re \leq 7.5 \cdot 10^{+299}\right)\right):\\ \;\;\;\;im\\ \mathbf{else}:\\ \;\;\;\;re \cdot im\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (or (<= re 1.0)
         (and (not (<= re 2.3e+246))
              (or (<= re 2.35e+246)
                  (and (not (<= re 1.08e+248))
                       (or (<= re 1.8e+252)
                           (and (not (<= re 7.2e+299)) (<= re 7.5e+299)))))))
   im
   (* re im)))
double code(double re, double im) {
	double tmp;
	if ((re <= 1.0) || (!(re <= 2.3e+246) && ((re <= 2.35e+246) || (!(re <= 1.08e+248) && ((re <= 1.8e+252) || (!(re <= 7.2e+299) && (re <= 7.5e+299))))))) {
		tmp = im;
	} else {
		tmp = re * im;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if ((re <= 1.0d0) .or. (.not. (re <= 2.3d+246)) .and. (re <= 2.35d+246) .or. (.not. (re <= 1.08d+248)) .and. (re <= 1.8d+252) .or. (.not. (re <= 7.2d+299)) .and. (re <= 7.5d+299)) then
        tmp = im
    else
        tmp = re * im
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if ((re <= 1.0) || (!(re <= 2.3e+246) && ((re <= 2.35e+246) || (!(re <= 1.08e+248) && ((re <= 1.8e+252) || (!(re <= 7.2e+299) && (re <= 7.5e+299))))))) {
		tmp = im;
	} else {
		tmp = re * im;
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if (re <= 1.0) or (not (re <= 2.3e+246) and ((re <= 2.35e+246) or (not (re <= 1.08e+248) and ((re <= 1.8e+252) or (not (re <= 7.2e+299) and (re <= 7.5e+299)))))):
		tmp = im
	else:
		tmp = re * im
	return tmp
function code(re, im)
	tmp = 0.0
	if ((re <= 1.0) || (!(re <= 2.3e+246) && ((re <= 2.35e+246) || (!(re <= 1.08e+248) && ((re <= 1.8e+252) || (!(re <= 7.2e+299) && (re <= 7.5e+299)))))))
		tmp = im;
	else
		tmp = Float64(re * im);
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if ((re <= 1.0) || (~((re <= 2.3e+246)) && ((re <= 2.35e+246) || (~((re <= 1.08e+248)) && ((re <= 1.8e+252) || (~((re <= 7.2e+299)) && (re <= 7.5e+299)))))))
		tmp = im;
	else
		tmp = re * im;
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[Or[LessEqual[re, 1.0], And[N[Not[LessEqual[re, 2.3e+246]], $MachinePrecision], Or[LessEqual[re, 2.35e+246], And[N[Not[LessEqual[re, 1.08e+248]], $MachinePrecision], Or[LessEqual[re, 1.8e+252], And[N[Not[LessEqual[re, 7.2e+299]], $MachinePrecision], LessEqual[re, 7.5e+299]]]]]]], im, N[(re * im), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq 1 \lor \neg \left(re \leq 2.3 \cdot 10^{+246}\right) \land \left(re \leq 2.35 \cdot 10^{+246} \lor \neg \left(re \leq 1.08 \cdot 10^{+248}\right) \land \left(re \leq 1.8 \cdot 10^{+252} \lor \neg \left(re \leq 7.2 \cdot 10^{+299}\right) \land re \leq 7.5 \cdot 10^{+299}\right)\right):\\
\;\;\;\;im\\

\mathbf{else}:\\
\;\;\;\;re \cdot im\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if re < 1 or 2.30000000000000014e246 < re < 2.34999999999999988e246 or 1.08e248 < re < 1.7999999999999999e252 or 7.20000000000000008e299 < re < 7.50000000000000039e299

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Taylor expanded in re around 0 32.1%

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

    if 1 < re < 2.30000000000000014e246 or 2.34999999999999988e246 < re < 1.08e248 or 1.7999999999999999e252 < re < 7.20000000000000008e299 or 7.50000000000000039e299 < re

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \sin im} \]
    4. Step-by-step derivation
      1. distribute-rgt1-in4.0%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    5. Simplified4.0%

      \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
    6. Taylor expanded in re around inf 4.0%

      \[\leadsto \color{blue}{re \cdot \sin im} \]
    7. Taylor expanded in im around 0 15.4%

      \[\leadsto \color{blue}{im \cdot re} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification28.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 1 \lor \neg \left(re \leq 2.3 \cdot 10^{+246}\right) \land \left(re \leq 2.35 \cdot 10^{+246} \lor \neg \left(re \leq 1.08 \cdot 10^{+248}\right) \land \left(re \leq 1.8 \cdot 10^{+252} \lor \neg \left(re \leq 7.2 \cdot 10^{+299}\right) \land re \leq 7.5 \cdot 10^{+299}\right)\right):\\ \;\;\;\;im\\ \mathbf{else}:\\ \;\;\;\;re \cdot im\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 34.7% accurate, 22.6× speedup?

\[\begin{array}{l} \\ re \cdot \left(\left(re + 1\right) \cdot \frac{im}{re}\right) \end{array} \]
(FPCore (re im) :precision binary64 (* re (* (+ re 1.0) (/ im re))))
double code(double re, double im) {
	return re * ((re + 1.0) * (im / re));
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    code = re * ((re + 1.0d0) * (im / re))
end function
public static double code(double re, double im) {
	return re * ((re + 1.0) * (im / re));
}
def code(re, im):
	return re * ((re + 1.0) * (im / re))
function code(re, im)
	return Float64(re * Float64(Float64(re + 1.0) * Float64(im / re)))
end
function tmp = code(re, im)
	tmp = re * ((re + 1.0) * (im / re));
end
code[re_, im_] := N[(re * N[(N[(re + 1.0), $MachinePrecision] * N[(im / re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

    \[\leadsto \color{blue}{\sin im + re \cdot \sin im} \]
  4. Step-by-step derivation
    1. distribute-rgt1-in51.0%

      \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
  5. Simplified51.0%

    \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} \]
  6. Taylor expanded in re around inf 50.5%

    \[\leadsto \color{blue}{re \cdot \left(\sin im + \frac{\sin im}{re}\right)} \]
  7. Taylor expanded in re around 0 50.5%

    \[\leadsto re \cdot \color{blue}{\frac{\sin im + re \cdot \sin im}{re}} \]
  8. Step-by-step derivation
    1. distribute-rgt1-in50.5%

      \[\leadsto re \cdot \frac{\color{blue}{\left(re + 1\right) \cdot \sin im}}{re} \]
    2. *-rgt-identity50.5%

      \[\leadsto re \cdot \frac{\left(\color{blue}{re \cdot 1} + 1\right) \cdot \sin im}{re} \]
    3. rgt-mult-inverse50.4%

      \[\leadsto re \cdot \frac{\left(re \cdot 1 + \color{blue}{re \cdot \frac{1}{re}}\right) \cdot \sin im}{re} \]
    4. distribute-lft-in50.4%

      \[\leadsto re \cdot \frac{\color{blue}{\left(re \cdot \left(1 + \frac{1}{re}\right)\right)} \cdot \sin im}{re} \]
    5. associate-/l*56.3%

      \[\leadsto re \cdot \color{blue}{\left(\left(re \cdot \left(1 + \frac{1}{re}\right)\right) \cdot \frac{\sin im}{re}\right)} \]
    6. distribute-lft-in56.3%

      \[\leadsto re \cdot \left(\color{blue}{\left(re \cdot 1 + re \cdot \frac{1}{re}\right)} \cdot \frac{\sin im}{re}\right) \]
    7. *-rgt-identity56.3%

      \[\leadsto re \cdot \left(\left(\color{blue}{re} + re \cdot \frac{1}{re}\right) \cdot \frac{\sin im}{re}\right) \]
    8. rgt-mult-inverse56.4%

      \[\leadsto re \cdot \left(\left(re + \color{blue}{1}\right) \cdot \frac{\sin im}{re}\right) \]
  9. Simplified56.4%

    \[\leadsto re \cdot \color{blue}{\left(\left(re + 1\right) \cdot \frac{\sin im}{re}\right)} \]
  10. Taylor expanded in im around 0 33.7%

    \[\leadsto re \cdot \left(\left(re + 1\right) \cdot \color{blue}{\frac{im}{re}}\right) \]
  11. Add Preprocessing

Alternative 14: 26.2% accurate, 203.0× speedup?

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

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

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

    \[\leadsto \color{blue}{im \cdot e^{re}} \]
  4. Taylor expanded in re around 0 24.9%

    \[\leadsto \color{blue}{im} \]
  5. Add Preprocessing

Reproduce

?
herbie shell --seed 2024096 
(FPCore (re im)
  :name "math.exp on complex, imaginary part"
  :precision binary64
  (* (exp re) (sin im)))