math.cos on complex, imaginary part

Percentage Accurate: 66.0% → 99.7%
Time: 10.0s
Alternatives: 13
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 13 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.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-im} - e^{im}\\ \mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 0.001\right):\\ \;\;\;\;0.5 \cdot \left(t_0 \cdot \sin re\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left({im}^{5} \cdot -0.008333333333333333 - im\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (- (exp (- im)) (exp im))))
   (if (or (<= t_0 (- INFINITY)) (not (<= t_0 0.001)))
     (* 0.5 (* t_0 (sin re)))
     (*
      (sin re)
      (+
       (* (pow im 3.0) -0.16666666666666666)
       (- (* (pow im 5.0) -0.008333333333333333) im))))))
double code(double re, double im) {
	double t_0 = exp(-im) - exp(im);
	double tmp;
	if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 0.001)) {
		tmp = 0.5 * (t_0 * sin(re));
	} else {
		tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) + ((pow(im, 5.0) * -0.008333333333333333) - im));
	}
	return tmp;
}
public static double code(double re, double im) {
	double t_0 = Math.exp(-im) - Math.exp(im);
	double tmp;
	if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 0.001)) {
		tmp = 0.5 * (t_0 * Math.sin(re));
	} else {
		tmp = Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) + ((Math.pow(im, 5.0) * -0.008333333333333333) - im));
	}
	return tmp;
}
def code(re, im):
	t_0 = math.exp(-im) - math.exp(im)
	tmp = 0
	if (t_0 <= -math.inf) or not (t_0 <= 0.001):
		tmp = 0.5 * (t_0 * math.sin(re))
	else:
		tmp = math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) + ((math.pow(im, 5.0) * -0.008333333333333333) - im))
	return tmp
function code(re, im)
	t_0 = Float64(exp(Float64(-im)) - exp(im))
	tmp = 0.0
	if ((t_0 <= Float64(-Inf)) || !(t_0 <= 0.001))
		tmp = Float64(0.5 * Float64(t_0 * sin(re)));
	else
		tmp = Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) + Float64(Float64((im ^ 5.0) * -0.008333333333333333) - im)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = exp(-im) - exp(im);
	tmp = 0.0;
	if ((t_0 <= -Inf) || ~((t_0 <= 0.001)))
		tmp = 0.5 * (t_0 * sin(re));
	else
		tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) + (((im ^ 5.0) * -0.008333333333333333) - 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, (-Infinity)], N[Not[LessEqual[t$95$0, 0.001]], $MachinePrecision]], N[(0.5 * N[(t$95$0 * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < -inf.0 or 1e-3 < (-.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) \]
    2. Step-by-step derivation
      1. associate-*l*100.0%

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

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

    if -inf.0 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 1e-3

    1. Initial program 27.8%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*27.8%

        \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} - e^{im}\right)\right)} \]
    3. Simplified27.8%

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

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

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

        \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right)} + \left(-0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right) + -1 \cdot \left(\sin re \cdot im\right)\right) \]
      3. +-commutative99.7%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \color{blue}{\left(-1 \cdot \left(\sin re \cdot im\right) + -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\right)} \]
      4. mul-1-neg99.7%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \left(\left(-\color{blue}{im \cdot \sin re}\right) + -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\right) \]
      6. distribute-lft-neg-in99.7%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \left(\left(-im\right) \cdot \sin re + -0.008333333333333333 \cdot \color{blue}{\left({im}^{5} \cdot \sin re\right)}\right) \]
      8. associate-*r*99.7%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \color{blue}{\sin re \cdot \left(\left(-im\right) + -0.008333333333333333 \cdot {im}^{5}\right)} \]
      10. distribute-lft-out99.7%

        \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left(\left(-im\right) + -0.008333333333333333 \cdot {im}^{5}\right)\right)} \]
      11. +-commutative99.7%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \color{blue}{\left(-0.008333333333333333 \cdot {im}^{5} + \left(-im\right)\right)}\right) \]
      12. sub-neg99.7%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{5} \cdot -0.008333333333333333} - im\right)\right) \]
    6. Simplified99.7%

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

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

Alternative 2: 99.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-im} - e^{im}\\ \mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 0.001\right):\\ \;\;\;\;0.5 \cdot \left(t_0 \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 (- INFINITY)) (not (<= t_0 0.001)))
     (* 0.5 (* t_0 (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 <= -((double) INFINITY)) || !(t_0 <= 0.001)) {
		tmp = 0.5 * (t_0 * sin(re));
	} else {
		tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
	}
	return tmp;
}
public static double code(double re, double im) {
	double t_0 = Math.exp(-im) - Math.exp(im);
	double tmp;
	if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 0.001)) {
		tmp = 0.5 * (t_0 * 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 <= -math.inf) or not (t_0 <= 0.001):
		tmp = 0.5 * (t_0 * 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 <= Float64(-Inf)) || !(t_0 <= 0.001))
		tmp = Float64(0.5 * Float64(t_0 * 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 <= -Inf) || ~((t_0 <= 0.001)))
		tmp = 0.5 * (t_0 * 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, (-Infinity)], N[Not[LessEqual[t$95$0, 0.001]], $MachinePrecision]], N[(0.5 * N[(t$95$0 * 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 -\infty \lor \neg \left(t_0 \leq 0.001\right):\\
\;\;\;\;0.5 \cdot \left(t_0 \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)) < -inf.0 or 1e-3 < (-.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) \]
    2. Step-by-step derivation
      1. associate-*l*100.0%

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

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

    if -inf.0 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 1e-3

    1. Initial program 27.8%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*27.8%

        \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} - e^{im}\right)\right)} \]
    3. Simplified27.8%

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

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

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

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

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

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

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

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

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

Alternative 3: 97.3% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re\right)\\ t_1 := -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\\ \mathbf{if}\;im \leq -4.5 \cdot 10^{+61}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq -0.24:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 0.09:\\ \;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\ \mathbf{elif}\;im \leq 4.6 \cdot 10^{+58}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (- (exp (- im)) (exp im)) (* 0.5 re)))
        (t_1 (* -0.008333333333333333 (* (sin re) (pow im 5.0)))))
   (if (<= im -4.5e+61)
     t_1
     (if (<= im -0.24)
       t_0
       (if (<= im 0.09)
         (* (sin re) (- (* (pow im 3.0) -0.16666666666666666) im))
         (if (<= im 4.6e+58) t_0 t_1))))))
