math.cos on complex, imaginary part

Percentage Accurate: 65.2% → 99.8%
Time: 13.3s
Alternatives: 14
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 14 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.2% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.4× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < -0.40000000000000002 or 5.00000000000000024e-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.40000000000000002 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 5.00000000000000024e-5

    1. Initial program 27.3%

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

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

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

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

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

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

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

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

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

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

Alternative 2: 95.7% accurate, 1.4× speedup?

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

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

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

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

\mathbf{elif}\;im \leq 2.7 \cdot 10^{+99}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -5.49999999999999981e102 or 2.69999999999999989e99 < 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 98.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.49999999999999981e102 < im < -0.021999999999999999 or 0.050000000000000003 < im < 2.69999999999999989e99

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

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

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

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

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

    if -0.021999999999999999 < im < 0.050000000000000003

    1. Initial program 27.3%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -5.5 \cdot 10^{+102}:\\ \;\;\;\;{im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\ \mathbf{elif}\;im \leq -0.022:\\ \;\;\;\;\left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{elif}\;im \leq 0.05:\\ \;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\ \mathbf{elif}\;im \leq 2.7 \cdot 10^{+99}:\\ \;\;\;\;\left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{else}:\\ \;\;\;\;{im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\ \end{array} \]

Alternative 3: 86.8% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;im \leq -8.4 \cdot 10^{+30}:\\
\;\;\;\;re \cdot \sqrt{0.027777777777777776 \cdot {im}^{6}}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -5.49999999999999981e102 or 2.39999999999999991 < 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 82.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.49999999999999981e102 < im < -8.4000000000000001e30

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto re \cdot \sqrt{\color{blue}{0.027777777777777776} \cdot \left({im}^{3} \cdot {im}^{3}\right)} \]
      5. pow-prod-up69.0%

        \[\leadsto re \cdot \sqrt{0.027777777777777776 \cdot \color{blue}{{im}^{\left(3 + 3\right)}}} \]
      6. metadata-eval69.0%

        \[\leadsto re \cdot \sqrt{0.027777777777777776 \cdot {im}^{\color{blue}{6}}} \]
    10. Applied egg-rr69.0%

      \[\leadsto re \cdot \color{blue}{\sqrt{0.027777777777777776 \cdot {im}^{6}}} \]

    if -8.4000000000000001e30 < im < 2.39999999999999991

    1. Initial program 31.5%

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot im\right) \cdot \sin re} \]
      2. neg-mul-194.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -5.5 \cdot 10^{+102}:\\ \;\;\;\;{im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\ \mathbf{elif}\;im \leq -8.4 \cdot 10^{+30}:\\ \;\;\;\;re \cdot \sqrt{0.027777777777777776 \cdot {im}^{6}}\\ \mathbf{elif}\;im \leq 2.4:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \mathbf{else}:\\ \;\;\;\;{im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\ \end{array} \]

Alternative 4: 87.1% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -5.5 \cdot 10^{+102}:\\ \;\;\;\;{im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\ \mathbf{elif}\;im \leq -4.6 \cdot 10^{+33}:\\ \;\;\;\;re \cdot \sqrt{0.027777777777777776 \cdot {im}^{6}}\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im -5.5e+102)
   (* (pow im 3.0) (* (sin re) -0.16666666666666666))
   (if (<= im -4.6e+33)
     (* re (sqrt (* 0.027777777777777776 (pow im 6.0))))
     (* (sin re) (- (* (pow im 3.0) -0.16666666666666666) im)))))
