math.cos on complex, imaginary part

Percentage Accurate: 66.0% → 99.6%
Time: 9.8s
Alternatives: 15
Speedup: 2.8×

Specification

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

\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)
\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 15 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: 66.0% accurate, 1.0× speedup?

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

\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)
\end{array}

Alternative 1: 99.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-im} - e^{im}\\ \mathbf{if}\;t_0 \leq -50000000000000 \lor \neg \left(t_0 \leq 2 \cdot 10^{-5}\right):\\ \;\;\;\;t_0 \cdot \left(0.5 \cdot \sin re\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (- (exp (- im)) (exp im))))
   (if (or (<= t_0 -50000000000000.0) (not (<= t_0 2e-5)))
     (* t_0 (* 0.5 (sin re)))
     (* (sin re) (- (* (pow im 3.0) -0.16666666666666666) im)))))
double code(double re, double im) {
	double t_0 = exp(-im) - exp(im);
	double tmp;
	if ((t_0 <= -50000000000000.0) || !(t_0 <= 2e-5)) {
		tmp = t_0 * (0.5 * sin(re));
	} else {
		tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = exp(-im) - exp(im)
    if ((t_0 <= (-50000000000000.0d0)) .or. (.not. (t_0 <= 2d-5))) then
        tmp = t_0 * (0.5d0 * sin(re))
    else
        tmp = sin(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = Math.exp(-im) - Math.exp(im);
	double tmp;
	if ((t_0 <= -50000000000000.0) || !(t_0 <= 2e-5)) {
		tmp = t_0 * (0.5 * Math.sin(re));
	} else {
		tmp = Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
	}
	return tmp;
}
def code(re, im):
	t_0 = math.exp(-im) - math.exp(im)
	tmp = 0
	if (t_0 <= -50000000000000.0) or not (t_0 <= 2e-5):
		tmp = t_0 * (0.5 * math.sin(re))
	else:
		tmp = math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im)
	return tmp
function code(re, im)
	t_0 = Float64(exp(Float64(-im)) - exp(im))
	tmp = 0.0
	if ((t_0 <= -50000000000000.0) || !(t_0 <= 2e-5))
		tmp = Float64(t_0 * Float64(0.5 * sin(re)));
	else
		tmp = Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = exp(-im) - exp(im);
	tmp = 0.0;
	if ((t_0 <= -50000000000000.0) || ~((t_0 <= 2e-5)))
		tmp = t_0 * (0.5 * sin(re));
	else
		tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) - im);
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -50000000000000.0], N[Not[LessEqual[t$95$0, 2e-5]], $MachinePrecision]], N[(t$95$0 * N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -50000000000000 \lor \neg \left(t_0 \leq 2 \cdot 10^{-5}\right):\\
\;\;\;\;t_0 \cdot \left(0.5 \cdot \sin re\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < -5e13 or 2.00000000000000016e-5 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]

    if -5e13 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 2.00000000000000016e-5

    1. Initial program 35.8%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 99.8%

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

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

        \[\leadsto \color{blue}{-0.16666666666666666 \cdot \left(\sin re \cdot {im}^{3}\right) - \sin re \cdot im} \]
      3. *-commutative99.8%

        \[\leadsto \color{blue}{\left(\sin re \cdot {im}^{3}\right) \cdot -0.16666666666666666} - \sin re \cdot im \]
      4. associate-*l*99.8%

        \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right)} - \sin re \cdot im \]
      5. distribute-lft-out--99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{-im} - e^{im} \leq -50000000000000 \lor \neg \left(e^{-im} - e^{im} \leq 2 \cdot 10^{-5}\right):\\ \;\;\;\;\left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot \sin re\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\ \end{array} \]

Alternative 2: 89.4% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\ t_1 := im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\\ t_2 := 0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - t_1 \cdot t_1}{im \cdot -2 - t_1}\right)\\ \mathbf{if}\;im \leq -5.5 \cdot 10^{+102}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -8.5 \cdot 10^{+58}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;im \leq -550000:\\ \;\;\;\;0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right) - im \cdot re\\ \mathbf{elif}\;im \leq -9 \cdot 10^{-6}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+14}:\\ \;\;\;\;im \cdot \left(-\sin re\right)\\ \mathbf{elif}\;im \leq 5.8 \cdot 10^{+102}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (pow im 3.0) (* (sin re) -0.16666666666666666)))
        (t_1 (* im (* im (* im -0.3333333333333333))))
        (t_2
         (*
          0.5
          (*
           re
           (/
            (- (* (* im -2.0) (* im -2.0)) (* t_1 t_1))
            (- (* im -2.0) t_1))))))
   (if (<= im -5.5e+102)
     t_0
     (if (<= im -8.5e+58)
       t_2
       (if (<= im -550000.0)
         (- (* 0.16666666666666666 (* im (pow re 3.0))) (* im re))
         (if (<= im -9e-6)
           (* 0.5 (* re (* im (+ -2.0 (* -0.3333333333333333 (* im im))))))
           (if (<= im 1.35e+14)
             (* im (- (sin re)))
             (if (<= im 5.8e+102) t_2 t_0))))))))
double code(double re, double im) {
	double t_0 = pow(im, 3.0) * (sin(re) * -0.16666666666666666);
	double t_1 = im * (im * (im * -0.3333333333333333));
	double t_2 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_1 * t_1)) / ((im * -2.0) - t_1)));
	double tmp;
	if (im <= -5.5e+102) {
		tmp = t_0;
	} else if (im <= -8.5e+58) {
		tmp = t_2;
	} else if (im <= -550000.0) {
		tmp = (0.16666666666666666 * (im * pow(re, 3.0))) - (im * re);
	} else if (im <= -9e-6) {
		tmp = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))));
	} else if (im <= 1.35e+14) {
		tmp = im * -sin(re);
	} else if (im <= 5.8e+102) {
		tmp = t_2;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = (im ** 3.0d0) * (sin(re) * (-0.16666666666666666d0))
    t_1 = im * (im * (im * (-0.3333333333333333d0)))
    t_2 = 0.5d0 * (re * ((((im * (-2.0d0)) * (im * (-2.0d0))) - (t_1 * t_1)) / ((im * (-2.0d0)) - t_1)))
    if (im <= (-5.5d+102)) then
        tmp = t_0
    else if (im <= (-8.5d+58)) then
        tmp = t_2
    else if (im <= (-550000.0d0)) then
        tmp = (0.16666666666666666d0 * (im * (re ** 3.0d0))) - (im * re)
    else if (im <= (-9d-6)) then
        tmp = 0.5d0 * (re * (im * ((-2.0d0) + ((-0.3333333333333333d0) * (im * im)))))
    else if (im <= 1.35d+14) then
        tmp = im * -sin(re)
    else if (im <= 5.8d+102) then
        tmp = t_2
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = Math.pow(im, 3.0) * (Math.sin(re) * -0.16666666666666666);
	double t_1 = im * (im * (im * -0.3333333333333333));
	double t_2 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_1 * t_1)) / ((im * -2.0) - t_1)));
	double tmp;
	if (im <= -5.5e+102) {
		tmp = t_0;
	} else if (im <= -8.5e+58) {
		tmp = t_2;
	} else if (im <= -550000.0) {
		tmp = (0.16666666666666666 * (im * Math.pow(re, 3.0))) - (im * re);
	} else if (im <= -9e-6) {
		tmp = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))));
	} else if (im <= 1.35e+14) {
		tmp = im * -Math.sin(re);
	} else if (im <= 5.8e+102) {
		tmp = t_2;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = math.pow(im, 3.0) * (math.sin(re) * -0.16666666666666666)
	t_1 = im * (im * (im * -0.3333333333333333))
	t_2 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_1 * t_1)) / ((im * -2.0) - t_1)))
	tmp = 0
	if im <= -5.5e+102:
		tmp = t_0
	elif im <= -8.5e+58:
		tmp = t_2
	elif im <= -550000.0:
		tmp = (0.16666666666666666 * (im * math.pow(re, 3.0))) - (im * re)
	elif im <= -9e-6:
		tmp = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))))
	elif im <= 1.35e+14:
		tmp = im * -math.sin(re)
	elif im <= 5.8e+102:
		tmp = t_2
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64((im ^ 3.0) * Float64(sin(re) * -0.16666666666666666))
	t_1 = Float64(im * Float64(im * Float64(im * -0.3333333333333333)))
	t_2 = Float64(0.5 * Float64(re * Float64(Float64(Float64(Float64(im * -2.0) * Float64(im * -2.0)) - Float64(t_1 * t_1)) / Float64(Float64(im * -2.0) - t_1))))
	tmp = 0.0
	if (im <= -5.5e+102)
		tmp = t_0;
	elseif (im <= -8.5e+58)
		tmp = t_2;
	elseif (im <= -550000.0)
		tmp = Float64(Float64(0.16666666666666666 * Float64(im * (re ^ 3.0))) - Float64(im * re));
	elseif (im <= -9e-6)
		tmp = Float64(0.5 * Float64(re * Float64(im * Float64(-2.0 + Float64(-0.3333333333333333 * Float64(im * im))))));
	elseif (im <= 1.35e+14)
		tmp = Float64(im * Float64(-sin(re)));
	elseif (im <= 5.8e+102)
		tmp = t_2;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = (im ^ 3.0) * (sin(re) * -0.16666666666666666);
	t_1 = im * (im * (im * -0.3333333333333333));
	t_2 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_1 * t_1)) / ((im * -2.0) - t_1)));
	tmp = 0.0;
	if (im <= -5.5e+102)
		tmp = t_0;
	elseif (im <= -8.5e+58)
		tmp = t_2;
	elseif (im <= -550000.0)
		tmp = (0.16666666666666666 * (im * (re ^ 3.0))) - (im * re);
	elseif (im <= -9e-6)
		tmp = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))));
	elseif (im <= 1.35e+14)
		tmp = im * -sin(re);
	elseif (im <= 5.8e+102)
		tmp = t_2;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[Power[im, 3.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(im * N[(im * N[(im * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[(re * N[(N[(N[(N[(im * -2.0), $MachinePrecision] * N[(im * -2.0), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(N[(im * -2.0), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5.5e+102], t$95$0, If[LessEqual[im, -8.5e+58], t$95$2, If[LessEqual[im, -550000.0], N[(N[(0.16666666666666666 * N[(im * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(im * re), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -9e-6], N[(0.5 * N[(re * N[(im * N[(-2.0 + N[(-0.3333333333333333 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.35e+14], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 5.8e+102], t$95$2, t$95$0]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\
t_1 := im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\\
t_2 := 0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - t_1 \cdot t_1}{im \cdot -2 - t_1}\right)\\
\mathbf{if}\;im \leq -5.5 \cdot 10^{+102}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -8.5 \cdot 10^{+58}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;im \leq -550000:\\
\;\;\;\;0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right) - im \cdot re\\

\mathbf{elif}\;im \leq -9 \cdot 10^{-6}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\

\mathbf{elif}\;im \leq 1.35 \cdot 10^{+14}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\

\mathbf{elif}\;im \leq 5.8 \cdot 10^{+102}:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if im < -5.49999999999999981e102 or 5.8000000000000005e102 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 100.0%

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

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

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

        \[\leadsto \color{blue}{\left(\sin re \cdot {im}^{3}\right) \cdot -0.16666666666666666} - \sin re \cdot im \]
      4. associate-*l*100.0%

        \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right)} - \sin re \cdot im \]
      5. distribute-lft-out--100.0%

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

      \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)} \]
    5. Taylor expanded in im around inf 100.0%

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

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

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

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

    if -5.49999999999999981e102 < im < -8.50000000000000015e58 or 1.35e14 < im < 5.8000000000000005e102

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in re around 0 81.1%

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right) + -2 \cdot \left(re \cdot im\right)\right)} \]
    4. Step-by-step derivation
      1. +-commutative13.3%

        \[\leadsto 0.5 \cdot \color{blue}{\left(-2 \cdot \left(re \cdot im\right) + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right)} \]
      2. *-commutative13.3%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(re \cdot im\right) \cdot -2} + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right) \]
      3. associate-*l*13.3%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2\right) + \color{blue}{\left(re \cdot {im}^{3}\right) \cdot -0.3333333333333333}\right) \]
      5. associate-*l*13.3%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\right)\right)} \]
      7. cube-mult13.3%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right)\right) \]
      8. associate-*l*13.3%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right)}\right)\right) \]
      9. distribute-lft-out13.3%

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)}\right) \]
    5. Simplified13.3%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(-2 \cdot im + \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}\right) \]
      2. flip-+57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}}\right) \]
      3. *-commutative57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\color{blue}{\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)} \cdot im\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      4. associate-*r*57.5%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\color{blue}{\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)} \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      6. associate-*r*57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\color{blue}{\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right)} \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      7. *-commutative57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right)}{-2 \cdot im - \color{blue}{\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)} \cdot im}\right) \]
      8. associate-*r*57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right)}{-2 \cdot im - \color{blue}{\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right)} \cdot im}\right) \]
    7. Applied egg-rr57.5%

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

    if -8.50000000000000015e58 < im < -5.5e5

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 2.9%

      \[\leadsto \color{blue}{-1 \cdot \left(\sin re \cdot im\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg2.9%

        \[\leadsto \color{blue}{-\sin re \cdot im} \]
      2. *-commutative2.9%

        \[\leadsto -\color{blue}{im \cdot \sin re} \]
      3. distribute-rgt-neg-in2.9%

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

      \[\leadsto \color{blue}{im \cdot \left(-\sin re\right)} \]
    5. Taylor expanded in re around 0 42.1%

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

    if -5.5e5 < im < -9.00000000000000023e-6

    1. Initial program 89.2%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in re around 0 89.2%

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right) + -2 \cdot \left(re \cdot im\right)\right)} \]
    4. Step-by-step derivation
      1. +-commutative51.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(-2 \cdot \left(re \cdot im\right) + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right)} \]
      2. *-commutative51.0%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(re \cdot im\right) \cdot -2} + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right) \]
      3. associate-*l*51.0%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2\right) + \color{blue}{\left(re \cdot {im}^{3}\right) \cdot -0.3333333333333333}\right) \]
      5. associate-*l*51.0%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\right)\right)} \]
      7. cube-mult51.0%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right)\right) \]
      8. associate-*l*51.0%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)}\right) \]
    5. Simplified51.0%

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

    if -9.00000000000000023e-6 < im < 1.35e14

    1. Initial program 37.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 97.5%

      \[\leadsto \color{blue}{-1 \cdot \left(\sin re \cdot im\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg97.5%

        \[\leadsto \color{blue}{-\sin re \cdot im} \]
      2. *-commutative97.5%

        \[\leadsto -\color{blue}{im \cdot \sin re} \]
      3. distribute-rgt-neg-in97.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -5.5 \cdot 10^{+102}:\\ \;\;\;\;{im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\ \mathbf{elif}\;im \leq -8.5 \cdot 10^{+58}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)}{im \cdot -2 - im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)}\right)\\ \mathbf{elif}\;im \leq -550000:\\ \;\;\;\;0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right) - im \cdot re\\ \mathbf{elif}\;im \leq -9 \cdot 10^{-6}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+14}:\\ \;\;\;\;im \cdot \left(-\sin re\right)\\ \mathbf{elif}\;im \leq 5.8 \cdot 10^{+102}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)}{im \cdot -2 - im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;{im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\ \end{array} \]

Alternative 3: 89.6% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\ t_1 := im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\\ t_2 := 0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - t_1 \cdot t_1}{im \cdot -2 - t_1}\right)\\ \mathbf{if}\;im \leq -5.5 \cdot 10^{+102}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -8.5 \cdot 10^{+58}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;im \leq -420000:\\ \;\;\;\;0.16666666666666666 \cdot \sqrt{\left(im \cdot im\right) \cdot {re}^{6}}\\ \mathbf{elif}\;im \leq 5.6 \cdot 10^{+14}:\\ \;\;\;\;im \cdot \left(-\sin re\right)\\ \mathbf{elif}\;im \leq 5.8 \cdot 10^{+102}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (pow im 3.0) (* (sin re) -0.16666666666666666)))
        (t_1 (* im (* im (* im -0.3333333333333333))))
        (t_2
         (*
          0.5
          (*
           re
           (/
            (- (* (* im -2.0) (* im -2.0)) (* t_1 t_1))
            (- (* im -2.0) t_1))))))
   (if (<= im -5.5e+102)
     t_0
     (if (<= im -8.5e+58)
       t_2
       (if (<= im -420000.0)
         (* 0.16666666666666666 (sqrt (* (* im im) (pow re 6.0))))
         (if (<= im 5.6e+14)
           (* im (- (sin re)))
           (if (<= im 5.8e+102) t_2 t_0)))))))
