math.cos on complex, imaginary part

Percentage Accurate: 66.6% → 99.5%
Time: 8.2s
Alternatives: 13
Speedup: 2.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

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

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

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

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


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

    1. Initial program 100.0%

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

    if -inf.0 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 2.0000000000000001e-4

    1. Initial program 36.1%

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

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

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

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

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

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

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

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

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

Alternative 2: 94.6% 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.035:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 3000000000:\\ \;\;\;\;\sin re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\ \mathbf{elif}\;im \leq 5.6 \cdot 10^{+102}:\\ \;\;\;\;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.035)
       t_0
       (if (<= im 3000000000.0)
         (* (sin re) (- (* -0.16666666666666666 (pow im 3.0)) im))
         (if (<= im 5.6e+102) 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.035) {
		tmp = t_0;
	} else if (im <= 3000000000.0) {
		tmp = sin(re) * ((-0.16666666666666666 * pow(im, 3.0)) - im);
	} else if (im <= 5.6e+102) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (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.035d0)) then
        tmp = t_0
    else if (im <= 3000000000.0d0) then
        tmp = sin(re) * (((-0.16666666666666666d0) * (im ** 3.0d0)) - im)
    else if (im <= 5.6d+102) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = (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.035) {
		tmp = t_0;
	} else if (im <= 3000000000.0) {
		tmp = Math.sin(re) * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im);
	} else if (im <= 5.6e+102) {
		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.035:
		tmp = t_0
	elif im <= 3000000000.0:
		tmp = math.sin(re) * ((-0.16666666666666666 * math.pow(im, 3.0)) - im)
	elif im <= 5.6e+102:
		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.035)
		tmp = t_0;
	elseif (im <= 3000000000.0)
		tmp = Float64(sin(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im));
	elseif (im <= 5.6e+102)
		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.035)
		tmp = t_0;
	elseif (im <= 3000000000.0)
		tmp = sin(re) * ((-0.16666666666666666 * (im ^ 3.0)) - im);
	elseif (im <= 5.6e+102)
		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.035], t$95$0, If[LessEqual[im, 3000000000.0], N[(N[Sin[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5.6e+102], 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.035:\\
\;\;\;\;t_0\\

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sin re \cdot \left(\left(-im\right) + {im}^{3} \cdot -0.16666666666666666\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 < -0.035000000000000003 or 3e9 < im < 5.60000000000000037e102

    1. Initial program 100.0%

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

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

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

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

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

    if -0.035000000000000003 < im < 3e9

    1. Initial program 36.6%

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

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

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

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

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

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

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

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

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

    \[\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.035:\\ \;\;\;\;\left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{elif}\;im \leq 3000000000:\\ \;\;\;\;\sin re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\ \mathbf{elif}\;im \leq 5.6 \cdot 10^{+102}:\\ \;\;\;\;\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: 85.2% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\ t_1 := {im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\ \mathbf{if}\;im \leq -3.8 \cdot 10^{+88}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq -2.1 \cdot 10^{+27}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 180000:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \mathbf{elif}\;im \leq 3.3 \cdot 10^{+99}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* im (- (* 0.16666666666666666 (pow re 3.0)) re)))
        (t_1 (* (pow im 3.0) (* (sin re) -0.16666666666666666))))
   (if (<= im -3.8e+88)
     t_1
     (if (<= im -2.1e+27)
       t_0
       (if (<= im 180000.0)
         (* (- im) (sin re))
         (if (<= im 3.3e+99) t_0 t_1))))))
double code(double re, double im) {
	double t_0 = im * ((0.16666666666666666 * pow(re, 3.0)) - re);
	double t_1 = pow(im, 3.0) * (sin(re) * -0.16666666666666666);
	double tmp;
	if (im <= -3.8e+88) {
		tmp = t_1;
	} else if (im <= -2.1e+27) {
		tmp = t_0;
	} else if (im <= 180000.0) {
		tmp = -im * sin(re);
	} else if (im <= 3.3e+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 = im * ((0.16666666666666666d0 * (re ** 3.0d0)) - re)
    t_1 = (im ** 3.0d0) * (sin(re) * (-0.16666666666666666d0))
    if (im <= (-3.8d+88)) then
        tmp = t_1
    else if (im <= (-2.1d+27)) then
        tmp = t_0
    else if (im <= 180000.0d0) then
        tmp = -im * sin(re)
    else if (im <= 3.3d+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 = im * ((0.16666666666666666 * Math.pow(re, 3.0)) - re);
	double t_1 = Math.pow(im, 3.0) * (Math.sin(re) * -0.16666666666666666);
	double tmp;
	if (im <= -3.8e+88) {
		tmp = t_1;
	} else if (im <= -2.1e+27) {
		tmp = t_0;
	} else if (im <= 180000.0) {
		tmp = -im * Math.sin(re);
	} else if (im <= 3.3e+99) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(re, im):
	t_0 = im * ((0.16666666666666666 * math.pow(re, 3.0)) - re)
	t_1 = math.pow(im, 3.0) * (math.sin(re) * -0.16666666666666666)
	tmp = 0
	if im <= -3.8e+88:
		tmp = t_1
	elif im <= -2.1e+27:
		tmp = t_0
	elif im <= 180000.0:
		tmp = -im * math.sin(re)
	elif im <= 3.3e+99:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(re, im)
	t_0 = Float64(im * Float64(Float64(0.16666666666666666 * (re ^ 3.0)) - re))
	t_1 = Float64((im ^ 3.0) * Float64(sin(re) * -0.16666666666666666))
	tmp = 0.0
	if (im <= -3.8e+88)
		tmp = t_1;
	elseif (im <= -2.1e+27)
		tmp = t_0;
	elseif (im <= 180000.0)
		tmp = Float64(Float64(-im) * sin(re));
	elseif (im <= 3.3e+99)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = im * ((0.16666666666666666 * (re ^ 3.0)) - re);
	t_1 = (im ^ 3.0) * (sin(re) * -0.16666666666666666);
	tmp = 0.0;
	if (im <= -3.8e+88)
		tmp = t_1;
	elseif (im <= -2.1e+27)
		tmp = t_0;
	elseif (im <= 180000.0)
		tmp = -im * sin(re);
	elseif (im <= 3.3e+99)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[im, 3.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.8e+88], t$95$1, If[LessEqual[im, -2.1e+27], t$95$0, If[LessEqual[im, 180000.0], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.3e+99], t$95$0, t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq -2.1 \cdot 10^{+27}:\\
\;\;\;\;t_0\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -3.7999999999999997e88 or 3.2999999999999999e99 < 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 97.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. associate-*r*97.0%

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

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

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

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

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

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

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

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

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

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

    if -3.7999999999999997e88 < im < -2.09999999999999995e27 or 1.8e5 < im < 3.2999999999999999e99

    1. Initial program 100.0%

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

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

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

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

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

      \[\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. +-commutative26.9%

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

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

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

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

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

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

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

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

    if -2.09999999999999995e27 < im < 1.8e5

    1. Initial program 40.5%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -3.8 \cdot 10^{+88}:\\ \;\;\;\;{im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\ \mathbf{elif}\;im \leq -2.1 \cdot 10^{+27}:\\ \;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\ \mathbf{elif}\;im \leq 180000:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \mathbf{elif}\;im \leq 3.3 \cdot 10^{+99}:\\ \;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\ \mathbf{else}:\\ \;\;\;\;{im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\ \end{array} \]

Alternative 4: 83.4% accurate, 1.5× speedup?

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

\\
\sin re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)
\end{array}
Derivation
  1. Initial program 69.8%

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

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

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

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

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

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

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

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

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

Alternative 5: 76.4% accurate, 2.6× speedup?

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

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

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

\mathbf{elif}\;im \leq -5.8 \cdot 10^{-5} \lor \neg \left(im \leq 3.5 \cdot 10^{+68}\right):\\
\;\;\;\;re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\

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


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

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

      \[\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. associate-*r*95.7%

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

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

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

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

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

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

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

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

    if -9.1999999999999995e81 < im < -8.9999999999999998e27

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.9999999999999998e27 < im < -5.8e-5 or 3.49999999999999977e68 < im

    1. Initial program 99.7%

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

      \[\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. associate-*r*76.2%

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

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

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

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

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

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

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

    if -5.8e-5 < im < 3.49999999999999977e68

    1. Initial program 42.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -9.2 \cdot 10^{+81}:\\ \;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\ \mathbf{elif}\;im \leq -9 \cdot 10^{+27}:\\ \;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\ \mathbf{elif}\;im \leq -5.8 \cdot 10^{-5} \lor \neg \left(im \leq 3.5 \cdot 10^{+68}\right):\\ \;\;\;\;re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \end{array} \]

Alternative 6: 76.3% 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 -3.8 \cdot 10^{+83}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -1.14 \cdot 10^{+33}:\\ \;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3}\right)\\ \mathbf{elif}\;im \leq -55 \lor \neg \left(im \leq 3.5 \cdot 10^{+68}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* -0.16666666666666666 (* re (pow im 3.0)))))
   (if (<= im -3.8e+83)
     t_0
     (if (<= im -1.14e+33)
       (* im (* 0.16666666666666666 (pow re 3.0)))
       (if (or (<= im -55.0) (not (<= im 3.5e+68)))
         t_0
         (* (- im) (sin re)))))))
double code(double re, double im) {
	double t_0 = -0.16666666666666666 * (re * pow(im, 3.0));
	double tmp;
	if (im <= -3.8e+83) {
		tmp = t_0;
	} else if (im <= -1.14e+33) {
		tmp = im * (0.16666666666666666 * pow(re, 3.0));
	} else if ((im <= -55.0) || !(im <= 3.5e+68)) {
		tmp = t_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) :: t_0
    real(8) :: tmp
    t_0 = (-0.16666666666666666d0) * (re * (im ** 3.0d0))
    if (im <= (-3.8d+83)) then
        tmp = t_0
    else if (im <= (-1.14d+33)) then
        tmp = im * (0.16666666666666666d0 * (re ** 3.0d0))
    else if ((im <= (-55.0d0)) .or. (.not. (im <= 3.5d+68))) then
        tmp = t_0
    else
        tmp = -im * sin(re)
    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 <= -3.8e+83) {
		tmp = t_0;
	} else if (im <= -1.14e+33) {
		tmp = im * (0.16666666666666666 * Math.pow(re, 3.0));
	} else if ((im <= -55.0) || !(im <= 3.5e+68)) {
		tmp = t_0;
	} else {
		tmp = -im * Math.sin(re);
	}
	return tmp;
}
def code(re, im):
	t_0 = -0.16666666666666666 * (re * math.pow(im, 3.0))
	tmp = 0
	if im <= -3.8e+83:
		tmp = t_0
	elif im <= -1.14e+33:
		tmp = im * (0.16666666666666666 * math.pow(re, 3.0))
	elif (im <= -55.0) or not (im <= 3.5e+68):
		tmp = t_0
	else:
		tmp = -im * math.sin(re)
	return tmp
function code(re, im)
	t_0 = Float64(-0.16666666666666666 * Float64(re * (im ^ 3.0)))
	tmp = 0.0
	if (im <= -3.8e+83)
		tmp = t_0;
	elseif (im <= -1.14e+33)
		tmp = Float64(im * Float64(0.16666666666666666 * (re ^ 3.0)));
	elseif ((im <= -55.0) || !(im <= 3.5e+68))
		tmp = t_0;
	else
		tmp = Float64(Float64(-im) * sin(re));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = -0.16666666666666666 * (re * (im ^ 3.0));
	tmp = 0.0;
	if (im <= -3.8e+83)
		tmp = t_0;
	elseif (im <= -1.14e+33)
		tmp = im * (0.16666666666666666 * (re ^ 3.0));
	elseif ((im <= -55.0) || ~((im <= 3.5e+68)))
		tmp = t_0;
	else
		tmp = -im * sin(re);
	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, -3.8e+83], t$95$0, If[LessEqual[im, -1.14e+33], N[(im * N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, -55.0], N[Not[LessEqual[im, 3.5e+68]], $MachinePrecision]], t$95$0, N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;im \leq -55 \lor \neg \left(im \leq 3.5 \cdot 10^{+68}\right):\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -3.8000000000000002e83 or -1.14e33 < im < -55 or 3.49999999999999977e68 < 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 83.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. associate-*r*83.9%

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

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

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

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

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

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

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

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

    if -3.8000000000000002e83 < im < -1.14e33

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -55 < im < 3.49999999999999977e68

    1. Initial program 42.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -3.8 \cdot 10^{+83}:\\ \;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\ \mathbf{elif}\;im \leq -1.14 \cdot 10^{+33}:\\ \;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3}\right)\\ \mathbf{elif}\;im \leq -55 \lor \neg \left(im \leq 3.5 \cdot 10^{+68}\right):\\ \;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \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 -1.55 \cdot 10^{+83}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -3.5 \cdot 10^{+30}:\\ \;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\ \mathbf{elif}\;im \leq -55 \lor \neg \left(im \leq 3.5 \cdot 10^{+68}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* -0.16666666666666666 (* re (pow im 3.0)))))
   (if (<= im -1.55e+83)
     t_0
     (if (<= im -3.5e+30)
       (* im (- (* 0.16666666666666666 (pow re 3.0)) re))
       (if (or (<= im -55.0) (not (<= im 3.5e+68)))
         t_0
         (* (- im) (sin re)))))))
