math.exp on complex, imaginary part

Percentage Accurate: 100.0% → 100.0%
Time: 13.6s
Alternatives: 18
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 18 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: 96.9% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.033:\\
\;\;\;\;e^{re} \cdot im\\

\mathbf{elif}\;re \leq 350:\\
\;\;\;\;\sin im \cdot \left(\left(re + 1\right) + \left(0.5 + re \cdot 0.16666666666666666\right) \cdot \left(re \cdot re\right)\right)\\

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

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


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

    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}} \]

    if -0.033000000000000002 < re < 350

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \left(\sin im + re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right)} \]
    4. Step-by-step derivation
      1. distribute-rgt-in98.5%

        \[\leadsto \sin im + \color{blue}{\left(\sin im \cdot re + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right)} \]
      2. *-commutative98.5%

        \[\leadsto \sin im + \left(\color{blue}{re \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right) \]
      3. associate-+r+98.5%

        \[\leadsto \color{blue}{\left(\sin im + re \cdot \sin im\right) + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re} \]
      4. distribute-rgt1-in98.5%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      5. *-commutative98.5%

        \[\leadsto \color{blue}{\sin im \cdot \left(re + 1\right)} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      6. *-commutative98.5%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right) \cdot re\right)} \cdot re \]
      7. associate-*l*98.5%

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

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(0.5 \cdot \sin im + 0.16666666666666666 \cdot \left(re \cdot \sin im\right)\right)} \cdot \left(re \cdot re\right) \]
      9. associate-*r*98.5%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \left(0.5 \cdot \sin im + \color{blue}{\left(0.16666666666666666 \cdot re\right) \cdot \sin im}\right) \cdot \left(re \cdot re\right) \]
      10. distribute-rgt-out98.5%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\sin im \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)} \cdot \left(re \cdot re\right) \]
      11. associate-*l*98.5%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\sin im \cdot \left(\left(0.5 + 0.16666666666666666 \cdot re\right) \cdot \left(re \cdot re\right)\right)} \]
      12. distribute-lft-out98.5%

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

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

    if 350 < re < 2.09999999999999981e90

    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 \left(e^{re} + -0.16666666666666666 \cdot \left({im}^{2} \cdot e^{re}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*0.0%

        \[\leadsto im \cdot \left(e^{re} + \color{blue}{\left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}}\right) \]
      2. *-lft-identity0.0%

        \[\leadsto im \cdot \left(\color{blue}{1 \cdot e^{re}} + \left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}\right) \]
      3. distribute-rgt-out82.6%

        \[\leadsto im \cdot \color{blue}{\left(e^{re} \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)} \]
      4. *-commutative82.6%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right)\right) \]
      5. unpow282.6%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right)\right) \]
      6. associate-*l*82.6%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right)\right) \]
    5. Simplified82.6%

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

    if 2.09999999999999981e90 < re

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \left(\sin im + re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right)} \]
    4. Step-by-step derivation
      1. distribute-rgt-in89.5%

        \[\leadsto \sin im + \color{blue}{\left(\sin im \cdot re + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right)} \]
      2. *-commutative89.5%

        \[\leadsto \sin im + \left(\color{blue}{re \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right) \]
      3. associate-+r+89.5%

        \[\leadsto \color{blue}{\left(\sin im + re \cdot \sin im\right) + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re} \]
      4. distribute-rgt1-in89.5%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      5. *-commutative89.5%

        \[\leadsto \color{blue}{\sin im \cdot \left(re + 1\right)} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      6. *-commutative89.5%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right) \cdot re\right)} \cdot re \]
      7. associate-*l*89.5%

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

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(0.5 \cdot \sin im + 0.16666666666666666 \cdot \left(re \cdot \sin im\right)\right)} \cdot \left(re \cdot re\right) \]
      9. associate-*r*89.5%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \left(0.5 \cdot \sin im + \color{blue}{\left(0.16666666666666666 \cdot re\right) \cdot \sin im}\right) \cdot \left(re \cdot re\right) \]
      10. distribute-rgt-out89.5%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\sin im \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)} \cdot \left(re \cdot re\right) \]
      11. associate-*l*98.0%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\sin im \cdot \left(\left(0.5 + 0.16666666666666666 \cdot re\right) \cdot \left(re \cdot re\right)\right)} \]
      12. distribute-lft-out98.0%

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

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left({re}^{3} \cdot \sin im\right)} \]
    7. Step-by-step derivation
      1. *-commutative98.0%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(\sin im \cdot {re}^{3}\right)} \]
      2. cube-mult98.0%

        \[\leadsto 0.16666666666666666 \cdot \left(\sin im \cdot \color{blue}{\left(re \cdot \left(re \cdot re\right)\right)}\right) \]
    8. Simplified98.0%

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

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

Alternative 3: 96.8% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.0205:\\
\;\;\;\;e^{re} \cdot im\\

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

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

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


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

    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}} \]

    if -0.0205000000000000009 < re < 350

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{1 \cdot \sin im} + re \cdot \left(\sin im + 0.5 \cdot \left(re \cdot \sin im\right)\right) \]
      2. associate-*r*98.3%

        \[\leadsto 1 \cdot \sin im + re \cdot \left(\sin im + \color{blue}{\left(0.5 \cdot re\right) \cdot \sin im}\right) \]
      3. distribute-rgt1-in98.3%

        \[\leadsto 1 \cdot \sin im + re \cdot \color{blue}{\left(\left(0.5 \cdot re + 1\right) \cdot \sin im\right)} \]
      4. associate-*r*98.3%

        \[\leadsto 1 \cdot \sin im + \color{blue}{\left(re \cdot \left(0.5 \cdot re + 1\right)\right) \cdot \sin im} \]
      5. distribute-rgt-out98.3%

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

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

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

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

    if 350 < re < 2.09999999999999981e90

    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 \left(e^{re} + -0.16666666666666666 \cdot \left({im}^{2} \cdot e^{re}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*0.0%

        \[\leadsto im \cdot \left(e^{re} + \color{blue}{\left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}}\right) \]
      2. *-lft-identity0.0%

        \[\leadsto im \cdot \left(\color{blue}{1 \cdot e^{re}} + \left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}\right) \]
      3. distribute-rgt-out82.6%

        \[\leadsto im \cdot \color{blue}{\left(e^{re} \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)} \]
      4. *-commutative82.6%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right)\right) \]
      5. unpow282.6%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right)\right) \]
      6. associate-*l*82.6%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right)\right) \]
    5. Simplified82.6%

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

    if 2.09999999999999981e90 < re

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \left(\sin im + re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right)} \]
    4. Step-by-step derivation
      1. distribute-rgt-in89.5%

        \[\leadsto \sin im + \color{blue}{\left(\sin im \cdot re + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right)} \]
      2. *-commutative89.5%

        \[\leadsto \sin im + \left(\color{blue}{re \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right) \]
      3. associate-+r+89.5%

        \[\leadsto \color{blue}{\left(\sin im + re \cdot \sin im\right) + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re} \]
      4. distribute-rgt1-in89.5%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      5. *-commutative89.5%

        \[\leadsto \color{blue}{\sin im \cdot \left(re + 1\right)} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      6. *-commutative89.5%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right) \cdot re\right)} \cdot re \]
      7. associate-*l*89.5%

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

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(0.5 \cdot \sin im + 0.16666666666666666 \cdot \left(re \cdot \sin im\right)\right)} \cdot \left(re \cdot re\right) \]
      9. associate-*r*89.5%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \left(0.5 \cdot \sin im + \color{blue}{\left(0.16666666666666666 \cdot re\right) \cdot \sin im}\right) \cdot \left(re \cdot re\right) \]
      10. distribute-rgt-out89.5%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\sin im \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)} \cdot \left(re \cdot re\right) \]
      11. associate-*l*98.0%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\sin im \cdot \left(\left(0.5 + 0.16666666666666666 \cdot re\right) \cdot \left(re \cdot re\right)\right)} \]
      12. distribute-lft-out98.0%

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

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left({re}^{3} \cdot \sin im\right)} \]
    7. Step-by-step derivation
      1. *-commutative98.0%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(\sin im \cdot {re}^{3}\right)} \]
      2. cube-mult98.0%

        \[\leadsto 0.16666666666666666 \cdot \left(\sin im \cdot \color{blue}{\left(re \cdot \left(re \cdot re\right)\right)}\right) \]
    8. Simplified98.0%

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

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

Alternative 4: 96.6% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.0046:\\
\;\;\;\;e^{re} \cdot im\\

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

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

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


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

    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}} \]

    if -0.0045999999999999999 < re < 350

    1. Initial program 100.0%

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

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

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

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

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

    if 350 < re < 2.09999999999999981e90

    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 \left(e^{re} + -0.16666666666666666 \cdot \left({im}^{2} \cdot e^{re}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*0.0%

        \[\leadsto im \cdot \left(e^{re} + \color{blue}{\left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}}\right) \]
      2. *-lft-identity0.0%

        \[\leadsto im \cdot \left(\color{blue}{1 \cdot e^{re}} + \left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}\right) \]
      3. distribute-rgt-out82.6%

        \[\leadsto im \cdot \color{blue}{\left(e^{re} \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)} \]
      4. *-commutative82.6%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right)\right) \]
      5. unpow282.6%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right)\right) \]
      6. associate-*l*82.6%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right)\right) \]
    5. Simplified82.6%

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

    if 2.09999999999999981e90 < re

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \left(\sin im + re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right)} \]
    4. Step-by-step derivation
      1. distribute-rgt-in89.5%

        \[\leadsto \sin im + \color{blue}{\left(\sin im \cdot re + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right)} \]
      2. *-commutative89.5%

        \[\leadsto \sin im + \left(\color{blue}{re \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right) \]
      3. associate-+r+89.5%

        \[\leadsto \color{blue}{\left(\sin im + re \cdot \sin im\right) + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re} \]
      4. distribute-rgt1-in89.5%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      5. *-commutative89.5%

        \[\leadsto \color{blue}{\sin im \cdot \left(re + 1\right)} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      6. *-commutative89.5%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right) \cdot re\right)} \cdot re \]
      7. associate-*l*89.5%

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

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(0.5 \cdot \sin im + 0.16666666666666666 \cdot \left(re \cdot \sin im\right)\right)} \cdot \left(re \cdot re\right) \]
      9. associate-*r*89.5%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \left(0.5 \cdot \sin im + \color{blue}{\left(0.16666666666666666 \cdot re\right) \cdot \sin im}\right) \cdot \left(re \cdot re\right) \]
      10. distribute-rgt-out89.5%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\sin im \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)} \cdot \left(re \cdot re\right) \]
      11. associate-*l*98.0%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\sin im \cdot \left(\left(0.5 + 0.16666666666666666 \cdot re\right) \cdot \left(re \cdot re\right)\right)} \]
      12. distribute-lft-out98.0%

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

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left({re}^{3} \cdot \sin im\right)} \]
    7. Step-by-step derivation
      1. *-commutative98.0%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(\sin im \cdot {re}^{3}\right)} \]
      2. cube-mult98.0%

        \[\leadsto 0.16666666666666666 \cdot \left(\sin im \cdot \color{blue}{\left(re \cdot \left(re \cdot re\right)\right)}\right) \]
    8. Simplified98.0%

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

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

