math.cos on complex, imaginary part

Percentage Accurate: 65.4% → 99.7%
Time: 10.2s
Alternatives: 13
Speedup: 2.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 65.4% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 0.4× speedup?

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

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

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


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

    1. Initial program 100.0%

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

    if -inf.0 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 4.00000000000000033e-5

    1. Initial program 37.6%

      \[\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.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right) + \left(-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)\right)} \]
    3. Step-by-step derivation
      1. associate-+r+99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 - im\right) + \left({im}^{7} \cdot -0.0001984126984126984 + \color{blue}{\left(\left(im \cdot im\right) \cdot im\right)} \cdot -0.16666666666666666\right)\right) \]
    6. Applied egg-rr99.8%

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

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

Alternative 2: 99.9% accurate, 0.4× speedup?

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

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

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


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

    1. Initial program 100.0%

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

    if -0.0200000000000000004 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 4.00000000000000033e-5

    1. Initial program 37.2%

      \[\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) + \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. +-commutative99.8%

        \[\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+99.8%

        \[\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. +-commutative99.8%

        \[\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-neg99.8%

        \[\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. *-commutative99.8%

        \[\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-in99.8%

        \[\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. *-commutative99.8%

        \[\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*99.8%

        \[\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-out99.8%

        \[\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*99.8%

        \[\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. *-commutative99.8%

        \[\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*99.8%

        \[\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-out99.8%

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

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

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

Alternative 3: 99.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-im} - e^{im}\\ \mathbf{if}\;t_0 \leq -0.005 \lor \neg \left(t_0 \leq 4 \cdot 10^{-5}\right):\\ \;\;\;\;t_0 \cdot \left(0.5 \cdot \sin re\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \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.005) (not (<= t_0 4e-5)))
     (* t_0 (* 0.5 (sin re)))
     (* (sin re) (- (* (* im (* im im)) -0.16666666666666666) im)))))
double code(double re, double im) {
	double t_0 = exp(-im) - exp(im);
	double tmp;
	if ((t_0 <= -0.005) || !(t_0 <= 4e-5)) {
		tmp = t_0 * (0.5 * sin(re));
	} else {
		tmp = sin(re) * (((im * (im * im)) * -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.005d0)) .or. (.not. (t_0 <= 4d-5))) then
        tmp = t_0 * (0.5d0 * sin(re))
    else
        tmp = sin(re) * (((im * (im * im)) * (-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.005) || !(t_0 <= 4e-5)) {
		tmp = t_0 * (0.5 * Math.sin(re));
	} else {
		tmp = Math.sin(re) * (((im * (im * im)) * -0.16666666666666666) - im);
	}
	return tmp;
}
def code(re, im):
	t_0 = math.exp(-im) - math.exp(im)
	tmp = 0
	if (t_0 <= -0.005) or not (t_0 <= 4e-5):
		tmp = t_0 * (0.5 * math.sin(re))
	else:
		tmp = math.sin(re) * (((im * (im * im)) * -0.16666666666666666) - im)
	return tmp
function code(re, im)
	t_0 = Float64(exp(Float64(-im)) - exp(im))
	tmp = 0.0
	if ((t_0 <= -0.005) || !(t_0 <= 4e-5))
		tmp = Float64(t_0 * Float64(0.5 * sin(re)));
	else
		tmp = Float64(sin(re) * Float64(Float64(Float64(im * Float64(im * im)) * -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.005) || ~((t_0 <= 4e-5)))
		tmp = t_0 * (0.5 * sin(re));
	else
		tmp = sin(re) * (((im * (im * im)) * -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.005], N[Not[LessEqual[t$95$0, 4e-5]], $MachinePrecision]], N[(t$95$0 * N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[(im * N[(im * im), $MachinePrecision]), $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.005 \lor \neg \left(t_0 \leq 4 \cdot 10^{-5}\right):\\
\;\;\;\;t_0 \cdot \left(0.5 \cdot \sin re\right)\\

\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \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.0050000000000000001 or 4.00000000000000033e-5 < (-.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.0050000000000000001 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 4.00000000000000033e-5

    1. Initial program 36.7%

      \[\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)} \]
    5. Step-by-step derivation
      1. unpow399.8%

        \[\leadsto \sin re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 - im\right) + \left({im}^{7} \cdot -0.0001984126984126984 + \color{blue}{\left(\left(im \cdot im\right) \cdot im\right)} \cdot -0.16666666666666666\right)\right) \]
    6. Applied egg-rr99.8%

      \[\leadsto \sin re \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot im\right)} \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.005 \lor \neg \left(e^{-im} - e^{im} \leq 4 \cdot 10^{-5}\right):\\ \;\;\;\;\left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot \sin re\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\right)\\ \end{array} \]

Alternative 4: 93.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\sin re \leq -5 \cdot 10^{-117} \lor \neg \left(\sin re \leq 10^{-140}\right):\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\left(-im\right) \cdot \sin re\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (or (<= (sin re) -5e-117) (not (<= (sin re) 1e-140)))
   (log1p (expm1 (* (- im) (sin re))))
   (* 0.5 (* (- (exp (- im)) (exp im)) re))))
double code(double re, double im) {
	double tmp;
	if ((sin(re) <= -5e-117) || !(sin(re) <= 1e-140)) {
		tmp = log1p(expm1((-im * sin(re))));
	} else {
		tmp = 0.5 * ((exp(-im) - exp(im)) * re);
	}
	return tmp;
}
public static double code(double re, double im) {
	double tmp;
	if ((Math.sin(re) <= -5e-117) || !(Math.sin(re) <= 1e-140)) {
		tmp = Math.log1p(Math.expm1((-im * Math.sin(re))));
	} else {
		tmp = 0.5 * ((Math.exp(-im) - Math.exp(im)) * re);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if (math.sin(re) <= -5e-117) or not (math.sin(re) <= 1e-140):
		tmp = math.log1p(math.expm1((-im * math.sin(re))))
	else:
		tmp = 0.5 * ((math.exp(-im) - math.exp(im)) * re)
	return tmp
function code(re, im)
	tmp = 0.0
	if ((sin(re) <= -5e-117) || !(sin(re) <= 1e-140))
		tmp = log1p(expm1(Float64(Float64(-im) * sin(re))));
	else
		tmp = Float64(0.5 * Float64(Float64(exp(Float64(-im)) - exp(im)) * re));
	end
	return tmp
end
code[re_, im_] := If[Or[LessEqual[N[Sin[re], $MachinePrecision], -5e-117], N[Not[LessEqual[N[Sin[re], $MachinePrecision], 1e-140]], $MachinePrecision]], N[Log[1 + N[(Exp[N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(0.5 * N[(N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\sin re \leq -5 \cdot 10^{-117} \lor \neg \left(\sin re \leq 10^{-140}\right):\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\left(-im\right) \cdot \sin re\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (sin.f64 re) < -5e-117 or 9.9999999999999998e-141 < (sin.f64 re)

    1. Initial program 59.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(im \cdot \left(-\sin re\right)\right)\right)} \]
    6. Applied egg-rr97.4%

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

    if -5e-117 < (sin.f64 re) < 9.9999999999999998e-141

    1. Initial program 91.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\sin re \leq -5 \cdot 10^{-117} \lor \neg \left(\sin re \leq 10^{-140}\right):\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\left(-im\right) \cdot \sin re\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)\\ \end{array} \]

Alternative 5: 97.7% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)\\ t_1 := -0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\ \mathbf{if}\;im \leq -7.5 \cdot 10^{+51}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq -0.035:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 0.11:\\ \;\;\;\;\sin re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\right)\\ \mathbf{elif}\;im \leq 1.95 \cdot 10^{+39}:\\ \;\;\;\;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 (* -0.0001984126984126984 (* (sin re) (pow im 7.0)))))
   (if (<= im -7.5e+51)
     t_1
     (if (<= im -0.035)
       t_0
       (if (<= im 0.11)
         (* (sin re) (- (* (* im (* im im)) -0.16666666666666666) im))
         (if (<= im 1.95e+39) t_0 t_1))))))
double code(double re, double im) {
	double t_0 = 0.5 * ((exp(-im) - exp(im)) * re);
	double t_1 = -0.0001984126984126984 * (sin(re) * pow(im, 7.0));
	double tmp;
	if (im <= -7.5e+51) {
		tmp = t_1;
	} else if (im <= -0.035) {
		tmp = t_0;
	} else if (im <= 0.11) {
		tmp = sin(re) * (((im * (im * im)) * -0.16666666666666666) - im);
	} else if (im <= 1.95e+39) {
		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 = (-0.0001984126984126984d0) * (sin(re) * (im ** 7.0d0))
    if (im <= (-7.5d+51)) then
        tmp = t_1
    else if (im <= (-0.035d0)) then
        tmp = t_0
    else if (im <= 0.11d0) then
        tmp = sin(re) * (((im * (im * im)) * (-0.16666666666666666d0)) - im)
    else if (im <= 1.95d+39) 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 = -0.0001984126984126984 * (Math.sin(re) * Math.pow(im, 7.0));
	double tmp;
	if (im <= -7.5e+51) {
		tmp = t_1;
	} else if (im <= -0.035) {
		tmp = t_0;
	} else if (im <= 0.11) {
		tmp = Math.sin(re) * (((im * (im * im)) * -0.16666666666666666) - im);
	} else if (im <= 1.95e+39) {
		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 = -0.0001984126984126984 * (math.sin(re) * math.pow(im, 7.0))
	tmp = 0
	if im <= -7.5e+51:
		tmp = t_1
	elif im <= -0.035:
		tmp = t_0
	elif im <= 0.11:
		tmp = math.sin(re) * (((im * (im * im)) * -0.16666666666666666) - im)
	elif im <= 1.95e+39:
		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(-0.0001984126984126984 * Float64(sin(re) * (im ^ 7.0)))
	tmp = 0.0
	if (im <= -7.5e+51)
		tmp = t_1;
	elseif (im <= -0.035)
		tmp = t_0;
	elseif (im <= 0.11)
		tmp = Float64(sin(re) * Float64(Float64(Float64(im * Float64(im * im)) * -0.16666666666666666) - im));
	elseif (im <= 1.95e+39)
		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 = -0.0001984126984126984 * (sin(re) * (im ^ 7.0));
	tmp = 0.0;
	if (im <= -7.5e+51)
		tmp = t_1;
	elseif (im <= -0.035)
		tmp = t_0;
	elseif (im <= 0.11)
		tmp = sin(re) * (((im * (im * im)) * -0.16666666666666666) - im);
	elseif (im <= 1.95e+39)
		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[(-0.0001984126984126984 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -7.5e+51], t$95$1, If[LessEqual[im, -0.035], t$95$0, If[LessEqual[im, 0.11], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.95e+39], 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 := -0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\
\mathbf{if}\;im \leq -7.5 \cdot 10^{+51}:\\
\;\;\;\;t_1\\

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

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

\mathbf{elif}\;im \leq 1.95 \cdot 10^{+39}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -7.4999999999999999e51 or 1.95e39 < 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 99.1%

      \[\leadsto \color{blue}{-0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right) + \left(-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)\right)} \]
    3. Step-by-step derivation
      1. associate-+r+99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.4999999999999999e51 < im < -0.035000000000000003 or 0.110000000000000001 < im < 1.95e39

    1. Initial program 99.9%

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

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

    if -0.035000000000000003 < im < 0.110000000000000001

    1. Initial program 37.6%

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

      \[\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.4%

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 - im\right) + \left({im}^{7} \cdot -0.0001984126984126984 + \color{blue}{\left(\left(im \cdot im\right) \cdot im\right)} \cdot -0.16666666666666666\right)\right) \]
    6. Applied egg-rr99.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -7.5 \cdot 10^{+51}:\\ \;\;\;\;-0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\ \mathbf{elif}\;im \leq -0.035:\\ \;\;\;\;0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)\\ \mathbf{elif}\;im \leq 0.11:\\ \;\;\;\;\sin re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\right)\\ \mathbf{elif}\;im \leq 1.95 \cdot 10^{+39}:\\ \;\;\;\;0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)\\ \mathbf{else}:\\ \;\;\;\;-0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\ \end{array} \]

Alternative 6: 93.3% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\ \mathbf{if}\;im \leq -7.5 \cdot 10^{+51}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -560000:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\left(-im\right) \cdot re\right)\right)\\ \mathbf{elif}\;im \leq 5.6:\\ \;\;\;\;\sin re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* -0.0001984126984126984 (* (sin re) (pow im 7.0)))))
   (if (<= im -7.5e+51)
     t_0
     (if (<= im -560000.0)
       (log1p (expm1 (* (- im) re)))
       (if (<= im 5.6)
         (* (sin re) (- (* (* im (* im im)) -0.16666666666666666) im))
         t_0)))))