double code(double re, double im) {
	double t_0 = -0.16666666666666666 * (re * pow(im, 3.0));
	double tmp;
	if (im <= -1.55e+83) {
		tmp = t_0;
	} else if (im <= -3.5e+30) {
		tmp = im * ((0.16666666666666666 * pow(re, 3.0)) - re);
	} else if ((im <= -55.0) || !(im <= 3.5e+68)) {
		tmp = t_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) :: t_0
    real(8) :: tmp
    t_0 = (-0.16666666666666666d0) * (re * (im ** 3.0d0))
    if (im <= (-1.55d+83)) then
        tmp = t_0
    else if (im <= (-3.5d+30)) then
        tmp = im * ((0.16666666666666666d0 * (re ** 3.0d0)) - re)
    else if ((im <= (-55.0d0)) .or. (.not. (im <= 3.5d+68))) then
        tmp = t_0
    else
        tmp = -im * sin(re)
    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 <= -1.55e+83) {
		tmp = t_0;
	} else if (im <= -3.5e+30) {
		tmp = im * ((0.16666666666666666 * Math.pow(re, 3.0)) - re);
	} else if ((im <= -55.0) || !(im <= 3.5e+68)) {
		tmp = t_0;
	} else {
		tmp = -im * Math.sin(re);
	}
	return tmp;
}
def code(re, im):
	t_0 = -0.16666666666666666 * (re * math.pow(im, 3.0))
	tmp = 0
	if im <= -1.55e+83:
		tmp = t_0
	elif im <= -3.5e+30:
		tmp = im * ((0.16666666666666666 * math.pow(re, 3.0)) - re)
	elif (im <= -55.0) or not (im <= 3.5e+68):
		tmp = t_0
	else:
		tmp = -im * math.sin(re)
	return tmp