Alternative 5: 97.4% accurate, 1.6× speedup?

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

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

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

\mathbf{elif}\;re \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < -0.0058 or 350 < re < 5.60000000000000037e102

    1. Initial program 100.0%

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

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

    if -0.0058 < re < 350

    1. Initial program 100.0%

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

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

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

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

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

    if 5.60000000000000037e102 < re

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \left(\sin im + re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right)} \]
    4. Step-by-step derivation
      1. distribute-rgt-in91.4%

        \[\leadsto \sin im + \color{blue}{\left(\sin im \cdot re + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right)} \]
      2. *-commutative91.4%

        \[\leadsto \sin im + \left(\color{blue}{re \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right) \]
      3. associate-+r+91.4%

        \[\leadsto \color{blue}{\left(\sin im + re \cdot \sin im\right) + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re} \]
      4. distribute-rgt1-in91.4%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      5. *-commutative91.4%

        \[\leadsto \color{blue}{\sin im \cdot \left(re + 1\right)} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      6. *-commutative91.4%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right) \cdot re\right)} \cdot re \]
      7. associate-*l*91.4%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right) \cdot \left(re \cdot re\right)} \]
      8. +-commutative91.4%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(0.5 \cdot \sin im + 0.16666666666666666 \cdot \left(re \cdot \sin im\right)\right)} \cdot \left(re \cdot re\right) \]
      9. associate-*r*91.4%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \left(0.5 \cdot \sin im + \color{blue}{\left(0.16666666666666666 \cdot re\right) \cdot \sin im}\right) \cdot \left(re \cdot re\right) \]
      10. distribute-rgt-out91.4%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\sin im \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)} \cdot \left(re \cdot re\right) \]
      11. associate-*l*100.0%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\sin im \cdot \left(\left(0.5 + 0.16666666666666666 \cdot re\right) \cdot \left(re \cdot re\right)\right)} \]
      12. distribute-lft-out100.0%

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

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left({re}^{3} \cdot \sin im\right)} \]
    7. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(\sin im \cdot {re}^{3}\right)} \]
      2. cube-mult100.0%

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

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

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

Alternative 6: 96.1% accurate, 1.7× speedup?

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

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

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

\mathbf{elif}\;re \leq 1.25 \cdot 10^{+150}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < -0.0029 or 350 < re < 1.25000000000000002e150

    1. Initial program 100.0%

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

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

    if -0.0029 < re < 350

    1. Initial program 100.0%

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

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

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

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

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

    if 1.25000000000000002e150 < re

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \left(\sin im + 0.5 \cdot \left(re \cdot \sin im\right)\right)} \]
    4. Step-by-step derivation
      1. *-lft-identity81.4%

        \[\leadsto \color{blue}{1 \cdot \sin im} + re \cdot \left(\sin im + 0.5 \cdot \left(re \cdot \sin im\right)\right) \]
      2. associate-*r*81.4%

        \[\leadsto 1 \cdot \sin im + re \cdot \left(\sin im + \color{blue}{\left(0.5 \cdot re\right) \cdot \sin im}\right) \]
      3. distribute-rgt1-in81.4%

        \[\leadsto 1 \cdot \sin im + re \cdot \color{blue}{\left(\left(0.5 \cdot re + 1\right) \cdot \sin im\right)} \]
      4. associate-*r*97.5%

        \[\leadsto 1 \cdot \sin im + \color{blue}{\left(re \cdot \left(0.5 \cdot re + 1\right)\right) \cdot \sin im} \]
      5. distribute-rgt-out97.5%

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left({re}^{2} \cdot \sin im\right)} \]
    7. Step-by-step derivation
      1. unpow297.5%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(re \cdot re\right)} \cdot \sin im\right) \]
      2. *-commutative97.5%

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

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

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

Alternative 7: 93.2% accurate, 1.7× speedup?

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

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

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

\mathbf{elif}\;re \leq 4 \cdot 10^{+214}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < -0.00309999999999999989 or 350 < re < 3.9999999999999998e214

    1. Initial program 100.0%

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

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

    if -0.00309999999999999989 < re < 350

    1. Initial program 100.0%

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

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

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

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

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

    if 3.9999999999999998e214 < re

    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 \left(e^{re} + -0.16666666666666666 \cdot \left({im}^{2} \cdot e^{re}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*0.0%

        \[\leadsto im \cdot \left(e^{re} + \color{blue}{\left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}}\right) \]
      2. *-lft-identity0.0%

        \[\leadsto im \cdot \left(\color{blue}{1 \cdot e^{re}} + \left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}\right) \]
      3. distribute-rgt-out88.9%

        \[\leadsto im \cdot \color{blue}{\left(e^{re} \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)} \]
      4. *-commutative88.9%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right)\right) \]
      5. unpow288.9%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right)\right) \]
      6. associate-*l*88.9%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right)\right) \]
    5. Simplified88.9%

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

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

        \[\leadsto im \cdot \left(1 + \left(\color{blue}{{im}^{2} \cdot -0.16666666666666666} + re \cdot \left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + 0.5 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right)\right)\right) \]
      2. unpow288.9%

        \[\leadsto im \cdot \left(1 + \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666 + re \cdot \left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + 0.5 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right)\right)\right) \]
      3. associate-*r*88.9%

        \[\leadsto im \cdot \left(1 + \left(\color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)} + re \cdot \left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + 0.5 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right)\right)\right) \]
      4. associate-+r+88.9%

        \[\leadsto im \cdot \color{blue}{\left(\left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + 0.5 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right)\right)} \]
      5. +-commutative88.9%

        \[\leadsto im \cdot \color{blue}{\left(re \cdot \left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + 0.5 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) + \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right)\right)} \]
    8. Simplified88.9%

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

      \[\leadsto \color{blue}{0.5 \cdot \left(im \cdot \left({re}^{2} \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)} \]
    10. Step-by-step derivation
      1. unpow288.9%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\color{blue}{\left(re \cdot re\right)} \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) \]
      2. *-commutative88.9%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\left(re \cdot re\right) \cdot \left(1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right)\right)\right) \]
      3. unpow288.9%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\left(re \cdot re\right) \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right)\right)\right) \]
      4. associate-*l*88.9%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\left(re \cdot re\right) \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right)\right)\right) \]
    11. Simplified88.9%

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

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

Alternative 8: 92.7% accurate, 1.7× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < -2.4499999999999999e-4 or 350 < re < 4.9999999999999995e211

    1. Initial program 100.0%

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

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

    if -2.4499999999999999e-4 < re < 350

    1. Initial program 100.0%

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

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

    if 4.9999999999999995e211 < re

    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 \left(e^{re} + -0.16666666666666666 \cdot \left({im}^{2} \cdot e^{re}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*0.0%

        \[\leadsto im \cdot \left(e^{re} + \color{blue}{\left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}}\right) \]
      2. *-lft-identity0.0%

        \[\leadsto im \cdot \left(\color{blue}{1 \cdot e^{re}} + \left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}\right) \]
      3. distribute-rgt-out88.9%

        \[\leadsto im \cdot \color{blue}{\left(e^{re} \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)} \]
      4. *-commutative88.9%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right)\right) \]
      5. unpow288.9%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right)\right) \]
      6. associate-*l*88.9%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right)\right) \]
    5. Simplified88.9%

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

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

        \[\leadsto im \cdot \left(1 + \left(\color{blue}{{im}^{2} \cdot -0.16666666666666666} + re \cdot \left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + 0.5 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right)\right)\right) \]
      2. unpow288.9%

        \[\leadsto im \cdot \left(1 + \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666 + re \cdot \left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + 0.5 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right)\right)\right) \]
      3. associate-*r*88.9%

        \[\leadsto im \cdot \left(1 + \left(\color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)} + re \cdot \left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + 0.5 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right)\right)\right) \]
      4. associate-+r+88.9%

        \[\leadsto im \cdot \color{blue}{\left(\left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + 0.5 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right)\right)} \]
      5. +-commutative88.9%

        \[\leadsto im \cdot \color{blue}{\left(re \cdot \left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + 0.5 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) + \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right)\right)} \]
    8. Simplified88.9%

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

      \[\leadsto \color{blue}{0.5 \cdot \left(im \cdot \left({re}^{2} \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)} \]
    10. Step-by-step derivation
      1. unpow288.9%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\color{blue}{\left(re \cdot re\right)} \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) \]
      2. *-commutative88.9%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\left(re \cdot re\right) \cdot \left(1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right)\right)\right) \]
      3. unpow288.9%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\left(re \cdot re\right) \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right)\right)\right) \]
      4. associate-*l*88.9%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\left(re \cdot re\right) \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right)\right)\right) \]
    11. Simplified88.9%

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

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

Alternative 9: 69.1% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;re \leq -2100000:\\
\;\;\;\;\left(1 + im \cdot \left(re + 1\right)\right) + -1\\

\mathbf{elif}\;re \leq 3.5 \cdot 10^{+52}:\\
\;\;\;\;\sin im\\