double code(double re, double im) {
	double tmp;
	if (im <= -5.5e+102) {
		tmp = pow(im, 3.0) * (sin(re) * -0.16666666666666666);
	} else if (im <= -4.6e+33) {
		tmp = re * sqrt((0.027777777777777776 * pow(im, 6.0)));
	} else {
		tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (im <= (-5.5d+102)) then
        tmp = (im ** 3.0d0) * (sin(re) * (-0.16666666666666666d0))
    else if (im <= (-4.6d+33)) then
        tmp = re * sqrt((0.027777777777777776d0 * (im ** 6.0d0)))
    else
        tmp = sin(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= -5.5e+102) {
		tmp = Math.pow(im, 3.0) * (Math.sin(re) * -0.16666666666666666);
	} else if (im <= -4.6e+33) {
		tmp = re * Math.sqrt((0.027777777777777776 * Math.pow(im, 6.0)));
	} else {
		tmp = Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= -5.5e+102:
		tmp = math.pow(im, 3.0) * (math.sin(re) * -0.16666666666666666)
	elif im <= -4.6e+33:
		tmp = re * math.sqrt((0.027777777777777776 * math.pow(im, 6.0)))
	else:
		tmp = math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im)
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= -5.5e+102)
		tmp = Float64((im ^ 3.0) * Float64(sin(re) * -0.16666666666666666));
	elseif (im <= -4.6e+33)
		tmp = Float64(re * sqrt(Float64(0.027777777777777776 * (im ^ 6.0))));
	else
		tmp = Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= -5.5e+102)
		tmp = (im ^ 3.0) * (sin(re) * -0.16666666666666666);
	elseif (im <= -4.6e+33)
		tmp = re * sqrt((0.027777777777777776 * (im ^ 6.0)));
	else
		tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) - im);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, -5.5e+102], N[(N[Power[im, 3.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -4.6e+33], N[(re * N[Sqrt[N[(0.027777777777777776 * N[Power[im, 6.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq -4.6 \cdot 10^{+33}:\\
\;\;\;\;re \cdot \sqrt{0.027777777777777776 \cdot {im}^{6}}\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.49999999999999981e102 < im < -4.60000000000000021e33

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto re \cdot \sqrt{\color{blue}{0.027777777777777776} \cdot \left({im}^{3} \cdot {im}^{3}\right)} \]
      5. pow-prod-up69.0%

        \[\leadsto re \cdot \sqrt{0.027777777777777776 \cdot \color{blue}{{im}^{\left(3 + 3\right)}}} \]
      6. metadata-eval69.0%

        \[\leadsto re \cdot \sqrt{0.027777777777777776 \cdot {im}^{\color{blue}{6}}} \]
    10. Applied egg-rr69.0%

      \[\leadsto re \cdot \color{blue}{\sqrt{0.027777777777777776 \cdot {im}^{6}}} \]

    if -4.60000000000000021e33 < im

    1. Initial program 51.5%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -5.5 \cdot 10^{+102}:\\ \;\;\;\;{im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\ \mathbf{elif}\;im \leq -4.6 \cdot 10^{+33}:\\ \;\;\;\;re \cdot \sqrt{0.027777777777777776 \cdot {im}^{6}}\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\ \end{array} \]

Alternative 5: 78.4% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -3.5 \cdot 10^{+31}:\\ \;\;\;\;re \cdot \sqrt{0.027777777777777776 \cdot {im}^{6}}\\ \mathbf{elif}\;im \leq 4.8 \cdot 10^{-20}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im -3.5e+31)
   (* re (sqrt (* 0.027777777777777776 (pow im 6.0))))
   (if (<= im 4.8e-20)
     (* (- im) (sin re))
     (* re (- (* (pow im 3.0) -0.16666666666666666) im)))))
double code(double re, double im) {
	double tmp;
	if (im <= -3.5e+31) {
		tmp = re * sqrt((0.027777777777777776 * pow(im, 6.0)));
	} else if (im <= 4.8e-20) {
		tmp = -im * sin(re);
	} else {
		tmp = re * ((pow(im, 3.0) * -0.16666666666666666) - im);
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (im <= (-3.5d+31)) then
        tmp = re * sqrt((0.027777777777777776d0 * (im ** 6.0d0)))
    else if (im <= 4.8d-20) then
        tmp = -im * sin(re)
    else
        tmp = re * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= -3.5e+31) {
		tmp = re * Math.sqrt((0.027777777777777776 * Math.pow(im, 6.0)));
	} else if (im <= 4.8e-20) {
		tmp = -im * Math.sin(re);
	} else {
		tmp = re * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= -3.5e+31:
		tmp = re * math.sqrt((0.027777777777777776 * math.pow(im, 6.0)))
	elif im <= 4.8e-20:
		tmp = -im * math.sin(re)
	else:
		tmp = re * ((math.pow(im, 3.0) * -0.16666666666666666) - im)
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= -3.5e+31)
		tmp = Float64(re * sqrt(Float64(0.027777777777777776 * (im ^ 6.0))));
	elseif (im <= 4.8e-20)
		tmp = Float64(Float64(-im) * sin(re));
	else
		tmp = Float64(re * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= -3.5e+31)
		tmp = re * sqrt((0.027777777777777776 * (im ^ 6.0)));
	elseif (im <= 4.8e-20)
		tmp = -im * sin(re);
	else
		tmp = re * (((im ^ 3.0) * -0.16666666666666666) - im);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, -3.5e+31], N[(re * N[Sqrt[N[(0.027777777777777776 * N[Power[im, 6.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.8e-20], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], N[(re * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;im \leq -3.5 \cdot 10^{+31}:\\
\;\;\;\;re \cdot \sqrt{0.027777777777777776 \cdot {im}^{6}}\\

\mathbf{elif}\;im \leq 4.8 \cdot 10^{-20}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -3.5e31

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto re \cdot \sqrt{\color{blue}{0.027777777777777776} \cdot \left({im}^{3} \cdot {im}^{3}\right)} \]
      5. pow-prod-up74.0%

        \[\leadsto re \cdot \sqrt{0.027777777777777776 \cdot \color{blue}{{im}^{\left(3 + 3\right)}}} \]
      6. metadata-eval74.0%

        \[\leadsto re \cdot \sqrt{0.027777777777777776 \cdot {im}^{\color{blue}{6}}} \]
    10. Applied egg-rr74.0%

      \[\leadsto re \cdot \color{blue}{\sqrt{0.027777777777777776 \cdot {im}^{6}}} \]

    if -3.5e31 < im < 4.79999999999999986e-20

    1. Initial program 30.7%

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot im\right) \cdot \sin re} \]
      2. neg-mul-195.3%

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

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

    if 4.79999999999999986e-20 < im

    1. Initial program 98.3%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -3.5 \cdot 10^{+31}:\\ \;\;\;\;re \cdot \sqrt{0.027777777777777776 \cdot {im}^{6}}\\ \mathbf{elif}\;im \leq 4.8 \cdot 10^{-20}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\ \end{array} \]

Alternative 6: 76.3% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -6.1 \cdot 10^{+106}:\\ \;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\ \mathbf{elif}\;im \leq -510:\\ \;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\ \mathbf{elif}\;im \leq 4.8 \cdot 10^{-20}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im -6.1e+106)
   (* -0.16666666666666666 (* re (pow im 3.0)))
   (if (<= im -510.0)
     (* im (- (* 0.16666666666666666 (pow re 3.0)) re))
     (if (<= im 4.8e-20)
       (* (- im) (sin re))
       (* re (- (* (pow im 3.0) -0.16666666666666666) im))))))
double code(double re, double im) {
	double tmp;
	if (im <= -6.1e+106) {
		tmp = -0.16666666666666666 * (re * pow(im, 3.0));
	} else if (im <= -510.0) {
		tmp = im * ((0.16666666666666666 * pow(re, 3.0)) - re);
	} else if (im <= 4.8e-20) {
		tmp = -im * sin(re);
	} else {
		tmp = re * ((pow(im, 3.0) * -0.16666666666666666) - im);
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (im <= (-6.1d+106)) then
        tmp = (-0.16666666666666666d0) * (re * (im ** 3.0d0))
    else if (im <= (-510.0d0)) then
        tmp = im * ((0.16666666666666666d0 * (re ** 3.0d0)) - re)
    else if (im <= 4.8d-20) then
        tmp = -im * sin(re)
    else
        tmp = re * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= -6.1e+106) {
		tmp = -0.16666666666666666 * (re * Math.pow(im, 3.0));
	} else if (im <= -510.0) {
		tmp = im * ((0.16666666666666666 * Math.pow(re, 3.0)) - re);
	} else if (im <= 4.8e-20) {
		tmp = -im * Math.sin(re);
	} else {
		tmp = re * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= -6.1e+106:
		tmp = -0.16666666666666666 * (re * math.pow(im, 3.0))
	elif im <= -510.0:
		tmp = im * ((0.16666666666666666 * math.pow(re, 3.0)) - re)
	elif im <= 4.8e-20:
		tmp = -im * math.sin(re)
	else:
		tmp = re * ((math.pow(im, 3.0) * -0.16666666666666666) - im)
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= -6.1e+106)
		tmp = Float64(-0.16666666666666666 * Float64(re * (im ^ 3.0)));
	elseif (im <= -510.0)
		tmp = Float64(im * Float64(Float64(0.16666666666666666 * (re ^ 3.0)) - re));
	elseif (im <= 4.8e-20)
		tmp = Float64(Float64(-im) * sin(re));
	else
		tmp = Float64(re * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= -6.1e+106)
		tmp = -0.16666666666666666 * (re * (im ^ 3.0));
	elseif (im <= -510.0)
		tmp = im * ((0.16666666666666666 * (re ^ 3.0)) - re);
	elseif (im <= 4.8e-20)
		tmp = -im * sin(re);
	else
		tmp = re * (((im ^ 3.0) * -0.16666666666666666) - im);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, -6.1e+106], N[(-0.16666666666666666 * N[(re * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -510.0], N[(im * N[(N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.8e-20], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], N[(re * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;im \leq -6.1 \cdot 10^{+106}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\

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

\mathbf{elif}\;im \leq 4.8 \cdot 10^{-20}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < -6.10000000000000001e106

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if -6.10000000000000001e106 < im < -510

    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.2%

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

        \[\leadsto \color{blue}{\left(-1 \cdot im\right) \cdot \sin re} \]
      2. neg-mul-13.2%

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

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

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

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

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

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

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

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

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

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

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

    if -510 < im < 4.79999999999999986e-20

    1. Initial program 27.5%

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot im\right) \cdot \sin re} \]
      2. neg-mul-199.6%

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

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

    if 4.79999999999999986e-20 < im

    1. Initial program 98.3%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -6.1 \cdot 10^{+106}:\\ \;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\ \mathbf{elif}\;im \leq -510:\\ \;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\ \mathbf{elif}\;im \leq 4.8 \cdot 10^{-20}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\ \end{array} \]

Alternative 7: 76.4% accurate, 2.7× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -6.10000000000000001e106 or 5.2000000000000001e40 < 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 92.4%

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

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

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

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

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

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

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

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

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

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

    if -6.10000000000000001e106 < im < -2.5e11

    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.2%

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

        \[\leadsto \color{blue}{\left(-1 \cdot im\right) \cdot \sin re} \]
      2. neg-mul-13.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.5e11 < im < 5.2000000000000001e40

    1. Initial program 34.3%

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot im\right) \cdot \sin re} \]
      2. neg-mul-190.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -6.1 \cdot 10^{+106}:\\ \;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\ \mathbf{elif}\;im \leq -250000000000:\\ \;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3}\right)\\ \mathbf{elif}\;im \leq 5.2 \cdot 10^{+40}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \mathbf{else}:\\ \;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\ \end{array} \]

Alternative 8: 76.6% accurate, 2.7× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -6.10000000000000001e106 or 5.6000000000000003e40 < 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 92.4%

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

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

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

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

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

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

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

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

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

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

    if -6.10000000000000001e106 < im < -640

    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.2%

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

        \[\leadsto \color{blue}{\left(-1 \cdot im\right) \cdot \sin re} \]
      2. neg-mul-13.2%

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

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

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

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

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

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

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

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

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

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

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

    if -640 < im < 5.6000000000000003e40

    1. Initial program 33.9%

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot im\right) \cdot \sin re} \]
      2. neg-mul-191.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -6.1 \cdot 10^{+106}:\\ \;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\ \mathbf{elif}\;im \leq -640:\\ \;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\ \mathbf{elif}\;im \leq 5.6 \cdot 10^{+40}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \mathbf{else}:\\ \;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\ \end{array} \]