double code(double re, double im) {
	double t_0 = pow(im, 3.0) * (sin(re) * -0.16666666666666666);
	double t_1 = im * (im * (im * -0.3333333333333333));
	double t_2 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_1 * t_1)) / ((im * -2.0) - t_1)));
	double tmp;
	if (im <= -5.5e+102) {
		tmp = t_0;
	} else if (im <= -8.5e+58) {
		tmp = t_2;
	} else if (im <= -420000.0) {
		tmp = 0.16666666666666666 * sqrt(((im * im) * pow(re, 6.0)));
	} else if (im <= 5.6e+14) {
		tmp = im * -sin(re);
	} else if (im <= 5.8e+102) {
		tmp = t_2;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = (im ** 3.0d0) * (sin(re) * (-0.16666666666666666d0))
    t_1 = im * (im * (im * (-0.3333333333333333d0)))
    t_2 = 0.5d0 * (re * ((((im * (-2.0d0)) * (im * (-2.0d0))) - (t_1 * t_1)) / ((im * (-2.0d0)) - t_1)))
    if (im <= (-5.5d+102)) then
        tmp = t_0
    else if (im <= (-8.5d+58)) then
        tmp = t_2
    else if (im <= (-420000.0d0)) then
        tmp = 0.16666666666666666d0 * sqrt(((im * im) * (re ** 6.0d0)))
    else if (im <= 5.6d+14) then
        tmp = im * -sin(re)
    else if (im <= 5.8d+102) then
        tmp = t_2
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = Math.pow(im, 3.0) * (Math.sin(re) * -0.16666666666666666);
	double t_1 = im * (im * (im * -0.3333333333333333));
	double t_2 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_1 * t_1)) / ((im * -2.0) - t_1)));
	double tmp;
	if (im <= -5.5e+102) {
		tmp = t_0;
	} else if (im <= -8.5e+58) {
		tmp = t_2;
	} else if (im <= -420000.0) {
		tmp = 0.16666666666666666 * Math.sqrt(((im * im) * Math.pow(re, 6.0)));
	} else if (im <= 5.6e+14) {
		tmp = im * -Math.sin(re);
	} else if (im <= 5.8e+102) {
		tmp = t_2;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = math.pow(im, 3.0) * (math.sin(re) * -0.16666666666666666)
	t_1 = im * (im * (im * -0.3333333333333333))
	t_2 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_1 * t_1)) / ((im * -2.0) - t_1)))
	tmp = 0
	if im <= -5.5e+102:
		tmp = t_0
	elif im <= -8.5e+58:
		tmp = t_2
	elif im <= -420000.0:
		tmp = 0.16666666666666666 * math.sqrt(((im * im) * math.pow(re, 6.0)))
	elif im <= 5.6e+14:
		tmp = im * -math.sin(re)
	elif im <= 5.8e+102:
		tmp = t_2
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64((im ^ 3.0) * Float64(sin(re) * -0.16666666666666666))
	t_1 = Float64(im * Float64(im * Float64(im * -0.3333333333333333)))
	t_2 = Float64(0.5 * Float64(re * Float64(Float64(Float64(Float64(im * -2.0) * Float64(im * -2.0)) - Float64(t_1 * t_1)) / Float64(Float64(im * -2.0) - t_1))))
	tmp = 0.0
	if (im <= -5.5e+102)
		tmp = t_0;
	elseif (im <= -8.5e+58)
		tmp = t_2;
	elseif (im <= -420000.0)
		tmp = Float64(0.16666666666666666 * sqrt(Float64(Float64(im * im) * (re ^ 6.0))));
	elseif (im <= 5.6e+14)
		tmp = Float64(im * Float64(-sin(re)));
	elseif (im <= 5.8e+102)
		tmp = t_2;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = (im ^ 3.0) * (sin(re) * -0.16666666666666666);
	t_1 = im * (im * (im * -0.3333333333333333));
	t_2 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_1 * t_1)) / ((im * -2.0) - t_1)));
	tmp = 0.0;
	if (im <= -5.5e+102)
		tmp = t_0;
	elseif (im <= -8.5e+58)
		tmp = t_2;
	elseif (im <= -420000.0)
		tmp = 0.16666666666666666 * sqrt(((im * im) * (re ^ 6.0)));
	elseif (im <= 5.6e+14)
		tmp = im * -sin(re);
	elseif (im <= 5.8e+102)
		tmp = t_2;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[Power[im, 3.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(im * N[(im * N[(im * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[(re * N[(N[(N[(N[(im * -2.0), $MachinePrecision] * N[(im * -2.0), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(N[(im * -2.0), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5.5e+102], t$95$0, If[LessEqual[im, -8.5e+58], t$95$2, If[LessEqual[im, -420000.0], N[(0.16666666666666666 * N[Sqrt[N[(N[(im * im), $MachinePrecision] * N[Power[re, 6.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5.6e+14], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 5.8e+102], t$95$2, t$95$0]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\
t_1 := im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\\
t_2 := 0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - t_1 \cdot t_1}{im \cdot -2 - t_1}\right)\\
\mathbf{if}\;im \leq -5.5 \cdot 10^{+102}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -8.5 \cdot 10^{+58}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;im \leq -420000:\\
\;\;\;\;0.16666666666666666 \cdot \sqrt{\left(im \cdot im\right) \cdot {re}^{6}}\\

\mathbf{elif}\;im \leq 5.6 \cdot 10^{+14}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\

\mathbf{elif}\;im \leq 5.8 \cdot 10^{+102}:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < -5.49999999999999981e102 or 5.8000000000000005e102 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 100.0%

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

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

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

        \[\leadsto \color{blue}{\left(\sin re \cdot {im}^{3}\right) \cdot -0.16666666666666666} - \sin re \cdot im \]
      4. associate-*l*100.0%

        \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right)} - \sin re \cdot im \]
      5. distribute-lft-out--100.0%

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

      \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)} \]
    5. Taylor expanded in im around inf 100.0%

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

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

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

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

    if -5.49999999999999981e102 < im < -8.50000000000000015e58 or 5.6e14 < im < 5.8000000000000005e102

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in re around 0 81.1%

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right) + -2 \cdot \left(re \cdot im\right)\right)} \]
    4. Step-by-step derivation
      1. +-commutative13.3%

        \[\leadsto 0.5 \cdot \color{blue}{\left(-2 \cdot \left(re \cdot im\right) + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right)} \]
      2. *-commutative13.3%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(re \cdot im\right) \cdot -2} + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right) \]
      3. associate-*l*13.3%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2\right) + \color{blue}{\left(re \cdot {im}^{3}\right) \cdot -0.3333333333333333}\right) \]
      5. associate-*l*13.3%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\right)\right)} \]
      7. cube-mult13.3%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right)\right) \]
      8. associate-*l*13.3%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right)}\right)\right) \]
      9. distribute-lft-out13.3%

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)}\right) \]
    5. Simplified13.3%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(-2 \cdot im + \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}\right) \]
      2. flip-+57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}}\right) \]
      3. *-commutative57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\color{blue}{\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)} \cdot im\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      4. associate-*r*57.5%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\color{blue}{\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)} \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      6. associate-*r*57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\color{blue}{\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right)} \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      7. *-commutative57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right)}{-2 \cdot im - \color{blue}{\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)} \cdot im}\right) \]
      8. associate-*r*57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right)}{-2 \cdot im - \color{blue}{\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right)} \cdot im}\right) \]
    7. Applied egg-rr57.5%

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

    if -8.50000000000000015e58 < im < -4.2e5

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 2.9%

      \[\leadsto \color{blue}{-1 \cdot \left(\sin re \cdot im\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg2.9%

        \[\leadsto \color{blue}{-\sin re \cdot im} \]
      2. *-commutative2.9%

        \[\leadsto -\color{blue}{im \cdot \sin re} \]
      3. distribute-rgt-neg-in2.9%

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

      \[\leadsto \color{blue}{im \cdot \left(-\sin re\right)} \]
    5. Taylor expanded in re around 0 42.1%

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left({re}^{3} \cdot im\right)} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt41.6%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(\sqrt{{re}^{3} \cdot im} \cdot \sqrt{{re}^{3} \cdot im}\right)} \]
      2. sqrt-unprod60.8%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\sqrt{\left({re}^{3} \cdot im\right) \cdot \left({re}^{3} \cdot im\right)}} \]
      3. *-commutative60.8%

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

        \[\leadsto 0.16666666666666666 \cdot \sqrt{\left(im \cdot {re}^{3}\right) \cdot \color{blue}{\left(im \cdot {re}^{3}\right)}} \]
      5. swap-sqr60.8%

        \[\leadsto 0.16666666666666666 \cdot \sqrt{\color{blue}{\left(im \cdot im\right) \cdot \left({re}^{3} \cdot {re}^{3}\right)}} \]
      6. pow-prod-up60.8%

        \[\leadsto 0.16666666666666666 \cdot \sqrt{\left(im \cdot im\right) \cdot \color{blue}{{re}^{\left(3 + 3\right)}}} \]
      7. metadata-eval60.8%

        \[\leadsto 0.16666666666666666 \cdot \sqrt{\left(im \cdot im\right) \cdot {re}^{\color{blue}{6}}} \]
    8. Applied egg-rr60.8%

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

    if -4.2e5 < im < 5.6e14

    1. Initial program 37.8%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 96.6%

      \[\leadsto \color{blue}{-1 \cdot \left(\sin re \cdot im\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg96.6%

        \[\leadsto \color{blue}{-\sin re \cdot im} \]
      2. *-commutative96.6%

        \[\leadsto -\color{blue}{im \cdot \sin re} \]
      3. distribute-rgt-neg-in96.6%

        \[\leadsto \color{blue}{im \cdot \left(-\sin re\right)} \]
    4. Simplified96.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -5.5 \cdot 10^{+102}:\\ \;\;\;\;{im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\ \mathbf{elif}\;im \leq -8.5 \cdot 10^{+58}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)}{im \cdot -2 - im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)}\right)\\ \mathbf{elif}\;im \leq -420000:\\ \;\;\;\;0.16666666666666666 \cdot \sqrt{\left(im \cdot im\right) \cdot {re}^{6}}\\ \mathbf{elif}\;im \leq 5.6 \cdot 10^{+14}:\\ \;\;\;\;im \cdot \left(-\sin re\right)\\ \mathbf{elif}\;im \leq 5.8 \cdot 10^{+102}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)}{im \cdot -2 - im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;{im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\ \end{array} \]

Alternative 4: 94.4% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)\\
t_1 := {im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\
\mathbf{if}\;im \leq -2.6 \cdot 10^{+121}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq -9 \cdot 10^{-6}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;im \leq 5.8 \cdot 10^{+102}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -2.5999999999999999e121 or 5.8000000000000005e102 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 100.0%

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

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

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

        \[\leadsto \color{blue}{\left(\sin re \cdot {im}^{3}\right) \cdot -0.16666666666666666} - \sin re \cdot im \]
      4. associate-*l*100.0%

        \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right)} - \sin re \cdot im \]
      5. distribute-lft-out--100.0%

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

      \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)} \]
    5. Taylor expanded in im around inf 100.0%

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

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

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

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

    if -2.5999999999999999e121 < im < -9.00000000000000023e-6 or 0.00104999999999999994 < im < 5.8000000000000005e102

    1. Initial program 99.6%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in re around 0 73.6%

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

    if -9.00000000000000023e-6 < im < 0.00104999999999999994

    1. Initial program 35.4%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 99.8%

      \[\leadsto \color{blue}{-1 \cdot \left(\sin re \cdot im\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg99.8%

        \[\leadsto \color{blue}{-\sin re \cdot im} \]
      2. *-commutative99.8%

        \[\leadsto -\color{blue}{im \cdot \sin re} \]
      3. distribute-rgt-neg-in99.8%

        \[\leadsto \color{blue}{im \cdot \left(-\sin re\right)} \]
    4. Simplified99.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -2.6 \cdot 10^{+121}:\\ \;\;\;\;{im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\ \mathbf{elif}\;im \leq -9 \cdot 10^{-6}:\\ \;\;\;\;0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)\\ \mathbf{elif}\;im \leq 0.00105:\\ \;\;\;\;im \cdot \left(-\sin re\right)\\ \mathbf{elif}\;im \leq 5.8 \cdot 10^{+102}:\\ \;\;\;\;0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)\\ \mathbf{else}:\\ \;\;\;\;{im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\ \end{array} \]

Alternative 5: 94.7% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)\\
t_1 := {im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\
\mathbf{if}\;im \leq -2.6 \cdot 10^{+121}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq -0.0185:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq 0.012:\\
\;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\

\mathbf{elif}\;im \leq 5.8 \cdot 10^{+102}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -2.5999999999999999e121 or 5.8000000000000005e102 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 100.0%

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

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

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

        \[\leadsto \color{blue}{\left(\sin re \cdot {im}^{3}\right) \cdot -0.16666666666666666} - \sin re \cdot im \]
      4. associate-*l*100.0%

        \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right)} - \sin re \cdot im \]
      5. distribute-lft-out--100.0%

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

      \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)} \]
    5. Taylor expanded in im around inf 100.0%

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

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

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

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

    if -2.5999999999999999e121 < im < -0.0184999999999999991 or 0.012 < im < 5.8000000000000005e102

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in re around 0 73.6%

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

    if -0.0184999999999999991 < im < 0.012

    1. Initial program 35.8%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 99.8%

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

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

        \[\leadsto \color{blue}{-0.16666666666666666 \cdot \left(\sin re \cdot {im}^{3}\right) - \sin re \cdot im} \]
      3. *-commutative99.8%

        \[\leadsto \color{blue}{\left(\sin re \cdot {im}^{3}\right) \cdot -0.16666666666666666} - \sin re \cdot im \]
      4. associate-*l*99.8%

        \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right)} - \sin re \cdot im \]
      5. distribute-lft-out--99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -2.6 \cdot 10^{+121}:\\ \;\;\;\;{im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\ \mathbf{elif}\;im \leq -0.0185:\\ \;\;\;\;0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)\\ \mathbf{elif}\;im \leq 0.012:\\ \;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\ \mathbf{elif}\;im \leq 5.8 \cdot 10^{+102}:\\ \;\;\;\;0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)\\ \mathbf{else}:\\ \;\;\;\;{im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\ \end{array} \]