double code(double re, double im) {
	double t_0 = -0.0001984126984126984 * (sin(re) * pow(im, 7.0));
	double tmp;
	if (im <= -7.5e+51) {
		tmp = t_0;
	} else if (im <= -560000.0) {
		tmp = log1p(expm1((-im * re)));
	} else if (im <= 5.6) {
		tmp = sin(re) * (((im * (im * im)) * -0.16666666666666666) - im);
	} else {
		tmp = t_0;
	}
	return tmp;
}
public static double code(double re, double im) {
	double t_0 = -0.0001984126984126984 * (Math.sin(re) * Math.pow(im, 7.0));
	double tmp;
	if (im <= -7.5e+51) {
		tmp = t_0;
	} else if (im <= -560000.0) {
		tmp = Math.log1p(Math.expm1((-im * re)));
	} else if (im <= 5.6) {
		tmp = Math.sin(re) * (((im * (im * im)) * -0.16666666666666666) - im);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = -0.0001984126984126984 * (math.sin(re) * math.pow(im, 7.0))
	tmp = 0
	if im <= -7.5e+51:
		tmp = t_0
	elif im <= -560000.0:
		tmp = math.log1p(math.expm1((-im * re)))
	elif im <= 5.6:
		tmp = math.sin(re) * (((im * (im * im)) * -0.16666666666666666) - im)
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(-0.0001984126984126984 * Float64(sin(re) * (im ^ 7.0)))
	tmp = 0.0
	if (im <= -7.5e+51)
		tmp = t_0;
	elseif (im <= -560000.0)
		tmp = log1p(expm1(Float64(Float64(-im) * re)));
	elseif (im <= 5.6)
		tmp = Float64(sin(re) * Float64(Float64(Float64(im * Float64(im * im)) * -0.16666666666666666) - im));
	else
		tmp = t_0;
	end
	return tmp
end
code[re_, im_] := Block[{t$95$0 = N[(-0.0001984126984126984 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -7.5e+51], t$95$0, If[LessEqual[im, -560000.0], N[Log[1 + N[(Exp[N[((-im) * re), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 5.6], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\
\mathbf{if}\;im \leq -7.5 \cdot 10^{+51}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -560000:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\left(-im\right) \cdot re\right)\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -7.4999999999999999e51 or 5.5999999999999996 < 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.8%

      \[\leadsto \color{blue}{-0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right) + \left(-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)\right)} \]
    3. Step-by-step derivation
      1. associate-+r+90.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.4999999999999999e51 < im < -5.6e5

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(im \cdot \left(-\sin re\right)\right)\right)} \]
    6. Applied egg-rr77.5%

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

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

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

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

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

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

    if -5.6e5 < im < 5.5999999999999996

    1. Initial program 39.1%

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

      \[\leadsto \color{blue}{-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-neg97.5%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -7.5 \cdot 10^{+51}:\\ \;\;\;\;-0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\ \mathbf{elif}\;im \leq -560000:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\left(-im\right) \cdot re\right)\right)\\ \mathbf{elif}\;im \leq 5.6:\\ \;\;\;\;\sin re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\right)\\ \mathbf{else}:\\ \;\;\;\;-0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\ \end{array} \]

Alternative 7: 89.5% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\right)\\ \mathbf{if}\;im \leq -6.2 \cdot 10^{+101}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -560000:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\left(-im\right) \cdot re\right)\right)\\ \mathbf{elif}\;im \leq 2 \cdot 10^{+39} \lor \neg \left(im \leq 5.6 \cdot 10^{+102}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(-0.016666666666666666 \cdot \left(re \cdot {im}^{5}\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (sin re) (- (* (* im (* im im)) -0.16666666666666666) im))))
   (if (<= im -6.2e+101)
     t_0
     (if (<= im -560000.0)
       (log1p (expm1 (* (- im) re)))
       (if (or (<= im 2e+39) (not (<= im 5.6e+102)))
         t_0
         (* 0.5 (* -0.016666666666666666 (* re (pow im 5.0)))))))))