\mathbf{elif}\;re \leq 10^{+212}:\\
\;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(im \cdot 0.16666666666666666\right)\\

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


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

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

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

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

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

      \[\leadsto im + re \cdot \color{blue}{im} \]
    8. Step-by-step derivation
      1. expm1-log1p-u1.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(im + re \cdot im\right)\right)} \]
      2. expm1-undefine18.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(im + re \cdot im\right)} - 1} \]
      3. distribute-rgt1-in18.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(re + 1\right) \cdot im}\right)} - 1 \]
    9. Applied egg-rr18.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(re + 1\right) \cdot im\right)} - 1} \]
    10. Step-by-step derivation
      1. sub-neg18.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(re + 1\right) \cdot im\right)} + \left(-1\right)} \]
      2. log1p-undefine18.8%

        \[\leadsto e^{\color{blue}{\log \left(1 + \left(re + 1\right) \cdot im\right)}} + \left(-1\right) \]
      3. rem-exp-log19.6%

        \[\leadsto \color{blue}{\left(1 + \left(re + 1\right) \cdot im\right)} + \left(-1\right) \]
      4. *-commutative19.6%

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

        \[\leadsto \left(1 + im \cdot \color{blue}{\left(1 + re\right)}\right) + \left(-1\right) \]
      6. metadata-eval19.6%

        \[\leadsto \left(1 + im \cdot \left(1 + re\right)\right) + \color{blue}{-1} \]
    11. Simplified19.6%

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

    if -2.1e6 < re < 3.5e52

    1. Initial program 100.0%

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

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

    if 3.5e52 < re < 9.9999999999999991e211

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \left(\sin im + re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right)} \]
    4. Step-by-step derivation
      1. distribute-rgt-in61.5%

        \[\leadsto \sin im + \color{blue}{\left(\sin im \cdot re + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right)} \]
      2. *-commutative61.5%

        \[\leadsto \sin im + \left(\color{blue}{re \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right) \]
      3. associate-+r+61.5%

        \[\leadsto \color{blue}{\left(\sin im + re \cdot \sin im\right) + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re} \]
      4. distribute-rgt1-in61.5%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      5. *-commutative61.5%

        \[\leadsto \color{blue}{\sin im \cdot \left(re + 1\right)} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      6. *-commutative61.5%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right) \cdot re\right)} \cdot re \]
      7. associate-*l*61.5%

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

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(0.5 \cdot \sin im + 0.16666666666666666 \cdot \left(re \cdot \sin im\right)\right)} \cdot \left(re \cdot re\right) \]
      9. associate-*r*61.5%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \left(0.5 \cdot \sin im + \color{blue}{\left(0.16666666666666666 \cdot re\right) \cdot \sin im}\right) \cdot \left(re \cdot re\right) \]
      10. distribute-rgt-out61.5%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\sin im \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)} \cdot \left(re \cdot re\right) \]
      11. associate-*l*71.7%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\sin im \cdot \left(\left(0.5 + 0.16666666666666666 \cdot re\right) \cdot \left(re \cdot re\right)\right)} \]
      12. distribute-lft-out71.7%

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

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

      \[\leadsto \color{blue}{im \cdot \left(1 + \left(re + {re}^{2} \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\right)} \]
    7. Step-by-step derivation
      1. distribute-rgt-in65.7%

        \[\leadsto \color{blue}{1 \cdot im + \left(re + {re}^{2} \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right) \cdot im} \]
      2. *-rgt-identity65.7%

        \[\leadsto 1 \cdot im + \left(\color{blue}{re \cdot 1} + {re}^{2} \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right) \cdot im \]
      3. distribute-lft-in65.7%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \color{blue}{\left({re}^{2} \cdot 0.5 + {re}^{2} \cdot \left(0.16666666666666666 \cdot re\right)\right)}\right) \cdot im \]
      4. *-commutative65.7%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \left({re}^{2} \cdot 0.5 + {re}^{2} \cdot \color{blue}{\left(re \cdot 0.16666666666666666\right)}\right)\right) \cdot im \]
      5. distribute-lft-in65.7%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \color{blue}{{re}^{2} \cdot \left(0.5 + re \cdot 0.16666666666666666\right)}\right) \cdot im \]
      6. unpow265.7%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \color{blue}{\left(re \cdot re\right)} \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right) \cdot im \]
      7. associate-*l*65.7%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \color{blue}{re \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)}\right) \cdot im \]
      8. *-commutative65.7%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + re \cdot \left(re \cdot \left(0.5 + \color{blue}{0.16666666666666666 \cdot re}\right)\right)\right) \cdot im \]
      9. distribute-lft-in65.7%

        \[\leadsto 1 \cdot im + \color{blue}{\left(re \cdot \left(1 + re \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\right)} \cdot im \]
      10. distribute-rgt-in65.7%

        \[\leadsto \color{blue}{im \cdot \left(1 + re \cdot \left(1 + re \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\right)} \]
      11. *-commutative65.7%

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

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right)} \]
    10. Step-by-step derivation
      1. associate-*r*65.7%

        \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot im\right) \cdot {re}^{3}} \]
      2. *-commutative65.7%

        \[\leadsto \color{blue}{\left(im \cdot 0.16666666666666666\right)} \cdot {re}^{3} \]
      3. cube-unmult65.7%

        \[\leadsto \left(im \cdot 0.16666666666666666\right) \cdot \color{blue}{\left(re \cdot \left(re \cdot re\right)\right)} \]
    11. Simplified65.7%

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

    if 9.9999999999999991e211 < re

    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 \left(e^{re} + -0.16666666666666666 \cdot \left({im}^{2} \cdot e^{re}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*0.0%

        \[\leadsto im \cdot \left(e^{re} + \color{blue}{\left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}}\right) \]
      2. *-lft-identity0.0%

        \[\leadsto im \cdot \left(\color{blue}{1 \cdot e^{re}} + \left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}\right) \]
      3. distribute-rgt-out88.9%

        \[\leadsto im \cdot \color{blue}{\left(e^{re} \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)} \]
      4. *-commutative88.9%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right)\right) \]
      5. unpow288.9%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right)\right) \]
      6. associate-*l*88.9%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right)\right) \]
    5. Simplified88.9%

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

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

        \[\leadsto im \cdot \left(1 + \left(\color{blue}{{im}^{2} \cdot -0.16666666666666666} + re \cdot \left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + 0.5 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right)\right)\right) \]
      2. unpow288.9%

        \[\leadsto im \cdot \left(1 + \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666 + re \cdot \left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + 0.5 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right)\right)\right) \]
      3. associate-*r*88.9%

        \[\leadsto im \cdot \left(1 + \left(\color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)} + re \cdot \left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + 0.5 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right)\right)\right) \]
      4. associate-+r+88.9%

        \[\leadsto im \cdot \color{blue}{\left(\left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + 0.5 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right)\right)} \]
      5. +-commutative88.9%

        \[\leadsto im \cdot \color{blue}{\left(re \cdot \left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + 0.5 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) + \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right)\right)} \]
    8. Simplified88.9%

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

      \[\leadsto \color{blue}{0.5 \cdot \left(im \cdot \left({re}^{2} \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)} \]
    10. Step-by-step derivation
      1. unpow288.9%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\color{blue}{\left(re \cdot re\right)} \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) \]
      2. *-commutative88.9%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\left(re \cdot re\right) \cdot \left(1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right)\right)\right) \]
      3. unpow288.9%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\left(re \cdot re\right) \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right)\right)\right) \]
      4. associate-*l*88.9%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\left(re \cdot re\right) \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right)\right)\right) \]
    11. Simplified88.9%

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

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

Alternative 10: 43.2% accurate, 6.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -7 \cdot 10^{-16}:\\ \;\;\;\;\left(1 + im \cdot \left(re + 1\right)\right) + -1\\ \mathbf{elif}\;re \leq 1.5 \cdot 10^{+54} \lor \neg \left(re \leq 3.1 \cdot 10^{+231}\right) \land re \leq 2.4 \cdot 10^{+293}:\\ \;\;\;\;im \cdot \left(\left(re + 1\right) \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(im \cdot 0.16666666666666666\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re -7e-16)
   (+ (+ 1.0 (* im (+ re 1.0))) -1.0)
   (if (or (<= re 1.5e+54) (and (not (<= re 3.1e+231)) (<= re 2.4e+293)))
     (* im (* (+ re 1.0) (+ 1.0 (* im (* im -0.16666666666666666)))))
     (* (* re (* re re)) (* im 0.16666666666666666)))))