Alternative 6: 78.1% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\ t_1 := 0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\ t_2 := im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\\ t_3 := 0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - t_2 \cdot t_2}{im \cdot -2 - t_2}\right)\\ \mathbf{if}\;im \leq -8 \cdot 10^{+102}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq -8.5 \cdot 10^{+58}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;im \leq -420000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -9 \cdot 10^{-6}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq 85000000000000:\\ \;\;\;\;im \cdot \left(-\sin re\right)\\ \mathbf{elif}\;im \leq 8.2 \cdot 10^{+102}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;im \leq 1.15 \cdot 10^{+159} \lor \neg \left(im \leq 3.6 \cdot 10^{+227}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* im (- (* 0.16666666666666666 (pow re 3.0)) re)))
        (t_1 (* 0.5 (* re (* im (+ -2.0 (* -0.3333333333333333 (* im im)))))))
        (t_2 (* im (* im (* im -0.3333333333333333))))
        (t_3
         (*
          0.5
          (*
           re
           (/
            (- (* (* im -2.0) (* im -2.0)) (* t_2 t_2))
            (- (* im -2.0) t_2))))))
   (if (<= im -8e+102)
     t_1
     (if (<= im -8.5e+58)
       t_3
       (if (<= im -420000.0)
         t_0
         (if (<= im -9e-6)
           t_1
           (if (<= im 85000000000000.0)
             (* im (- (sin re)))
             (if (<= im 8.2e+102)
               t_3
               (if (or (<= im 1.15e+159) (not (<= im 3.6e+227)))
                 t_1
                 t_0)))))))))