double code(double re, double im) {
	double t_0 = sin(re) * (((im * (im * im)) * -0.16666666666666666) - im);
	double tmp;
	if (im <= -6.2e+101) {
		tmp = t_0;
	} else if (im <= -560000.0) {
		tmp = log1p(expm1((-im * re)));
	} else if ((im <= 2e+39) || !(im <= 5.6e+102)) {
		tmp = t_0;
	} else {
		tmp = 0.5 * (-0.016666666666666666 * (re * pow(im, 5.0)));
	}
	return tmp;
}
public static double code(double re, double im) {
	double t_0 = Math.sin(re) * (((im * (im * im)) * -0.16666666666666666) - im);
	double tmp;
	if (im <= -6.2e+101) {
		tmp = t_0;
	} else if (im <= -560000.0) {
		tmp = Math.log1p(Math.expm1((-im * re)));
	} else if ((im <= 2e+39) || !(im <= 5.6e+102)) {
		tmp = t_0;
	} else {
		tmp = 0.5 * (-0.016666666666666666 * (re * Math.pow(im, 5.0)));
	}
	return tmp;
}
def code(re, im):
	t_0 = math.sin(re) * (((im * (im * im)) * -0.16666666666666666) - im)
	tmp = 0
	if im <= -6.2e+101:
		tmp = t_0
	elif im <= -560000.0:
		tmp = math.log1p(math.expm1((-im * re)))
	elif (im <= 2e+39) or not (im <= 5.6e+102):
		tmp = t_0
	else:
		tmp = 0.5 * (-0.016666666666666666 * (re * math.pow(im, 5.0)))
	return tmp