double code(double re, double im) {
	double t_0 = (exp(-im) - exp(im)) * (0.5 * re);
	double t_1 = -0.008333333333333333 * (sin(re) * pow(im, 5.0));
	double tmp;
	if (im <= -4.5e+61) {
		tmp = t_1;
	} else if (im <= -0.24) {
		tmp = t_0;
	} else if (im <= 0.09) {
		tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
	} else if (im <= 4.6e+58) {
		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 = (exp(-im) - exp(im)) * (0.5d0 * re)
    t_1 = (-0.008333333333333333d0) * (sin(re) * (im ** 5.0d0))
    if (im <= (-4.5d+61)) then
        tmp = t_1
    else if (im <= (-0.24d0)) then
        tmp = t_0
    else if (im <= 0.09d0) then
        tmp = sin(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
    else if (im <= 4.6d+58) 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 = (Math.exp(-im) - Math.exp(im)) * (0.5 * re);
	double t_1 = -0.008333333333333333 * (Math.sin(re) * Math.pow(im, 5.0));
	double tmp;
	if (im <= -4.5e+61) {
		tmp = t_1;
	} else if (im <= -0.24) {
		tmp = t_0;
	} else if (im <= 0.09) {
		tmp = Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
	} else if (im <= 4.6e+58) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(re, im):
	t_0 = (math.exp(-im) - math.exp(im)) * (0.5 * re)
	t_1 = -0.008333333333333333 * (math.sin(re) * math.pow(im, 5.0))
	tmp = 0
	if im <= -4.5e+61:
		tmp = t_1
	elif im <= -0.24:
		tmp = t_0
	elif im <= 0.09:
		tmp = math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im)
	elif im <= 4.6e+58:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(re, im)
	t_0 = Float64(Float64(exp(Float64(-im)) - exp(im)) * Float64(0.5 * re))
	t_1 = Float64(-0.008333333333333333 * Float64(sin(re) * (im ^ 5.0)))
	tmp = 0.0
	if (im <= -4.5e+61)
		tmp = t_1;
	elseif (im <= -0.24)
		tmp = t_0;
	elseif (im <= 0.09)
		tmp = Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im));
	elseif (im <= 4.6e+58)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = (exp(-im) - exp(im)) * (0.5 * re);
	t_1 = -0.008333333333333333 * (sin(re) * (im ^ 5.0));
	tmp = 0.0;
	if (im <= -4.5e+61)
		tmp = t_1;
	elseif (im <= -0.24)
		tmp = t_0;
	elseif (im <= 0.09)
		tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) - im);
	elseif (im <= 4.6e+58)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.008333333333333333 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -4.5e+61], t$95$1, If[LessEqual[im, -0.24], t$95$0, If[LessEqual[im, 0.09], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.6e+58], t$95$0, t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
t_1 := -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\\
\mathbf{if}\;im \leq -4.5 \cdot 10^{+61}:\\
\;\;\;\;t_1\\

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

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

\mathbf{elif}\;im \leq 4.6 \cdot 10^{+58}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -4.5e61 or 4.60000000000000005e58 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*100.0%

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

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

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

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

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \color{blue}{\left(-1 \cdot \left(\sin re \cdot im\right) + -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\right)} \]
      4. mul-1-neg98.9%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \left(\left(-\color{blue}{im \cdot \sin re}\right) + -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\right) \]
      6. distribute-lft-neg-in98.9%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \left(\left(-im\right) \cdot \sin re + -0.008333333333333333 \cdot \color{blue}{\left({im}^{5} \cdot \sin re\right)}\right) \]
      8. associate-*r*98.9%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \color{blue}{\sin re \cdot \left(\left(-im\right) + -0.008333333333333333 \cdot {im}^{5}\right)} \]
      10. distribute-lft-out98.9%

        \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left(\left(-im\right) + -0.008333333333333333 \cdot {im}^{5}\right)\right)} \]
      11. +-commutative98.9%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \color{blue}{\left(-0.008333333333333333 \cdot {im}^{5} + \left(-im\right)\right)}\right) \]
      12. sub-neg98.9%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \color{blue}{\left(-0.008333333333333333 \cdot {im}^{5} - im\right)}\right) \]
      13. *-commutative98.9%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{5} \cdot -0.008333333333333333} - im\right)\right) \]
    6. Simplified98.9%

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

      \[\leadsto \color{blue}{-0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)} \]
    8. Step-by-step derivation
      1. *-commutative98.9%

        \[\leadsto -0.008333333333333333 \cdot \color{blue}{\left({im}^{5} \cdot \sin re\right)} \]
    9. Simplified98.9%

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

    if -4.5e61 < im < -0.23999999999999999 or 0.089999999999999997 < im < 4.60000000000000005e58

    1. Initial program 99.9%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*99.9%

        \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} - e^{im}\right)\right)} \]
    3. Simplified99.9%

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

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

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

        \[\leadsto \color{blue}{\left(e^{-im} - e^{im}\right) \cdot \left(re \cdot 0.5\right)} \]
    6. Simplified88.8%

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

    if -0.23999999999999999 < im < 0.089999999999999997

    1. Initial program 27.8%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*27.8%

        \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} - e^{im}\right)\right)} \]
    3. Simplified27.8%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -4.5 \cdot 10^{+61}:\\ \;\;\;\;-0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\\ \mathbf{elif}\;im \leq -0.24:\\ \;\;\;\;\left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{elif}\;im \leq 0.09:\\ \;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\ \mathbf{elif}\;im \leq 4.6 \cdot 10^{+58}:\\ \;\;\;\;\left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{else}:\\ \;\;\;\;-0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\\ \end{array} \]

Alternative 4: 92.3% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\\ \mathbf{if}\;im \leq -4.5 \cdot 10^{+61}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -600:\\ \;\;\;\;re \cdot \sqrt{6.944444444444444 \cdot 10^{-5} \cdot {im}^{10}}\\ \mathbf{elif}\;im \leq 5:\\ \;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* -0.008333333333333333 (* (sin re) (pow im 5.0)))))
   (if (<= im -4.5e+61)
     t_0
     (if (<= im -600.0)
       (* re (sqrt (* 6.944444444444444e-5 (pow im 10.0))))
       (if (<= im 5.0)
         (* (sin re) (- (* (pow im 3.0) -0.16666666666666666) im))
         t_0)))))