double code(double re, double im) {
	double t_0 = im * ((0.16666666666666666 * pow(re, 3.0)) - re);
	double t_1 = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))));
	double t_2 = im * (im * (im * -0.3333333333333333));
	double t_3 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_2 * t_2)) / ((im * -2.0) - t_2)));
	double tmp;
	if (im <= -8e+102) {
		tmp = t_1;
	} else if (im <= -8.5e+58) {
		tmp = t_3;
	} else if (im <= -420000.0) {
		tmp = t_0;
	} else if (im <= -9e-6) {
		tmp = t_1;
	} else if (im <= 85000000000000.0) {
		tmp = im * -sin(re);
	} else if (im <= 8.2e+102) {
		tmp = t_3;
	} else if ((im <= 1.15e+159) || !(im <= 3.6e+227)) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = im * ((0.16666666666666666d0 * (re ** 3.0d0)) - re)
    t_1 = 0.5d0 * (re * (im * ((-2.0d0) + ((-0.3333333333333333d0) * (im * im)))))
    t_2 = im * (im * (im * (-0.3333333333333333d0)))
    t_3 = 0.5d0 * (re * ((((im * (-2.0d0)) * (im * (-2.0d0))) - (t_2 * t_2)) / ((im * (-2.0d0)) - t_2)))
    if (im <= (-8d+102)) then
        tmp = t_1
    else if (im <= (-8.5d+58)) then
        tmp = t_3
    else if (im <= (-420000.0d0)) then
        tmp = t_0
    else if (im <= (-9d-6)) then
        tmp = t_1
    else if (im <= 85000000000000.0d0) then
        tmp = im * -sin(re)
    else if (im <= 8.2d+102) then
        tmp = t_3
    else if ((im <= 1.15d+159) .or. (.not. (im <= 3.6d+227))) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = im * ((0.16666666666666666 * Math.pow(re, 3.0)) - re);
	double t_1 = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))));
	double t_2 = im * (im * (im * -0.3333333333333333));
	double t_3 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_2 * t_2)) / ((im * -2.0) - t_2)));
	double tmp;
	if (im <= -8e+102) {
		tmp = t_1;
	} else if (im <= -8.5e+58) {
		tmp = t_3;
	} else if (im <= -420000.0) {
		tmp = t_0;
	} else if (im <= -9e-6) {
		tmp = t_1;
	} else if (im <= 85000000000000.0) {
		tmp = im * -Math.sin(re);
	} else if (im <= 8.2e+102) {
		tmp = t_3;
	} else if ((im <= 1.15e+159) || !(im <= 3.6e+227)) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = im * ((0.16666666666666666 * math.pow(re, 3.0)) - re)
	t_1 = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))))
	t_2 = im * (im * (im * -0.3333333333333333))
	t_3 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_2 * t_2)) / ((im * -2.0) - t_2)))
	tmp = 0
	if im <= -8e+102:
		tmp = t_1
	elif im <= -8.5e+58:
		tmp = t_3
	elif im <= -420000.0:
		tmp = t_0
	elif im <= -9e-6:
		tmp = t_1
	elif im <= 85000000000000.0:
		tmp = im * -math.sin(re)
	elif im <= 8.2e+102:
		tmp = t_3
	elif (im <= 1.15e+159) or not (im <= 3.6e+227):
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(im * Float64(Float64(0.16666666666666666 * (re ^ 3.0)) - re))
	t_1 = Float64(0.5 * Float64(re * Float64(im * Float64(-2.0 + Float64(-0.3333333333333333 * Float64(im * im))))))
	t_2 = Float64(im * Float64(im * Float64(im * -0.3333333333333333)))
	t_3 = Float64(0.5 * Float64(re * Float64(Float64(Float64(Float64(im * -2.0) * Float64(im * -2.0)) - Float64(t_2 * t_2)) / Float64(Float64(im * -2.0) - t_2))))
	tmp = 0.0
	if (im <= -8e+102)
		tmp = t_1;
	elseif (im <= -8.5e+58)
		tmp = t_3;
	elseif (im <= -420000.0)
		tmp = t_0;
	elseif (im <= -9e-6)
		tmp = t_1;
	elseif (im <= 85000000000000.0)
		tmp = Float64(im * Float64(-sin(re)));
	elseif (im <= 8.2e+102)
		tmp = t_3;
	elseif ((im <= 1.15e+159) || !(im <= 3.6e+227))
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = im * ((0.16666666666666666 * (re ^ 3.0)) - re);
	t_1 = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))));
	t_2 = im * (im * (im * -0.3333333333333333));
	t_3 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_2 * t_2)) / ((im * -2.0) - t_2)));
	tmp = 0.0;
	if (im <= -8e+102)
		tmp = t_1;
	elseif (im <= -8.5e+58)
		tmp = t_3;
	elseif (im <= -420000.0)
		tmp = t_0;
	elseif (im <= -9e-6)
		tmp = t_1;
	elseif (im <= 85000000000000.0)
		tmp = im * -sin(re);
	elseif (im <= 8.2e+102)
		tmp = t_3;
	elseif ((im <= 1.15e+159) || ~((im <= 3.6e+227)))
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(re * N[(im * N[(-2.0 + N[(-0.3333333333333333 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(im * N[(im * N[(im * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(0.5 * N[(re * N[(N[(N[(N[(im * -2.0), $MachinePrecision] * N[(im * -2.0), $MachinePrecision]), $MachinePrecision] - N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision] / N[(N[(im * -2.0), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -8e+102], t$95$1, If[LessEqual[im, -8.5e+58], t$95$3, If[LessEqual[im, -420000.0], t$95$0, If[LessEqual[im, -9e-6], t$95$1, If[LessEqual[im, 85000000000000.0], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 8.2e+102], t$95$3, If[Or[LessEqual[im, 1.15e+159], N[Not[LessEqual[im, 3.6e+227]], $MachinePrecision]], t$95$1, t$95$0]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\
t_1 := 0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\
t_2 := im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\\
t_3 := 0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - t_2 \cdot t_2}{im \cdot -2 - t_2}\right)\\
\mathbf{if}\;im \leq -8 \cdot 10^{+102}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq -8.5 \cdot 10^{+58}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;im \leq -420000:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -9 \cdot 10^{-6}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;im \leq 8.2 \cdot 10^{+102}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;im \leq 1.15 \cdot 10^{+159} \lor \neg \left(im \leq 3.6 \cdot 10^{+227}\right):\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < -7.99999999999999982e102 or -4.2e5 < im < -9.00000000000000023e-6 or 8.1999999999999999e102 < im < 1.14999999999999998e159 or 3.59999999999999991e227 < im

    1. Initial program 99.7%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in re around 0 72.9%

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

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

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

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(re \cdot im\right) \cdot -2} + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right) \]
      3. associate-*l*71.9%

        \[\leadsto 0.5 \cdot \left(\color{blue}{re \cdot \left(im \cdot -2\right)} + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right) \]
      4. *-commutative71.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2\right) + \color{blue}{\left(re \cdot {im}^{3}\right) \cdot -0.3333333333333333}\right) \]
      5. associate-*l*71.9%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\right)\right)} \]
      7. cube-mult71.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right)\right) \]
      8. associate-*l*71.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right)}\right)\right) \]
      9. distribute-lft-out71.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)}\right) \]
    5. Simplified71.9%

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

    if -7.99999999999999982e102 < im < -8.50000000000000015e58 or 8.5e13 < im < 8.1999999999999999e102

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in re around 0 81.1%

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right) + -2 \cdot \left(re \cdot im\right)\right)} \]
    4. Step-by-step derivation
      1. +-commutative13.3%

        \[\leadsto 0.5 \cdot \color{blue}{\left(-2 \cdot \left(re \cdot im\right) + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right)} \]
      2. *-commutative13.3%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(re \cdot im\right) \cdot -2} + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right) \]
      3. associate-*l*13.3%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2\right) + \color{blue}{\left(re \cdot {im}^{3}\right) \cdot -0.3333333333333333}\right) \]
      5. associate-*l*13.3%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\right)\right)} \]
      7. cube-mult13.3%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right)\right) \]
      8. associate-*l*13.3%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right)}\right)\right) \]
      9. distribute-lft-out13.3%

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)}\right) \]
    5. Simplified13.3%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(-2 \cdot im + \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}\right) \]
      2. flip-+57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}}\right) \]
      3. *-commutative57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\color{blue}{\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)} \cdot im\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      4. associate-*r*57.5%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\color{blue}{\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)} \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      6. associate-*r*57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\color{blue}{\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right)} \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      7. *-commutative57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right)}{-2 \cdot im - \color{blue}{\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)} \cdot im}\right) \]
      8. associate-*r*57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right)}{-2 \cdot im - \color{blue}{\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right)} \cdot im}\right) \]
    7. Applied egg-rr57.5%

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

    if -8.50000000000000015e58 < im < -4.2e5 or 1.14999999999999998e159 < im < 3.59999999999999991e227

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 59.8%

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

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

        \[\leadsto \color{blue}{-0.16666666666666666 \cdot \left(\sin re \cdot {im}^{3}\right) - \sin re \cdot im} \]
      3. *-commutative59.8%

        \[\leadsto \color{blue}{\left(\sin re \cdot {im}^{3}\right) \cdot -0.16666666666666666} - \sin re \cdot im \]
      4. associate-*l*59.8%

        \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right)} - \sin re \cdot im \]
      5. distribute-lft-out--59.8%

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

      \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)} \]
    5. Taylor expanded in re around 0 17.7%

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

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

        \[\leadsto re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right) + \color{blue}{\left(-0.16666666666666666 \cdot {re}^{3}\right) \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)} \]
      3. distribute-rgt-out71.8%

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

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

      \[\leadsto \color{blue}{\left({im}^{3} \cdot -0.16666666666666666 - im\right) \cdot \left(re + -0.16666666666666666 \cdot {re}^{3}\right)} \]
    8. Taylor expanded in im around 0 59.8%

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

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

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

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

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

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

        \[\leadsto \color{blue}{im \cdot \left(-1 \cdot re + 0.16666666666666666 \cdot {re}^{3}\right)} \]
      7. neg-mul-159.8%

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

        \[\leadsto im \cdot \color{blue}{\left(0.16666666666666666 \cdot {re}^{3} + \left(-re\right)\right)} \]
      9. unsub-neg59.8%

        \[\leadsto im \cdot \color{blue}{\left(0.16666666666666666 \cdot {re}^{3} - re\right)} \]
      10. *-commutative59.8%

        \[\leadsto im \cdot \left(\color{blue}{{re}^{3} \cdot 0.16666666666666666} - re\right) \]
    10. Simplified59.8%

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

    if -9.00000000000000023e-6 < im < 8.5e13

    1. Initial program 37.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 97.5%

      \[\leadsto \color{blue}{-1 \cdot \left(\sin re \cdot im\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg97.5%

        \[\leadsto \color{blue}{-\sin re \cdot im} \]
      2. *-commutative97.5%

        \[\leadsto -\color{blue}{im \cdot \sin re} \]
      3. distribute-rgt-neg-in97.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -8 \cdot 10^{+102}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{elif}\;im \leq -8.5 \cdot 10^{+58}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)}{im \cdot -2 - im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)}\right)\\ \mathbf{elif}\;im \leq -420000:\\ \;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\ \mathbf{elif}\;im \leq -9 \cdot 10^{-6}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{elif}\;im \leq 85000000000000:\\ \;\;\;\;im \cdot \left(-\sin re\right)\\ \mathbf{elif}\;im \leq 8.2 \cdot 10^{+102}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)}{im \cdot -2 - im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)}\right)\\ \mathbf{elif}\;im \leq 1.15 \cdot 10^{+159} \lor \neg \left(im \leq 3.6 \cdot 10^{+227}\right):\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\ \end{array} \]

Alternative 7: 78.0% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\ t_1 := im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\\ t_2 := 0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - t_1 \cdot t_1}{im \cdot -2 - t_1}\right)\\ \mathbf{if}\;im \leq -8 \cdot 10^{+102}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -8.5 \cdot 10^{+58}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;im \leq -420000:\\ \;\;\;\;0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right) - im \cdot re\\ \mathbf{elif}\;im \leq -9 \cdot 10^{-6}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 2.4 \cdot 10^{+14}:\\ \;\;\;\;im \cdot \left(-\sin re\right)\\ \mathbf{elif}\;im \leq 8.2 \cdot 10^{+102}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;im \leq 1.15 \cdot 10^{+159} \lor \neg \left(im \leq 3.6 \cdot 10^{+227}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* 0.5 (* re (* im (+ -2.0 (* -0.3333333333333333 (* im im)))))))
        (t_1 (* im (* im (* im -0.3333333333333333))))
        (t_2
         (*
          0.5
          (*
           re
           (/
            (- (* (* im -2.0) (* im -2.0)) (* t_1 t_1))
            (- (* im -2.0) t_1))))))
   (if (<= im -8e+102)
     t_0
     (if (<= im -8.5e+58)
       t_2
       (if (<= im -420000.0)
         (- (* 0.16666666666666666 (* im (pow re 3.0))) (* im re))
         (if (<= im -9e-6)
           t_0
           (if (<= im 2.4e+14)
             (* im (- (sin re)))
             (if (<= im 8.2e+102)
               t_2
               (if (or (<= im 1.15e+159) (not (<= im 3.6e+227)))
                 t_0
                 (* im (- (* 0.16666666666666666 (pow re 3.0)) re)))))))))))
double code(double re, double im) {
	double t_0 = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))));
	double t_1 = im * (im * (im * -0.3333333333333333));
	double t_2 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_1 * t_1)) / ((im * -2.0) - t_1)));
	double tmp;
	if (im <= -8e+102) {
		tmp = t_0;
	} else if (im <= -8.5e+58) {
		tmp = t_2;
	} else if (im <= -420000.0) {
		tmp = (0.16666666666666666 * (im * pow(re, 3.0))) - (im * re);
	} else if (im <= -9e-6) {
		tmp = t_0;
	} else if (im <= 2.4e+14) {
		tmp = im * -sin(re);
	} else if (im <= 8.2e+102) {
		tmp = t_2;
	} else if ((im <= 1.15e+159) || !(im <= 3.6e+227)) {
		tmp = t_0;
	} else {
		tmp = im * ((0.16666666666666666 * pow(re, 3.0)) - re);
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = 0.5d0 * (re * (im * ((-2.0d0) + ((-0.3333333333333333d0) * (im * im)))))
    t_1 = im * (im * (im * (-0.3333333333333333d0)))
    t_2 = 0.5d0 * (re * ((((im * (-2.0d0)) * (im * (-2.0d0))) - (t_1 * t_1)) / ((im * (-2.0d0)) - t_1)))
    if (im <= (-8d+102)) then
        tmp = t_0
    else if (im <= (-8.5d+58)) then
        tmp = t_2
    else if (im <= (-420000.0d0)) then
        tmp = (0.16666666666666666d0 * (im * (re ** 3.0d0))) - (im * re)
    else if (im <= (-9d-6)) then
        tmp = t_0
    else if (im <= 2.4d+14) then
        tmp = im * -sin(re)
    else if (im <= 8.2d+102) then
        tmp = t_2
    else if ((im <= 1.15d+159) .or. (.not. (im <= 3.6d+227))) then
        tmp = t_0
    else
        tmp = im * ((0.16666666666666666d0 * (re ** 3.0d0)) - re)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))));
	double t_1 = im * (im * (im * -0.3333333333333333));
	double t_2 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_1 * t_1)) / ((im * -2.0) - t_1)));
	double tmp;
	if (im <= -8e+102) {
		tmp = t_0;
	} else if (im <= -8.5e+58) {
		tmp = t_2;
	} else if (im <= -420000.0) {
		tmp = (0.16666666666666666 * (im * Math.pow(re, 3.0))) - (im * re);
	} else if (im <= -9e-6) {
		tmp = t_0;
	} else if (im <= 2.4e+14) {
		tmp = im * -Math.sin(re);
	} else if (im <= 8.2e+102) {
		tmp = t_2;
	} else if ((im <= 1.15e+159) || !(im <= 3.6e+227)) {
		tmp = t_0;
	} else {
		tmp = im * ((0.16666666666666666 * Math.pow(re, 3.0)) - re);
	}
	return tmp;
}
def code(re, im):
	t_0 = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))))
	t_1 = im * (im * (im * -0.3333333333333333))
	t_2 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_1 * t_1)) / ((im * -2.0) - t_1)))
	tmp = 0
	if im <= -8e+102:
		tmp = t_0
	elif im <= -8.5e+58:
		tmp = t_2
	elif im <= -420000.0:
		tmp = (0.16666666666666666 * (im * math.pow(re, 3.0))) - (im * re)
	elif im <= -9e-6:
		tmp = t_0
	elif im <= 2.4e+14:
		tmp = im * -math.sin(re)
	elif im <= 8.2e+102:
		tmp = t_2
	elif (im <= 1.15e+159) or not (im <= 3.6e+227):
		tmp = t_0
	else:
		tmp = im * ((0.16666666666666666 * math.pow(re, 3.0)) - re)
	return tmp
