math.cos on complex, imaginary part

Percentage Accurate: 65.9% → 99.8%
Time: 9.1s
Alternatives: 15
Speedup: 2.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 15 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 65.9% 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.8% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-im} - e^{im}\\ \mathbf{if}\;t_0 \leq -0.01 \lor \neg \left(t_0 \leq 10^{-6}\right):\\ \;\;\;\;t_0 \cdot \left(\sin re \cdot 0.5\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 -0.01) (not (<= t_0 1e-6)))
     (* t_0 (* (sin re) 0.5))
     (* (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 <= -0.01) || !(t_0 <= 1e-6)) {
		tmp = t_0 * (sin(re) * 0.5);
	} else {
		tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = exp(-im) - exp(im)
    if ((t_0 <= (-0.01d0)) .or. (.not. (t_0 <= 1d-6))) then
        tmp = t_0 * (sin(re) * 0.5d0)
    else
        tmp = sin(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = Math.exp(-im) - Math.exp(im);
	double tmp;
	if ((t_0 <= -0.01) || !(t_0 <= 1e-6)) {
		tmp = t_0 * (Math.sin(re) * 0.5);
	} 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 <= -0.01) or not (t_0 <= 1e-6):
		tmp = t_0 * (math.sin(re) * 0.5)
	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 <= -0.01) || !(t_0 <= 1e-6))
		tmp = Float64(t_0 * Float64(sin(re) * 0.5));
	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 <= -0.01) || ~((t_0 <= 1e-6)))
		tmp = t_0 * (sin(re) * 0.5);
	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, -0.01], N[Not[LessEqual[t$95$0, 1e-6]], $MachinePrecision]], N[(t$95$0 * N[(N[Sin[re], $MachinePrecision] * 0.5), $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 -0.01 \lor \neg \left(t_0 \leq 10^{-6}\right):\\
\;\;\;\;t_0 \cdot \left(\sin re \cdot 0.5\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)) < -0.0100000000000000002 or 9.99999999999999955e-7 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))

    1. Initial program 99.9%

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

    if -0.0100000000000000002 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 9.99999999999999955e-7

    1. Initial program 34.9%

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

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

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

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

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

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

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

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

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

Alternative 2: 94.7% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq 0.005:\\
\;\;\;\;\sin re \cdot \left(\left({im}^{3} \cdot -0.16666666666666666 - im\right) + {im}^{5} \cdot -0.008333333333333333\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 0.0050000000000000001

    1. Initial program 54.4%

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

      \[\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)} \]
    3. Step-by-step derivation
      1. +-commutative98.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.0050000000000000001 < (-.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) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.4%

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

Alternative 3: 96.0% accurate, 1.4× speedup?

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

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

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

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

\mathbf{elif}\;im \leq 4.5 \cdot 10^{+61}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.1999999999999999e103 < im < -6.2e-4 or 0.0058 < im < 4.5e61

    1. Initial program 99.4%

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

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

    if -6.2e-4 < im < 0.0058

    1. Initial program 34.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1.2 \cdot 10^{+103}:\\ \;\;\;\;\sin re \cdot \left({im}^{5} \cdot -0.008333333333333333\right)\\ \mathbf{elif}\;im \leq -0.00062:\\ \;\;\;\;0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)\\ \mathbf{elif}\;im \leq 0.0058:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \mathbf{elif}\;im \leq 4.5 \cdot 10^{+61}:\\ \;\;\;\;0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left({im}^{5} \cdot -0.008333333333333333\right)\\ \end{array} \]

Alternative 4: 96.2% accurate, 1.4× speedup?

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

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

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

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

\mathbf{elif}\;im \leq 4.5 \cdot 10^{+61}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.1999999999999999e103 < im < -0.0013500000000000001 or 0.0080000000000000002 < im < 4.5e61

    1. Initial program 99.4%

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

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

    if -0.0013500000000000001 < im < 0.0080000000000000002

    1. Initial program 34.9%

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

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

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

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

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

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

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

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

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

Alternative 5: 89.7% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -3.3 \lor \neg \left(im \leq 3.3\right):\\ \;\;\;\;\sin re \cdot \left({im}^{5} \cdot -0.008333333333333333\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)))
   (* (sin re) (* (pow im 5.0) -0.008333333333333333))
   (* (- im) (sin re))))