double code(double re, double im) {
	double t_0 = -0.008333333333333333 * (sin(re) * pow(im, 5.0));
	double tmp;
	if (im <= -4.5e+61) {
		tmp = t_0;
	} else if (im <= -600.0) {
		tmp = re * sqrt((6.944444444444444e-5 * pow(im, 10.0)));
	} else if (im <= 5.0) {
		tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (-0.008333333333333333d0) * (sin(re) * (im ** 5.0d0))
    if (im <= (-4.5d+61)) then
        tmp = t_0
    else if (im <= (-600.0d0)) then
        tmp = re * sqrt((6.944444444444444d-5 * (im ** 10.0d0)))
    else if (im <= 5.0d0) then
        tmp = sin(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = -0.008333333333333333 * (Math.sin(re) * Math.pow(im, 5.0));
	double tmp;
	if (im <= -4.5e+61) {
		tmp = t_0;
	} else if (im <= -600.0) {
		tmp = re * Math.sqrt((6.944444444444444e-5 * Math.pow(im, 10.0)));
	} else if (im <= 5.0) {
		tmp = Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = -0.008333333333333333 * (math.sin(re) * math.pow(im, 5.0))
	tmp = 0
	if im <= -4.5e+61:
		tmp = t_0
	elif im <= -600.0:
		tmp = re * math.sqrt((6.944444444444444e-5 * math.pow(im, 10.0)))
	elif im <= 5.0:
		tmp = math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im)
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(-0.008333333333333333 * Float64(sin(re) * (im ^ 5.0)))
	tmp = 0.0
	if (im <= -4.5e+61)
		tmp = t_0;
	elseif (im <= -600.0)
		tmp = Float64(re * sqrt(Float64(6.944444444444444e-5 * (im ^ 10.0))));
	elseif (im <= 5.0)
		tmp = Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = -0.008333333333333333 * (sin(re) * (im ^ 5.0));
	tmp = 0.0;
	if (im <= -4.5e+61)
		tmp = t_0;
	elseif (im <= -600.0)
		tmp = re * sqrt((6.944444444444444e-5 * (im ^ 10.0)));
	elseif (im <= 5.0)
		tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) - im);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(-0.008333333333333333 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -4.5e+61], t$95$0, If[LessEqual[im, -600.0], N[(re * N[Sqrt[N[(6.944444444444444e-5 * N[Power[im, 10.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5.0], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\\
\mathbf{if}\;im \leq -4.5 \cdot 10^{+61}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -600:\\
\;\;\;\;re \cdot \sqrt{6.944444444444444 \cdot 10^{-5} \cdot {im}^{10}}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -4.5e61 or 5 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*100.0%

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

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

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

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

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \color{blue}{\left(-1 \cdot \left(\sin re \cdot im\right) + -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\right)} \]
      4. mul-1-neg88.2%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \left(\left(-\color{blue}{im \cdot \sin re}\right) + -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\right) \]
      6. distribute-lft-neg-in88.2%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \left(\left(-im\right) \cdot \sin re + -0.008333333333333333 \cdot \color{blue}{\left({im}^{5} \cdot \sin re\right)}\right) \]
      8. associate-*r*88.2%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \color{blue}{\sin re \cdot \left(\left(-im\right) + -0.008333333333333333 \cdot {im}^{5}\right)} \]
      10. distribute-lft-out88.2%

        \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left(\left(-im\right) + -0.008333333333333333 \cdot {im}^{5}\right)\right)} \]
      11. +-commutative88.2%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \color{blue}{\left(-0.008333333333333333 \cdot {im}^{5} + \left(-im\right)\right)}\right) \]
      12. sub-neg88.2%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \color{blue}{\left(-0.008333333333333333 \cdot {im}^{5} - im\right)}\right) \]
      13. *-commutative88.2%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{5} \cdot -0.008333333333333333} - im\right)\right) \]
    6. Simplified88.2%

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

      \[\leadsto \color{blue}{-0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)} \]
    8. Step-by-step derivation
      1. *-commutative88.2%

        \[\leadsto -0.008333333333333333 \cdot \color{blue}{\left({im}^{5} \cdot \sin re\right)} \]
    9. Simplified88.2%

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

    if -4.5e61 < im < -600

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*100.0%

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

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

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

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

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \color{blue}{\left(-1 \cdot \left(\sin re \cdot im\right) + -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\right)} \]
      4. mul-1-neg4.2%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \left(\left(-\color{blue}{im \cdot \sin re}\right) + -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\right) \]
      6. distribute-lft-neg-in4.2%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \left(\left(-im\right) \cdot \sin re + -0.008333333333333333 \cdot \color{blue}{\left({im}^{5} \cdot \sin re\right)}\right) \]
      8. associate-*r*4.2%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \color{blue}{\sin re \cdot \left(\left(-im\right) + -0.008333333333333333 \cdot {im}^{5}\right)} \]
      10. distribute-lft-out4.2%

        \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left(\left(-im\right) + -0.008333333333333333 \cdot {im}^{5}\right)\right)} \]
      11. +-commutative4.2%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \color{blue}{\left(-0.008333333333333333 \cdot {im}^{5} + \left(-im\right)\right)}\right) \]
      12. sub-neg4.2%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \color{blue}{\left(-0.008333333333333333 \cdot {im}^{5} - im\right)}\right) \]
      13. *-commutative4.2%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{5} \cdot -0.008333333333333333} - im\right)\right) \]
    6. Simplified4.2%

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

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

      \[\leadsto \color{blue}{-0.008333333333333333 \cdot \left(re \cdot {im}^{5}\right)} \]
    9. Step-by-step derivation
      1. *-commutative3.2%

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

        \[\leadsto \color{blue}{\left(-0.008333333333333333 \cdot {im}^{5}\right) \cdot re} \]
      3. *-commutative3.2%

        \[\leadsto \color{blue}{re \cdot \left(-0.008333333333333333 \cdot {im}^{5}\right)} \]
    10. Simplified3.2%

      \[\leadsto \color{blue}{re \cdot \left(-0.008333333333333333 \cdot {im}^{5}\right)} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt3.2%

        \[\leadsto re \cdot \color{blue}{\left(\sqrt{-0.008333333333333333 \cdot {im}^{5}} \cdot \sqrt{-0.008333333333333333 \cdot {im}^{5}}\right)} \]
      2. sqrt-unprod41.4%

        \[\leadsto re \cdot \color{blue}{\sqrt{\left(-0.008333333333333333 \cdot {im}^{5}\right) \cdot \left(-0.008333333333333333 \cdot {im}^{5}\right)}} \]
      3. swap-sqr41.4%

        \[\leadsto re \cdot \sqrt{\color{blue}{\left(-0.008333333333333333 \cdot -0.008333333333333333\right) \cdot \left({im}^{5} \cdot {im}^{5}\right)}} \]
      4. metadata-eval41.4%

        \[\leadsto re \cdot \sqrt{\color{blue}{6.944444444444444 \cdot 10^{-5}} \cdot \left({im}^{5} \cdot {im}^{5}\right)} \]
      5. pow-prod-up41.4%

        \[\leadsto re \cdot \sqrt{6.944444444444444 \cdot 10^{-5} \cdot \color{blue}{{im}^{\left(5 + 5\right)}}} \]
      6. metadata-eval41.4%

        \[\leadsto re \cdot \sqrt{6.944444444444444 \cdot 10^{-5} \cdot {im}^{\color{blue}{10}}} \]
    12. Applied egg-rr41.4%

      \[\leadsto re \cdot \color{blue}{\sqrt{6.944444444444444 \cdot 10^{-5} \cdot {im}^{10}}} \]

    if -600 < im < 5

    1. Initial program 28.3%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*28.3%

        \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} - e^{im}\right)\right)} \]
    3. Simplified28.3%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -4.5 \cdot 10^{+61}:\\ \;\;\;\;-0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\\ \mathbf{elif}\;im \leq -600:\\ \;\;\;\;re \cdot \sqrt{6.944444444444444 \cdot 10^{-5} \cdot {im}^{10}}\\ \mathbf{elif}\;im \leq 5:\\ \;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\ \mathbf{else}:\\ \;\;\;\;-0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\\ \end{array} \]

Alternative 5: 92.0% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\\ \mathbf{if}\;im \leq -4.5 \cdot 10^{+61}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -480:\\ \;\;\;\;re \cdot \sqrt{6.944444444444444 \cdot 10^{-5} \cdot {im}^{10}}\\ \mathbf{elif}\;im \leq 3.3:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* -0.008333333333333333 (* (sin re) (pow im 5.0)))))
   (if (<= im -4.5e+61)
     t_0
     (if (<= im -480.0)
       (* re (sqrt (* 6.944444444444444e-5 (pow im 10.0))))
       (if (<= im 3.3) (* (- im) (sin re)) t_0)))))