function code(re, im)
	t_0 = Float64(0.5 * Float64(re * Float64(im * Float64(-2.0 + Float64(-0.3333333333333333 * Float64(im * im))))))
	t_1 = Float64(im * Float64(im * Float64(im * -0.3333333333333333)))
	t_2 = Float64(0.5 * Float64(re * Float64(Float64(Float64(Float64(im * -2.0) * Float64(im * -2.0)) - Float64(t_1 * t_1)) / Float64(Float64(im * -2.0) - t_1))))
	tmp = 0.0
	if (im <= -8e+102)
		tmp = t_0;
	elseif (im <= -8.5e+58)
		tmp = t_2;
	elseif (im <= -420000.0)
		tmp = Float64(Float64(0.16666666666666666 * Float64(im * (re ^ 3.0))) - Float64(im * re));
	elseif (im <= -9e-6)
		tmp = t_0;
	elseif (im <= 2.4e+14)
		tmp = Float64(im * Float64(-sin(re)));
	elseif (im <= 8.2e+102)
		tmp = t_2;
	elseif ((im <= 1.15e+159) || !(im <= 3.6e+227))
		tmp = t_0;
	else
		tmp = Float64(im * Float64(Float64(0.16666666666666666 * (re ^ 3.0)) - re));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))));
	t_1 = im * (im * (im * -0.3333333333333333));
	t_2 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_1 * t_1)) / ((im * -2.0) - t_1)));
	tmp = 0.0;
	if (im <= -8e+102)
		tmp = t_0;
	elseif (im <= -8.5e+58)
		tmp = t_2;
	elseif (im <= -420000.0)
		tmp = (0.16666666666666666 * (im * (re ^ 3.0))) - (im * re);
	elseif (im <= -9e-6)
		tmp = t_0;
	elseif (im <= 2.4e+14)
		tmp = im * -sin(re);
	elseif (im <= 8.2e+102)
		tmp = t_2;
	elseif ((im <= 1.15e+159) || ~((im <= 3.6e+227)))
		tmp = t_0;
	else
		tmp = im * ((0.16666666666666666 * (re ^ 3.0)) - re);
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(re * N[(im * N[(-2.0 + N[(-0.3333333333333333 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(im * N[(im * N[(im * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[(re * N[(N[(N[(N[(im * -2.0), $MachinePrecision] * N[(im * -2.0), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(N[(im * -2.0), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -8e+102], t$95$0, If[LessEqual[im, -8.5e+58], t$95$2, If[LessEqual[im, -420000.0], N[(N[(0.16666666666666666 * N[(im * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(im * re), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -9e-6], t$95$0, If[LessEqual[im, 2.4e+14], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 8.2e+102], t$95$2, If[Or[LessEqual[im, 1.15e+159], N[Not[LessEqual[im, 3.6e+227]], $MachinePrecision]], t$95$0, N[(im * N[(N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\
t_1 := im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\\
t_2 := 0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - t_1 \cdot t_1}{im \cdot -2 - t_1}\right)\\
\mathbf{if}\;im \leq -8 \cdot 10^{+102}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -8.5 \cdot 10^{+58}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;im \leq -420000:\\
\;\;\;\;0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right) - im \cdot re\\

\mathbf{elif}\;im \leq -9 \cdot 10^{-6}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;im \leq 8.2 \cdot 10^{+102}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;im \leq 1.15 \cdot 10^{+159} \lor \neg \left(im \leq 3.6 \cdot 10^{+227}\right):\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if im < -7.99999999999999982e102 or -4.2e5 < im < -9.00000000000000023e-6 or 8.1999999999999999e102 < im < 1.14999999999999998e159 or 3.59999999999999991e227 < im

    1. Initial program 99.7%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in re around 0 72.9%

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

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

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

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(re \cdot im\right) \cdot -2} + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right) \]
      3. associate-*l*71.9%

        \[\leadsto 0.5 \cdot \left(\color{blue}{re \cdot \left(im \cdot -2\right)} + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right) \]
      4. *-commutative71.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2\right) + \color{blue}{\left(re \cdot {im}^{3}\right) \cdot -0.3333333333333333}\right) \]
      5. associate-*l*71.9%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\right)\right)} \]
      7. cube-mult71.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right)\right) \]
      8. associate-*l*71.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right)}\right)\right) \]
      9. distribute-lft-out71.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)}\right) \]
    5. Simplified71.9%

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

    if -7.99999999999999982e102 < im < -8.50000000000000015e58 or 2.4e14 < im < 8.1999999999999999e102

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in re around 0 81.1%

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right) + -2 \cdot \left(re \cdot im\right)\right)} \]
    4. Step-by-step derivation
      1. +-commutative13.3%

        \[\leadsto 0.5 \cdot \color{blue}{\left(-2 \cdot \left(re \cdot im\right) + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right)} \]
      2. *-commutative13.3%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(re \cdot im\right) \cdot -2} + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right) \]
      3. associate-*l*13.3%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2\right) + \color{blue}{\left(re \cdot {im}^{3}\right) \cdot -0.3333333333333333}\right) \]
      5. associate-*l*13.3%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\right)\right)} \]
      7. cube-mult13.3%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right)\right) \]
      8. associate-*l*13.3%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right)}\right)\right) \]
      9. distribute-lft-out13.3%

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)}\right) \]
    5. Simplified13.3%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(-2 \cdot im + \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}\right) \]
      2. flip-+57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}}\right) \]
      3. *-commutative57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\color{blue}{\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)} \cdot im\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      4. associate-*r*57.5%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\color{blue}{\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)} \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      6. associate-*r*57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\color{blue}{\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right)} \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      7. *-commutative57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right)}{-2 \cdot im - \color{blue}{\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)} \cdot im}\right) \]
      8. associate-*r*57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right)}{-2 \cdot im - \color{blue}{\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right)} \cdot im}\right) \]
    7. Applied egg-rr57.5%

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

    if -8.50000000000000015e58 < im < -4.2e5

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 2.9%

      \[\leadsto \color{blue}{-1 \cdot \left(\sin re \cdot im\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg2.9%

        \[\leadsto \color{blue}{-\sin re \cdot im} \]
      2. *-commutative2.9%

        \[\leadsto -\color{blue}{im \cdot \sin re} \]
      3. distribute-rgt-neg-in2.9%

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

      \[\leadsto \color{blue}{im \cdot \left(-\sin re\right)} \]
    5. Taylor expanded in re around 0 42.1%

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

    if -9.00000000000000023e-6 < im < 2.4e14

    1. Initial program 37.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 97.5%

      \[\leadsto \color{blue}{-1 \cdot \left(\sin re \cdot im\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg97.5%

        \[\leadsto \color{blue}{-\sin re \cdot im} \]
      2. *-commutative97.5%

        \[\leadsto -\color{blue}{im \cdot \sin re} \]
      3. distribute-rgt-neg-in97.5%

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

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

    if 1.14999999999999998e159 < im < 3.59999999999999991e227

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 100.0%

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

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

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

        \[\leadsto \color{blue}{\left(\sin re \cdot {im}^{3}\right) \cdot -0.16666666666666666} - \sin re \cdot im \]
      4. associate-*l*100.0%

        \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right)} - \sin re \cdot im \]
      5. distribute-lft-out--100.0%

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

      \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)} \]
    5. Taylor expanded in re around 0 0.0%

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

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

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

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

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

      \[\leadsto \color{blue}{\left({im}^{3} \cdot -0.16666666666666666 - im\right) \cdot \left(re + -0.16666666666666666 \cdot {re}^{3}\right)} \]
    8. Taylor expanded in im around 0 72.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{im \cdot \left(-1 \cdot re + 0.16666666666666666 \cdot {re}^{3}\right)} \]
      7. neg-mul-172.4%

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

        \[\leadsto im \cdot \color{blue}{\left(0.16666666666666666 \cdot {re}^{3} + \left(-re\right)\right)} \]
      9. unsub-neg72.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -8 \cdot 10^{+102}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{elif}\;im \leq -8.5 \cdot 10^{+58}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)}{im \cdot -2 - im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)}\right)\\ \mathbf{elif}\;im \leq -420000:\\ \;\;\;\;0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right) - im \cdot re\\ \mathbf{elif}\;im \leq -9 \cdot 10^{-6}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{elif}\;im \leq 2.4 \cdot 10^{+14}:\\ \;\;\;\;im \cdot \left(-\sin re\right)\\ \mathbf{elif}\;im \leq 8.2 \cdot 10^{+102}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)}{im \cdot -2 - im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)}\right)\\ \mathbf{elif}\;im \leq 1.15 \cdot 10^{+159} \lor \neg \left(im \leq 3.6 \cdot 10^{+227}\right):\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\ \end{array} \]

Alternative 8: 78.0% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right)\\ t_1 := 0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\ t_2 := im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\\ t_3 := 0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - t_2 \cdot t_2}{im \cdot -2 - t_2}\right)\\ \mathbf{if}\;im \leq -8 \cdot 10^{+102}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq -8.5 \cdot 10^{+58}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;im \leq -480000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -9 \cdot 10^{-6}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq 92000000000000:\\ \;\;\;\;im \cdot \left(-\sin re\right)\\ \mathbf{elif}\;im \leq 8.2 \cdot 10^{+102}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;im \leq 1.15 \cdot 10^{+159} \lor \neg \left(im \leq 5.4 \cdot 10^{+228}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* 0.16666666666666666 (* im (pow re 3.0))))
        (t_1 (* 0.5 (* re (* im (+ -2.0 (* -0.3333333333333333 (* im im)))))))
        (t_2 (* im (* im (* im -0.3333333333333333))))
        (t_3
         (*
          0.5
          (*
           re
           (/
            (- (* (* im -2.0) (* im -2.0)) (* t_2 t_2))
            (- (* im -2.0) t_2))))))
   (if (<= im -8e+102)
     t_1
     (if (<= im -8.5e+58)
       t_3
       (if (<= im -480000.0)
         t_0
         (if (<= im -9e-6)
           t_1
           (if (<= im 92000000000000.0)
             (* im (- (sin re)))
             (if (<= im 8.2e+102)
               t_3
               (if (or (<= im 1.15e+159) (not (<= im 5.4e+228)))
                 t_1
                 t_0)))))))))