Alternative 9: 76.3% accurate, 2.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq -6.8 \cdot 10^{+30} \lor \neg \left(im \leq 3.9 \cdot 10^{+42}\right):\\
\;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < -6.8000000000000005e30 or 3.8999999999999997e42 < 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 77.0%

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

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

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

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

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

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

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

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

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

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

    if -6.8000000000000005e30 < im < 3.8999999999999997e42

    1. Initial program 36.5%

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot im\right) \cdot \sin re} \]
      2. neg-mul-187.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -6.8 \cdot 10^{+30} \lor \neg \left(im \leq 3.9 \cdot 10^{+42}\right):\\ \;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \end{array} \]

Alternative 10: 54.3% accurate, 2.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 3.4 \cdot 10^{+129}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\

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


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

    1. Initial program 57.8%

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot im\right) \cdot \sin re} \]
      2. neg-mul-159.6%

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

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

    if 3.40000000000000018e129 < 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 4.7%

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

        \[\leadsto \color{blue}{\left(-1 \cdot im\right) \cdot \sin re} \]
      2. neg-mul-14.7%

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

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot im\right) \cdot re} \]
      2. neg-mul-121.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 3.4 \cdot 10^{+129}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \mathbf{else}:\\ \;\;\;\;\left(-im\right) \cdot re\\ \end{array} \]