double code(double re, double im) {
	double t_0 = -0.008333333333333333 * (sin(re) * pow(im, 5.0));
	double tmp;
	if (im <= -4.5e+61) {
		tmp = t_0;
	} else if (im <= -480.0) {
		tmp = re * sqrt((6.944444444444444e-5 * pow(im, 10.0)));
	} else if (im <= 3.3) {
		tmp = -im * sin(re);
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (-0.008333333333333333d0) * (sin(re) * (im ** 5.0d0))
    if (im <= (-4.5d+61)) then
        tmp = t_0
    else if (im <= (-480.0d0)) then
        tmp = re * sqrt((6.944444444444444d-5 * (im ** 10.0d0)))
    else if (im <= 3.3d0) then
        tmp = -im * sin(re)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = -0.008333333333333333 * (Math.sin(re) * Math.pow(im, 5.0));
	double tmp;
	if (im <= -4.5e+61) {
		tmp = t_0;
	} else if (im <= -480.0) {
		tmp = re * Math.sqrt((6.944444444444444e-5 * Math.pow(im, 10.0)));
	} else if (im <= 3.3) {
		tmp = -im * Math.sin(re);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = -0.008333333333333333 * (math.sin(re) * math.pow(im, 5.0))
	tmp = 0
	if im <= -4.5e+61:
		tmp = t_0
	elif im <= -480.0:
		tmp = re * math.sqrt((6.944444444444444e-5 * math.pow(im, 10.0)))
	elif im <= 3.3:
		tmp = -im * math.sin(re)
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(-0.008333333333333333 * Float64(sin(re) * (im ^ 5.0)))
	tmp = 0.0
	if (im <= -4.5e+61)
		tmp = t_0;
	elseif (im <= -480.0)
		tmp = Float64(re * sqrt(Float64(6.944444444444444e-5 * (im ^ 10.0))));
	elseif (im <= 3.3)
		tmp = Float64(Float64(-im) * sin(re));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = -0.008333333333333333 * (sin(re) * (im ^ 5.0));
	tmp = 0.0;
	if (im <= -4.5e+61)
		tmp = t_0;
	elseif (im <= -480.0)
		tmp = re * sqrt((6.944444444444444e-5 * (im ^ 10.0)));
	elseif (im <= 3.3)
		tmp = -im * sin(re);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(-0.008333333333333333 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -4.5e+61], t$95$0, If[LessEqual[im, -480.0], N[(re * N[Sqrt[N[(6.944444444444444e-5 * N[Power[im, 10.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.3], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\\
\mathbf{if}\;im \leq -4.5 \cdot 10^{+61}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -480:\\
\;\;\;\;re \cdot \sqrt{6.944444444444444 \cdot 10^{-5} \cdot {im}^{10}}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -4.5e61 or 3.2999999999999998 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*100.0%

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

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

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

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

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \color{blue}{\left(-1 \cdot \left(\sin re \cdot im\right) + -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\right)} \]
      4. mul-1-neg88.2%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \left(\left(-\color{blue}{im \cdot \sin re}\right) + -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\right) \]
      6. distribute-lft-neg-in88.2%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \left(\left(-im\right) \cdot \sin re + -0.008333333333333333 \cdot \color{blue}{\left({im}^{5} \cdot \sin re\right)}\right) \]
      8. associate-*r*88.2%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \color{blue}{\sin re \cdot \left(\left(-im\right) + -0.008333333333333333 \cdot {im}^{5}\right)} \]
      10. distribute-lft-out88.2%

        \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left(\left(-im\right) + -0.008333333333333333 \cdot {im}^{5}\right)\right)} \]
      11. +-commutative88.2%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \color{blue}{\left(-0.008333333333333333 \cdot {im}^{5} + \left(-im\right)\right)}\right) \]
      12. sub-neg88.2%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \color{blue}{\left(-0.008333333333333333 \cdot {im}^{5} - im\right)}\right) \]
      13. *-commutative88.2%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{5} \cdot -0.008333333333333333} - im\right)\right) \]
    6. Simplified88.2%

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

      \[\leadsto \color{blue}{-0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)} \]
    8. Step-by-step derivation
      1. *-commutative88.2%

        \[\leadsto -0.008333333333333333 \cdot \color{blue}{\left({im}^{5} \cdot \sin re\right)} \]
    9. Simplified88.2%

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

    if -4.5e61 < im < -480

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*100.0%

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

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

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

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

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \color{blue}{\left(-1 \cdot \left(\sin re \cdot im\right) + -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\right)} \]
      4. mul-1-neg4.2%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \left(\left(-\color{blue}{im \cdot \sin re}\right) + -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\right) \]
      6. distribute-lft-neg-in4.2%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \left(\left(-im\right) \cdot \sin re + -0.008333333333333333 \cdot \color{blue}{\left({im}^{5} \cdot \sin re\right)}\right) \]
      8. associate-*r*4.2%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \color{blue}{\sin re \cdot \left(\left(-im\right) + -0.008333333333333333 \cdot {im}^{5}\right)} \]
      10. distribute-lft-out4.2%

        \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left(\left(-im\right) + -0.008333333333333333 \cdot {im}^{5}\right)\right)} \]
      11. +-commutative4.2%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \color{blue}{\left(-0.008333333333333333 \cdot {im}^{5} + \left(-im\right)\right)}\right) \]
      12. sub-neg4.2%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \color{blue}{\left(-0.008333333333333333 \cdot {im}^{5} - im\right)}\right) \]
      13. *-commutative4.2%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{5} \cdot -0.008333333333333333} - im\right)\right) \]
    6. Simplified4.2%

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

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

      \[\leadsto \color{blue}{-0.008333333333333333 \cdot \left(re \cdot {im}^{5}\right)} \]
    9. Step-by-step derivation
      1. *-commutative3.2%

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

        \[\leadsto \color{blue}{\left(-0.008333333333333333 \cdot {im}^{5}\right) \cdot re} \]
      3. *-commutative3.2%

        \[\leadsto \color{blue}{re \cdot \left(-0.008333333333333333 \cdot {im}^{5}\right)} \]
    10. Simplified3.2%

      \[\leadsto \color{blue}{re \cdot \left(-0.008333333333333333 \cdot {im}^{5}\right)} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt3.2%

        \[\leadsto re \cdot \color{blue}{\left(\sqrt{-0.008333333333333333 \cdot {im}^{5}} \cdot \sqrt{-0.008333333333333333 \cdot {im}^{5}}\right)} \]
      2. sqrt-unprod41.4%

        \[\leadsto re \cdot \color{blue}{\sqrt{\left(-0.008333333333333333 \cdot {im}^{5}\right) \cdot \left(-0.008333333333333333 \cdot {im}^{5}\right)}} \]
      3. swap-sqr41.4%

        \[\leadsto re \cdot \sqrt{\color{blue}{\left(-0.008333333333333333 \cdot -0.008333333333333333\right) \cdot \left({im}^{5} \cdot {im}^{5}\right)}} \]
      4. metadata-eval41.4%

        \[\leadsto re \cdot \sqrt{\color{blue}{6.944444444444444 \cdot 10^{-5}} \cdot \left({im}^{5} \cdot {im}^{5}\right)} \]
      5. pow-prod-up41.4%

        \[\leadsto re \cdot \sqrt{6.944444444444444 \cdot 10^{-5} \cdot \color{blue}{{im}^{\left(5 + 5\right)}}} \]
      6. metadata-eval41.4%

        \[\leadsto re \cdot \sqrt{6.944444444444444 \cdot 10^{-5} \cdot {im}^{\color{blue}{10}}} \]
    12. Applied egg-rr41.4%

      \[\leadsto re \cdot \color{blue}{\sqrt{6.944444444444444 \cdot 10^{-5} \cdot {im}^{10}}} \]

    if -480 < im < 3.2999999999999998

    1. Initial program 28.3%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*28.3%

        \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} - e^{im}\right)\right)} \]
    3. Simplified28.3%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -4.5 \cdot 10^{+61}:\\ \;\;\;\;-0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\\ \mathbf{elif}\;im \leq -480:\\ \;\;\;\;re \cdot \sqrt{6.944444444444444 \cdot 10^{-5} \cdot {im}^{10}}\\ \mathbf{elif}\;im \leq 3.3:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \mathbf{else}:\\ \;\;\;\;-0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\\ \end{array} \]