double code(double re, double im) {
	double tmp;
	if ((im <= -3.3) || !(im <= 3.3)) {
		tmp = sin(re) * (pow(im, 5.0) * -0.008333333333333333);
	} 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 = sin(re) * ((im ** 5.0d0) * (-0.008333333333333333d0))
    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 = Math.sin(re) * (Math.pow(im, 5.0) * -0.008333333333333333);
	} else {
		tmp = -im * Math.sin(re);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if (im <= -3.3) or not (im <= 3.3):
		tmp = math.sin(re) * (math.pow(im, 5.0) * -0.008333333333333333)
	else:
		tmp = -im * math.sin(re)
	return tmp
function code(re, im)
	tmp = 0.0
	if ((im <= -3.3) || !(im <= 3.3))
		tmp = Float64(sin(re) * Float64((im ^ 5.0) * -0.008333333333333333));
	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 = sin(re) * ((im ^ 5.0) * -0.008333333333333333);
	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[(N[Sin[re], $MachinePrecision] * N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $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):\\
\;\;\;\;\sin re \cdot \left({im}^{5} \cdot -0.008333333333333333\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. 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)} \]
    3. Step-by-step derivation
      1. +-commutative88.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.2999999999999998 < im < 3.2999999999999998

    1. Initial program 35.7%

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

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

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

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

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

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

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

Alternative 6: 79.8% accurate, 2.6× speedup?

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

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

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

\mathbf{elif}\;im \leq 10^{+226} \lor \neg \left(im \leq 1.6 \cdot 10^{+258}\right):\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -3.09999999999999996e27 or 5200 < im < 9.99999999999999961e225 or 1.60000000000000005e258 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 89.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)} \]
    3. Step-by-step derivation
      1. +-commutative89.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.09999999999999996e27 < im < 5200

    1. Initial program 37.1%

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

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

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

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

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

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

    if 9.99999999999999961e225 < im < 1.60000000000000005e258

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -3.1 \cdot 10^{+27}:\\ \;\;\;\;-0.008333333333333333 \cdot \left(re \cdot {im}^{5}\right)\\ \mathbf{elif}\;im \leq 5200:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \mathbf{elif}\;im \leq 10^{+226} \lor \neg \left(im \leq 1.6 \cdot 10^{+258}\right):\\ \;\;\;\;-0.008333333333333333 \cdot \left(re \cdot {im}^{5}\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\ \end{array} \]

Alternative 7: 79.8% accurate, 2.6× speedup?

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

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

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

\mathbf{elif}\;im \leq 10^{+226}:\\
\;\;\;\;t_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < -1.2199999999999999e28 or 5600 < im < 9.99999999999999961e225

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 87.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)} \]
    3. Step-by-step derivation
      1. +-commutative87.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.2199999999999999e28 < im < 5600

    1. Initial program 37.1%

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

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

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

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

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

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

    if 9.99999999999999961e225 < im < 1.8499999999999999e258

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.8499999999999999e258 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1.22 \cdot 10^{+28}:\\ \;\;\;\;-0.008333333333333333 \cdot \left(re \cdot {im}^{5}\right)\\ \mathbf{elif}\;im \leq 5600:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \mathbf{elif}\;im \leq 10^{+226}:\\ \;\;\;\;-0.008333333333333333 \cdot \left(re \cdot {im}^{5}\right)\\ \mathbf{elif}\;im \leq 1.85 \cdot 10^{+258}:\\ \;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\ \end{array} \]

Alternative 8: 79.7% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -0.008333333333333333 \cdot \left(re \cdot {im}^{5}\right)\\ \mathbf{if}\;im \leq -2.8 \cdot 10^{+27}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 3850:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \mathbf{elif}\;im \leq 10^{+226} \lor \neg \left(im \leq 1.6 \cdot 10^{+258}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* -0.008333333333333333 (* re (pow im 5.0)))))
   (if (<= im -2.8e+27)
     t_0
     (if (<= im 3850.0)
       (* (- im) (sin re))
       (if (or (<= im 1e+226) (not (<= im 1.6e+258)))
         t_0
         (* 0.16666666666666666 (* im (pow re 3.0))))))))