function code(re, im)
	t_0 = Float64(-0.16666666666666666 * Float64(re * (im ^ 3.0)))
	tmp = 0.0
	if (im <= -1.55e+83)
		tmp = t_0;
	elseif (im <= -3.5e+30)
		tmp = Float64(im * Float64(Float64(0.16666666666666666 * (re ^ 3.0)) - re));
	elseif ((im <= -55.0) || !(im <= 3.5e+68))
		tmp = t_0;
	else
		tmp = Float64(Float64(-im) * sin(re));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = -0.16666666666666666 * (re * (im ^ 3.0));
	tmp = 0.0;
	if (im <= -1.55e+83)
		tmp = t_0;
	elseif (im <= -3.5e+30)
		tmp = im * ((0.16666666666666666 * (re ^ 3.0)) - re);
	elseif ((im <= -55.0) || ~((im <= 3.5e+68)))
		tmp = t_0;
	else
		tmp = -im * sin(re);
	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, -1.55e+83], t$95$0, If[LessEqual[im, -3.5e+30], N[(im * N[(N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, -55.0], N[Not[LessEqual[im, 3.5e+68]], $MachinePrecision]], t$95$0, N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;im \leq -55 \lor \neg \left(im \leq 3.5 \cdot 10^{+68}\right):\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -1.54999999999999996e83 or -3.50000000000000021e30 < im < -55 or 3.49999999999999977e68 < 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 83.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. associate-*r*83.9%

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

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

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

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

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

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

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

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

    if -1.54999999999999996e83 < im < -3.50000000000000021e30

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -55 < im < 3.49999999999999977e68

    1. Initial program 42.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1.55 \cdot 10^{+83}:\\ \;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\ \mathbf{elif}\;im \leq -3.5 \cdot 10^{+30}:\\ \;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\ \mathbf{elif}\;im \leq -55 \lor \neg \left(im \leq 3.5 \cdot 10^{+68}\right):\\ \;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \end{array} \]

Alternative 8: 76.3% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -55 \lor \neg \left(im \leq 3.5 \cdot 10^{+68}\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 -55.0) (not (<= im 3.5e+68)))
   (* -0.16666666666666666 (* re (pow im 3.0)))
   (* (- im) (sin re))))