double code(double re, double im) {
	double t_0 = 0.16666666666666666 * (im * pow(re, 3.0));
	double t_1 = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))));
	double t_2 = im * (im * (im * -0.3333333333333333));
	double t_3 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_2 * t_2)) / ((im * -2.0) - t_2)));
	double tmp;
	if (im <= -8e+102) {
		tmp = t_1;
	} else if (im <= -8.5e+58) {
		tmp = t_3;
	} else if (im <= -480000.0) {
		tmp = t_0;
	} else if (im <= -9e-6) {
		tmp = t_1;
	} else if (im <= 92000000000000.0) {
		tmp = im * -sin(re);
	} else if (im <= 8.2e+102) {
		tmp = t_3;
	} else if ((im <= 1.15e+159) || !(im <= 5.4e+228)) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = 0.16666666666666666d0 * (im * (re ** 3.0d0))
    t_1 = 0.5d0 * (re * (im * ((-2.0d0) + ((-0.3333333333333333d0) * (im * im)))))
    t_2 = im * (im * (im * (-0.3333333333333333d0)))
    t_3 = 0.5d0 * (re * ((((im * (-2.0d0)) * (im * (-2.0d0))) - (t_2 * t_2)) / ((im * (-2.0d0)) - t_2)))
    if (im <= (-8d+102)) then
        tmp = t_1
    else if (im <= (-8.5d+58)) then
        tmp = t_3
    else if (im <= (-480000.0d0)) then
        tmp = t_0
    else if (im <= (-9d-6)) then
        tmp = t_1
    else if (im <= 92000000000000.0d0) then
        tmp = im * -sin(re)
    else if (im <= 8.2d+102) then
        tmp = t_3
    else if ((im <= 1.15d+159) .or. (.not. (im <= 5.4d+228))) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = 0.16666666666666666 * (im * Math.pow(re, 3.0));
	double t_1 = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))));
	double t_2 = im * (im * (im * -0.3333333333333333));
	double t_3 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_2 * t_2)) / ((im * -2.0) - t_2)));
	double tmp;
	if (im <= -8e+102) {
		tmp = t_1;
	} else if (im <= -8.5e+58) {
		tmp = t_3;
	} else if (im <= -480000.0) {
		tmp = t_0;
	} else if (im <= -9e-6) {
		tmp = t_1;
	} else if (im <= 92000000000000.0) {
		tmp = im * -Math.sin(re);
	} else if (im <= 8.2e+102) {
		tmp = t_3;
	} else if ((im <= 1.15e+159) || !(im <= 5.4e+228)) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = 0.16666666666666666 * (im * math.pow(re, 3.0))
	t_1 = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))))
	t_2 = im * (im * (im * -0.3333333333333333))
	t_3 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_2 * t_2)) / ((im * -2.0) - t_2)))
	tmp = 0
	if im <= -8e+102:
		tmp = t_1
	elif im <= -8.5e+58:
		tmp = t_3
	elif im <= -480000.0:
		tmp = t_0
	elif im <= -9e-6:
		tmp = t_1
	elif im <= 92000000000000.0:
		tmp = im * -math.sin(re)
	elif im <= 8.2e+102:
		tmp = t_3
	elif (im <= 1.15e+159) or not (im <= 5.4e+228):
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(0.16666666666666666 * Float64(im * (re ^ 3.0)))
	t_1 = Float64(0.5 * Float64(re * Float64(im * Float64(-2.0 + Float64(-0.3333333333333333 * Float64(im * im))))))
	t_2 = Float64(im * Float64(im * Float64(im * -0.3333333333333333)))
	t_3 = Float64(0.5 * Float64(re * Float64(Float64(Float64(Float64(im * -2.0) * Float64(im * -2.0)) - Float64(t_2 * t_2)) / Float64(Float64(im * -2.0) - t_2))))
	tmp = 0.0
	if (im <= -8e+102)
		tmp = t_1;
	elseif (im <= -8.5e+58)
		tmp = t_3;
	elseif (im <= -480000.0)
		tmp = t_0;
	elseif (im <= -9e-6)
		tmp = t_1;
	elseif (im <= 92000000000000.0)
		tmp = Float64(im * Float64(-sin(re)));
	elseif (im <= 8.2e+102)
		tmp = t_3;
	elseif ((im <= 1.15e+159) || !(im <= 5.4e+228))
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 0.16666666666666666 * (im * (re ^ 3.0));
	t_1 = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))));
	t_2 = im * (im * (im * -0.3333333333333333));
	t_3 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_2 * t_2)) / ((im * -2.0) - t_2)));
	tmp = 0.0;
	if (im <= -8e+102)
		tmp = t_1;
	elseif (im <= -8.5e+58)
		tmp = t_3;
	elseif (im <= -480000.0)
		tmp = t_0;
	elseif (im <= -9e-6)
		tmp = t_1;
	elseif (im <= 92000000000000.0)
		tmp = im * -sin(re);
	elseif (im <= 8.2e+102)
		tmp = t_3;
	elseif ((im <= 1.15e+159) || ~((im <= 5.4e+228)))
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(im * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(re * N[(im * N[(-2.0 + N[(-0.3333333333333333 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(im * N[(im * N[(im * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(0.5 * N[(re * N[(N[(N[(N[(im * -2.0), $MachinePrecision] * N[(im * -2.0), $MachinePrecision]), $MachinePrecision] - N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision] / N[(N[(im * -2.0), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -8e+102], t$95$1, If[LessEqual[im, -8.5e+58], t$95$3, If[LessEqual[im, -480000.0], t$95$0, If[LessEqual[im, -9e-6], t$95$1, If[LessEqual[im, 92000000000000.0], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 8.2e+102], t$95$3, If[Or[LessEqual[im, 1.15e+159], N[Not[LessEqual[im, 5.4e+228]], $MachinePrecision]], t$95$1, t$95$0]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right)\\
t_1 := 0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\
t_2 := im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\\
t_3 := 0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - t_2 \cdot t_2}{im \cdot -2 - t_2}\right)\\
\mathbf{if}\;im \leq -8 \cdot 10^{+102}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq -8.5 \cdot 10^{+58}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;im \leq -480000:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -9 \cdot 10^{-6}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;im \leq 8.2 \cdot 10^{+102}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;im \leq 1.15 \cdot 10^{+159} \lor \neg \left(im \leq 5.4 \cdot 10^{+228}\right):\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < -7.99999999999999982e102 or -4.8e5 < im < -9.00000000000000023e-6 or 8.1999999999999999e102 < im < 1.14999999999999998e159 or 5.4000000000000003e228 < im

    1. Initial program 99.7%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in re around 0 72.9%

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

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

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

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(re \cdot im\right) \cdot -2} + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right) \]
      3. associate-*l*71.9%

        \[\leadsto 0.5 \cdot \left(\color{blue}{re \cdot \left(im \cdot -2\right)} + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right) \]
      4. *-commutative71.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2\right) + \color{blue}{\left(re \cdot {im}^{3}\right) \cdot -0.3333333333333333}\right) \]
      5. associate-*l*71.9%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\right)\right)} \]
      7. cube-mult71.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right)\right) \]
      8. associate-*l*71.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right)}\right)\right) \]
      9. distribute-lft-out71.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)}\right) \]
    5. Simplified71.9%

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

    if -7.99999999999999982e102 < im < -8.50000000000000015e58 or 9.2e13 < im < 8.1999999999999999e102

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in re around 0 81.1%

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right) + -2 \cdot \left(re \cdot im\right)\right)} \]
    4. Step-by-step derivation
      1. +-commutative13.3%

        \[\leadsto 0.5 \cdot \color{blue}{\left(-2 \cdot \left(re \cdot im\right) + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right)} \]
      2. *-commutative13.3%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(re \cdot im\right) \cdot -2} + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right) \]
      3. associate-*l*13.3%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2\right) + \color{blue}{\left(re \cdot {im}^{3}\right) \cdot -0.3333333333333333}\right) \]
      5. associate-*l*13.3%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\right)\right)} \]
      7. cube-mult13.3%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right)\right) \]
      8. associate-*l*13.3%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right)}\right)\right) \]
      9. distribute-lft-out13.3%

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)}\right) \]
    5. Simplified13.3%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(-2 \cdot im + \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}\right) \]
      2. flip-+57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}}\right) \]
      3. *-commutative57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\color{blue}{\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)} \cdot im\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      4. associate-*r*57.5%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\color{blue}{\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)} \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      6. associate-*r*57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\color{blue}{\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right)} \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      7. *-commutative57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right)}{-2 \cdot im - \color{blue}{\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)} \cdot im}\right) \]
      8. associate-*r*57.5%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right)}{-2 \cdot im - \color{blue}{\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right)} \cdot im}\right) \]
    7. Applied egg-rr57.5%

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

    if -8.50000000000000015e58 < im < -4.8e5 or 1.14999999999999998e159 < im < 5.4000000000000003e228

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 4.3%

      \[\leadsto \color{blue}{-1 \cdot \left(\sin re \cdot im\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg4.3%

        \[\leadsto \color{blue}{-\sin re \cdot im} \]
      2. *-commutative4.3%

        \[\leadsto -\color{blue}{im \cdot \sin re} \]
      3. distribute-rgt-neg-in4.3%

        \[\leadsto \color{blue}{im \cdot \left(-\sin re\right)} \]
    4. Simplified4.3%

      \[\leadsto \color{blue}{im \cdot \left(-\sin re\right)} \]
    5. Taylor expanded in re around 0 26.5%

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

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

    if -9.00000000000000023e-6 < im < 9.2e13

    1. Initial program 37.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 97.5%

      \[\leadsto \color{blue}{-1 \cdot \left(\sin re \cdot im\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg97.5%

        \[\leadsto \color{blue}{-\sin re \cdot im} \]
      2. *-commutative97.5%

        \[\leadsto -\color{blue}{im \cdot \sin re} \]
      3. distribute-rgt-neg-in97.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -8 \cdot 10^{+102}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{elif}\;im \leq -8.5 \cdot 10^{+58}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)}{im \cdot -2 - im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)}\right)\\ \mathbf{elif}\;im \leq -480000:\\ \;\;\;\;0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right)\\ \mathbf{elif}\;im \leq -9 \cdot 10^{-6}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{elif}\;im \leq 92000000000000:\\ \;\;\;\;im \cdot \left(-\sin re\right)\\ \mathbf{elif}\;im \leq 8.2 \cdot 10^{+102}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)}{im \cdot -2 - im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)}\right)\\ \mathbf{elif}\;im \leq 1.15 \cdot 10^{+159} \lor \neg \left(im \leq 5.4 \cdot 10^{+228}\right):\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right)\\ \end{array} \]

Alternative 9: 80.5% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\ t_1 := im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\\ t_2 := 0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - t_1 \cdot t_1}{im \cdot -2 - t_1}\right)\\ \mathbf{if}\;im \leq -8 \cdot 10^{+102}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -5.4 \cdot 10^{-6}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;im \leq 78000000000000:\\ \;\;\;\;im \cdot \left(-\sin re\right)\\ \mathbf{elif}\;im \leq 8.2 \cdot 10^{+102}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* 0.5 (* re (* im (+ -2.0 (* -0.3333333333333333 (* im im)))))))
        (t_1 (* im (* im (* im -0.3333333333333333))))
        (t_2
         (*
          0.5
          (*
           re
           (/
            (- (* (* im -2.0) (* im -2.0)) (* t_1 t_1))
            (- (* im -2.0) t_1))))))
   (if (<= im -8e+102)
     t_0
     (if (<= im -5.4e-6)
       t_2
       (if (<= im 78000000000000.0)
         (* im (- (sin re)))
         (if (<= im 8.2e+102) t_2 t_0))))))