double code(double re, double im) {
	double tmp;
	if (re <= -7e-16) {
		tmp = (1.0 + (im * (re + 1.0))) + -1.0;
	} else if ((re <= 1.5e+54) || (!(re <= 3.1e+231) && (re <= 2.4e+293))) {
		tmp = im * ((re + 1.0) * (1.0 + (im * (im * -0.16666666666666666))));
	} else {
		tmp = (re * (re * re)) * (im * 0.16666666666666666);
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= (-7d-16)) then
        tmp = (1.0d0 + (im * (re + 1.0d0))) + (-1.0d0)
    else if ((re <= 1.5d+54) .or. (.not. (re <= 3.1d+231)) .and. (re <= 2.4d+293)) then
        tmp = im * ((re + 1.0d0) * (1.0d0 + (im * (im * (-0.16666666666666666d0)))))
    else
        tmp = (re * (re * re)) * (im * 0.16666666666666666d0)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= -7e-16) {
		tmp = (1.0 + (im * (re + 1.0))) + -1.0;
	} else if ((re <= 1.5e+54) || (!(re <= 3.1e+231) && (re <= 2.4e+293))) {
		tmp = im * ((re + 1.0) * (1.0 + (im * (im * -0.16666666666666666))));
	} else {
		tmp = (re * (re * re)) * (im * 0.16666666666666666);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= -7e-16:
		tmp = (1.0 + (im * (re + 1.0))) + -1.0
	elif (re <= 1.5e+54) or (not (re <= 3.1e+231) and (re <= 2.4e+293)):
		tmp = im * ((re + 1.0) * (1.0 + (im * (im * -0.16666666666666666))))
	else:
		tmp = (re * (re * re)) * (im * 0.16666666666666666)
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= -7e-16)
		tmp = Float64(Float64(1.0 + Float64(im * Float64(re + 1.0))) + -1.0);
	elseif ((re <= 1.5e+54) || (!(re <= 3.1e+231) && (re <= 2.4e+293)))
		tmp = Float64(im * Float64(Float64(re + 1.0) * Float64(1.0 + Float64(im * Float64(im * -0.16666666666666666)))));
	else
		tmp = Float64(Float64(re * Float64(re * re)) * Float64(im * 0.16666666666666666));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= -7e-16)
		tmp = (1.0 + (im * (re + 1.0))) + -1.0;
	elseif ((re <= 1.5e+54) || (~((re <= 3.1e+231)) && (re <= 2.4e+293)))
		tmp = im * ((re + 1.0) * (1.0 + (im * (im * -0.16666666666666666))));
	else
		tmp = (re * (re * re)) * (im * 0.16666666666666666);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, -7e-16], N[(N[(1.0 + N[(im * N[(re + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], If[Or[LessEqual[re, 1.5e+54], And[N[Not[LessEqual[re, 3.1e+231]], $MachinePrecision], LessEqual[re, 2.4e+293]]], N[(im * N[(N[(re + 1.0), $MachinePrecision] * N[(1.0 + N[(im * N[(im * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq -7 \cdot 10^{-16}:\\
\;\;\;\;\left(1 + im \cdot \left(re + 1\right)\right) + -1\\

\mathbf{elif}\;re \leq 1.5 \cdot 10^{+54} \lor \neg \left(re \leq 3.1 \cdot 10^{+231}\right) \land re \leq 2.4 \cdot 10^{+293}:\\
\;\;\;\;im \cdot \left(\left(re + 1\right) \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right)\right)\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto im + re \cdot \color{blue}{im} \]
    8. Step-by-step derivation
      1. expm1-log1p-u1.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(im + re \cdot im\right)\right)} \]
      2. expm1-undefine17.6%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(im + re \cdot im\right)} - 1} \]
      3. distribute-rgt1-in17.6%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(re + 1\right) \cdot im}\right)} - 1 \]
    9. Applied egg-rr17.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(re + 1\right) \cdot im\right)} - 1} \]
    10. Step-by-step derivation
      1. sub-neg17.6%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(re + 1\right) \cdot im\right)} + \left(-1\right)} \]
      2. log1p-undefine17.6%

        \[\leadsto e^{\color{blue}{\log \left(1 + \left(re + 1\right) \cdot im\right)}} + \left(-1\right) \]
      3. rem-exp-log18.4%

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

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

        \[\leadsto \left(1 + im \cdot \color{blue}{\left(1 + re\right)}\right) + \left(-1\right) \]
      6. metadata-eval18.4%

        \[\leadsto \left(1 + im \cdot \left(1 + re\right)\right) + \color{blue}{-1} \]
    11. Simplified18.4%

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

    if -7.00000000000000035e-16 < re < 1.4999999999999999e54 or 3.0999999999999999e231 < re < 2.40000000000000003e293

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot \left(e^{re} + -0.16666666666666666 \cdot \left({im}^{2} \cdot e^{re}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*40.5%

        \[\leadsto im \cdot \left(e^{re} + \color{blue}{\left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}}\right) \]
      2. *-lft-identity40.5%

        \[\leadsto im \cdot \left(\color{blue}{1 \cdot e^{re}} + \left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}\right) \]
      3. distribute-rgt-out55.6%

        \[\leadsto im \cdot \color{blue}{\left(e^{re} \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)} \]
      4. *-commutative55.6%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right)\right) \]
      5. unpow255.6%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right)\right) \]
      6. associate-*l*55.6%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right)\right) \]
    5. Simplified55.6%

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

      \[\leadsto im \cdot \color{blue}{\left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutative47.8%

        \[\leadsto im \cdot \left(1 + \left(\color{blue}{{im}^{2} \cdot -0.16666666666666666} + re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) \]
      2. unpow247.8%

        \[\leadsto im \cdot \left(1 + \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666 + re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) \]
      3. associate-*r*47.8%

        \[\leadsto im \cdot \left(1 + \left(\color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)} + re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) \]
      4. associate-+r+47.8%

        \[\leadsto im \cdot \color{blue}{\left(\left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)} \]
      5. *-commutative47.8%

        \[\leadsto im \cdot \left(\left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right)\right) \]
      6. unpow247.8%

        \[\leadsto im \cdot \left(\left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right)\right) \]
      7. associate-*r*47.8%

        \[\leadsto im \cdot \left(\left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right)\right) \]
      8. distribute-rgt1-in47.9%

        \[\leadsto im \cdot \color{blue}{\left(\left(re + 1\right) \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right)\right)} \]
    8. Simplified47.9%

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

    if 1.4999999999999999e54 < re < 3.0999999999999999e231 or 2.40000000000000003e293 < re

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \left(\sin im + re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right)} \]
    4. Step-by-step derivation
      1. distribute-rgt-in68.3%

        \[\leadsto \sin im + \color{blue}{\left(\sin im \cdot re + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right)} \]
      2. *-commutative68.3%

        \[\leadsto \sin im + \left(\color{blue}{re \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right) \]
      3. associate-+r+68.3%

        \[\leadsto \color{blue}{\left(\sin im + re \cdot \sin im\right) + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re} \]
      4. distribute-rgt1-in68.3%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      5. *-commutative68.3%

        \[\leadsto \color{blue}{\sin im \cdot \left(re + 1\right)} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      6. *-commutative68.3%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right) \cdot re\right)} \cdot re \]
      7. associate-*l*68.3%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right) \cdot \left(re \cdot re\right)} \]
      8. +-commutative68.3%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(0.5 \cdot \sin im + 0.16666666666666666 \cdot \left(re \cdot \sin im\right)\right)} \cdot \left(re \cdot re\right) \]
      9. associate-*r*68.3%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \left(0.5 \cdot \sin im + \color{blue}{\left(0.16666666666666666 \cdot re\right) \cdot \sin im}\right) \cdot \left(re \cdot re\right) \]
      10. distribute-rgt-out68.3%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\sin im \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)} \cdot \left(re \cdot re\right) \]
      11. associate-*l*76.8%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\sin im \cdot \left(\left(0.5 + 0.16666666666666666 \cdot re\right) \cdot \left(re \cdot re\right)\right)} \]
      12. distribute-lft-out76.8%

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

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

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

        \[\leadsto \color{blue}{1 \cdot im + \left(re + {re}^{2} \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right) \cdot im} \]
      2. *-rgt-identity69.6%

        \[\leadsto 1 \cdot im + \left(\color{blue}{re \cdot 1} + {re}^{2} \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right) \cdot im \]
      3. distribute-lft-in69.6%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \color{blue}{\left({re}^{2} \cdot 0.5 + {re}^{2} \cdot \left(0.16666666666666666 \cdot re\right)\right)}\right) \cdot im \]
      4. *-commutative69.6%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \left({re}^{2} \cdot 0.5 + {re}^{2} \cdot \color{blue}{\left(re \cdot 0.16666666666666666\right)}\right)\right) \cdot im \]
      5. distribute-lft-in69.6%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \color{blue}{{re}^{2} \cdot \left(0.5 + re \cdot 0.16666666666666666\right)}\right) \cdot im \]
      6. unpow269.6%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \color{blue}{\left(re \cdot re\right)} \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right) \cdot im \]
      7. associate-*l*69.6%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \color{blue}{re \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)}\right) \cdot im \]
      8. *-commutative69.6%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + re \cdot \left(re \cdot \left(0.5 + \color{blue}{0.16666666666666666 \cdot re}\right)\right)\right) \cdot im \]
      9. distribute-lft-in69.6%

        \[\leadsto 1 \cdot im + \color{blue}{\left(re \cdot \left(1 + re \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\right)} \cdot im \]
      10. distribute-rgt-in69.6%

        \[\leadsto \color{blue}{im \cdot \left(1 + re \cdot \left(1 + re \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\right)} \]
      11. *-commutative69.6%

        \[\leadsto im \cdot \left(1 + re \cdot \left(1 + re \cdot \left(0.5 + \color{blue}{re \cdot 0.16666666666666666}\right)\right)\right) \]
    8. Simplified69.6%

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right)} \]
    10. Step-by-step derivation
      1. associate-*r*69.6%

        \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot im\right) \cdot {re}^{3}} \]
      2. *-commutative69.6%

        \[\leadsto \color{blue}{\left(im \cdot 0.16666666666666666\right)} \cdot {re}^{3} \]
      3. cube-unmult69.6%

        \[\leadsto \left(im \cdot 0.16666666666666666\right) \cdot \color{blue}{\left(re \cdot \left(re \cdot re\right)\right)} \]
    11. Simplified69.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -7 \cdot 10^{-16}:\\ \;\;\;\;\left(1 + im \cdot \left(re + 1\right)\right) + -1\\ \mathbf{elif}\;re \leq 1.5 \cdot 10^{+54} \lor \neg \left(re \leq 3.1 \cdot 10^{+231}\right) \land re \leq 2.4 \cdot 10^{+293}:\\ \;\;\;\;im \cdot \left(\left(re + 1\right) \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(im \cdot 0.16666666666666666\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 43.4% accurate, 7.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.88:\\
\;\;\;\;\left(1 + im \cdot \left(re + 1\right)\right) + -1\\

\mathbf{elif}\;re \leq 3.1 \cdot 10^{+231}:\\
\;\;\;\;im \cdot \left(1 + re \cdot \left(1 + 0.16666666666666666 \cdot \left(re \cdot re\right)\right)\right)\\

\mathbf{elif}\;re \leq 2.4 \cdot 10^{+293}:\\
\;\;\;\;im \cdot \left(\left(re + 1\right) \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right)\right)\\

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


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

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

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

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

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

      \[\leadsto im + re \cdot \color{blue}{im} \]
    8. Step-by-step derivation
      1. expm1-log1p-u1.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(im + re \cdot im\right)\right)} \]
      2. expm1-undefine18.6%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(im + re \cdot im\right)} - 1} \]
      3. distribute-rgt1-in18.6%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(re + 1\right) \cdot im}\right)} - 1 \]
    9. Applied egg-rr18.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(re + 1\right) \cdot im\right)} - 1} \]
    10. Step-by-step derivation
      1. sub-neg18.6%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(re + 1\right) \cdot im\right)} + \left(-1\right)} \]
      2. log1p-undefine18.6%

        \[\leadsto e^{\color{blue}{\log \left(1 + \left(re + 1\right) \cdot im\right)}} + \left(-1\right) \]
      3. rem-exp-log19.3%

        \[\leadsto \color{blue}{\left(1 + \left(re + 1\right) \cdot im\right)} + \left(-1\right) \]
      4. *-commutative19.3%

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

        \[\leadsto \left(1 + im \cdot \color{blue}{\left(1 + re\right)}\right) + \left(-1\right) \]
      6. metadata-eval19.3%

        \[\leadsto \left(1 + im \cdot \left(1 + re\right)\right) + \color{blue}{-1} \]
    11. Simplified19.3%

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

    if -0.880000000000000004 < re < 3.0999999999999999e231

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \left(\sin im + re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right)} \]
    4. Step-by-step derivation
      1. distribute-rgt-in83.5%

        \[\leadsto \sin im + \color{blue}{\left(\sin im \cdot re + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right)} \]
      2. *-commutative83.5%

        \[\leadsto \sin im + \left(\color{blue}{re \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right) \]
      3. associate-+r+83.5%

        \[\leadsto \color{blue}{\left(\sin im + re \cdot \sin im\right) + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re} \]
      4. distribute-rgt1-in83.5%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      5. *-commutative83.5%

        \[\leadsto \color{blue}{\sin im \cdot \left(re + 1\right)} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      6. *-commutative83.5%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right) \cdot re\right)} \cdot re \]
      7. associate-*l*83.5%

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

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(0.5 \cdot \sin im + 0.16666666666666666 \cdot \left(re \cdot \sin im\right)\right)} \cdot \left(re \cdot re\right) \]
      9. associate-*r*83.5%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \left(0.5 \cdot \sin im + \color{blue}{\left(0.16666666666666666 \cdot re\right) \cdot \sin im}\right) \cdot \left(re \cdot re\right) \]
      10. distribute-rgt-out83.5%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\sin im \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)} \cdot \left(re \cdot re\right) \]
      11. associate-*l*85.7%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\sin im \cdot \left(\left(0.5 + 0.16666666666666666 \cdot re\right) \cdot \left(re \cdot re\right)\right)} \]
      12. distribute-lft-out85.7%

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

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

      \[\leadsto \sin im \cdot \left(\left(re + 1\right) + \color{blue}{0.16666666666666666 \cdot {re}^{3}}\right) \]
    7. Step-by-step derivation
      1. cube-mult85.5%

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

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

      \[\leadsto \color{blue}{im \cdot \left(1 + \left(re + 0.16666666666666666 \cdot {re}^{3}\right)\right)} \]
    10. Step-by-step derivation
      1. *-rgt-identity48.3%

        \[\leadsto im \cdot \left(1 + \left(\color{blue}{re \cdot 1} + 0.16666666666666666 \cdot {re}^{3}\right)\right) \]
      2. *-commutative48.3%

        \[\leadsto im \cdot \left(1 + \left(re \cdot 1 + \color{blue}{{re}^{3} \cdot 0.16666666666666666}\right)\right) \]
      3. cube-unmult48.3%

        \[\leadsto im \cdot \left(1 + \left(re \cdot 1 + \color{blue}{\left(re \cdot \left(re \cdot re\right)\right)} \cdot 0.16666666666666666\right)\right) \]
      4. unpow248.3%

        \[\leadsto im \cdot \left(1 + \left(re \cdot 1 + \left(re \cdot \color{blue}{{re}^{2}}\right) \cdot 0.16666666666666666\right)\right) \]
      5. associate-*l*48.3%

        \[\leadsto im \cdot \left(1 + \left(re \cdot 1 + \color{blue}{re \cdot \left({re}^{2} \cdot 0.16666666666666666\right)}\right)\right) \]
      6. *-commutative48.3%

        \[\leadsto im \cdot \left(1 + \left(re \cdot 1 + re \cdot \color{blue}{\left(0.16666666666666666 \cdot {re}^{2}\right)}\right)\right) \]
      7. distribute-lft-in48.3%

        \[\leadsto im \cdot \left(1 + \color{blue}{re \cdot \left(1 + 0.16666666666666666 \cdot {re}^{2}\right)}\right) \]
      8. unpow248.3%

        \[\leadsto im \cdot \left(1 + re \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(re \cdot re\right)}\right)\right) \]
    11. Simplified48.3%

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

    if 3.0999999999999999e231 < re < 2.40000000000000003e293

    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 \left(e^{re} + -0.16666666666666666 \cdot \left({im}^{2} \cdot e^{re}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*0.0%

        \[\leadsto im \cdot \left(e^{re} + \color{blue}{\left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}}\right) \]
      2. *-lft-identity0.0%

        \[\leadsto im \cdot \left(\color{blue}{1 \cdot e^{re}} + \left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}\right) \]
      3. distribute-rgt-out90.0%

        \[\leadsto im \cdot \color{blue}{\left(e^{re} \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)} \]
      4. *-commutative90.0%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right)\right) \]
      5. unpow290.0%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right)\right) \]
      6. associate-*l*90.0%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right)\right) \]
    5. Simplified90.0%

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

      \[\leadsto im \cdot \color{blue}{\left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutative71.0%

        \[\leadsto im \cdot \left(1 + \left(\color{blue}{{im}^{2} \cdot -0.16666666666666666} + re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) \]
      2. unpow271.0%

        \[\leadsto im \cdot \left(1 + \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666 + re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) \]
      3. associate-*r*71.0%

        \[\leadsto im \cdot \left(1 + \left(\color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)} + re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) \]
      4. associate-+r+71.0%

        \[\leadsto im \cdot \color{blue}{\left(\left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)} \]
      5. *-commutative71.0%

        \[\leadsto im \cdot \left(\left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right)\right) \]
      6. unpow271.0%

        \[\leadsto im \cdot \left(\left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right)\right) \]
      7. associate-*r*71.0%

        \[\leadsto im \cdot \left(\left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right)\right) \]
      8. distribute-rgt1-in71.0%

        \[\leadsto im \cdot \color{blue}{\left(\left(re + 1\right) \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right)\right)} \]
    8. Simplified71.0%

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

    if 2.40000000000000003e293 < re

    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 \left(\sin im + re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right)} \]
    4. Step-by-step derivation
      1. distribute-rgt-in100.0%

        \[\leadsto \sin im + \color{blue}{\left(\sin im \cdot re + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right)} \]
      2. *-commutative100.0%

        \[\leadsto \sin im + \left(\color{blue}{re \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right) \]
      3. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(\sin im + re \cdot \sin im\right) + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re} \]
      4. distribute-rgt1-in100.0%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      5. *-commutative100.0%

        \[\leadsto \color{blue}{\sin im \cdot \left(re + 1\right)} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      6. *-commutative100.0%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right) \cdot re\right)} \cdot re \]
      7. associate-*l*100.0%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right) \cdot \left(re \cdot re\right)} \]
      8. +-commutative100.0%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(0.5 \cdot \sin im + 0.16666666666666666 \cdot \left(re \cdot \sin im\right)\right)} \cdot \left(re \cdot re\right) \]
      9. associate-*r*100.0%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \left(0.5 \cdot \sin im + \color{blue}{\left(0.16666666666666666 \cdot re\right) \cdot \sin im}\right) \cdot \left(re \cdot re\right) \]
      10. distribute-rgt-out100.0%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\sin im \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)} \cdot \left(re \cdot re\right) \]
      11. associate-*l*100.0%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\sin im \cdot \left(\left(0.5 + 0.16666666666666666 \cdot re\right) \cdot \left(re \cdot re\right)\right)} \]
      12. distribute-lft-out100.0%

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

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

      \[\leadsto \color{blue}{im \cdot \left(1 + \left(re + {re}^{2} \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\right)} \]
    7. Step-by-step derivation
      1. distribute-rgt-in100.0%

        \[\leadsto \color{blue}{1 \cdot im + \left(re + {re}^{2} \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right) \cdot im} \]
      2. *-rgt-identity100.0%

        \[\leadsto 1 \cdot im + \left(\color{blue}{re \cdot 1} + {re}^{2} \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right) \cdot im \]
      3. distribute-lft-in100.0%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \color{blue}{\left({re}^{2} \cdot 0.5 + {re}^{2} \cdot \left(0.16666666666666666 \cdot re\right)\right)}\right) \cdot im \]
      4. *-commutative100.0%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \left({re}^{2} \cdot 0.5 + {re}^{2} \cdot \color{blue}{\left(re \cdot 0.16666666666666666\right)}\right)\right) \cdot im \]
      5. distribute-lft-in100.0%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \color{blue}{{re}^{2} \cdot \left(0.5 + re \cdot 0.16666666666666666\right)}\right) \cdot im \]
      6. unpow2100.0%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \color{blue}{\left(re \cdot re\right)} \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right) \cdot im \]
      7. associate-*l*100.0%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \color{blue}{re \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)}\right) \cdot im \]
      8. *-commutative100.0%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + re \cdot \left(re \cdot \left(0.5 + \color{blue}{0.16666666666666666 \cdot re}\right)\right)\right) \cdot im \]
      9. distribute-lft-in100.0%

        \[\leadsto 1 \cdot im + \color{blue}{\left(re \cdot \left(1 + re \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\right)} \cdot im \]
      10. distribute-rgt-in100.0%

        \[\leadsto \color{blue}{im \cdot \left(1 + re \cdot \left(1 + re \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\right)} \]
      11. *-commutative100.0%

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

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right)} \]
    10. Step-by-step derivation
      1. associate-*r*100.0%

        \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot im\right) \cdot {re}^{3}} \]
      2. *-commutative100.0%

        \[\leadsto \color{blue}{\left(im \cdot 0.16666666666666666\right)} \cdot {re}^{3} \]
      3. cube-unmult100.0%

        \[\leadsto \left(im \cdot 0.16666666666666666\right) \cdot \color{blue}{\left(re \cdot \left(re \cdot re\right)\right)} \]
    11. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -0.88:\\ \;\;\;\;\left(1 + im \cdot \left(re + 1\right)\right) + -1\\ \mathbf{elif}\;re \leq 3.1 \cdot 10^{+231}:\\ \;\;\;\;im \cdot \left(1 + re \cdot \left(1 + 0.16666666666666666 \cdot \left(re \cdot re\right)\right)\right)\\ \mathbf{elif}\;re \leq 2.4 \cdot 10^{+293}:\\ \;\;\;\;im \cdot \left(\left(re + 1\right) \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(im \cdot 0.16666666666666666\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 45.8% accurate, 8.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.88:\\
\;\;\;\;\left(1 + im \cdot \left(re + 1\right)\right) + -1\\

\mathbf{elif}\;re \leq 2 \cdot 10^{+214}:\\
\;\;\;\;im \cdot \left(1 + re \cdot \left(1 + 0.16666666666666666 \cdot \left(re \cdot re\right)\right)\right)\\

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


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

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

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

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

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

      \[\leadsto im + re \cdot \color{blue}{im} \]
    8. Step-by-step derivation
      1. expm1-log1p-u1.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(im + re \cdot im\right)\right)} \]
      2. expm1-undefine18.6%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(im + re \cdot im\right)} - 1} \]
      3. distribute-rgt1-in18.6%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(re + 1\right) \cdot im}\right)} - 1 \]
    9. Applied egg-rr18.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(re + 1\right) \cdot im\right)} - 1} \]
    10. Step-by-step derivation
      1. sub-neg18.6%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(re + 1\right) \cdot im\right)} + \left(-1\right)} \]
      2. log1p-undefine18.6%

        \[\leadsto e^{\color{blue}{\log \left(1 + \left(re + 1\right) \cdot im\right)}} + \left(-1\right) \]
      3. rem-exp-log19.3%

        \[\leadsto \color{blue}{\left(1 + \left(re + 1\right) \cdot im\right)} + \left(-1\right) \]
      4. *-commutative19.3%

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

        \[\leadsto \left(1 + im \cdot \color{blue}{\left(1 + re\right)}\right) + \left(-1\right) \]
      6. metadata-eval19.3%

        \[\leadsto \left(1 + im \cdot \left(1 + re\right)\right) + \color{blue}{-1} \]
    11. Simplified19.3%

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

    if -0.880000000000000004 < re < 1.9999999999999999e214

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \left(\sin im + re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right)} \]
    4. Step-by-step derivation
      1. distribute-rgt-in83.1%

        \[\leadsto \sin im + \color{blue}{\left(\sin im \cdot re + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right)} \]
      2. *-commutative83.1%

        \[\leadsto \sin im + \left(\color{blue}{re \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right) \]
      3. associate-+r+83.1%

        \[\leadsto \color{blue}{\left(\sin im + re \cdot \sin im\right) + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re} \]
      4. distribute-rgt1-in83.1%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      5. *-commutative83.1%

        \[\leadsto \color{blue}{\sin im \cdot \left(re + 1\right)} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      6. *-commutative83.1%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right) \cdot re\right)} \cdot re \]
      7. associate-*l*83.1%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right) \cdot \left(re \cdot re\right)} \]
      8. +-commutative83.1%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(0.5 \cdot \sin im + 0.16666666666666666 \cdot \left(re \cdot \sin im\right)\right)} \cdot \left(re \cdot re\right) \]
      9. associate-*r*83.1%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \left(0.5 \cdot \sin im + \color{blue}{\left(0.16666666666666666 \cdot re\right) \cdot \sin im}\right) \cdot \left(re \cdot re\right) \]
      10. distribute-rgt-out83.1%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\sin im \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)} \cdot \left(re \cdot re\right) \]
      11. associate-*l*85.4%

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

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

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

      \[\leadsto \sin im \cdot \left(\left(re + 1\right) + \color{blue}{0.16666666666666666 \cdot {re}^{3}}\right) \]
    7. Step-by-step derivation
      1. cube-mult85.1%

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

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

      \[\leadsto \color{blue}{im \cdot \left(1 + \left(re + 0.16666666666666666 \cdot {re}^{3}\right)\right)} \]
    10. Step-by-step derivation
      1. *-rgt-identity47.6%

        \[\leadsto im \cdot \left(1 + \left(\color{blue}{re \cdot 1} + 0.16666666666666666 \cdot {re}^{3}\right)\right) \]
      2. *-commutative47.6%

        \[\leadsto im \cdot \left(1 + \left(re \cdot 1 + \color{blue}{{re}^{3} \cdot 0.16666666666666666}\right)\right) \]
      3. cube-unmult47.6%

        \[\leadsto im \cdot \left(1 + \left(re \cdot 1 + \color{blue}{\left(re \cdot \left(re \cdot re\right)\right)} \cdot 0.16666666666666666\right)\right) \]
      4. unpow247.6%

        \[\leadsto im \cdot \left(1 + \left(re \cdot 1 + \left(re \cdot \color{blue}{{re}^{2}}\right) \cdot 0.16666666666666666\right)\right) \]
      5. associate-*l*47.6%

        \[\leadsto im \cdot \left(1 + \left(re \cdot 1 + \color{blue}{re \cdot \left({re}^{2} \cdot 0.16666666666666666\right)}\right)\right) \]
      6. *-commutative47.6%

        \[\leadsto im \cdot \left(1 + \left(re \cdot 1 + re \cdot \color{blue}{\left(0.16666666666666666 \cdot {re}^{2}\right)}\right)\right) \]
      7. distribute-lft-in47.6%

        \[\leadsto im \cdot \left(1 + \color{blue}{re \cdot \left(1 + 0.16666666666666666 \cdot {re}^{2}\right)}\right) \]
      8. unpow247.6%

        \[\leadsto im \cdot \left(1 + re \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(re \cdot re\right)}\right)\right) \]
    11. Simplified47.6%

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

    if 1.9999999999999999e214 < re

    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 \left(e^{re} + -0.16666666666666666 \cdot \left({im}^{2} \cdot e^{re}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*0.0%

        \[\leadsto im \cdot \left(e^{re} + \color{blue}{\left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}}\right) \]
      2. *-lft-identity0.0%

        \[\leadsto im \cdot \left(\color{blue}{1 \cdot e^{re}} + \left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}\right) \]
      3. distribute-rgt-out88.9%

        \[\leadsto im \cdot \color{blue}{\left(e^{re} \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)} \]
      4. *-commutative88.9%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right)\right) \]
      5. unpow288.9%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right)\right) \]
      6. associate-*l*88.9%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right)\right) \]
    5. Simplified88.9%

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

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

        \[\leadsto im \cdot \left(1 + \left(\color{blue}{{im}^{2} \cdot -0.16666666666666666} + re \cdot \left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + 0.5 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right)\right)\right) \]
      2. unpow288.9%

        \[\leadsto im \cdot \left(1 + \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666 + re \cdot \left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + 0.5 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right)\right)\right) \]
      3. associate-*r*88.9%

        \[\leadsto im \cdot \left(1 + \left(\color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)} + re \cdot \left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + 0.5 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right)\right)\right) \]
      4. associate-+r+88.9%

        \[\leadsto im \cdot \color{blue}{\left(\left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + 0.5 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right)\right)} \]
      5. +-commutative88.9%

        \[\leadsto im \cdot \color{blue}{\left(re \cdot \left(1 + \left(-0.16666666666666666 \cdot {im}^{2} + 0.5 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) + \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right)\right)} \]
    8. Simplified88.9%

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

      \[\leadsto \color{blue}{0.5 \cdot \left(im \cdot \left({re}^{2} \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)} \]
    10. Step-by-step derivation
      1. unpow288.9%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\color{blue}{\left(re \cdot re\right)} \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) \]
      2. *-commutative88.9%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\left(re \cdot re\right) \cdot \left(1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right)\right)\right) \]
      3. unpow288.9%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\left(re \cdot re\right) \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right)\right)\right) \]
      4. associate-*l*88.9%

        \[\leadsto 0.5 \cdot \left(im \cdot \left(\left(re \cdot re\right) \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right)\right)\right) \]
    11. Simplified88.9%

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

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