Alternative 6: 90.3% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -3.3 \lor \neg \left(im \leq 3.3\right):\\ \;\;\;\;-0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (or (<= im -3.3) (not (<= im 3.3)))
   (* -0.008333333333333333 (* (sin re) (pow im 5.0)))
   (* (- im) (sin re))))
double code(double re, double im) {
	double tmp;
	if ((im <= -3.3) || !(im <= 3.3)) {
		tmp = -0.008333333333333333 * (sin(re) * pow(im, 5.0));
	} else {
		tmp = -im * sin(re);
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if ((im <= (-3.3d0)) .or. (.not. (im <= 3.3d0))) then
        tmp = (-0.008333333333333333d0) * (sin(re) * (im ** 5.0d0))
    else
        tmp = -im * sin(re)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if ((im <= -3.3) || !(im <= 3.3)) {
		tmp = -0.008333333333333333 * (Math.sin(re) * Math.pow(im, 5.0));
	} else {
		tmp = -im * Math.sin(re);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if (im <= -3.3) or not (im <= 3.3):
		tmp = -0.008333333333333333 * (math.sin(re) * math.pow(im, 5.0))
	else:
		tmp = -im * math.sin(re)
	return tmp
function code(re, im)
	tmp = 0.0
	if ((im <= -3.3) || !(im <= 3.3))
		tmp = Float64(-0.008333333333333333 * Float64(sin(re) * (im ^ 5.0)));
	else
		tmp = Float64(Float64(-im) * sin(re));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if ((im <= -3.3) || ~((im <= 3.3)))
		tmp = -0.008333333333333333 * (sin(re) * (im ^ 5.0));
	else
		tmp = -im * sin(re);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[Or[LessEqual[im, -3.3], N[Not[LessEqual[im, 3.3]], $MachinePrecision]], N[(-0.008333333333333333 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;im \leq -3.3 \lor \neg \left(im \leq 3.3\right):\\
\;\;\;\;-0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < -3.2999999999999998 or 3.2999999999999998 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*100.0%

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

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

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

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

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \color{blue}{\left(-1 \cdot \left(\sin re \cdot im\right) + -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\right)} \]
      4. mul-1-neg76.9%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \left(\left(-\color{blue}{im \cdot \sin re}\right) + -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\right) \]
      6. distribute-lft-neg-in76.9%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \left(\left(-im\right) \cdot \sin re + -0.008333333333333333 \cdot \color{blue}{\left({im}^{5} \cdot \sin re\right)}\right) \]
      8. associate-*r*76.9%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \color{blue}{\sin re \cdot \left(\left(-im\right) + -0.008333333333333333 \cdot {im}^{5}\right)} \]
      10. distribute-lft-out76.9%

        \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left(\left(-im\right) + -0.008333333333333333 \cdot {im}^{5}\right)\right)} \]
      11. +-commutative76.9%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \color{blue}{\left(-0.008333333333333333 \cdot {im}^{5} + \left(-im\right)\right)}\right) \]
      12. sub-neg76.9%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \color{blue}{\left(-0.008333333333333333 \cdot {im}^{5} - im\right)}\right) \]
      13. *-commutative76.9%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{5} \cdot -0.008333333333333333} - im\right)\right) \]
    6. Simplified76.9%

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

      \[\leadsto \color{blue}{-0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)} \]
    8. Step-by-step derivation
      1. *-commutative76.9%

        \[\leadsto -0.008333333333333333 \cdot \color{blue}{\left({im}^{5} \cdot \sin re\right)} \]
    9. Simplified76.9%

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

    if -3.2999999999999998 < im < 3.2999999999999998

    1. Initial program 28.3%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*28.3%

        \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} - e^{im}\right)\right)} \]
    3. Simplified28.3%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -3.3 \lor \neg \left(im \leq 3.3\right):\\ \;\;\;\;-0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \end{array} \]

Alternative 7: 79.8% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -0.00046:\\ \;\;\;\;\left(im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\right) \cdot \left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right)\\ \mathbf{elif}\;im \leq 4200:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \mathbf{else}:\\ \;\;\;\;-0.008333333333333333 \cdot \left(re \cdot {im}^{5}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im -0.00046)
   (*
    (+ (* im -2.0) (* (pow im 3.0) -0.3333333333333333))
    (* re (+ 0.5 (* -0.08333333333333333 (* re re)))))
   (if (<= im 4200.0)
     (* (- im) (sin re))
     (* -0.008333333333333333 (* re (pow im 5.0))))))