Alternative 11: 33.1% 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 63.1%

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

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

      \[\leadsto \color{blue}{\left(-1 \cdot im\right) \cdot \sin re} \]
    2. neg-mul-152.7%

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

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

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

      \[\leadsto \color{blue}{\left(-1 \cdot im\right) \cdot re} \]
    2. neg-mul-132.1%

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

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

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

Alternative 12: 2.7% accurate, 308.0× speedup?

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

\\
-3
\end{array}
Derivation
  1. Initial program 63.1%

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

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

      \[\leadsto \color{blue}{\left(-1 \cdot im\right) \cdot \sin re} \]
    2. neg-mul-152.7%

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

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

    \[\leadsto \color{blue}{-3} \]
  6. Final simplification2.9%

    \[\leadsto -3 \]

Alternative 13: 2.8% accurate, 308.0× speedup?

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

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

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

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

      \[\leadsto \color{blue}{\left(-1 \cdot im\right) \cdot \sin re} \]
    2. neg-mul-152.7%

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

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

    \[\leadsto \color{blue}{-9.92290301275212 \cdot 10^{-8}} \]
  6. Final simplification2.9%

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

Alternative 14: 14.7% accurate, 308.0× speedup?

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

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

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

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

      \[\leadsto \color{blue}{\left(-1 \cdot im\right) \cdot \sin re} \]
    2. neg-mul-152.7%

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

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

    \[\leadsto \color{blue}{0} \]
  6. Final simplification13.5%

    \[\leadsto 0 \]

Developer target: 99.8% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}

Reproduce

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