Alternative 13: 45.4% accurate, 10.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;re \leq -7 \cdot 10^{-16}:\\
\;\;\;\;\left(1 + im \cdot \left(re + 1\right)\right) + -1\\

\mathbf{elif}\;re \leq 3 \cdot 10^{+55}:\\
\;\;\;\;im \cdot \left(1 + -0.16666666666666666 \cdot \left(im \cdot im\right)\right)\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto im + re \cdot \color{blue}{im} \]
    8. Step-by-step derivation
      1. expm1-log1p-u1.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(im + re \cdot im\right)\right)} \]
      2. expm1-undefine17.6%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(im + re \cdot im\right)} - 1} \]
      3. distribute-rgt1-in17.6%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(re + 1\right) \cdot im}\right)} - 1 \]
    9. Applied egg-rr17.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(re + 1\right) \cdot im\right)} - 1} \]
    10. Step-by-step derivation
      1. sub-neg17.6%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(re + 1\right) \cdot im\right)} + \left(-1\right)} \]
      2. log1p-undefine17.6%

        \[\leadsto e^{\color{blue}{\log \left(1 + \left(re + 1\right) \cdot im\right)}} + \left(-1\right) \]
      3. rem-exp-log18.4%

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

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

        \[\leadsto \left(1 + im \cdot \color{blue}{\left(1 + re\right)}\right) + \left(-1\right) \]
      6. metadata-eval18.4%

        \[\leadsto \left(1 + im \cdot \left(1 + re\right)\right) + \color{blue}{-1} \]
    11. Simplified18.4%

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

    if -7.00000000000000035e-16 < re < 3.00000000000000017e55

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot \left(e^{re} + -0.16666666666666666 \cdot \left({im}^{2} \cdot e^{re}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*43.6%

        \[\leadsto im \cdot \left(e^{re} + \color{blue}{\left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}}\right) \]
      2. *-lft-identity43.6%

        \[\leadsto im \cdot \left(\color{blue}{1 \cdot e^{re}} + \left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}\right) \]
      3. distribute-rgt-out52.9%

        \[\leadsto im \cdot \color{blue}{\left(e^{re} \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)} \]
      4. *-commutative52.9%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right)\right) \]
      5. unpow252.9%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right)\right) \]
      6. associate-*l*52.9%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right)\right) \]
    5. Simplified52.9%

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

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

        \[\leadsto \color{blue}{\left(1 + -0.16666666666666666 \cdot {im}^{2}\right) \cdot im} + re \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
      2. *-commutative45.9%

        \[\leadsto \left(1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right) \cdot im + re \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
      3. unpow245.9%

        \[\leadsto \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right) \cdot im + re \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
      4. associate-*r*45.9%

        \[\leadsto \left(1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right) \cdot im + re \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
      5. *-commutative45.9%

        \[\leadsto \color{blue}{im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right)} + re \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
      6. distribute-lft-in45.9%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\color{blue}{\left(im \cdot 1 + im \cdot \left(-0.16666666666666666 \cdot {im}^{2}\right)\right)} + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
      7. *-commutative45.9%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot 1 + im \cdot \color{blue}{\left({im}^{2} \cdot -0.16666666666666666\right)}\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
      8. unpow245.9%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot 1 + im \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right)\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
      9. associate-*r*45.9%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot 1 + im \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.16666666666666666\right)\right)}\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
      10. distribute-lft-in45.9%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\color{blue}{im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right)} + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
    8. Simplified45.9%

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

      \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \color{blue}{\left({im}^{3} \cdot \left(\left(-0.027777777777777776 \cdot re + \left(0.16666666666666666 \cdot \frac{re}{{im}^{2}} + 0.5 \cdot \frac{1}{{im}^{2}}\right)\right) - 0.08333333333333333\right)\right)}\right) \]
    10. Step-by-step derivation
      1. cube-mult26.4%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot \left(\left(-0.027777777777777776 \cdot re + \left(0.16666666666666666 \cdot \frac{re}{{im}^{2}} + 0.5 \cdot \frac{1}{{im}^{2}}\right)\right) - 0.08333333333333333\right)\right)\right) \]
      2. sub-neg26.4%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(\left(-0.027777777777777776 \cdot re + \left(0.16666666666666666 \cdot \frac{re}{{im}^{2}} + 0.5 \cdot \frac{1}{{im}^{2}}\right)\right) + \left(-0.08333333333333333\right)\right)}\right)\right) \]
      3. +-commutative26.4%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\color{blue}{\left(\left(0.16666666666666666 \cdot \frac{re}{{im}^{2}} + 0.5 \cdot \frac{1}{{im}^{2}}\right) + -0.027777777777777776 \cdot re\right)} + \left(-0.08333333333333333\right)\right)\right)\right) \]
      4. associate-+l+26.4%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(\left(0.16666666666666666 \cdot \frac{re}{{im}^{2}} + 0.5 \cdot \frac{1}{{im}^{2}}\right) + \left(-0.027777777777777776 \cdot re + \left(-0.08333333333333333\right)\right)\right)}\right)\right) \]
      5. unpow226.4%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.16666666666666666 \cdot \frac{re}{\color{blue}{im \cdot im}} + 0.5 \cdot \frac{1}{{im}^{2}}\right) + \left(-0.027777777777777776 \cdot re + \left(-0.08333333333333333\right)\right)\right)\right)\right) \]
      6. associate-*r/26.4%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.16666666666666666 \cdot \frac{re}{im \cdot im} + \color{blue}{\frac{0.5 \cdot 1}{{im}^{2}}}\right) + \left(-0.027777777777777776 \cdot re + \left(-0.08333333333333333\right)\right)\right)\right)\right) \]
      7. metadata-eval26.4%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.16666666666666666 \cdot \frac{re}{im \cdot im} + \frac{\color{blue}{0.5}}{{im}^{2}}\right) + \left(-0.027777777777777776 \cdot re + \left(-0.08333333333333333\right)\right)\right)\right)\right) \]
      8. unpow226.4%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.16666666666666666 \cdot \frac{re}{im \cdot im} + \frac{0.5}{\color{blue}{im \cdot im}}\right) + \left(-0.027777777777777776 \cdot re + \left(-0.08333333333333333\right)\right)\right)\right)\right) \]
      9. *-commutative26.4%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.16666666666666666 \cdot \frac{re}{im \cdot im} + \frac{0.5}{im \cdot im}\right) + \left(\color{blue}{re \cdot -0.027777777777777776} + \left(-0.08333333333333333\right)\right)\right)\right)\right) \]
      10. metadata-eval26.4%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.16666666666666666 \cdot \frac{re}{im \cdot im} + \frac{0.5}{im \cdot im}\right) + \left(re \cdot -0.027777777777777776 + \color{blue}{-0.08333333333333333}\right)\right)\right)\right) \]
    11. Simplified26.4%

      \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \color{blue}{\left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.16666666666666666 \cdot \frac{re}{im \cdot im} + \frac{0.5}{im \cdot im}\right) + \left(re \cdot -0.027777777777777776 + -0.08333333333333333\right)\right)\right)}\right) \]
    12. Taylor expanded in re around 0 46.1%

      \[\leadsto \color{blue}{im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)} \]
    13. Step-by-step derivation
      1. unpow246.1%

        \[\leadsto im \cdot \left(1 + -0.16666666666666666 \cdot \color{blue}{\left(im \cdot im\right)}\right) \]
    14. Simplified46.1%

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

    if 3.00000000000000017e55 < re

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \left(\sin im + re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right)} \]
    4. Step-by-step derivation
      1. distribute-rgt-in74.1%

        \[\leadsto \sin im + \color{blue}{\left(\sin im \cdot re + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right)} \]
      2. *-commutative74.1%

        \[\leadsto \sin im + \left(\color{blue}{re \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right) \]
      3. associate-+r+74.1%

        \[\leadsto \color{blue}{\left(\sin im + re \cdot \sin im\right) + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re} \]
      4. distribute-rgt1-in74.1%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      5. *-commutative74.1%

        \[\leadsto \color{blue}{\sin im \cdot \left(re + 1\right)} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      6. *-commutative74.1%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right) \cdot re\right)} \cdot re \]
      7. associate-*l*74.1%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right) \cdot \left(re \cdot re\right)} \]
      8. +-commutative74.1%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(0.5 \cdot \sin im + 0.16666666666666666 \cdot \left(re \cdot \sin im\right)\right)} \cdot \left(re \cdot re\right) \]
      9. associate-*r*74.1%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \left(0.5 \cdot \sin im + \color{blue}{\left(0.16666666666666666 \cdot re\right) \cdot \sin im}\right) \cdot \left(re \cdot re\right) \]
      10. distribute-rgt-out74.1%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\sin im \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)} \cdot \left(re \cdot re\right) \]
      11. associate-*l*81.0%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\sin im \cdot \left(\left(0.5 + 0.16666666666666666 \cdot re\right) \cdot \left(re \cdot re\right)\right)} \]
      12. distribute-lft-out81.0%

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

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

      \[\leadsto \color{blue}{im \cdot \left(1 + \left(re + {re}^{2} \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\right)} \]
    7. Step-by-step derivation
      1. distribute-rgt-in62.4%

        \[\leadsto \color{blue}{1 \cdot im + \left(re + {re}^{2} \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right) \cdot im} \]
      2. *-rgt-identity62.4%

        \[\leadsto 1 \cdot im + \left(\color{blue}{re \cdot 1} + {re}^{2} \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right) \cdot im \]
      3. distribute-lft-in62.4%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \color{blue}{\left({re}^{2} \cdot 0.5 + {re}^{2} \cdot \left(0.16666666666666666 \cdot re\right)\right)}\right) \cdot im \]
      4. *-commutative62.4%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \left({re}^{2} \cdot 0.5 + {re}^{2} \cdot \color{blue}{\left(re \cdot 0.16666666666666666\right)}\right)\right) \cdot im \]
      5. distribute-lft-in62.4%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \color{blue}{{re}^{2} \cdot \left(0.5 + re \cdot 0.16666666666666666\right)}\right) \cdot im \]
      6. unpow262.4%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \color{blue}{\left(re \cdot re\right)} \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right) \cdot im \]
      7. associate-*l*62.4%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \color{blue}{re \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)}\right) \cdot im \]
      8. *-commutative62.4%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + re \cdot \left(re \cdot \left(0.5 + \color{blue}{0.16666666666666666 \cdot re}\right)\right)\right) \cdot im \]
      9. distribute-lft-in62.4%

        \[\leadsto 1 \cdot im + \color{blue}{\left(re \cdot \left(1 + re \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\right)} \cdot im \]
      10. distribute-rgt-in62.4%

        \[\leadsto \color{blue}{im \cdot \left(1 + re \cdot \left(1 + re \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\right)} \]
      11. *-commutative62.4%

        \[\leadsto im \cdot \left(1 + re \cdot \left(1 + re \cdot \left(0.5 + \color{blue}{re \cdot 0.16666666666666666}\right)\right)\right) \]
    8. Simplified62.4%

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right)} \]
    10. Step-by-step derivation
      1. associate-*r*62.4%

        \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot im\right) \cdot {re}^{3}} \]
      2. *-commutative62.4%

        \[\leadsto \color{blue}{\left(im \cdot 0.16666666666666666\right)} \cdot {re}^{3} \]
      3. cube-unmult62.4%

        \[\leadsto \left(im \cdot 0.16666666666666666\right) \cdot \color{blue}{\left(re \cdot \left(re \cdot re\right)\right)} \]
    11. Simplified62.4%

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

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