double code(double re, double im) {
	double t_0 = -0.008333333333333333 * (re * pow(im, 5.0));
	double tmp;
	if (im <= -2.8e+27) {
		tmp = t_0;
	} else if (im <= 3850.0) {
		tmp = -im * sin(re);
	} else if ((im <= 1e+226) || !(im <= 1.6e+258)) {
		tmp = t_0;
	} else {
		tmp = 0.16666666666666666 * (im * pow(re, 3.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) * (re * (im ** 5.0d0))
    if (im <= (-2.8d+27)) then
        tmp = t_0
    else if (im <= 3850.0d0) then
        tmp = -im * sin(re)
    else if ((im <= 1d+226) .or. (.not. (im <= 1.6d+258))) then
        tmp = t_0
    else
        tmp = 0.16666666666666666d0 * (im * (re ** 3.0d0))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = -0.008333333333333333 * (re * Math.pow(im, 5.0));
	double tmp;
	if (im <= -2.8e+27) {
		tmp = t_0;
	} else if (im <= 3850.0) {
		tmp = -im * Math.sin(re);
	} else if ((im <= 1e+226) || !(im <= 1.6e+258)) {
		tmp = t_0;
	} else {
		tmp = 0.16666666666666666 * (im * Math.pow(re, 3.0));
	}
	return tmp;
}
def code(re, im):
	t_0 = -0.008333333333333333 * (re * math.pow(im, 5.0))
	tmp = 0
	if im <= -2.8e+27:
		tmp = t_0
	elif im <= 3850.0:
		tmp = -im * math.sin(re)
	elif (im <= 1e+226) or not (im <= 1.6e+258):
		tmp = t_0
	else:
		tmp = 0.16666666666666666 * (im * math.pow(re, 3.0))
	return tmp
function code(re, im)
	t_0 = Float64(-0.008333333333333333 * Float64(re * (im ^ 5.0)))
	tmp = 0.0
	if (im <= -2.8e+27)
		tmp = t_0;
	elseif (im <= 3850.0)
		tmp = Float64(Float64(-im) * sin(re));
	elseif ((im <= 1e+226) || !(im <= 1.6e+258))
		tmp = t_0;
	else
		tmp = Float64(0.16666666666666666 * Float64(im * (re ^ 3.0)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = -0.008333333333333333 * (re * (im ^ 5.0));
	tmp = 0.0;
	if (im <= -2.8e+27)
		tmp = t_0;
	elseif (im <= 3850.0)
		tmp = -im * sin(re);
	elseif ((im <= 1e+226) || ~((im <= 1.6e+258)))
		tmp = t_0;
	else
		tmp = 0.16666666666666666 * (im * (re ^ 3.0));
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(-0.008333333333333333 * N[(re * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.8e+27], t$95$0, If[LessEqual[im, 3850.0], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, 1e+226], N[Not[LessEqual[im, 1.6e+258]], $MachinePrecision]], t$95$0, N[(0.16666666666666666 * N[(im * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;im \leq 10^{+226} \lor \neg \left(im \leq 1.6 \cdot 10^{+258}\right):\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -2.7999999999999999e27 or 3850 < im < 9.99999999999999961e225 or 1.60000000000000005e258 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 89.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)} \]
    3. Step-by-step derivation
      1. +-commutative89.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.7999999999999999e27 < im < 3850

    1. Initial program 37.1%

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

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

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

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

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

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

    if 9.99999999999999961e225 < im < 1.60000000000000005e258

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -2.8 \cdot 10^{+27}:\\ \;\;\;\;-0.008333333333333333 \cdot \left(re \cdot {im}^{5}\right)\\ \mathbf{elif}\;im \leq 3850:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \mathbf{elif}\;im \leq 10^{+226} \lor \neg \left(im \leq 1.6 \cdot 10^{+258}\right):\\ \;\;\;\;-0.008333333333333333 \cdot \left(re \cdot {im}^{5}\right)\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right)\\ \end{array} \]

Alternative 9: 81.0% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -2.8 \cdot 10^{+27} \lor \neg \left(im \leq 980\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 -2.8e+27) (not (<= im 980.0)))
   (* -0.008333333333333333 (* re (pow im 5.0)))
   (* (- im) (sin re))))
double code(double re, double im) {
	double tmp;
	if ((im <= -2.8e+27) || !(im <= 980.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 <= (-2.8d+27)) .or. (.not. (im <= 980.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 <= -2.8e+27) || !(im <= 980.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 <= -2.8e+27) or not (im <= 980.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 <= -2.8e+27) || !(im <= 980.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 <= -2.8e+27) || ~((im <= 980.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, -2.8e+27], N[Not[LessEqual[im, 980.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 -2.8 \cdot 10^{+27} \lor \neg \left(im \leq 980\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 < -2.7999999999999999e27 or 980 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 90.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)} \]
    3. Step-by-step derivation
      1. +-commutative90.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.7999999999999999e27 < im < 980

    1. Initial program 37.1%

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

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

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

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

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

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

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

Alternative 10: 56.0% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -9.2 \cdot 10^{+42} \lor \neg \left(im \leq 9.8 \cdot 10^{+176}\right):\\ \;\;\;\;im \cdot \left(-re\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (or (<= im -9.2e+42) (not (<= im 9.8e+176)))
   (* im (- re))
   (* (- im) (sin re))))
double code(double re, double im) {
	double tmp;
	if ((im <= -9.2e+42) || !(im <= 9.8e+176)) {
		tmp = im * -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 <= (-9.2d+42)) .or. (.not. (im <= 9.8d+176))) then
        tmp = im * -re
    else
        tmp = -im * sin(re)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if ((im <= -9.2e+42) || !(im <= 9.8e+176)) {
		tmp = im * -re;
	} else {
		tmp = -im * Math.sin(re);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if (im <= -9.2e+42) or not (im <= 9.8e+176):
		tmp = im * -re
	else:
		tmp = -im * math.sin(re)
	return tmp
function code(re, im)
	tmp = 0.0
	if ((im <= -9.2e+42) || !(im <= 9.8e+176))
		tmp = Float64(im * Float64(-re));
	else
		tmp = Float64(Float64(-im) * sin(re));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if ((im <= -9.2e+42) || ~((im <= 9.8e+176)))
		tmp = im * -re;
	else
		tmp = -im * sin(re);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[Or[LessEqual[im, -9.2e+42], N[Not[LessEqual[im, 9.8e+176]], $MachinePrecision]], N[(im * (-re)), $MachinePrecision], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;im \leq -9.2 \cdot 10^{+42} \lor \neg \left(im \leq 9.8 \cdot 10^{+176}\right):\\
\;\;\;\;im \cdot \left(-re\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < -9.2e42 or 9.8e176 < im

    1. Initial program 100.0%

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

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

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

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

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

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

    if -9.2e42 < im < 9.8e176

    1. Initial program 45.7%

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

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

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

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

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

      \[\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 -9.2 \cdot 10^{+42} \lor \neg \left(im \leq 9.8 \cdot 10^{+176}\right):\\ \;\;\;\;im \cdot \left(-re\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \end{array} \]

Alternative 11: 33.2% 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 64.4%

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

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

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

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

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

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

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

Alternative 12: 2.7% accurate, 308.0× speedup?

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

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

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

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

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

    \[\leadsto -1.5 \]

Alternative 13: 2.7% accurate, 308.0× speedup?

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

\\
-2.8935185185185185 \cdot 10^{-7}
\end{array}
Derivation
  1. Initial program 64.4%

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

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

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

    \[\leadsto -2.8935185185185185 \cdot 10^{-7} \]

Alternative 14: 2.8% accurate, 308.0× speedup?

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

\\
-9.690334973390744 \cdot 10^{-20}
\end{array}
Derivation
  1. Initial program 64.4%

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

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

    \[\leadsto 0.5 \cdot \color{blue}{-1.9380669946781487 \cdot 10^{-19}} \]
  4. Final simplification2.9%

    \[\leadsto -9.690334973390744 \cdot 10^{-20} \]

Alternative 15: 14.8% accurate, 308.0× speedup?

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

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

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

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

    \[\leadsto 0.5 \cdot \color{blue}{0} \]
  4. Final simplification18.8%

    \[\leadsto 0 \]

Developer target: 99.8% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023238 
(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))))