double code(double re, double im) {
	double t_0 = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))));
	double t_1 = im * (im * (im * -0.3333333333333333));
	double t_2 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_1 * t_1)) / ((im * -2.0) - t_1)));
	double tmp;
	if (im <= -8e+102) {
		tmp = t_0;
	} else if (im <= -5.4e-6) {
		tmp = t_2;
	} else if (im <= 78000000000000.0) {
		tmp = im * -sin(re);
	} else if (im <= 8.2e+102) {
		tmp = t_2;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = 0.5d0 * (re * (im * ((-2.0d0) + ((-0.3333333333333333d0) * (im * im)))))
    t_1 = im * (im * (im * (-0.3333333333333333d0)))
    t_2 = 0.5d0 * (re * ((((im * (-2.0d0)) * (im * (-2.0d0))) - (t_1 * t_1)) / ((im * (-2.0d0)) - t_1)))
    if (im <= (-8d+102)) then
        tmp = t_0
    else if (im <= (-5.4d-6)) then
        tmp = t_2
    else if (im <= 78000000000000.0d0) then
        tmp = im * -sin(re)
    else if (im <= 8.2d+102) then
        tmp = t_2
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))));
	double t_1 = im * (im * (im * -0.3333333333333333));
	double t_2 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_1 * t_1)) / ((im * -2.0) - t_1)));
	double tmp;
	if (im <= -8e+102) {
		tmp = t_0;
	} else if (im <= -5.4e-6) {
		tmp = t_2;
	} else if (im <= 78000000000000.0) {
		tmp = im * -Math.sin(re);
	} else if (im <= 8.2e+102) {
		tmp = t_2;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))))
	t_1 = im * (im * (im * -0.3333333333333333))
	t_2 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_1 * t_1)) / ((im * -2.0) - t_1)))
	tmp = 0
	if im <= -8e+102:
		tmp = t_0
	elif im <= -5.4e-6:
		tmp = t_2
	elif im <= 78000000000000.0:
		tmp = im * -math.sin(re)
	elif im <= 8.2e+102:
		tmp = t_2
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(0.5 * Float64(re * Float64(im * Float64(-2.0 + Float64(-0.3333333333333333 * Float64(im * im))))))
	t_1 = Float64(im * Float64(im * Float64(im * -0.3333333333333333)))
	t_2 = Float64(0.5 * Float64(re * Float64(Float64(Float64(Float64(im * -2.0) * Float64(im * -2.0)) - Float64(t_1 * t_1)) / Float64(Float64(im * -2.0) - t_1))))
	tmp = 0.0
	if (im <= -8e+102)
		tmp = t_0;
	elseif (im <= -5.4e-6)
		tmp = t_2;
	elseif (im <= 78000000000000.0)
		tmp = Float64(im * Float64(-sin(re)));
	elseif (im <= 8.2e+102)
		tmp = t_2;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))));
	t_1 = im * (im * (im * -0.3333333333333333));
	t_2 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_1 * t_1)) / ((im * -2.0) - t_1)));
	tmp = 0.0;
	if (im <= -8e+102)
		tmp = t_0;
	elseif (im <= -5.4e-6)
		tmp = t_2;
	elseif (im <= 78000000000000.0)
		tmp = im * -sin(re);
	elseif (im <= 8.2e+102)
		tmp = t_2;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(re * N[(im * N[(-2.0 + N[(-0.3333333333333333 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(im * N[(im * N[(im * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[(re * N[(N[(N[(N[(im * -2.0), $MachinePrecision] * N[(im * -2.0), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(N[(im * -2.0), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -8e+102], t$95$0, If[LessEqual[im, -5.4e-6], t$95$2, If[LessEqual[im, 78000000000000.0], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 8.2e+102], t$95$2, t$95$0]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\
t_1 := im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\\
t_2 := 0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - t_1 \cdot t_1}{im \cdot -2 - t_1}\right)\\
\mathbf{if}\;im \leq -8 \cdot 10^{+102}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -5.4 \cdot 10^{-6}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;im \leq 8.2 \cdot 10^{+102}:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -7.99999999999999982e102 or 8.1999999999999999e102 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in re around 0 63.9%

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

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

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

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(re \cdot im\right) \cdot -2} + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right) \]
      3. associate-*l*63.9%

        \[\leadsto 0.5 \cdot \left(\color{blue}{re \cdot \left(im \cdot -2\right)} + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right) \]
      4. *-commutative63.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2\right) + \color{blue}{\left(re \cdot {im}^{3}\right) \cdot -0.3333333333333333}\right) \]
      5. associate-*l*63.9%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\right)\right)} \]
      7. cube-mult63.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right)\right) \]
      8. associate-*l*63.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right)}\right)\right) \]
      9. distribute-lft-out63.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)}\right) \]
    5. Simplified63.9%

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

    if -7.99999999999999982e102 < im < -5.39999999999999997e-6 or 7.8e13 < im < 8.1999999999999999e102

    1. Initial program 99.6%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in re around 0 73.0%

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right) + -2 \cdot \left(re \cdot im\right)\right)} \]
    4. Step-by-step derivation
      1. +-commutative12.3%

        \[\leadsto 0.5 \cdot \color{blue}{\left(-2 \cdot \left(re \cdot im\right) + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right)} \]
      2. *-commutative12.3%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(re \cdot im\right) \cdot -2} + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right) \]
      3. associate-*l*12.3%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2\right) + \color{blue}{\left(re \cdot {im}^{3}\right) \cdot -0.3333333333333333}\right) \]
      5. associate-*l*12.3%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\right)\right)} \]
      7. cube-mult12.3%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right)\right) \]
      8. associate-*l*12.3%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right)}\right)\right) \]
      9. distribute-lft-out12.3%

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)}\right) \]
    5. Simplified12.3%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(-2 \cdot im + \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}\right) \]
      2. flip-+45.7%

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}}\right) \]
      3. *-commutative45.7%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\color{blue}{\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)} \cdot im\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      4. associate-*r*45.7%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\color{blue}{\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right)} \cdot im\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      5. *-commutative45.7%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\color{blue}{\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)} \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      6. associate-*r*45.7%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\color{blue}{\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right)} \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      7. *-commutative45.7%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right)}{-2 \cdot im - \color{blue}{\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)} \cdot im}\right) \]
      8. associate-*r*45.7%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right)}{-2 \cdot im - \color{blue}{\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right)} \cdot im}\right) \]
    7. Applied egg-rr45.7%

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

    if -5.39999999999999997e-6 < im < 7.8e13

    1. Initial program 37.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 97.5%

      \[\leadsto \color{blue}{-1 \cdot \left(\sin re \cdot im\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg97.5%

        \[\leadsto \color{blue}{-\sin re \cdot im} \]
      2. *-commutative97.5%

        \[\leadsto -\color{blue}{im \cdot \sin re} \]
      3. distribute-rgt-neg-in97.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -8 \cdot 10^{+102}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{elif}\;im \leq -5.4 \cdot 10^{-6}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)}{im \cdot -2 - im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)}\right)\\ \mathbf{elif}\;im \leq 78000000000000:\\ \;\;\;\;im \cdot \left(-\sin re\right)\\ \mathbf{elif}\;im \leq 8.2 \cdot 10^{+102}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)}{im \cdot -2 - im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\ \end{array} \]

Alternative 10: 55.8% accurate, 6.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\ t_1 := im \cdot \left(im \cdot -0.3333333333333333\right)\\ t_2 := im \cdot t_1\\ t_3 := 0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - t_2 \cdot t_2}{im \cdot -2 - t_2}\right)\\ \mathbf{if}\;im \leq -8 \cdot 10^{+102}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -8.5 \cdot 10^{+58}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;im \leq 3.25 \cdot 10^{-178}:\\ \;\;\;\;0.5 \cdot \left(t_1 \cdot \left(im \cdot re\right) + -2 \cdot \left(im \cdot re\right)\right)\\ \mathbf{elif}\;im \leq 8.2 \cdot 10^{+102}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* 0.5 (* re (* im (+ -2.0 (* -0.3333333333333333 (* im im)))))))
        (t_1 (* im (* im -0.3333333333333333)))
        (t_2 (* im t_1))
        (t_3
         (*
          0.5
          (*
           re
           (/
            (- (* (* im -2.0) (* im -2.0)) (* t_2 t_2))
            (- (* im -2.0) t_2))))))
   (if (<= im -8e+102)
     t_0
     (if (<= im -8.5e+58)
       t_3
       (if (<= im 3.25e-178)
         (* 0.5 (+ (* t_1 (* im re)) (* -2.0 (* im re))))
         (if (<= im 8.2e+102) t_3 t_0))))))