Alternative 14: 40.6% accurate, 14.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.1 \cdot 10^{+55}:\\
\;\;\;\;im \cdot \left(1 + -0.16666666666666666 \cdot \left(im \cdot im\right)\right)\\

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


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

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{im \cdot \left(e^{re} + -0.16666666666666666 \cdot \left({im}^{2} \cdot e^{re}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*48.9%

        \[\leadsto im \cdot \left(e^{re} + \color{blue}{\left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}}\right) \]
      2. *-lft-identity48.9%

        \[\leadsto im \cdot \left(\color{blue}{1 \cdot e^{re}} + \left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}\right) \]
      3. distribute-rgt-out54.9%

        \[\leadsto im \cdot \color{blue}{\left(e^{re} \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)} \]
      4. *-commutative54.9%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right)\right) \]
      5. unpow254.9%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right)\right) \]
      6. associate-*l*55.4%

        \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right)\right) \]
    5. Simplified55.4%

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

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

        \[\leadsto \color{blue}{\left(1 + -0.16666666666666666 \cdot {im}^{2}\right) \cdot im} + re \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
      2. *-commutative29.8%

        \[\leadsto \left(1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right) \cdot im + re \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
      3. unpow229.8%

        \[\leadsto \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right) \cdot im + re \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
      4. associate-*r*29.8%

        \[\leadsto \left(1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right) \cdot im + re \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
      5. *-commutative29.8%

        \[\leadsto \color{blue}{im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right)} + re \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
      6. distribute-lft-in29.8%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\color{blue}{\left(im \cdot 1 + im \cdot \left(-0.16666666666666666 \cdot {im}^{2}\right)\right)} + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
      7. *-commutative29.8%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot 1 + im \cdot \color{blue}{\left({im}^{2} \cdot -0.16666666666666666\right)}\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
      8. unpow229.8%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot 1 + im \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right)\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
      9. associate-*r*29.8%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot 1 + im \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.16666666666666666\right)\right)}\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
      10. distribute-lft-in29.8%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\color{blue}{im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right)} + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
    8. Simplified29.8%

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

      \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \color{blue}{\left({im}^{3} \cdot \left(\left(-0.027777777777777776 \cdot re + \left(0.16666666666666666 \cdot \frac{re}{{im}^{2}} + 0.5 \cdot \frac{1}{{im}^{2}}\right)\right) - 0.08333333333333333\right)\right)}\right) \]
    10. Step-by-step derivation
      1. cube-mult17.1%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot \left(\left(-0.027777777777777776 \cdot re + \left(0.16666666666666666 \cdot \frac{re}{{im}^{2}} + 0.5 \cdot \frac{1}{{im}^{2}}\right)\right) - 0.08333333333333333\right)\right)\right) \]
      2. sub-neg17.1%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(\left(-0.027777777777777776 \cdot re + \left(0.16666666666666666 \cdot \frac{re}{{im}^{2}} + 0.5 \cdot \frac{1}{{im}^{2}}\right)\right) + \left(-0.08333333333333333\right)\right)}\right)\right) \]
      3. +-commutative17.1%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\color{blue}{\left(\left(0.16666666666666666 \cdot \frac{re}{{im}^{2}} + 0.5 \cdot \frac{1}{{im}^{2}}\right) + -0.027777777777777776 \cdot re\right)} + \left(-0.08333333333333333\right)\right)\right)\right) \]
      4. associate-+l+17.1%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(\left(0.16666666666666666 \cdot \frac{re}{{im}^{2}} + 0.5 \cdot \frac{1}{{im}^{2}}\right) + \left(-0.027777777777777776 \cdot re + \left(-0.08333333333333333\right)\right)\right)}\right)\right) \]
      5. unpow217.1%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.16666666666666666 \cdot \frac{re}{\color{blue}{im \cdot im}} + 0.5 \cdot \frac{1}{{im}^{2}}\right) + \left(-0.027777777777777776 \cdot re + \left(-0.08333333333333333\right)\right)\right)\right)\right) \]
      6. associate-*r/17.1%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.16666666666666666 \cdot \frac{re}{im \cdot im} + \color{blue}{\frac{0.5 \cdot 1}{{im}^{2}}}\right) + \left(-0.027777777777777776 \cdot re + \left(-0.08333333333333333\right)\right)\right)\right)\right) \]
      7. metadata-eval17.1%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.16666666666666666 \cdot \frac{re}{im \cdot im} + \frac{\color{blue}{0.5}}{{im}^{2}}\right) + \left(-0.027777777777777776 \cdot re + \left(-0.08333333333333333\right)\right)\right)\right)\right) \]
      8. unpow217.1%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.16666666666666666 \cdot \frac{re}{im \cdot im} + \frac{0.5}{\color{blue}{im \cdot im}}\right) + \left(-0.027777777777777776 \cdot re + \left(-0.08333333333333333\right)\right)\right)\right)\right) \]
      9. *-commutative17.1%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.16666666666666666 \cdot \frac{re}{im \cdot im} + \frac{0.5}{im \cdot im}\right) + \left(\color{blue}{re \cdot -0.027777777777777776} + \left(-0.08333333333333333\right)\right)\right)\right)\right) \]
      10. metadata-eval17.1%

        \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.16666666666666666 \cdot \frac{re}{im \cdot im} + \frac{0.5}{im \cdot im}\right) + \left(re \cdot -0.027777777777777776 + \color{blue}{-0.08333333333333333}\right)\right)\right)\right) \]
    11. Simplified17.1%

      \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \color{blue}{\left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.16666666666666666 \cdot \frac{re}{im \cdot im} + \frac{0.5}{im \cdot im}\right) + \left(re \cdot -0.027777777777777776 + -0.08333333333333333\right)\right)\right)}\right) \]
    12. Taylor expanded in re around 0 30.8%

      \[\leadsto \color{blue}{im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)} \]
    13. Step-by-step derivation
      1. unpow230.8%

        \[\leadsto im \cdot \left(1 + -0.16666666666666666 \cdot \color{blue}{\left(im \cdot im\right)}\right) \]
    14. Simplified30.8%

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

    if 1.10000000000000005e55 < re

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\sin im + re \cdot \left(\sin im + re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right)} \]
    4. Step-by-step derivation
      1. distribute-rgt-in74.1%

        \[\leadsto \sin im + \color{blue}{\left(\sin im \cdot re + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right)} \]
      2. *-commutative74.1%

        \[\leadsto \sin im + \left(\color{blue}{re \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re\right) \]
      3. associate-+r+74.1%

        \[\leadsto \color{blue}{\left(\sin im + re \cdot \sin im\right) + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re} \]
      4. distribute-rgt1-in74.1%

        \[\leadsto \color{blue}{\left(re + 1\right) \cdot \sin im} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      5. *-commutative74.1%

        \[\leadsto \color{blue}{\sin im \cdot \left(re + 1\right)} + \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right)\right) \cdot re \]
      6. *-commutative74.1%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right) \cdot re\right)} \cdot re \]
      7. associate-*l*74.1%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(0.16666666666666666 \cdot \left(re \cdot \sin im\right) + 0.5 \cdot \sin im\right) \cdot \left(re \cdot re\right)} \]
      8. +-commutative74.1%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(0.5 \cdot \sin im + 0.16666666666666666 \cdot \left(re \cdot \sin im\right)\right)} \cdot \left(re \cdot re\right) \]
      9. associate-*r*74.1%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \left(0.5 \cdot \sin im + \color{blue}{\left(0.16666666666666666 \cdot re\right) \cdot \sin im}\right) \cdot \left(re \cdot re\right) \]
      10. distribute-rgt-out74.1%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\left(\sin im \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)} \cdot \left(re \cdot re\right) \]
      11. associate-*l*81.0%

        \[\leadsto \sin im \cdot \left(re + 1\right) + \color{blue}{\sin im \cdot \left(\left(0.5 + 0.16666666666666666 \cdot re\right) \cdot \left(re \cdot re\right)\right)} \]
      12. distribute-lft-out81.0%

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

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

      \[\leadsto \color{blue}{im \cdot \left(1 + \left(re + {re}^{2} \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\right)} \]
    7. Step-by-step derivation
      1. distribute-rgt-in62.4%

        \[\leadsto \color{blue}{1 \cdot im + \left(re + {re}^{2} \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right) \cdot im} \]
      2. *-rgt-identity62.4%

        \[\leadsto 1 \cdot im + \left(\color{blue}{re \cdot 1} + {re}^{2} \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right) \cdot im \]
      3. distribute-lft-in62.4%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \color{blue}{\left({re}^{2} \cdot 0.5 + {re}^{2} \cdot \left(0.16666666666666666 \cdot re\right)\right)}\right) \cdot im \]
      4. *-commutative62.4%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \left({re}^{2} \cdot 0.5 + {re}^{2} \cdot \color{blue}{\left(re \cdot 0.16666666666666666\right)}\right)\right) \cdot im \]
      5. distribute-lft-in62.4%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \color{blue}{{re}^{2} \cdot \left(0.5 + re \cdot 0.16666666666666666\right)}\right) \cdot im \]
      6. unpow262.4%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \color{blue}{\left(re \cdot re\right)} \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right) \cdot im \]
      7. associate-*l*62.4%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + \color{blue}{re \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)}\right) \cdot im \]
      8. *-commutative62.4%

        \[\leadsto 1 \cdot im + \left(re \cdot 1 + re \cdot \left(re \cdot \left(0.5 + \color{blue}{0.16666666666666666 \cdot re}\right)\right)\right) \cdot im \]
      9. distribute-lft-in62.4%

        \[\leadsto 1 \cdot im + \color{blue}{\left(re \cdot \left(1 + re \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\right)} \cdot im \]
      10. distribute-rgt-in62.4%

        \[\leadsto \color{blue}{im \cdot \left(1 + re \cdot \left(1 + re \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\right)} \]
      11. *-commutative62.4%

        \[\leadsto im \cdot \left(1 + re \cdot \left(1 + re \cdot \left(0.5 + \color{blue}{re \cdot 0.16666666666666666}\right)\right)\right) \]
    8. Simplified62.4%

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right)} \]
    10. Step-by-step derivation
      1. associate-*r*62.4%

        \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot im\right) \cdot {re}^{3}} \]
      2. *-commutative62.4%

        \[\leadsto \color{blue}{\left(im \cdot 0.16666666666666666\right)} \cdot {re}^{3} \]
      3. cube-unmult62.4%

        \[\leadsto \left(im \cdot 0.16666666666666666\right) \cdot \color{blue}{\left(re \cdot \left(re \cdot re\right)\right)} \]
    11. Simplified62.4%

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

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