double code(double re, double im) {
	double tmp;
	if (im <= -0.00046) {
		tmp = ((im * -2.0) + (pow(im, 3.0) * -0.3333333333333333)) * (re * (0.5 + (-0.08333333333333333 * (re * re))));
	} else if (im <= 4200.0) {
		tmp = -im * sin(re);
	} else {
		tmp = -0.008333333333333333 * (re * pow(im, 5.0));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (im <= (-0.00046d0)) then
        tmp = ((im * (-2.0d0)) + ((im ** 3.0d0) * (-0.3333333333333333d0))) * (re * (0.5d0 + ((-0.08333333333333333d0) * (re * re))))
    else if (im <= 4200.0d0) then
        tmp = -im * sin(re)
    else
        tmp = (-0.008333333333333333d0) * (re * (im ** 5.0d0))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= -0.00046) {
		tmp = ((im * -2.0) + (Math.pow(im, 3.0) * -0.3333333333333333)) * (re * (0.5 + (-0.08333333333333333 * (re * re))));
	} else if (im <= 4200.0) {
		tmp = -im * Math.sin(re);
	} else {
		tmp = -0.008333333333333333 * (re * Math.pow(im, 5.0));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= -0.00046:
		tmp = ((im * -2.0) + (math.pow(im, 3.0) * -0.3333333333333333)) * (re * (0.5 + (-0.08333333333333333 * (re * re))))
	elif im <= 4200.0:
		tmp = -im * math.sin(re)
	else:
		tmp = -0.008333333333333333 * (re * math.pow(im, 5.0))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= -0.00046)
		tmp = Float64(Float64(Float64(im * -2.0) + Float64((im ^ 3.0) * -0.3333333333333333)) * Float64(re * Float64(0.5 + Float64(-0.08333333333333333 * Float64(re * re)))));
	elseif (im <= 4200.0)
		tmp = Float64(Float64(-im) * sin(re));
	else
		tmp = Float64(-0.008333333333333333 * Float64(re * (im ^ 5.0)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= -0.00046)
		tmp = ((im * -2.0) + ((im ^ 3.0) * -0.3333333333333333)) * (re * (0.5 + (-0.08333333333333333 * (re * re))));
	elseif (im <= 4200.0)
		tmp = -im * sin(re);
	else
		tmp = -0.008333333333333333 * (re * (im ^ 5.0));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, -0.00046], N[(N[(N[(im * -2.0), $MachinePrecision] + N[(N[Power[im, 3.0], $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision] * N[(re * N[(0.5 + N[(-0.08333333333333333 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4200.0], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], N[(-0.008333333333333333 * N[(re * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;im \leq -0.00046:\\
\;\;\;\;\left(im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\right) \cdot \left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -4.6000000000000001e-4

    1. Initial program 99.8%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*99.8%

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

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

      \[\leadsto \color{blue}{-0.08333333333333333 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot {re}^{3}\right) + 0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)} \]
    5. Step-by-step derivation
      1. +-commutative3.0%

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

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

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

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

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

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

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

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

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re + -0.08333333333333333 \cdot \color{blue}{\left(\left(re \cdot re\right) \cdot re\right)}\right) \]
      10. associate-*r*79.2%

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re + \color{blue}{\left(-0.08333333333333333 \cdot \left(re \cdot re\right)\right) \cdot re}\right) \]
      11. distribute-rgt-out79.2%

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \color{blue}{\left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right)} \]
    6. Simplified79.2%

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

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

    if -4.6000000000000001e-4 < im < 4200

    1. Initial program 27.4%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*27.4%

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

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

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

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

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

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

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

    if 4200 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*100.0%

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \left(\left(-\color{blue}{im \cdot \sin re}\right) + -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\right) \]
      6. distribute-lft-neg-in77.5%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \left(\color{blue}{\left(-im\right) \cdot \sin re} + -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\right) \]
      7. *-commutative77.5%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \left(\left(-im\right) \cdot \sin re + -0.008333333333333333 \cdot \color{blue}{\left({im}^{5} \cdot \sin re\right)}\right) \]
      8. associate-*r*77.5%

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

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

        \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left(\left(-im\right) + -0.008333333333333333 \cdot {im}^{5}\right)\right)} \]
      11. +-commutative77.5%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \color{blue}{\left(-0.008333333333333333 \cdot {im}^{5} + \left(-im\right)\right)}\right) \]
      12. sub-neg77.5%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \color{blue}{\left(-0.008333333333333333 \cdot {im}^{5} - im\right)}\right) \]
      13. *-commutative77.5%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{5} \cdot -0.008333333333333333} - im\right)\right) \]
    6. Simplified77.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -0.00046:\\ \;\;\;\;\left(im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\right) \cdot \left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right)\\ \mathbf{elif}\;im \leq 4200:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \mathbf{else}:\\ \;\;\;\;-0.008333333333333333 \cdot \left(re \cdot {im}^{5}\right)\\ \end{array} \]

Alternative 8: 80.8% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -760 \lor \neg \left(im \leq 6600\right):\\ \;\;\;\;-0.008333333333333333 \cdot \left(re \cdot {im}^{5}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (or (<= im -760.0) (not (<= im 6600.0)))
   (* -0.008333333333333333 (* re (pow im 5.0)))
   (* (- im) (sin re))))
double code(double re, double im) {
	double tmp;
	if ((im <= -760.0) || !(im <= 6600.0)) {
		tmp = -0.008333333333333333 * (re * pow(im, 5.0));
	} else {
		tmp = -im * sin(re);
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if ((im <= (-760.0d0)) .or. (.not. (im <= 6600.0d0))) then
        tmp = (-0.008333333333333333d0) * (re * (im ** 5.0d0))
    else
        tmp = -im * sin(re)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if ((im <= -760.0) || !(im <= 6600.0)) {
		tmp = -0.008333333333333333 * (re * Math.pow(im, 5.0));
	} else {
		tmp = -im * Math.sin(re);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if (im <= -760.0) or not (im <= 6600.0):
		tmp = -0.008333333333333333 * (re * math.pow(im, 5.0))
	else:
		tmp = -im * math.sin(re)
	return tmp
function code(re, im)
	tmp = 0.0
	if ((im <= -760.0) || !(im <= 6600.0))
		tmp = Float64(-0.008333333333333333 * Float64(re * (im ^ 5.0)));
	else
		tmp = Float64(Float64(-im) * sin(re));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if ((im <= -760.0) || ~((im <= 6600.0)))
		tmp = -0.008333333333333333 * (re * (im ^ 5.0));
	else
		tmp = -im * sin(re);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[Or[LessEqual[im, -760.0], N[Not[LessEqual[im, 6600.0]], $MachinePrecision]], N[(-0.008333333333333333 * N[(re * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;im \leq -760 \lor \neg \left(im \leq 6600\right):\\
\;\;\;\;-0.008333333333333333 \cdot \left(re \cdot {im}^{5}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < -760 or 6600 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*100.0%

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

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

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

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

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \color{blue}{\left(-1 \cdot \left(\sin re \cdot im\right) + -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\right)} \]
      4. mul-1-neg76.9%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \left(\left(-\color{blue}{im \cdot \sin re}\right) + -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\right) \]
      6. distribute-lft-neg-in76.9%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \left(\left(-im\right) \cdot \sin re + -0.008333333333333333 \cdot \color{blue}{\left({im}^{5} \cdot \sin re\right)}\right) \]
      8. associate-*r*76.9%

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

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) + \color{blue}{\sin re \cdot \left(\left(-im\right) + -0.008333333333333333 \cdot {im}^{5}\right)} \]
      10. distribute-lft-out76.9%

        \[\leadsto \color{blue}{\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left(\left(-im\right) + -0.008333333333333333 \cdot {im}^{5}\right)\right)} \]
      11. +-commutative76.9%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \color{blue}{\left(-0.008333333333333333 \cdot {im}^{5} + \left(-im\right)\right)}\right) \]
      12. sub-neg76.9%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \color{blue}{\left(-0.008333333333333333 \cdot {im}^{5} - im\right)}\right) \]
      13. *-commutative76.9%

        \[\leadsto \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left(\color{blue}{{im}^{5} \cdot -0.008333333333333333} - im\right)\right) \]
    6. Simplified76.9%

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

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

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

    if -760 < im < 6600

    1. Initial program 28.3%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*28.3%

        \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} - e^{im}\right)\right)} \]
    3. Simplified28.3%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -760 \lor \neg \left(im \leq 6600\right):\\ \;\;\;\;-0.008333333333333333 \cdot \left(re \cdot {im}^{5}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \end{array} \]

Alternative 9: 60.4% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -1 \cdot 10^{+23} \lor \neg \left(im \leq 3.55 \cdot 10^{+22}\right):\\ \;\;\;\;\left(im \cdot -2\right) \cdot \left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (or (<= im -1e+23) (not (<= im 3.55e+22)))
   (* (* im -2.0) (* re (+ 0.5 (* -0.08333333333333333 (* re re)))))
   (* (- im) (sin re))))