function code(re, im)
	t_0 = Float64(sin(re) * Float64(Float64(Float64(im * Float64(im * im)) * -0.16666666666666666) - im))
	tmp = 0.0
	if (im <= -6.2e+101)
		tmp = t_0;
	elseif (im <= -560000.0)
		tmp = log1p(expm1(Float64(Float64(-im) * re)));
	elseif ((im <= 2e+39) || !(im <= 5.6e+102))
		tmp = t_0;
	else
		tmp = Float64(0.5 * Float64(-0.016666666666666666 * Float64(re * (im ^ 5.0))));
	end
	return tmp
end
code[re_, im_] := Block[{t$95$0 = N[(N[Sin[re], $MachinePrecision] * N[(N[(N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -6.2e+101], t$95$0, If[LessEqual[im, -560000.0], N[Log[1 + N[(Exp[N[((-im) * re), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[im, 2e+39], N[Not[LessEqual[im, 5.6e+102]], $MachinePrecision]], t$95$0, N[(0.5 * N[(-0.016666666666666666 * N[(re * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\right)\\
\mathbf{if}\;im \leq -6.2 \cdot 10^{+101}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -560000:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\left(-im\right) \cdot re\right)\right)\\

\mathbf{elif}\;im \leq 2 \cdot 10^{+39} \lor \neg \left(im \leq 5.6 \cdot 10^{+102}\right):\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -6.19999999999999998e101 or -5.6e5 < im < 1.99999999999999988e39 or 5.60000000000000037e102 < im

    1. Initial program 64.2%

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

      \[\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-neg93.2%

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 - im\right) + \left({im}^{7} \cdot -0.0001984126984126984 + \color{blue}{\left(\left(im \cdot im\right) \cdot im\right)} \cdot -0.16666666666666666\right)\right) \]
    6. Applied egg-rr93.2%

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

    if -6.19999999999999998e101 < im < -5.6e5

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(im \cdot \left(-\sin re\right)\right)\right)} \]
    6. Applied egg-rr71.5%

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

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

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

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

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

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

    if 1.99999999999999988e39 < im < 5.60000000000000037e102

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

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

      \[\leadsto 0.5 \cdot \left(\color{blue}{\left(-2 \cdot im + \left(-0.016666666666666666 \cdot {im}^{5} + -0.3333333333333333 \cdot {im}^{3}\right)\right)} \cdot re\right) \]
    4. Taylor expanded in im around inf 86.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -6.2 \cdot 10^{+101}:\\ \;\;\;\;\sin re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\right)\\ \mathbf{elif}\;im \leq -560000:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\left(-im\right) \cdot re\right)\right)\\ \mathbf{elif}\;im \leq 2 \cdot 10^{+39} \lor \neg \left(im \leq 5.6 \cdot 10^{+102}\right):\\ \;\;\;\;\sin re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(-0.016666666666666666 \cdot \left(re \cdot {im}^{5}\right)\right)\\ \end{array} \]

Alternative 8: 89.8% accurate, 2.5× speedup?

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

\\
\begin{array}{l}
t_0 := im \cdot \left(im \cdot im\right)\\
t_1 := \sin re \cdot \left(t_0 \cdot -0.16666666666666666 - im\right)\\
\mathbf{if}\;im \leq -5.8 \cdot 10^{+102}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq -0.048:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot -2 + \left({im}^{5} \cdot -0.016666666666666666 + t_0 \cdot -0.3333333333333333\right)\right)\right)\\

\mathbf{elif}\;im \leq 2.1 \cdot 10^{+39} \lor \neg \left(im \leq 5.6 \cdot 10^{+102}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -5.8000000000000005e102 or -0.048000000000000001 < im < 2.0999999999999999e39 or 5.60000000000000037e102 < im

    1. Initial program 63.6%

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

      \[\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-neg94.6%

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

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

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

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

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

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

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

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

    if -5.8000000000000005e102 < im < -0.048000000000000001

    1. Initial program 99.9%

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

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

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

        \[\leadsto \sin re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 - im\right) + \left({im}^{7} \cdot -0.0001984126984126984 + \color{blue}{\left(\left(im \cdot im\right) \cdot im\right)} \cdot -0.16666666666666666\right)\right) \]
    5. Applied egg-rr39.9%

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

    if 2.0999999999999999e39 < im < 5.60000000000000037e102

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

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

      \[\leadsto 0.5 \cdot \left(\color{blue}{\left(-2 \cdot im + \left(-0.016666666666666666 \cdot {im}^{5} + -0.3333333333333333 \cdot {im}^{3}\right)\right)} \cdot re\right) \]
    4. Taylor expanded in im around inf 86.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -5.8 \cdot 10^{+102}:\\ \;\;\;\;\sin re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\right)\\ \mathbf{elif}\;im \leq -0.048:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot -2 + \left({im}^{5} \cdot -0.016666666666666666 + \left(im \cdot \left(im \cdot im\right)\right) \cdot -0.3333333333333333\right)\right)\right)\\ \mathbf{elif}\;im \leq 2.1 \cdot 10^{+39} \lor \neg \left(im \leq 5.6 \cdot 10^{+102}\right):\\ \;\;\;\;\sin re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(-0.016666666666666666 \cdot \left(re \cdot {im}^{5}\right)\right)\\ \end{array} \]

Alternative 9: 89.7% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -5.8 \cdot 10^{+102} \lor \neg \left(im \leq -1.8 \cdot 10^{+31}\right) \land \left(im \leq 2 \cdot 10^{+39} \lor \neg \left(im \leq 5.6 \cdot 10^{+102}\right)\right):\\ \;\;\;\;\sin re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(-0.016666666666666666 \cdot \left(re \cdot {im}^{5}\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (or (<= im -5.8e+102)
         (and (not (<= im -1.8e+31))
              (or (<= im 2e+39) (not (<= im 5.6e+102)))))
   (* (sin re) (- (* (* im (* im im)) -0.16666666666666666) im))
   (* 0.5 (* -0.016666666666666666 (* re (pow im 5.0))))))
double code(double re, double im) {
	double tmp;
	if ((im <= -5.8e+102) || (!(im <= -1.8e+31) && ((im <= 2e+39) || !(im <= 5.6e+102)))) {
		tmp = sin(re) * (((im * (im * im)) * -0.16666666666666666) - im);
	} else {
		tmp = 0.5 * (-0.016666666666666666 * (re * pow(im, 5.0)));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if ((im <= (-5.8d+102)) .or. (.not. (im <= (-1.8d+31))) .and. (im <= 2d+39) .or. (.not. (im <= 5.6d+102))) then
        tmp = sin(re) * (((im * (im * im)) * (-0.16666666666666666d0)) - im)
    else
        tmp = 0.5d0 * ((-0.016666666666666666d0) * (re * (im ** 5.0d0)))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if ((im <= -5.8e+102) || (!(im <= -1.8e+31) && ((im <= 2e+39) || !(im <= 5.6e+102)))) {
		tmp = Math.sin(re) * (((im * (im * im)) * -0.16666666666666666) - im);
	} else {
		tmp = 0.5 * (-0.016666666666666666 * (re * Math.pow(im, 5.0)));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if (im <= -5.8e+102) or (not (im <= -1.8e+31) and ((im <= 2e+39) or not (im <= 5.6e+102))):
		tmp = math.sin(re) * (((im * (im * im)) * -0.16666666666666666) - im)
	else:
		tmp = 0.5 * (-0.016666666666666666 * (re * math.pow(im, 5.0)))
	return tmp
function code(re, im)
	tmp = 0.0
	if ((im <= -5.8e+102) || (!(im <= -1.8e+31) && ((im <= 2e+39) || !(im <= 5.6e+102))))
		tmp = Float64(sin(re) * Float64(Float64(Float64(im * Float64(im * im)) * -0.16666666666666666) - im));
	else
		tmp = Float64(0.5 * Float64(-0.016666666666666666 * Float64(re * (im ^ 5.0))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if ((im <= -5.8e+102) || (~((im <= -1.8e+31)) && ((im <= 2e+39) || ~((im <= 5.6e+102)))))
		tmp = sin(re) * (((im * (im * im)) * -0.16666666666666666) - im);
	else
		tmp = 0.5 * (-0.016666666666666666 * (re * (im ^ 5.0)));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[Or[LessEqual[im, -5.8e+102], And[N[Not[LessEqual[im, -1.8e+31]], $MachinePrecision], Or[LessEqual[im, 2e+39], N[Not[LessEqual[im, 5.6e+102]], $MachinePrecision]]]], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(-0.016666666666666666 * N[(re * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;im \leq -5.8 \cdot 10^{+102} \lor \neg \left(im \leq -1.8 \cdot 10^{+31}\right) \land \left(im \leq 2 \cdot 10^{+39} \lor \neg \left(im \leq 5.6 \cdot 10^{+102}\right)\right):\\
\;\;\;\;\sin re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < -5.8000000000000005e102 or -1.79999999999999998e31 < im < 1.99999999999999988e39 or 5.60000000000000037e102 < im

    1. Initial program 65.2%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Taylor expanded in im around 0 90.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-neg90.8%

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 - im\right) + \left({im}^{7} \cdot -0.0001984126984126984 + \color{blue}{\left(\left(im \cdot im\right) \cdot im\right)} \cdot -0.16666666666666666\right)\right) \]
    6. Applied egg-rr90.8%

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

    if -5.8000000000000005e102 < im < -1.79999999999999998e31 or 1.99999999999999988e39 < im < 5.60000000000000037e102

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

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

      \[\leadsto 0.5 \cdot \left(\color{blue}{\left(-2 \cdot im + \left(-0.016666666666666666 \cdot {im}^{5} + -0.3333333333333333 \cdot {im}^{3}\right)\right)} \cdot re\right) \]
    4. Taylor expanded in im around inf 69.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -5.8 \cdot 10^{+102} \lor \neg \left(im \leq -1.8 \cdot 10^{+31}\right) \land \left(im \leq 2 \cdot 10^{+39} \lor \neg \left(im \leq 5.6 \cdot 10^{+102}\right)\right):\\ \;\;\;\;\sin re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(-0.016666666666666666 \cdot \left(re \cdot {im}^{5}\right)\right)\\ \end{array} \]

Alternative 10: 81.3% accurate, 2.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.8 \cdot 10^{+31} \lor \neg \left(im \leq 2 \cdot 10^{+39}\right):\\
\;\;\;\;0.5 \cdot \left(-0.016666666666666666 \cdot \left(re \cdot {im}^{5}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < -1.79999999999999998e31 or 1.99999999999999988e39 < 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 80.9%

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

      \[\leadsto 0.5 \cdot \left(\color{blue}{\left(-2 \cdot im + \left(-0.016666666666666666 \cdot {im}^{5} + -0.3333333333333333 \cdot {im}^{3}\right)\right)} \cdot re\right) \]
    4. Taylor expanded in im around inf 75.7%

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

    if -1.79999999999999998e31 < im < 1.99999999999999988e39

    1. Initial program 46.6%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1.8 \cdot 10^{+31} \lor \neg \left(im \leq 2 \cdot 10^{+39}\right):\\ \;\;\;\;0.5 \cdot \left(-0.016666666666666666 \cdot \left(re \cdot {im}^{5}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \end{array} \]

Alternative 11: 77.6% accurate, 2.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.85 \cdot 10^{+31} \lor \neg \left(im \leq 2 \cdot 10^{+39}\right):\\
\;\;\;\;0.5 \cdot \left(-0.3333333333333333 \cdot \left(re \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < -1.8499999999999999e31 or 1.99999999999999988e39 < 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 80.9%

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right) + -2 \cdot \left(re \cdot im\right)\right)} \]
    4. Taylor expanded in im around inf 62.7%

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

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

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

    if -1.8499999999999999e31 < im < 1.99999999999999988e39

    1. Initial program 46.6%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1.85 \cdot 10^{+31} \lor \neg \left(im \leq 2 \cdot 10^{+39}\right):\\ \;\;\;\;0.5 \cdot \left(-0.3333333333333333 \cdot \left(re \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \end{array} \]

Alternative 12: 54.2% accurate, 20.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq -3100 \lor \neg \left(im \leq 0.014\right):\\
\;\;\;\;0.5 \cdot \left(-0.3333333333333333 \cdot \left(re \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < -3100 or 0.0140000000000000003 < 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 78.5%

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(-0.3333333333333333 \cdot \left(re \cdot {im}^{3}\right) + -2 \cdot \left(re \cdot im\right)\right)} \]
    4. Taylor expanded in im around inf 53.4%

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

        \[\leadsto \sin re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 - im\right) + \left({im}^{7} \cdot -0.0001984126984126984 + \color{blue}{\left(\left(im \cdot im\right) \cdot im\right)} \cdot -0.16666666666666666\right)\right) \]
    6. Applied egg-rr53.4%

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

    if -3100 < im < 0.0140000000000000003

    1. Initial program 38.1%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -3100 \lor \neg \left(im \leq 0.014\right):\\ \;\;\;\;0.5 \cdot \left(-0.3333333333333333 \cdot \left(re \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-im\right) \cdot re\\ \end{array} \]

Alternative 13: 34.2% accurate, 77.0× speedup?

\[\begin{array}{l} \\ \left(-im\right) \cdot re \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(Float64(-im) * re)
end
function tmp = code(re, im)
	tmp = -im * re;
end
code[re_, im_] := N[((-im) * re), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

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

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

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

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