Alternative 15: 30.3% accurate, 22.6× speedup?

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

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

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

    \[\leadsto \color{blue}{im \cdot \left(e^{re} + -0.16666666666666666 \cdot \left({im}^{2} \cdot e^{re}\right)\right)} \]
  4. Step-by-step derivation
    1. associate-*r*38.4%

      \[\leadsto im \cdot \left(e^{re} + \color{blue}{\left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}}\right) \]
    2. *-lft-identity38.4%

      \[\leadsto im \cdot \left(\color{blue}{1 \cdot e^{re}} + \left(-0.16666666666666666 \cdot {im}^{2}\right) \cdot e^{re}\right) \]
    3. distribute-rgt-out58.7%

      \[\leadsto im \cdot \color{blue}{\left(e^{re} \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)} \]
    4. *-commutative58.7%

      \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right)\right) \]
    5. unpow258.7%

      \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right)\right) \]
    6. associate-*l*59.1%

      \[\leadsto im \cdot \left(e^{re} \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right)\right) \]
  5. Simplified59.1%

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

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

      \[\leadsto \color{blue}{\left(1 + -0.16666666666666666 \cdot {im}^{2}\right) \cdot im} + re \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
    2. *-commutative34.9%

      \[\leadsto \left(1 + \color{blue}{{im}^{2} \cdot -0.16666666666666666}\right) \cdot im + re \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
    3. unpow234.9%

      \[\leadsto \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right) \cdot im + re \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
    4. associate-*r*34.9%

      \[\leadsto \left(1 + \color{blue}{im \cdot \left(im \cdot -0.16666666666666666\right)}\right) \cdot im + re \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
    5. *-commutative34.9%

      \[\leadsto \color{blue}{im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right)} + re \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
    6. distribute-lft-in34.9%

      \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\color{blue}{\left(im \cdot 1 + im \cdot \left(-0.16666666666666666 \cdot {im}^{2}\right)\right)} + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
    7. *-commutative34.9%

      \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot 1 + im \cdot \color{blue}{\left({im}^{2} \cdot -0.16666666666666666\right)}\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
    8. unpow234.9%

      \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot 1 + im \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot -0.16666666666666666\right)\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
    9. associate-*r*34.9%

      \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot 1 + im \cdot \color{blue}{\left(im \cdot \left(im \cdot -0.16666666666666666\right)\right)}\right) + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
    10. distribute-lft-in34.9%

      \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\color{blue}{im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right)} + re \cdot \left(0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right) + 0.5 \cdot \left(im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)\right)\right)\right) \]
  8. Simplified34.9%

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

    \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \color{blue}{\left({im}^{3} \cdot \left(\left(-0.027777777777777776 \cdot re + \left(0.16666666666666666 \cdot \frac{re}{{im}^{2}} + 0.5 \cdot \frac{1}{{im}^{2}}\right)\right) - 0.08333333333333333\right)\right)}\right) \]
  10. Step-by-step derivation
    1. cube-mult21.0%

      \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot \left(\left(-0.027777777777777776 \cdot re + \left(0.16666666666666666 \cdot \frac{re}{{im}^{2}} + 0.5 \cdot \frac{1}{{im}^{2}}\right)\right) - 0.08333333333333333\right)\right)\right) \]
    2. sub-neg21.0%

      \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(\left(-0.027777777777777776 \cdot re + \left(0.16666666666666666 \cdot \frac{re}{{im}^{2}} + 0.5 \cdot \frac{1}{{im}^{2}}\right)\right) + \left(-0.08333333333333333\right)\right)}\right)\right) \]
    3. +-commutative21.0%

      \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\color{blue}{\left(\left(0.16666666666666666 \cdot \frac{re}{{im}^{2}} + 0.5 \cdot \frac{1}{{im}^{2}}\right) + -0.027777777777777776 \cdot re\right)} + \left(-0.08333333333333333\right)\right)\right)\right) \]
    4. associate-+l+21.0%

      \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \color{blue}{\left(\left(0.16666666666666666 \cdot \frac{re}{{im}^{2}} + 0.5 \cdot \frac{1}{{im}^{2}}\right) + \left(-0.027777777777777776 \cdot re + \left(-0.08333333333333333\right)\right)\right)}\right)\right) \]
    5. unpow221.0%

      \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.16666666666666666 \cdot \frac{re}{\color{blue}{im \cdot im}} + 0.5 \cdot \frac{1}{{im}^{2}}\right) + \left(-0.027777777777777776 \cdot re + \left(-0.08333333333333333\right)\right)\right)\right)\right) \]
    6. associate-*r/21.0%

      \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.16666666666666666 \cdot \frac{re}{im \cdot im} + \color{blue}{\frac{0.5 \cdot 1}{{im}^{2}}}\right) + \left(-0.027777777777777776 \cdot re + \left(-0.08333333333333333\right)\right)\right)\right)\right) \]
    7. metadata-eval21.0%

      \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.16666666666666666 \cdot \frac{re}{im \cdot im} + \frac{\color{blue}{0.5}}{{im}^{2}}\right) + \left(-0.027777777777777776 \cdot re + \left(-0.08333333333333333\right)\right)\right)\right)\right) \]
    8. unpow221.0%

      \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.16666666666666666 \cdot \frac{re}{im \cdot im} + \frac{0.5}{\color{blue}{im \cdot im}}\right) + \left(-0.027777777777777776 \cdot re + \left(-0.08333333333333333\right)\right)\right)\right)\right) \]
    9. *-commutative21.0%

      \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.16666666666666666 \cdot \frac{re}{im \cdot im} + \frac{0.5}{im \cdot im}\right) + \left(\color{blue}{re \cdot -0.027777777777777776} + \left(-0.08333333333333333\right)\right)\right)\right)\right) \]
    10. metadata-eval21.0%

      \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.16666666666666666 \cdot \frac{re}{im \cdot im} + \frac{0.5}{im \cdot im}\right) + \left(re \cdot -0.027777777777777776 + \color{blue}{-0.08333333333333333}\right)\right)\right)\right) \]
  11. Simplified21.0%

    \[\leadsto im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \left(im \cdot \left(1 + im \cdot \left(im \cdot -0.16666666666666666\right)\right) + re \cdot \color{blue}{\left(\left(im \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.16666666666666666 \cdot \frac{re}{im \cdot im} + \frac{0.5}{im \cdot im}\right) + \left(re \cdot -0.027777777777777776 + -0.08333333333333333\right)\right)\right)}\right) \]
  12. Taylor expanded in re around 0 28.8%

    \[\leadsto \color{blue}{im \cdot \left(1 + -0.16666666666666666 \cdot {im}^{2}\right)} \]
  13. Step-by-step derivation
    1. unpow228.8%

      \[\leadsto im \cdot \left(1 + -0.16666666666666666 \cdot \color{blue}{\left(im \cdot im\right)}\right) \]
  14. Simplified28.8%

    \[\leadsto \color{blue}{im \cdot \left(1 + -0.16666666666666666 \cdot \left(im \cdot im\right)\right)} \]
  15. Add Preprocessing

Alternative 16: 28.1% accurate, 25.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.76 \cdot 10^{+68}:\\
\;\;\;\;im\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 1.76e68

    1. Initial program 100.0%

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

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

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

    if 1.76e68 < im

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto im + re \cdot \color{blue}{im} \]
    8. Taylor expanded in re around inf 11.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 1.76 \cdot 10^{+68}:\\ \;\;\;\;im\\ \mathbf{else}:\\ \;\;\;\;re \cdot im\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 29.7% accurate, 40.6× speedup?

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

\\
im + re \cdot 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.7%

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

    \[\leadsto \color{blue}{im + im \cdot re} \]
  5. Final simplification26.5%

    \[\leadsto im + re \cdot im \]
  6. Add Preprocessing

Alternative 18: 26.6% 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.7%

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

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

Reproduce

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