double code(double re, double im) {
	double tmp;
	if ((im <= -55.0) || !(im <= 3.5e+68)) {
		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 <= (-55.0d0)) .or. (.not. (im <= 3.5d+68))) 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 <= -55.0) || !(im <= 3.5e+68)) {
		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 <= -55.0) or not (im <= 3.5e+68):
		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 <= -55.0) || !(im <= 3.5e+68))
		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 <= -55.0) || ~((im <= 3.5e+68)))
		tmp = -0.16666666666666666 * (re * (im ^ 3.0));
	else
		tmp = -im * sin(re);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[Or[LessEqual[im, -55.0], N[Not[LessEqual[im, 3.5e+68]], $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 -55 \lor \neg \left(im \leq 3.5 \cdot 10^{+68}\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 < -55 or 3.49999999999999977e68 < 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 74.1%

      \[\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. associate-*r*74.1%

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

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

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

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

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

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

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

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

    if -55 < im < 3.49999999999999977e68

    1. Initial program 42.7%

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

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

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

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

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

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

Alternative 9: 53.3% accurate, 2.9× speedup?

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

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

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


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

    1. Initial program 62.1%

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

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

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

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

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

    if 9.50000000000000061e75 < 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.8%

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

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

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

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

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

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

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

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

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

Alternative 10: 32.4% accurate, 77.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto -3 \]

Alternative 12: 2.7% accurate, 308.0× speedup?

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

\\
-0.004629629629629629
\end{array}
Derivation
  1. Initial program 69.8%

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

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

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

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

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

    \[\leadsto \color{blue}{-0.004629629629629629} \]
  6. Final simplification2.7%

    \[\leadsto -0.004629629629629629 \]

Alternative 13: 14.8% accurate, 308.0× speedup?

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

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

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

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

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

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

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

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

    \[\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 2023308 
(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))))