double code(double re, double im) {
	double tmp;
	if ((im <= -1e+23) || !(im <= 3.55e+22)) {
		tmp = (im * -2.0) * (re * (0.5 + (-0.08333333333333333 * (re * re))));
	} else {
		tmp = -im * sin(re);
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if ((im <= (-1d+23)) .or. (.not. (im <= 3.55d+22))) then
        tmp = (im * (-2.0d0)) * (re * (0.5d0 + ((-0.08333333333333333d0) * (re * re))))
    else
        tmp = -im * sin(re)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if ((im <= -1e+23) || !(im <= 3.55e+22)) {
		tmp = (im * -2.0) * (re * (0.5 + (-0.08333333333333333 * (re * re))));
	} else {
		tmp = -im * Math.sin(re);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if (im <= -1e+23) or not (im <= 3.55e+22):
		tmp = (im * -2.0) * (re * (0.5 + (-0.08333333333333333 * (re * re))))
	else:
		tmp = -im * math.sin(re)
	return tmp
function code(re, im)
	tmp = 0.0
	if ((im <= -1e+23) || !(im <= 3.55e+22))
		tmp = Float64(Float64(im * -2.0) * Float64(re * Float64(0.5 + Float64(-0.08333333333333333 * Float64(re * re)))));
	else
		tmp = Float64(Float64(-im) * sin(re));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if ((im <= -1e+23) || ~((im <= 3.55e+22)))
		tmp = (im * -2.0) * (re * (0.5 + (-0.08333333333333333 * (re * re))));
	else
		tmp = -im * sin(re);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[Or[LessEqual[im, -1e+23], N[Not[LessEqual[im, 3.55e+22]], $MachinePrecision]], N[(N[(im * -2.0), $MachinePrecision] * N[(re * N[(0.5 + N[(-0.08333333333333333 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;im \leq -1 \cdot 10^{+23} \lor \neg \left(im \leq 3.55 \cdot 10^{+22}\right):\\
\;\;\;\;\left(im \cdot -2\right) \cdot \left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < -9.9999999999999992e22 or 3.5500000000000001e22 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*100.0%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(e^{-im} - e^{im}\right) \cdot \left(re \cdot 0.5 + {re}^{3} \cdot -0.08333333333333333\right)} \]
      7. *-commutative76.8%

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

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re + \color{blue}{-0.08333333333333333 \cdot {re}^{3}}\right) \]
      9. unpow376.8%

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re + -0.08333333333333333 \cdot \color{blue}{\left(\left(re \cdot re\right) \cdot re\right)}\right) \]
      10. associate-*r*76.8%

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re + \color{blue}{\left(-0.08333333333333333 \cdot \left(re \cdot re\right)\right) \cdot re}\right) \]
      11. distribute-rgt-out76.8%

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \color{blue}{\left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right)} \]
    6. Simplified76.8%

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

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

    if -9.9999999999999992e22 < im < 3.5500000000000001e22

    1. Initial program 34.2%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*34.2%

        \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} - e^{im}\right)\right)} \]
    3. Simplified34.2%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1 \cdot 10^{+23} \lor \neg \left(im \leq 3.55 \cdot 10^{+22}\right):\\ \;\;\;\;\left(im \cdot -2\right) \cdot \left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \end{array} \]

Alternative 10: 34.5% accurate, 17.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\\ t_1 := t_0 \cdot -3\\ \mathbf{if}\;re \leq -3.2 \cdot 10^{+123}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;re \leq 1.35 \cdot 10^{+100}:\\ \;\;\;\;im \cdot \left(-re\right)\\ \mathbf{elif}\;re \leq 4.6 \cdot 10^{+189}:\\ \;\;\;\;t_0 \cdot 27\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* re (+ 0.5 (* -0.08333333333333333 (* re re)))))
        (t_1 (* t_0 -3.0)))
   (if (<= re -3.2e+123)
     t_1
     (if (<= re 1.35e+100)
       (* im (- re))
       (if (<= re 4.6e+189) (* t_0 27.0) t_1)))))
double code(double re, double im) {
	double t_0 = re * (0.5 + (-0.08333333333333333 * (re * re)));
	double t_1 = t_0 * -3.0;
	double tmp;
	if (re <= -3.2e+123) {
		tmp = t_1;
	} else if (re <= 1.35e+100) {
		tmp = im * -re;
	} else if (re <= 4.6e+189) {
		tmp = t_0 * 27.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 = re * (0.5d0 + ((-0.08333333333333333d0) * (re * re)))
    t_1 = t_0 * (-3.0d0)
    if (re <= (-3.2d+123)) then
        tmp = t_1
    else if (re <= 1.35d+100) then
        tmp = im * -re
    else if (re <= 4.6d+189) then
        tmp = t_0 * 27.0d0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = re * (0.5 + (-0.08333333333333333 * (re * re)));
	double t_1 = t_0 * -3.0;
	double tmp;
	if (re <= -3.2e+123) {
		tmp = t_1;
	} else if (re <= 1.35e+100) {
		tmp = im * -re;
	} else if (re <= 4.6e+189) {
		tmp = t_0 * 27.0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(re, im):
	t_0 = re * (0.5 + (-0.08333333333333333 * (re * re)))
	t_1 = t_0 * -3.0
	tmp = 0
	if re <= -3.2e+123:
		tmp = t_1
	elif re <= 1.35e+100:
		tmp = im * -re
	elif re <= 4.6e+189:
		tmp = t_0 * 27.0
	else:
		tmp = t_1
	return tmp
function code(re, im)
	t_0 = Float64(re * Float64(0.5 + Float64(-0.08333333333333333 * Float64(re * re))))
	t_1 = Float64(t_0 * -3.0)
	tmp = 0.0
	if (re <= -3.2e+123)
		tmp = t_1;
	elseif (re <= 1.35e+100)
		tmp = Float64(im * Float64(-re));
	elseif (re <= 4.6e+189)
		tmp = Float64(t_0 * 27.0);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = re * (0.5 + (-0.08333333333333333 * (re * re)));
	t_1 = t_0 * -3.0;
	tmp = 0.0;
	if (re <= -3.2e+123)
		tmp = t_1;
	elseif (re <= 1.35e+100)
		tmp = im * -re;
	elseif (re <= 4.6e+189)
		tmp = t_0 * 27.0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(0.5 + N[(-0.08333333333333333 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * -3.0), $MachinePrecision]}, If[LessEqual[re, -3.2e+123], t$95$1, If[LessEqual[re, 1.35e+100], N[(im * (-re)), $MachinePrecision], If[LessEqual[re, 4.6e+189], N[(t$95$0 * 27.0), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\\
t_1 := t_0 \cdot -3\\
\mathbf{if}\;re \leq -3.2 \cdot 10^{+123}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;re \leq 4.6 \cdot 10^{+189}:\\
\;\;\;\;t_0 \cdot 27\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < -3.20000000000000005e123 or 4.6e189 < re

    1. Initial program 44.4%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*44.4%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(e^{-im} - e^{im}\right) \cdot \left(re \cdot 0.5 + {re}^{3} \cdot -0.08333333333333333\right)} \]
      7. *-commutative22.9%

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(\color{blue}{0.5 \cdot re} + {re}^{3} \cdot -0.08333333333333333\right) \]
      8. *-commutative22.9%

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re + \color{blue}{-0.08333333333333333 \cdot {re}^{3}}\right) \]
      9. unpow322.9%

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re + -0.08333333333333333 \cdot \color{blue}{\left(\left(re \cdot re\right) \cdot re\right)}\right) \]
      10. associate-*r*22.9%

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re + \color{blue}{\left(-0.08333333333333333 \cdot \left(re \cdot re\right)\right) \cdot re}\right) \]
      11. distribute-rgt-out22.9%

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \color{blue}{\left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right)} \]
    6. Simplified22.9%

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

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

    if -3.20000000000000005e123 < re < 1.34999999999999999e100

    1. Initial program 65.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*65.0%

        \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} - e^{im}\right)\right)} \]
    3. Simplified65.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{im \cdot \left(-re\right)} \]
    9. Simplified41.2%

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

    if 1.34999999999999999e100 < re < 4.6e189

    1. Initial program 71.4%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*71.4%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re + -0.08333333333333333 \cdot \color{blue}{\left(\left(re \cdot re\right) \cdot re\right)}\right) \]
      10. associate-*r*46.2%

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re + \color{blue}{\left(-0.08333333333333333 \cdot \left(re \cdot re\right)\right) \cdot re}\right) \]
      11. distribute-rgt-out46.2%

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \color{blue}{\left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right)} \]
    6. Simplified46.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -3.2 \cdot 10^{+123}:\\ \;\;\;\;\left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right) \cdot -3\\ \mathbf{elif}\;re \leq 1.35 \cdot 10^{+100}:\\ \;\;\;\;im \cdot \left(-re\right)\\ \mathbf{elif}\;re \leq 4.6 \cdot 10^{+189}:\\ \;\;\;\;\left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right) \cdot 27\\ \mathbf{else}:\\ \;\;\;\;\left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right) \cdot -3\\ \end{array} \]