double code(double re, double im) {
	double t_0 = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))));
	double t_1 = im * (im * -0.3333333333333333);
	double t_2 = im * t_1;
	double t_3 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_2 * t_2)) / ((im * -2.0) - t_2)));
	double tmp;
	if (im <= -8e+102) {
		tmp = t_0;
	} else if (im <= -8.5e+58) {
		tmp = t_3;
	} else if (im <= 3.25e-178) {
		tmp = 0.5 * ((t_1 * (im * re)) + (-2.0 * (im * re)));
	} else if (im <= 8.2e+102) {
		tmp = t_3;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = 0.5d0 * (re * (im * ((-2.0d0) + ((-0.3333333333333333d0) * (im * im)))))
    t_1 = im * (im * (-0.3333333333333333d0))
    t_2 = im * t_1
    t_3 = 0.5d0 * (re * ((((im * (-2.0d0)) * (im * (-2.0d0))) - (t_2 * t_2)) / ((im * (-2.0d0)) - t_2)))
    if (im <= (-8d+102)) then
        tmp = t_0
    else if (im <= (-8.5d+58)) then
        tmp = t_3
    else if (im <= 3.25d-178) then
        tmp = 0.5d0 * ((t_1 * (im * re)) + ((-2.0d0) * (im * re)))
    else if (im <= 8.2d+102) then
        tmp = t_3
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))));
	double t_1 = im * (im * -0.3333333333333333);
	double t_2 = im * t_1;
	double t_3 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_2 * t_2)) / ((im * -2.0) - t_2)));
	double tmp;
	if (im <= -8e+102) {
		tmp = t_0;
	} else if (im <= -8.5e+58) {
		tmp = t_3;
	} else if (im <= 3.25e-178) {
		tmp = 0.5 * ((t_1 * (im * re)) + (-2.0 * (im * re)));
	} else if (im <= 8.2e+102) {
		tmp = t_3;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))))
	t_1 = im * (im * -0.3333333333333333)
	t_2 = im * t_1
	t_3 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_2 * t_2)) / ((im * -2.0) - t_2)))
	tmp = 0
	if im <= -8e+102:
		tmp = t_0
	elif im <= -8.5e+58:
		tmp = t_3
	elif im <= 3.25e-178:
		tmp = 0.5 * ((t_1 * (im * re)) + (-2.0 * (im * re)))
	elif im <= 8.2e+102:
		tmp = t_3
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(0.5 * Float64(re * Float64(im * Float64(-2.0 + Float64(-0.3333333333333333 * Float64(im * im))))))
	t_1 = Float64(im * Float64(im * -0.3333333333333333))
	t_2 = Float64(im * t_1)
	t_3 = Float64(0.5 * Float64(re * Float64(Float64(Float64(Float64(im * -2.0) * Float64(im * -2.0)) - Float64(t_2 * t_2)) / Float64(Float64(im * -2.0) - t_2))))
	tmp = 0.0
	if (im <= -8e+102)
		tmp = t_0;
	elseif (im <= -8.5e+58)
		tmp = t_3;
	elseif (im <= 3.25e-178)
		tmp = Float64(0.5 * Float64(Float64(t_1 * Float64(im * re)) + Float64(-2.0 * Float64(im * re))));
	elseif (im <= 8.2e+102)
		tmp = t_3;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 0.5 * (re * (im * (-2.0 + (-0.3333333333333333 * (im * im)))));
	t_1 = im * (im * -0.3333333333333333);
	t_2 = im * t_1;
	t_3 = 0.5 * (re * ((((im * -2.0) * (im * -2.0)) - (t_2 * t_2)) / ((im * -2.0) - t_2)));
	tmp = 0.0;
	if (im <= -8e+102)
		tmp = t_0;
	elseif (im <= -8.5e+58)
		tmp = t_3;
	elseif (im <= 3.25e-178)
		tmp = 0.5 * ((t_1 * (im * re)) + (-2.0 * (im * re)));
	elseif (im <= 8.2e+102)
		tmp = t_3;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(re * N[(im * N[(-2.0 + N[(-0.3333333333333333 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(im * N[(im * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(im * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(0.5 * N[(re * N[(N[(N[(N[(im * -2.0), $MachinePrecision] * N[(im * -2.0), $MachinePrecision]), $MachinePrecision] - N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision] / N[(N[(im * -2.0), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -8e+102], t$95$0, If[LessEqual[im, -8.5e+58], t$95$3, If[LessEqual[im, 3.25e-178], N[(0.5 * N[(N[(t$95$1 * N[(im * re), $MachinePrecision]), $MachinePrecision] + N[(-2.0 * N[(im * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 8.2e+102], t$95$3, t$95$0]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\
t_1 := im \cdot \left(im \cdot -0.3333333333333333\right)\\
t_2 := im \cdot t_1\\
t_3 := 0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - t_2 \cdot t_2}{im \cdot -2 - t_2}\right)\\
\mathbf{if}\;im \leq -8 \cdot 10^{+102}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -8.5 \cdot 10^{+58}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;im \leq 3.25 \cdot 10^{-178}:\\
\;\;\;\;0.5 \cdot \left(t_1 \cdot \left(im \cdot re\right) + -2 \cdot \left(im \cdot re\right)\right)\\

\mathbf{elif}\;im \leq 8.2 \cdot 10^{+102}:\\
\;\;\;\;t_3\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -7.99999999999999982e102 or 8.1999999999999999e102 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in re around 0 63.9%

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

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

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

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(re \cdot im\right) \cdot -2} + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right) \]
      3. associate-*l*63.9%

        \[\leadsto 0.5 \cdot \left(\color{blue}{re \cdot \left(im \cdot -2\right)} + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right) \]
      4. *-commutative63.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2\right) + \color{blue}{\left(re \cdot {im}^{3}\right) \cdot -0.3333333333333333}\right) \]
      5. associate-*l*63.9%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\right)\right)} \]
      7. cube-mult63.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right)\right) \]
      8. associate-*l*63.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right)}\right)\right) \]
      9. distribute-lft-out63.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)}\right) \]
    5. Simplified63.9%

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

    if -7.99999999999999982e102 < im < -8.50000000000000015e58 or 3.2500000000000001e-178 < im < 8.1999999999999999e102

    1. Initial program 66.8%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in re around 0 55.0%

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right) + -2 \cdot \left(re \cdot im\right)\right)} \]
    4. Step-by-step derivation
      1. +-commutative30.8%

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

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(re \cdot im\right) \cdot -2} + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right) \]
      3. associate-*l*30.8%

        \[\leadsto 0.5 \cdot \left(\color{blue}{re \cdot \left(im \cdot -2\right)} + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right) \]
      4. *-commutative30.8%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2\right) + \color{blue}{\left(re \cdot {im}^{3}\right) \cdot -0.3333333333333333}\right) \]
      5. associate-*l*30.8%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\right)\right)} \]
      7. cube-mult30.8%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right)\right) \]
      8. associate-*l*30.8%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{im \cdot \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right)}\right)\right) \]
      9. distribute-lft-out30.8%

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)}\right) \]
    5. Simplified30.8%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(-2 \cdot im + \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}\right) \]
      2. flip-+52.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}}\right) \]
      3. *-commutative52.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\color{blue}{\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)} \cdot im\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      4. associate-*r*52.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\color{blue}{\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right)} \cdot im\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      5. *-commutative52.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\color{blue}{\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)} \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      6. associate-*r*52.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\color{blue}{\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right)} \cdot im\right)}{-2 \cdot im - \left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im}\right) \]
      7. *-commutative52.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right)}{-2 \cdot im - \color{blue}{\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)} \cdot im}\right) \]
      8. associate-*r*52.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \frac{\left(-2 \cdot im\right) \cdot \left(-2 \cdot im\right) - \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot im\right)}{-2 \cdot im - \color{blue}{\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right)} \cdot im}\right) \]
    7. Applied egg-rr52.9%

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

    if -8.50000000000000015e58 < im < 3.2500000000000001e-178

    1. Initial program 45.7%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in re around 0 39.2%

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right) + -2 \cdot \left(re \cdot im\right)\right)} \]
    4. Step-by-step derivation
      1. +-commutative58.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(-2 \cdot \left(re \cdot im\right) + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right)} \]
      2. *-commutative58.0%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(re \cdot im\right) \cdot -2} + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right) \]
      3. associate-*l*58.0%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2\right) + \color{blue}{\left(re \cdot {im}^{3}\right) \cdot -0.3333333333333333}\right) \]
      5. associate-*l*58.0%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\right)\right)} \]
      7. cube-mult58.0%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right)\right) \]
      8. associate-*l*58.0%

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

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)}\right) \]
    5. Simplified58.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*58.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\left(re \cdot im\right) \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)} \]
      2. +-commutative58.0%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot im\right) \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot -0.3333333333333333 + -2\right)}\right) \]
      3. distribute-rgt-in58.0%

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

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

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right)} \cdot \left(re \cdot im\right) + -2 \cdot \left(re \cdot im\right)\right) \]
      6. *-commutative58.0%

        \[\leadsto 0.5 \cdot \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot \color{blue}{\left(im \cdot re\right)} + -2 \cdot \left(re \cdot im\right)\right) \]
      7. *-commutative58.0%

        \[\leadsto 0.5 \cdot \left(\left(\left(-0.3333333333333333 \cdot im\right) \cdot im\right) \cdot \left(im \cdot re\right) + -2 \cdot \color{blue}{\left(im \cdot re\right)}\right) \]
    7. Applied egg-rr58.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -8 \cdot 10^{+102}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{elif}\;im \leq -8.5 \cdot 10^{+58}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)}{im \cdot -2 - im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)}\right)\\ \mathbf{elif}\;im \leq 3.25 \cdot 10^{-178}:\\ \;\;\;\;0.5 \cdot \left(\left(im \cdot \left(im \cdot -0.3333333333333333\right)\right) \cdot \left(im \cdot re\right) + -2 \cdot \left(im \cdot re\right)\right)\\ \mathbf{elif}\;im \leq 8.2 \cdot 10^{+102}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \frac{\left(im \cdot -2\right) \cdot \left(im \cdot -2\right) - \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)}{im \cdot -2 - im \cdot \left(im \cdot \left(im \cdot -0.3333333333333333\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)\\ \end{array} \]

Alternative 11: 52.5% accurate, 23.7× speedup?

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

\\
0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 69.4%

    \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
  2. Taylor expanded in re around 0 51.8%

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

    \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right) + -2 \cdot \left(re \cdot im\right)\right)} \]
  4. Step-by-step derivation
    1. +-commutative52.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left(-2 \cdot \left(re \cdot im\right) + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right)} \]
    2. *-commutative52.0%

      \[\leadsto 0.5 \cdot \left(\color{blue}{\left(re \cdot im\right) \cdot -2} + -0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right)\right) \]
    3. associate-*l*52.0%

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

      \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2\right) + \color{blue}{\left(re \cdot {im}^{3}\right) \cdot -0.3333333333333333}\right) \]
    5. associate-*l*52.0%

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\right)\right)} \]
    7. cube-mult52.0%

      \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot -2 + \color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot -0.3333333333333333\right)\right) \]
    8. associate-*l*52.0%

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

      \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)}\right) \]
  5. Simplified52.0%

    \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot -0.3333333333333333\right)\right)\right)} \]
  6. Final simplification52.0%

    \[\leadsto 0.5 \cdot \left(re \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\right) \]

Alternative 12: 31.8% accurate, 77.0× speedup?

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

\\
im \cdot \left(-re\right)
\end{array}
Derivation
  1. Initial program 69.4%

    \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
  2. Taylor expanded in re around 0 51.8%

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

    \[\leadsto \color{blue}{-1 \cdot \left(re \cdot im\right)} \]
  4. Step-by-step derivation
    1. mul-1-neg34.3%

      \[\leadsto \color{blue}{-re \cdot im} \]
    2. distribute-rgt-neg-in34.3%

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

    \[\leadsto \color{blue}{re \cdot \left(-im\right)} \]
  6. Final simplification34.3%

    \[\leadsto im \cdot \left(-re\right) \]

Alternative 13: 2.7% accurate, 308.0× speedup?

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

\\
-1.5
\end{array}
Derivation
  1. Initial program 69.4%

    \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
  2. Taylor expanded in re around 0 51.8%

    \[\leadsto \color{blue}{0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)} \]
  3. Applied egg-rr2.6%

    \[\leadsto 0.5 \cdot \color{blue}{-3} \]
  4. Final simplification2.6%

    \[\leadsto -1.5 \]

Alternative 14: 2.8% accurate, 308.0× speedup?

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

\\
-4.96145150637606 \cdot 10^{-8}
\end{array}
Derivation
  1. Initial program 69.4%

    \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
  2. Taylor expanded in re around 0 51.8%

    \[\leadsto \color{blue}{0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)} \]
  3. Applied egg-rr2.7%

    \[\leadsto 0.5 \cdot \color{blue}{-9.92290301275212 \cdot 10^{-8}} \]
  4. Final simplification2.7%

    \[\leadsto -4.96145150637606 \cdot 10^{-8} \]

Alternative 15: 14.3% accurate, 308.0× speedup?

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

\\
0
\end{array}
Derivation
  1. Initial program 69.4%

    \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
  2. Taylor expanded in re around 0 51.8%

    \[\leadsto \color{blue}{0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)} \]
  3. Applied egg-rr17.1%

    \[\leadsto 0.5 \cdot \color{blue}{0} \]
  4. Final simplification17.1%

    \[\leadsto 0 \]

Developer target: 99.8% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|im\right| < 1:\\ \;\;\;\;-\sin re \cdot \left(\left(im + \left(\left(0.16666666666666666 \cdot im\right) \cdot im\right) \cdot im\right) + \left(\left(\left(\left(0.008333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (< (fabs im) 1.0)
   (-
    (*
     (sin re)
     (+
      (+ im (* (* (* 0.16666666666666666 im) im) im))
      (* (* (* (* (* 0.008333333333333333 im) im) im) im) im))))
   (* (* 0.5 (sin re)) (- (exp (- im)) (exp im)))))
double code(double re, double im) {
	double tmp;
	if (fabs(im) < 1.0) {
		tmp = -(sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
	} else {
		tmp = (0.5 * sin(re)) * (exp(-im) - exp(im));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (abs(im) < 1.0d0) then
        tmp = -(sin(re) * ((im + (((0.16666666666666666d0 * im) * im) * im)) + (((((0.008333333333333333d0 * im) * im) * im) * im) * im)))
    else
        tmp = (0.5d0 * sin(re)) * (exp(-im) - exp(im))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (Math.abs(im) < 1.0) {
		tmp = -(Math.sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
	} else {
		tmp = (0.5 * Math.sin(re)) * (Math.exp(-im) - Math.exp(im));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if math.fabs(im) < 1.0:
		tmp = -(math.sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)))
	else:
		tmp = (0.5 * math.sin(re)) * (math.exp(-im) - math.exp(im))
	return tmp
function code(re, im)
	tmp = 0.0
	if (abs(im) < 1.0)
		tmp = Float64(-Float64(sin(re) * Float64(Float64(im + Float64(Float64(Float64(0.16666666666666666 * im) * im) * im)) + Float64(Float64(Float64(Float64(Float64(0.008333333333333333 * im) * im) * im) * im) * im))));
	else
		tmp = Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) - exp(im)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (abs(im) < 1.0)
		tmp = -(sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
	else
		tmp = (0.5 * sin(re)) * (exp(-im) - exp(im));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[Less[N[Abs[im], $MachinePrecision], 1.0], (-N[(N[Sin[re], $MachinePrecision] * N[(N[(im + N[(N[(N[(0.16666666666666666 * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(N[(0.008333333333333333 * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left|im\right| < 1:\\
\;\;\;\;-\sin re \cdot \left(\left(im + \left(\left(0.16666666666666666 \cdot im\right) \cdot im\right) \cdot im\right) + \left(\left(\left(\left(0.008333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right)\\

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023194 
(FPCore (re im)
  :name "math.cos on complex, imaginary part"
  :precision binary64

  :herbie-target
  (if (< (fabs im) 1.0) (- (* (sin re) (+ (+ im (* (* (* 0.16666666666666666 im) im) im)) (* (* (* (* (* 0.008333333333333333 im) im) im) im) im)))) (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))

  (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))