Alternative 11: 34.4% accurate, 20.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -4 \cdot 10^{+125} \lor \neg \left(re \leq 9 \cdot 10^{+102}\right):\\ \;\;\;\;\left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right) \cdot -3\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(-re\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (or (<= re -4e+125) (not (<= re 9e+102)))
   (* (* re (+ 0.5 (* -0.08333333333333333 (* re re)))) -3.0)
   (* im (- re))))
double code(double re, double im) {
	double tmp;
	if ((re <= -4e+125) || !(re <= 9e+102)) {
		tmp = (re * (0.5 + (-0.08333333333333333 * (re * re)))) * -3.0;
	} else {
		tmp = im * -re;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if ((re <= (-4d+125)) .or. (.not. (re <= 9d+102))) then
        tmp = (re * (0.5d0 + ((-0.08333333333333333d0) * (re * re)))) * (-3.0d0)
    else
        tmp = im * -re
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if ((re <= -4e+125) || !(re <= 9e+102)) {
		tmp = (re * (0.5 + (-0.08333333333333333 * (re * re)))) * -3.0;
	} else {
		tmp = im * -re;
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if (re <= -4e+125) or not (re <= 9e+102):
		tmp = (re * (0.5 + (-0.08333333333333333 * (re * re)))) * -3.0
	else:
		tmp = im * -re
	return tmp
function code(re, im)
	tmp = 0.0
	if ((re <= -4e+125) || !(re <= 9e+102))
		tmp = Float64(Float64(re * Float64(0.5 + Float64(-0.08333333333333333 * Float64(re * re)))) * -3.0);
	else
		tmp = Float64(im * Float64(-re));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if ((re <= -4e+125) || ~((re <= 9e+102)))
		tmp = (re * (0.5 + (-0.08333333333333333 * (re * re)))) * -3.0;
	else
		tmp = im * -re;
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[Or[LessEqual[re, -4e+125], N[Not[LessEqual[re, 9e+102]], $MachinePrecision]], N[(N[(re * N[(0.5 + N[(-0.08333333333333333 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -3.0), $MachinePrecision], N[(im * (-re)), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq -4 \cdot 10^{+125} \lor \neg \left(re \leq 9 \cdot 10^{+102}\right):\\
\;\;\;\;\left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right) \cdot -3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if re < -3.9999999999999997e125 or 9.00000000000000042e102 < re

    1. Initial program 48.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*48.0%

        \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} - e^{im}\right)\right)} \]
    3. Simplified48.0%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(e^{-im} - e^{im}\right) \cdot \left(re \cdot 0.5 + {re}^{3} \cdot -0.08333333333333333\right)} \]
      7. *-commutative25.6%

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(\color{blue}{0.5 \cdot re} + {re}^{3} \cdot -0.08333333333333333\right) \]
      8. *-commutative25.6%

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re + \color{blue}{-0.08333333333333333 \cdot {re}^{3}}\right) \]
      9. unpow325.6%

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re + -0.08333333333333333 \cdot \color{blue}{\left(\left(re \cdot re\right) \cdot re\right)}\right) \]
      10. associate-*r*25.6%

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re + \color{blue}{\left(-0.08333333333333333 \cdot \left(re \cdot re\right)\right) \cdot re}\right) \]
      11. distribute-rgt-out25.6%

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \color{blue}{\left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right)} \]
    6. Simplified25.6%

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

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

    if -3.9999999999999997e125 < re < 9.00000000000000042e102

    1. Initial program 65.2%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. associate-*l*65.2%

        \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} - e^{im}\right)\right)} \]
    3. Simplified65.2%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -4 \cdot 10^{+125} \lor \neg \left(re \leq 9 \cdot 10^{+102}\right):\\ \;\;\;\;\left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right) \cdot -3\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(-re\right)\\ \end{array} \]

Alternative 12: 36.4% accurate, 23.7× speedup?

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

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

    \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
  2. Step-by-step derivation
    1. associate-*l*59.7%

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

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

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

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

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

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

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

      \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(re \cdot 0.5\right) + \color{blue}{\left(e^{-im} - e^{im}\right) \cdot \left({re}^{3} \cdot -0.08333333333333333\right)} \]
    6. distribute-lft-out46.7%

      \[\leadsto \color{blue}{\left(e^{-im} - e^{im}\right) \cdot \left(re \cdot 0.5 + {re}^{3} \cdot -0.08333333333333333\right)} \]
    7. *-commutative46.7%

      \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(\color{blue}{0.5 \cdot re} + {re}^{3} \cdot -0.08333333333333333\right) \]
    8. *-commutative46.7%

      \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re + \color{blue}{-0.08333333333333333 \cdot {re}^{3}}\right) \]
    9. unpow346.7%

      \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re + -0.08333333333333333 \cdot \color{blue}{\left(\left(re \cdot re\right) \cdot re\right)}\right) \]
    10. associate-*r*46.7%

      \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re + \color{blue}{\left(-0.08333333333333333 \cdot \left(re \cdot re\right)\right) \cdot re}\right) \]
    11. distribute-rgt-out46.7%

      \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \color{blue}{\left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right)} \]
  6. Simplified46.7%

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

    \[\leadsto \color{blue}{\left(-2 \cdot im\right)} \cdot \left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right) \]
  8. Final simplification35.3%

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

Alternative 13: 32.3% 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 59.7%

    \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
  2. Step-by-step derivation
    1. associate-*l*59.7%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-re \cdot im} \]
    2. *-commutative31.7%

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

      \[\leadsto \color{blue}{im \cdot \left(-re\right)} \]
  9. Simplified31.7%

    \[\leadsto \color{blue}{im \cdot \left(-re\right)} \]
  10. Final simplification31.7%

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

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 2023172 
(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))))