math.sin on complex, imaginary part

Percentage Accurate: 53.9% → 99.8%
Time: 12.8s
Alternatives: 18
Speedup: 2.9×

Specification

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

\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - 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 18 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: 53.9% accurate, 1.0× speedup?

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

\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - 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 -10 \lor \neg \left(t_0 \leq 0.0002\right):\\ \;\;\;\;\left(\cos re \cdot 0.5\right) \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;\cos re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 + {im}^{7} \cdot -0.0001984126984126984\right) + \left({im}^{3} \cdot -0.16666666666666666 - im\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (- (exp (- im)) (exp im))))
   (if (or (<= t_0 -10.0) (not (<= t_0 0.0002)))
     (* (* (cos re) 0.5) t_0)
     (*
      (cos re)
      (+
       (+
        (* (pow im 5.0) -0.008333333333333333)
        (* (pow im 7.0) -0.0001984126984126984))
       (- (* (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 <= -10.0) || !(t_0 <= 0.0002)) {
		tmp = (cos(re) * 0.5) * t_0;
	} else {
		tmp = cos(re) * (((pow(im, 5.0) * -0.008333333333333333) + (pow(im, 7.0) * -0.0001984126984126984)) + ((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 <= (-10.0d0)) .or. (.not. (t_0 <= 0.0002d0))) then
        tmp = (cos(re) * 0.5d0) * t_0
    else
        tmp = cos(re) * ((((im ** 5.0d0) * (-0.008333333333333333d0)) + ((im ** 7.0d0) * (-0.0001984126984126984d0))) + (((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 <= -10.0) || !(t_0 <= 0.0002)) {
		tmp = (Math.cos(re) * 0.5) * t_0;
	} else {
		tmp = Math.cos(re) * (((Math.pow(im, 5.0) * -0.008333333333333333) + (Math.pow(im, 7.0) * -0.0001984126984126984)) + ((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 <= -10.0) or not (t_0 <= 0.0002):
		tmp = (math.cos(re) * 0.5) * t_0
	else:
		tmp = math.cos(re) * (((math.pow(im, 5.0) * -0.008333333333333333) + (math.pow(im, 7.0) * -0.0001984126984126984)) + ((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 <= -10.0) || !(t_0 <= 0.0002))
		tmp = Float64(Float64(cos(re) * 0.5) * t_0);
	else
		tmp = Float64(cos(re) * Float64(Float64(Float64((im ^ 5.0) * -0.008333333333333333) + Float64((im ^ 7.0) * -0.0001984126984126984)) + 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 <= -10.0) || ~((t_0 <= 0.0002)))
		tmp = (cos(re) * 0.5) * t_0;
	else
		tmp = cos(re) * ((((im ^ 5.0) * -0.008333333333333333) + ((im ^ 7.0) * -0.0001984126984126984)) + (((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, -10.0], N[Not[LessEqual[t$95$0, 0.0002]], $MachinePrecision]], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision] + N[(N[Power[im, 7.0], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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


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

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg100.0%

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

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

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

    1. Initial program 8.7%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg8.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos re \cdot \left({im}^{5} \cdot -0.008333333333333333 + {im}^{7} \cdot -0.0001984126984126984\right) + \left(\color{blue}{\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666\right)} - \cos re \cdot im\right) \]
      12. distribute-lft-out--99.8%

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

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

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

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

Alternative 2: 99.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-im} - e^{im}\\ \mathbf{if}\;t_0 \leq -0.05 \lor \neg \left(t_0 \leq 0.0002\right):\\ \;\;\;\;\left(\cos re \cdot 0.5\right) \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;\cos 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.05) (not (<= t_0 0.0002)))
     (* (* (cos re) 0.5) t_0)
     (* (cos 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.05) || !(t_0 <= 0.0002)) {
		tmp = (cos(re) * 0.5) * t_0;
	} else {
		tmp = cos(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.05d0)) .or. (.not. (t_0 <= 0.0002d0))) then
        tmp = (cos(re) * 0.5d0) * t_0
    else
        tmp = cos(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.05) || !(t_0 <= 0.0002)) {
		tmp = (Math.cos(re) * 0.5) * t_0;
	} else {
		tmp = Math.cos(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.05) or not (t_0 <= 0.0002):
		tmp = (math.cos(re) * 0.5) * t_0
	else:
		tmp = math.cos(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.05) || !(t_0 <= 0.0002))
		tmp = Float64(Float64(cos(re) * 0.5) * t_0);
	else
		tmp = Float64(cos(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.05) || ~((t_0 <= 0.0002)))
		tmp = (cos(re) * 0.5) * t_0;
	else
		tmp = cos(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.05], N[Not[LessEqual[t$95$0, 0.0002]], $MachinePrecision]], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[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.05 \lor \neg \left(t_0 \leq 0.0002\right):\\
\;\;\;\;\left(\cos re \cdot 0.5\right) \cdot t_0\\

\mathbf{else}:\\
\;\;\;\;\cos 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 (-.f64 0 im)) (exp.f64 im)) < -0.050000000000000003 or 2.0000000000000001e-4 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im))

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg100.0%

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

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

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

    1. Initial program 8.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg8.0%

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

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

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

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

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

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

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

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

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

Alternative 3: 99.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \cos re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 + {im}^{7} \cdot -0.0001984126984126984\right) + \left(\log \left(1 + \mathsf{expm1}\left({im}^{3} \cdot -0.16666666666666666\right)\right) - im\right)\right) \end{array} \]
(FPCore (re im)
 :precision binary64
 (*
  (cos re)
  (+
   (+
    (* (pow im 5.0) -0.008333333333333333)
    (* (pow im 7.0) -0.0001984126984126984))
   (- (log (+ 1.0 (expm1 (* (pow im 3.0) -0.16666666666666666)))) im))))
double code(double re, double im) {
	return cos(re) * (((pow(im, 5.0) * -0.008333333333333333) + (pow(im, 7.0) * -0.0001984126984126984)) + (log((1.0 + expm1((pow(im, 3.0) * -0.16666666666666666)))) - im));
}
public static double code(double re, double im) {
	return Math.cos(re) * (((Math.pow(im, 5.0) * -0.008333333333333333) + (Math.pow(im, 7.0) * -0.0001984126984126984)) + (Math.log((1.0 + Math.expm1((Math.pow(im, 3.0) * -0.16666666666666666)))) - im));
}
def code(re, im):
	return math.cos(re) * (((math.pow(im, 5.0) * -0.008333333333333333) + (math.pow(im, 7.0) * -0.0001984126984126984)) + (math.log((1.0 + math.expm1((math.pow(im, 3.0) * -0.16666666666666666)))) - im))
function code(re, im)
	return Float64(cos(re) * Float64(Float64(Float64((im ^ 5.0) * -0.008333333333333333) + Float64((im ^ 7.0) * -0.0001984126984126984)) + Float64(log(Float64(1.0 + expm1(Float64((im ^ 3.0) * -0.16666666666666666)))) - im)))
end
code[re_, im_] := N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision] + N[(N[Power[im, 7.0], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision] + N[(N[Log[N[(1.0 + N[(Exp[N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\cos re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 + {im}^{7} \cdot -0.0001984126984126984\right) + \left(\log \left(1 + \mathsf{expm1}\left({im}^{3} \cdot -0.16666666666666666\right)\right) - im\right)\right)
\end{array}
Derivation
  1. Initial program 49.3%

    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
  2. Step-by-step derivation
    1. sub0-neg49.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \cos re \cdot \left({im}^{5} \cdot -0.008333333333333333 + {im}^{7} \cdot -0.0001984126984126984\right) + \left(\color{blue}{\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666\right)} - \cos re \cdot im\right) \]
    12. distribute-lft-out--90.8%

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

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

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

      \[\leadsto \cos re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 + {im}^{7} \cdot -0.0001984126984126984\right) + \left(\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left({im}^{3} \cdot -0.16666666666666666\right)\right)} - im\right)\right) \]
    2. log1p-udef99.0%

      \[\leadsto \cos re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 + {im}^{7} \cdot -0.0001984126984126984\right) + \left(\color{blue}{\log \left(1 + \mathsf{expm1}\left({im}^{3} \cdot -0.16666666666666666\right)\right)} - im\right)\right) \]
  8. Applied egg-rr99.0%

    \[\leadsto \cos re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 + {im}^{7} \cdot -0.0001984126984126984\right) + \left(\color{blue}{\log \left(1 + \mathsf{expm1}\left({im}^{3} \cdot -0.16666666666666666\right)\right)} - im\right)\right) \]
  9. Final simplification99.0%

    \[\leadsto \cos re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 + {im}^{7} \cdot -0.0001984126984126984\right) + \left(\log \left(1 + \mathsf{expm1}\left({im}^{3} \cdot -0.16666666666666666\right)\right) - im\right)\right) \]

Alternative 4: 97.8% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-im} - e^{im}\\ t_1 := -0.0001984126984126984 \cdot \left(\cos re \cdot {im}^{7}\right)\\ \mathbf{if}\;im \leq -4.1 \cdot 10^{+46}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq -0.054:\\ \;\;\;\;t_0 \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\ \mathbf{elif}\;im \leq 0.04:\\ \;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\ \mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\ \;\;\;\;0.5 \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (- (exp (- im)) (exp im)))
        (t_1 (* -0.0001984126984126984 (* (cos re) (pow im 7.0)))))
   (if (<= im -4.1e+46)
     t_1
     (if (<= im -0.054)
       (* t_0 (+ 0.5 (* re (* re -0.25))))
       (if (<= im 0.04)
         (* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im))
         (if (<= im 1.1e+44) (* 0.5 t_0) t_1))))))
double code(double re, double im) {
	double t_0 = exp(-im) - exp(im);
	double t_1 = -0.0001984126984126984 * (cos(re) * pow(im, 7.0));
	double tmp;
	if (im <= -4.1e+46) {
		tmp = t_1;
	} else if (im <= -0.054) {
		tmp = t_0 * (0.5 + (re * (re * -0.25)));
	} else if (im <= 0.04) {
		tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
	} else if (im <= 1.1e+44) {
		tmp = 0.5 * 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)
    t_1 = (-0.0001984126984126984d0) * (cos(re) * (im ** 7.0d0))
    if (im <= (-4.1d+46)) then
        tmp = t_1
    else if (im <= (-0.054d0)) then
        tmp = t_0 * (0.5d0 + (re * (re * (-0.25d0))))
    else if (im <= 0.04d0) then
        tmp = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
    else if (im <= 1.1d+44) then
        tmp = 0.5d0 * 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);
	double t_1 = -0.0001984126984126984 * (Math.cos(re) * Math.pow(im, 7.0));
	double tmp;
	if (im <= -4.1e+46) {
		tmp = t_1;
	} else if (im <= -0.054) {
		tmp = t_0 * (0.5 + (re * (re * -0.25)));
	} else if (im <= 0.04) {
		tmp = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
	} else if (im <= 1.1e+44) {
		tmp = 0.5 * t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(re, im):
	t_0 = math.exp(-im) - math.exp(im)
	t_1 = -0.0001984126984126984 * (math.cos(re) * math.pow(im, 7.0))
	tmp = 0
	if im <= -4.1e+46:
		tmp = t_1
	elif im <= -0.054:
		tmp = t_0 * (0.5 + (re * (re * -0.25)))
	elif im <= 0.04:
		tmp = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im)
	elif im <= 1.1e+44:
		tmp = 0.5 * t_0
	else:
		tmp = t_1
	return tmp
function code(re, im)
	t_0 = Float64(exp(Float64(-im)) - exp(im))
	t_1 = Float64(-0.0001984126984126984 * Float64(cos(re) * (im ^ 7.0)))
	tmp = 0.0
	if (im <= -4.1e+46)
		tmp = t_1;
	elseif (im <= -0.054)
		tmp = Float64(t_0 * Float64(0.5 + Float64(re * Float64(re * -0.25))));
	elseif (im <= 0.04)
		tmp = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im));
	elseif (im <= 1.1e+44)
		tmp = Float64(0.5 * t_0);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = exp(-im) - exp(im);
	t_1 = -0.0001984126984126984 * (cos(re) * (im ^ 7.0));
	tmp = 0.0;
	if (im <= -4.1e+46)
		tmp = t_1;
	elseif (im <= -0.054)
		tmp = t_0 * (0.5 + (re * (re * -0.25)));
	elseif (im <= 0.04)
		tmp = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im);
	elseif (im <= 1.1e+44)
		tmp = 0.5 * t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.0001984126984126984 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -4.1e+46], t$95$1, If[LessEqual[im, -0.054], N[(t$95$0 * N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 0.04], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+44], N[(0.5 * t$95$0), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
t_1 := -0.0001984126984126984 \cdot \left(\cos re \cdot {im}^{7}\right)\\
\mathbf{if}\;im \leq -4.1 \cdot 10^{+46}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq -0.054:\\
\;\;\;\;t_0 \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\

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

\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;0.5 \cdot t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < -4.1e46 or 1.09999999999999998e44 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos re \cdot \left({im}^{5} \cdot -0.008333333333333333 + {im}^{7} \cdot -0.0001984126984126984\right) + \left(-0.16666666666666666 \cdot \left(\cos re \cdot {im}^{3}\right) + \color{blue}{\left(-\cos re \cdot im\right)}\right) \]
      9. unsub-neg100.0%

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

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

        \[\leadsto \cos re \cdot \left({im}^{5} \cdot -0.008333333333333333 + {im}^{7} \cdot -0.0001984126984126984\right) + \left(\color{blue}{\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666\right)} - \cos re \cdot im\right) \]
      12. distribute-lft-out--100.0%

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

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

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

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

        \[\leadsto -0.0001984126984126984 \cdot \color{blue}{\left({im}^{7} \cdot \cos re\right)} \]
    9. Simplified100.0%

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

    if -4.1e46 < im < -0.0539999999999999994

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg100.0%

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left(e^{-im} - e^{im}\right) + \color{blue}{\left(-0.25 \cdot {re}^{2}\right) \cdot \left(e^{-im} - e^{im}\right)} \]
      4. distribute-rgt-out86.7%

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

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

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

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

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

    if -0.0539999999999999994 < im < 0.0400000000000000008

    1. Initial program 8.7%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg8.7%

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

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

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

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

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

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

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

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

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

    if 0.0400000000000000008 < im < 1.09999999999999998e44

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -4.1 \cdot 10^{+46}:\\ \;\;\;\;-0.0001984126984126984 \cdot \left(\cos re \cdot {im}^{7}\right)\\ \mathbf{elif}\;im \leq -0.054:\\ \;\;\;\;\left(e^{-im} - e^{im}\right) \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\ \mathbf{elif}\;im \leq 0.04:\\ \;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\ \mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\ \;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;-0.0001984126984126984 \cdot \left(\cos re \cdot {im}^{7}\right)\\ \end{array} \]

Alternative 5: 97.6% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
t_1 := -0.0001984126984126984 \cdot \left(\cos re \cdot {im}^{7}\right)\\
\mathbf{if}\;im \leq -1.1 \cdot 10^{+44}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq -2 \cdot 10^{-5}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos re \cdot \left({im}^{5} \cdot -0.008333333333333333 + {im}^{7} \cdot -0.0001984126984126984\right) + \left(-0.16666666666666666 \cdot \left(\cos re \cdot {im}^{3}\right) + \color{blue}{\left(-\cos re \cdot im\right)}\right) \]
      9. unsub-neg100.0%

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

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

        \[\leadsto \cos re \cdot \left({im}^{5} \cdot -0.008333333333333333 + {im}^{7} \cdot -0.0001984126984126984\right) + \left(\color{blue}{\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666\right)} - \cos re \cdot im\right) \]
      12. distribute-lft-out--100.0%

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

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

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

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

        \[\leadsto -0.0001984126984126984 \cdot \color{blue}{\left({im}^{7} \cdot \cos re\right)} \]
    9. Simplified100.0%

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

    if -1.09999999999999998e44 < im < -2.00000000000000016e-5 or 0.033000000000000002 < im < 1.09999999999999998e44

    1. Initial program 98.6%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg98.6%

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

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

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

    if -2.00000000000000016e-5 < im < 0.033000000000000002

    1. Initial program 7.6%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg7.6%

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

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

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

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

        \[\leadsto -\color{blue}{im \cdot \cos re} \]
      3. distribute-lft-neg-in99.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1.1 \cdot 10^{+44}:\\ \;\;\;\;-0.0001984126984126984 \cdot \left(\cos re \cdot {im}^{7}\right)\\ \mathbf{elif}\;im \leq -2 \cdot 10^{-5}:\\ \;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\ \mathbf{elif}\;im \leq 0.033:\\ \;\;\;\;\cos re \cdot \left(-im\right)\\ \mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\ \;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;-0.0001984126984126984 \cdot \left(\cos re \cdot {im}^{7}\right)\\ \end{array} \]

Alternative 6: 97.9% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
t_1 := -0.0001984126984126984 \cdot \left(\cos re \cdot {im}^{7}\right)\\
\mathbf{if}\;im \leq -1.1 \cdot 10^{+44}:\\
\;\;\;\;t_1\\

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

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

\mathbf{elif}\;im \leq 2 \cdot 10^{+44}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -1.09999999999999998e44 or 2.0000000000000002e44 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos re \cdot \left({im}^{5} \cdot -0.008333333333333333 + {im}^{7} \cdot -0.0001984126984126984\right) + \left(-0.16666666666666666 \cdot \left(\cos re \cdot {im}^{3}\right) + \color{blue}{\left(-\cos re \cdot im\right)}\right) \]
      9. unsub-neg100.0%

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

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

        \[\leadsto \cos re \cdot \left({im}^{5} \cdot -0.008333333333333333 + {im}^{7} \cdot -0.0001984126984126984\right) + \left(\color{blue}{\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666\right)} - \cos re \cdot im\right) \]
      12. distribute-lft-out--100.0%

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

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

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

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

        \[\leadsto -0.0001984126984126984 \cdot \color{blue}{\left({im}^{7} \cdot \cos re\right)} \]
    9. Simplified100.0%

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

    if -1.09999999999999998e44 < im < -0.110000000000000001 or 0.0529999999999999985 < im < 2.0000000000000002e44

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg100.0%

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

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

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

    if -0.110000000000000001 < im < 0.0529999999999999985

    1. Initial program 8.7%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg8.7%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1.1 \cdot 10^{+44}:\\ \;\;\;\;-0.0001984126984126984 \cdot \left(\cos re \cdot {im}^{7}\right)\\ \mathbf{elif}\;im \leq -0.11:\\ \;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\ \mathbf{elif}\;im \leq 0.053:\\ \;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\ \mathbf{elif}\;im \leq 2 \cdot 10^{+44}:\\ \;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;-0.0001984126984126984 \cdot \left(\cos re \cdot {im}^{7}\right)\\ \end{array} \]

Alternative 7: 92.7% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq -4.2 \lor \neg \left(im \leq 4.2\right):\\
\;\;\;\;-0.0001984126984126984 \cdot \left(\cos re \cdot {im}^{7}\right)\\

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


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

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos re \cdot \left({im}^{5} \cdot -0.008333333333333333 + {im}^{7} \cdot -0.0001984126984126984\right) + \left(-0.16666666666666666 \cdot \left(\cos re \cdot {im}^{3}\right) + \color{blue}{\left(-\cos re \cdot im\right)}\right) \]
      9. unsub-neg79.9%

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

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

        \[\leadsto \cos re \cdot \left({im}^{5} \cdot -0.008333333333333333 + {im}^{7} \cdot -0.0001984126984126984\right) + \left(\color{blue}{\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666\right)} - \cos re \cdot im\right) \]
      12. distribute-lft-out--79.9%

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

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

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

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

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

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

    if -4.20000000000000018 < im < 4.20000000000000018

    1. Initial program 9.3%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg9.3%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -4.2 \lor \neg \left(im \leq 4.2\right):\\ \;\;\;\;-0.0001984126984126984 \cdot \left(\cos re \cdot {im}^{7}\right)\\ \mathbf{else}:\\ \;\;\;\;\cos re \cdot \left(-im\right)\\ \end{array} \]

Alternative 8: 80.1% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left({im}^{3} \cdot -0.16666666666666666 - im\right) \cdot \left(1 + -0.5 \cdot \left(re \cdot re\right)\right)\\ t_1 := 0.5 \cdot \left(im \cdot -2 + {im}^{5} \cdot -0.016666666666666666\right)\\ \mathbf{if}\;im \leq -3.8 \cdot 10^{+72}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq -3.15 \cdot 10^{-6}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 1.3 \cdot 10^{+15}:\\ \;\;\;\;\cos re \cdot \left(-im\right)\\ \mathbf{elif}\;im \leq 1.2 \cdot 10^{+112}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0
         (*
          (- (* (pow im 3.0) -0.16666666666666666) im)
          (+ 1.0 (* -0.5 (* re re)))))
        (t_1 (* 0.5 (+ (* im -2.0) (* (pow im 5.0) -0.016666666666666666)))))
   (if (<= im -3.8e+72)
     t_1
     (if (<= im -3.15e-6)
       t_0
       (if (<= im 1.3e+15)
         (* (cos re) (- im))
         (if (<= im 1.2e+112) t_1 t_0))))))
double code(double re, double im) {
	double t_0 = ((pow(im, 3.0) * -0.16666666666666666) - im) * (1.0 + (-0.5 * (re * re)));
	double t_1 = 0.5 * ((im * -2.0) + (pow(im, 5.0) * -0.016666666666666666));
	double tmp;
	if (im <= -3.8e+72) {
		tmp = t_1;
	} else if (im <= -3.15e-6) {
		tmp = t_0;
	} else if (im <= 1.3e+15) {
		tmp = cos(re) * -im;
	} else if (im <= 1.2e+112) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_0 = (((im ** 3.0d0) * (-0.16666666666666666d0)) - im) * (1.0d0 + ((-0.5d0) * (re * re)))
    t_1 = 0.5d0 * ((im * (-2.0d0)) + ((im ** 5.0d0) * (-0.016666666666666666d0)))
    if (im <= (-3.8d+72)) then
        tmp = t_1
    else if (im <= (-3.15d-6)) then
        tmp = t_0
    else if (im <= 1.3d+15) then
        tmp = cos(re) * -im
    else if (im <= 1.2d+112) then
        tmp = t_1
    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) * -0.16666666666666666) - im) * (1.0 + (-0.5 * (re * re)));
	double t_1 = 0.5 * ((im * -2.0) + (Math.pow(im, 5.0) * -0.016666666666666666));
	double tmp;
	if (im <= -3.8e+72) {
		tmp = t_1;
	} else if (im <= -3.15e-6) {
		tmp = t_0;
	} else if (im <= 1.3e+15) {
		tmp = Math.cos(re) * -im;
	} else if (im <= 1.2e+112) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = ((math.pow(im, 3.0) * -0.16666666666666666) - im) * (1.0 + (-0.5 * (re * re)))
	t_1 = 0.5 * ((im * -2.0) + (math.pow(im, 5.0) * -0.016666666666666666))
	tmp = 0
	if im <= -3.8e+72:
		tmp = t_1
	elif im <= -3.15e-6:
		tmp = t_0
	elif im <= 1.3e+15:
		tmp = math.cos(re) * -im
	elif im <= 1.2e+112:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) * Float64(1.0 + Float64(-0.5 * Float64(re * re))))
	t_1 = Float64(0.5 * Float64(Float64(im * -2.0) + Float64((im ^ 5.0) * -0.016666666666666666)))
	tmp = 0.0
	if (im <= -3.8e+72)
		tmp = t_1;
	elseif (im <= -3.15e-6)
		tmp = t_0;
	elseif (im <= 1.3e+15)
		tmp = Float64(cos(re) * Float64(-im));
	elseif (im <= 1.2e+112)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = (((im ^ 3.0) * -0.16666666666666666) - im) * (1.0 + (-0.5 * (re * re)));
	t_1 = 0.5 * ((im * -2.0) + ((im ^ 5.0) * -0.016666666666666666));
	tmp = 0.0;
	if (im <= -3.8e+72)
		tmp = t_1;
	elseif (im <= -3.15e-6)
		tmp = t_0;
	elseif (im <= 1.3e+15)
		tmp = cos(re) * -im;
	elseif (im <= 1.2e+112)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[Power[im, 5.0], $MachinePrecision] * -0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.8e+72], t$95$1, If[LessEqual[im, -3.15e-6], t$95$0, If[LessEqual[im, 1.3e+15], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 1.2e+112], t$95$1, t$95$0]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left({im}^{3} \cdot -0.16666666666666666 - im\right) \cdot \left(1 + -0.5 \cdot \left(re \cdot re\right)\right)\\
t_1 := 0.5 \cdot \left(im \cdot -2 + {im}^{5} \cdot -0.016666666666666666\right)\\
\mathbf{if}\;im \leq -3.8 \cdot 10^{+72}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq -3.15 \cdot 10^{-6}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq 1.3 \cdot 10^{+15}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\

\mathbf{elif}\;im \leq 1.2 \cdot 10^{+112}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -3.80000000000000006e72 or 1.3e15 < im < 1.2e112

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg100.0%

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

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

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

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

      \[\leadsto 0.5 \cdot \left(-2 \cdot im + \color{blue}{-0.016666666666666666 \cdot {im}^{5}}\right) \]
    7. Step-by-step derivation
      1. *-commutative82.5%

        \[\leadsto 0.5 \cdot \left(-2 \cdot im + \color{blue}{{im}^{5} \cdot -0.016666666666666666}\right) \]
    8. Simplified82.5%

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

    if -3.80000000000000006e72 < im < -3.14999999999999991e-6 or 1.2e112 < im

    1. Initial program 99.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg99.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-0.5 \cdot {re}^{2}\right) \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right) + \color{blue}{1 \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)} \]
      6. distribute-rgt-out62.2%

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

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

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

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

    if -3.14999999999999991e-6 < im < 1.3e15

    1. Initial program 11.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg11.0%

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

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

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

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

        \[\leadsto -\color{blue}{im \cdot \cos re} \]
      3. distribute-lft-neg-in95.5%

        \[\leadsto \color{blue}{\left(-im\right) \cdot \cos re} \]
    6. Simplified95.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -3.8 \cdot 10^{+72}:\\ \;\;\;\;0.5 \cdot \left(im \cdot -2 + {im}^{5} \cdot -0.016666666666666666\right)\\ \mathbf{elif}\;im \leq -3.15 \cdot 10^{-6}:\\ \;\;\;\;\left({im}^{3} \cdot -0.16666666666666666 - im\right) \cdot \left(1 + -0.5 \cdot \left(re \cdot re\right)\right)\\ \mathbf{elif}\;im \leq 1.3 \cdot 10^{+15}:\\ \;\;\;\;\cos re \cdot \left(-im\right)\\ \mathbf{elif}\;im \leq 1.2 \cdot 10^{+112}:\\ \;\;\;\;0.5 \cdot \left(im \cdot -2 + {im}^{5} \cdot -0.016666666666666666\right)\\ \mathbf{else}:\\ \;\;\;\;\left({im}^{3} \cdot -0.16666666666666666 - im\right) \cdot \left(1 + -0.5 \cdot \left(re \cdot re\right)\right)\\ \end{array} \]

Alternative 9: 78.7% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right) - im\\ t_1 := 0.5 \cdot \left(im \cdot -2 + {im}^{5} \cdot -0.016666666666666666\right)\\ \mathbf{if}\;im \leq -3.6 \cdot 10^{+72}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq -1.12 \cdot 10^{+15}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 1.5 \cdot 10^{+15}:\\ \;\;\;\;\cos re \cdot \left(-im\right)\\ \mathbf{elif}\;im \leq 5.9 \cdot 10^{+175}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq 1.75 \cdot 10^{+196}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;{im}^{3} \cdot -0.16666666666666666 - im\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (- (* 0.5 (* im (* re re))) im))
        (t_1 (* 0.5 (+ (* im -2.0) (* (pow im 5.0) -0.016666666666666666)))))
   (if (<= im -3.6e+72)
     t_1
     (if (<= im -1.12e+15)
       t_0
       (if (<= im 1.5e+15)
         (* (cos re) (- im))
         (if (<= im 5.9e+175)
           t_1
           (if (<= im 1.75e+196)
             t_0
             (- (* (pow im 3.0) -0.16666666666666666) im))))))))
double code(double re, double im) {
	double t_0 = (0.5 * (im * (re * re))) - im;
	double t_1 = 0.5 * ((im * -2.0) + (pow(im, 5.0) * -0.016666666666666666));
	double tmp;
	if (im <= -3.6e+72) {
		tmp = t_1;
	} else if (im <= -1.12e+15) {
		tmp = t_0;
	} else if (im <= 1.5e+15) {
		tmp = cos(re) * -im;
	} else if (im <= 5.9e+175) {
		tmp = t_1;
	} else if (im <= 1.75e+196) {
		tmp = t_0;
	} else {
		tmp = (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) :: t_1
    real(8) :: tmp
    t_0 = (0.5d0 * (im * (re * re))) - im
    t_1 = 0.5d0 * ((im * (-2.0d0)) + ((im ** 5.0d0) * (-0.016666666666666666d0)))
    if (im <= (-3.6d+72)) then
        tmp = t_1
    else if (im <= (-1.12d+15)) then
        tmp = t_0
    else if (im <= 1.5d+15) then
        tmp = cos(re) * -im
    else if (im <= 5.9d+175) then
        tmp = t_1
    else if (im <= 1.75d+196) then
        tmp = t_0
    else
        tmp = ((im ** 3.0d0) * (-0.16666666666666666d0)) - im
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = (0.5 * (im * (re * re))) - im;
	double t_1 = 0.5 * ((im * -2.0) + (Math.pow(im, 5.0) * -0.016666666666666666));
	double tmp;
	if (im <= -3.6e+72) {
		tmp = t_1;
	} else if (im <= -1.12e+15) {
		tmp = t_0;
	} else if (im <= 1.5e+15) {
		tmp = Math.cos(re) * -im;
	} else if (im <= 5.9e+175) {
		tmp = t_1;
	} else if (im <= 1.75e+196) {
		tmp = t_0;
	} else {
		tmp = (Math.pow(im, 3.0) * -0.16666666666666666) - im;
	}
	return tmp;
}
def code(re, im):
	t_0 = (0.5 * (im * (re * re))) - im
	t_1 = 0.5 * ((im * -2.0) + (math.pow(im, 5.0) * -0.016666666666666666))
	tmp = 0
	if im <= -3.6e+72:
		tmp = t_1
	elif im <= -1.12e+15:
		tmp = t_0
	elif im <= 1.5e+15:
		tmp = math.cos(re) * -im
	elif im <= 5.9e+175:
		tmp = t_1
	elif im <= 1.75e+196:
		tmp = t_0
	else:
		tmp = (math.pow(im, 3.0) * -0.16666666666666666) - im
	return tmp
function code(re, im)
	t_0 = Float64(Float64(0.5 * Float64(im * Float64(re * re))) - im)
	t_1 = Float64(0.5 * Float64(Float64(im * -2.0) + Float64((im ^ 5.0) * -0.016666666666666666)))
	tmp = 0.0
	if (im <= -3.6e+72)
		tmp = t_1;
	elseif (im <= -1.12e+15)
		tmp = t_0;
	elseif (im <= 1.5e+15)
		tmp = Float64(cos(re) * Float64(-im));
	elseif (im <= 5.9e+175)
		tmp = t_1;
	elseif (im <= 1.75e+196)
		tmp = t_0;
	else
		tmp = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im);
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = (0.5 * (im * (re * re))) - im;
	t_1 = 0.5 * ((im * -2.0) + ((im ^ 5.0) * -0.016666666666666666));
	tmp = 0.0;
	if (im <= -3.6e+72)
		tmp = t_1;
	elseif (im <= -1.12e+15)
		tmp = t_0;
	elseif (im <= 1.5e+15)
		tmp = cos(re) * -im;
	elseif (im <= 5.9e+175)
		tmp = t_1;
	elseif (im <= 1.75e+196)
		tmp = t_0;
	else
		tmp = ((im ^ 3.0) * -0.16666666666666666) - im;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[(0.5 * N[(im * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[Power[im, 5.0], $MachinePrecision] * -0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.6e+72], t$95$1, If[LessEqual[im, -1.12e+15], t$95$0, If[LessEqual[im, 1.5e+15], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 5.9e+175], t$95$1, If[LessEqual[im, 1.75e+196], t$95$0, N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right) - im\\
t_1 := 0.5 \cdot \left(im \cdot -2 + {im}^{5} \cdot -0.016666666666666666\right)\\
\mathbf{if}\;im \leq -3.6 \cdot 10^{+72}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq -1.12 \cdot 10^{+15}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq 1.5 \cdot 10^{+15}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\

\mathbf{elif}\;im \leq 5.9 \cdot 10^{+175}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq 1.75 \cdot 10^{+196}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;{im}^{3} \cdot -0.16666666666666666 - im\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < -3.60000000000000035e72 or 1.5e15 < im < 5.9000000000000003e175

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg100.0%

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

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

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

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

      \[\leadsto 0.5 \cdot \left(-2 \cdot im + \color{blue}{-0.016666666666666666 \cdot {im}^{5}}\right) \]
    7. Step-by-step derivation
      1. *-commutative78.8%

        \[\leadsto 0.5 \cdot \left(-2 \cdot im + \color{blue}{{im}^{5} \cdot -0.016666666666666666}\right) \]
    8. Simplified78.8%

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

    if -3.60000000000000035e72 < im < -1.12e15 or 5.9000000000000003e175 < im < 1.7499999999999999e196

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg100.0%

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

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

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

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

        \[\leadsto -\color{blue}{im \cdot \cos re} \]
      3. distribute-lft-neg-in3.8%

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

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

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

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

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

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

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

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

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

    if -1.12e15 < im < 1.5e15

    1. Initial program 14.7%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg14.7%

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

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

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

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

        \[\leadsto -\color{blue}{im \cdot \cos re} \]
      3. distribute-lft-neg-in92.6%

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

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

    if 1.7499999999999999e196 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg100.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.16666666666666666 \cdot {im}^{3} - im} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification83.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -3.6 \cdot 10^{+72}:\\ \;\;\;\;0.5 \cdot \left(im \cdot -2 + {im}^{5} \cdot -0.016666666666666666\right)\\ \mathbf{elif}\;im \leq -1.12 \cdot 10^{+15}:\\ \;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right) - im\\ \mathbf{elif}\;im \leq 1.5 \cdot 10^{+15}:\\ \;\;\;\;\cos re \cdot \left(-im\right)\\ \mathbf{elif}\;im \leq 5.9 \cdot 10^{+175}:\\ \;\;\;\;0.5 \cdot \left(im \cdot -2 + {im}^{5} \cdot -0.016666666666666666\right)\\ \mathbf{elif}\;im \leq 1.75 \cdot 10^{+196}:\\ \;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right) - im\\ \mathbf{else}:\\ \;\;\;\;{im}^{3} \cdot -0.16666666666666666 - im\\ \end{array} \]

Alternative 10: 74.6% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\ t_1 := 0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right) - im\\ \mathbf{if}\;im \leq -9.2 \cdot 10^{+77}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -8.6 \cdot 10^{+16}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq 0.058:\\ \;\;\;\;\cos re \cdot \left(-im\right)\\ \mathbf{elif}\;im \leq 5.9 \cdot 10^{+175} \lor \neg \left(im \leq 1.75 \cdot 10^{+196}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (- (* (pow im 3.0) -0.16666666666666666) im))
        (t_1 (- (* 0.5 (* im (* re re))) im)))
   (if (<= im -9.2e+77)
     t_0
     (if (<= im -8.6e+16)
       t_1
       (if (<= im 0.058)
         (* (cos re) (- im))
         (if (or (<= im 5.9e+175) (not (<= im 1.75e+196))) t_0 t_1))))))
double code(double re, double im) {
	double t_0 = (pow(im, 3.0) * -0.16666666666666666) - im;
	double t_1 = (0.5 * (im * (re * re))) - im;
	double tmp;
	if (im <= -9.2e+77) {
		tmp = t_0;
	} else if (im <= -8.6e+16) {
		tmp = t_1;
	} else if (im <= 0.058) {
		tmp = cos(re) * -im;
	} else if ((im <= 5.9e+175) || !(im <= 1.75e+196)) {
		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 ** 3.0d0) * (-0.16666666666666666d0)) - im
    t_1 = (0.5d0 * (im * (re * re))) - im
    if (im <= (-9.2d+77)) then
        tmp = t_0
    else if (im <= (-8.6d+16)) then
        tmp = t_1
    else if (im <= 0.058d0) then
        tmp = cos(re) * -im
    else if ((im <= 5.9d+175) .or. (.not. (im <= 1.75d+196))) 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.pow(im, 3.0) * -0.16666666666666666) - im;
	double t_1 = (0.5 * (im * (re * re))) - im;
	double tmp;
	if (im <= -9.2e+77) {
		tmp = t_0;
	} else if (im <= -8.6e+16) {
		tmp = t_1;
	} else if (im <= 0.058) {
		tmp = Math.cos(re) * -im;
	} else if ((im <= 5.9e+175) || !(im <= 1.75e+196)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(re, im):
	t_0 = (math.pow(im, 3.0) * -0.16666666666666666) - im
	t_1 = (0.5 * (im * (re * re))) - im
	tmp = 0
	if im <= -9.2e+77:
		tmp = t_0
	elif im <= -8.6e+16:
		tmp = t_1
	elif im <= 0.058:
		tmp = math.cos(re) * -im
	elif (im <= 5.9e+175) or not (im <= 1.75e+196):
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(re, im)
	t_0 = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)
	t_1 = Float64(Float64(0.5 * Float64(im * Float64(re * re))) - im)
	tmp = 0.0
	if (im <= -9.2e+77)
		tmp = t_0;
	elseif (im <= -8.6e+16)
		tmp = t_1;
	elseif (im <= 0.058)
		tmp = Float64(cos(re) * Float64(-im));
	elseif ((im <= 5.9e+175) || !(im <= 1.75e+196))
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = ((im ^ 3.0) * -0.16666666666666666) - im;
	t_1 = (0.5 * (im * (re * re))) - im;
	tmp = 0.0;
	if (im <= -9.2e+77)
		tmp = t_0;
	elseif (im <= -8.6e+16)
		tmp = t_1;
	elseif (im <= 0.058)
		tmp = cos(re) * -im;
	elseif ((im <= 5.9e+175) || ~((im <= 1.75e+196)))
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.5 * N[(im * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]}, If[LessEqual[im, -9.2e+77], t$95$0, If[LessEqual[im, -8.6e+16], t$95$1, If[LessEqual[im, 0.058], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[Or[LessEqual[im, 5.9e+175], N[Not[LessEqual[im, 1.75e+196]], $MachinePrecision]], t$95$0, t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq -8.6 \cdot 10^{+16}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;im \leq 5.9 \cdot 10^{+175} \lor \neg \left(im \leq 1.75 \cdot 10^{+196}\right):\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -9.19999999999999979e77 or 0.0580000000000000029 < im < 5.9000000000000003e175 or 1.7499999999999999e196 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg100.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.16666666666666666 \cdot {im}^{3} - im} \]

    if -9.19999999999999979e77 < im < -8.6e16 or 5.9000000000000003e175 < im < 1.7499999999999999e196

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg100.0%

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

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

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

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

        \[\leadsto -\color{blue}{im \cdot \cos re} \]
      3. distribute-lft-neg-in3.8%

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

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

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

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

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

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

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

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

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

    if -8.6e16 < im < 0.0580000000000000029

    1. Initial program 11.8%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg11.8%

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

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

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

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

        \[\leadsto -\color{blue}{im \cdot \cos re} \]
      3. distribute-lft-neg-in95.5%

        \[\leadsto \color{blue}{\left(-im\right) \cdot \cos re} \]
    6. Simplified95.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -9.2 \cdot 10^{+77}:\\ \;\;\;\;{im}^{3} \cdot -0.16666666666666666 - im\\ \mathbf{elif}\;im \leq -8.6 \cdot 10^{+16}:\\ \;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right) - im\\ \mathbf{elif}\;im \leq 0.058:\\ \;\;\;\;\cos re \cdot \left(-im\right)\\ \mathbf{elif}\;im \leq 5.9 \cdot 10^{+175} \lor \neg \left(im \leq 1.75 \cdot 10^{+196}\right):\\ \;\;\;\;{im}^{3} \cdot -0.16666666666666666 - im\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right) - im\\ \end{array} \]

Alternative 11: 60.4% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(re \cdot re\right) \cdot 0.75\\ t_1 := 0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right) - im\\ \mathbf{if}\;im \leq -2.25 \cdot 10^{+123}:\\ \;\;\;\;im \cdot \left({re}^{4} \cdot -0.041666666666666664\right)\\ \mathbf{elif}\;im \leq -8500000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq -1700000000:\\ \;\;\;\;\frac{2.25 - t_0 \cdot t_0}{-1.5 - t_0}\\ \mathbf{elif}\;im \leq 250:\\ \;\;\;\;\cos re \cdot \left(-im\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (* re re) 0.75)) (t_1 (- (* 0.5 (* im (* re re))) im)))
   (if (<= im -2.25e+123)
     (* im (* (pow re 4.0) -0.041666666666666664))
     (if (<= im -8500000000.0)
       t_1
       (if (<= im -1700000000.0)
         (/ (- 2.25 (* t_0 t_0)) (- -1.5 t_0))
         (if (<= im 250.0) (* (cos re) (- im)) t_1))))))
double code(double re, double im) {
	double t_0 = (re * re) * 0.75;
	double t_1 = (0.5 * (im * (re * re))) - im;
	double tmp;
	if (im <= -2.25e+123) {
		tmp = im * (pow(re, 4.0) * -0.041666666666666664);
	} else if (im <= -8500000000.0) {
		tmp = t_1;
	} else if (im <= -1700000000.0) {
		tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0);
	} else if (im <= 250.0) {
		tmp = cos(re) * -im;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (re * re) * 0.75d0
    t_1 = (0.5d0 * (im * (re * re))) - im
    if (im <= (-2.25d+123)) then
        tmp = im * ((re ** 4.0d0) * (-0.041666666666666664d0))
    else if (im <= (-8500000000.0d0)) then
        tmp = t_1
    else if (im <= (-1700000000.0d0)) then
        tmp = (2.25d0 - (t_0 * t_0)) / ((-1.5d0) - t_0)
    else if (im <= 250.0d0) then
        tmp = cos(re) * -im
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = (re * re) * 0.75;
	double t_1 = (0.5 * (im * (re * re))) - im;
	double tmp;
	if (im <= -2.25e+123) {
		tmp = im * (Math.pow(re, 4.0) * -0.041666666666666664);
	} else if (im <= -8500000000.0) {
		tmp = t_1;
	} else if (im <= -1700000000.0) {
		tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0);
	} else if (im <= 250.0) {
		tmp = Math.cos(re) * -im;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(re, im):
	t_0 = (re * re) * 0.75
	t_1 = (0.5 * (im * (re * re))) - im
	tmp = 0
	if im <= -2.25e+123:
		tmp = im * (math.pow(re, 4.0) * -0.041666666666666664)
	elif im <= -8500000000.0:
		tmp = t_1
	elif im <= -1700000000.0:
		tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0)
	elif im <= 250.0:
		tmp = math.cos(re) * -im
	else:
		tmp = t_1
	return tmp
function code(re, im)
	t_0 = Float64(Float64(re * re) * 0.75)
	t_1 = Float64(Float64(0.5 * Float64(im * Float64(re * re))) - im)
	tmp = 0.0
	if (im <= -2.25e+123)
		tmp = Float64(im * Float64((re ^ 4.0) * -0.041666666666666664));
	elseif (im <= -8500000000.0)
		tmp = t_1;
	elseif (im <= -1700000000.0)
		tmp = Float64(Float64(2.25 - Float64(t_0 * t_0)) / Float64(-1.5 - t_0));
	elseif (im <= 250.0)
		tmp = Float64(cos(re) * Float64(-im));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = (re * re) * 0.75;
	t_1 = (0.5 * (im * (re * re))) - im;
	tmp = 0.0;
	if (im <= -2.25e+123)
		tmp = im * ((re ^ 4.0) * -0.041666666666666664);
	elseif (im <= -8500000000.0)
		tmp = t_1;
	elseif (im <= -1700000000.0)
		tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0);
	elseif (im <= 250.0)
		tmp = cos(re) * -im;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[(re * re), $MachinePrecision] * 0.75), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.5 * N[(im * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]}, If[LessEqual[im, -2.25e+123], N[(im * N[(N[Power[re, 4.0], $MachinePrecision] * -0.041666666666666664), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -8500000000.0], t$95$1, If[LessEqual[im, -1700000000.0], N[(N[(2.25 - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(-1.5 - t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 250.0], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(re \cdot re\right) \cdot 0.75\\
t_1 := 0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right) - im\\
\mathbf{if}\;im \leq -2.25 \cdot 10^{+123}:\\
\;\;\;\;im \cdot \left({re}^{4} \cdot -0.041666666666666664\right)\\

\mathbf{elif}\;im \leq -8500000000:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq -1700000000:\\
\;\;\;\;\frac{2.25 - t_0 \cdot t_0}{-1.5 - t_0}\\

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

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


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

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg100.0%

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

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

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

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

        \[\leadsto -\color{blue}{im \cdot \cos re} \]
      3. distribute-lft-neg-in6.1%

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

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

      \[\leadsto \color{blue}{-0.041666666666666664 \cdot \left({re}^{4} \cdot im\right) + \left(-1 \cdot im + 0.5 \cdot \left({re}^{2} \cdot im\right)\right)} \]
    8. Step-by-step derivation
      1. neg-mul-16.4%

        \[\leadsto -0.041666666666666664 \cdot \left({re}^{4} \cdot im\right) + \left(\color{blue}{\left(-im\right)} + 0.5 \cdot \left({re}^{2} \cdot im\right)\right) \]
      2. associate-+r+6.4%

        \[\leadsto \color{blue}{\left(-0.041666666666666664 \cdot \left({re}^{4} \cdot im\right) + \left(-im\right)\right) + 0.5 \cdot \left({re}^{2} \cdot im\right)} \]
      3. +-commutative6.4%

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

        \[\leadsto \color{blue}{\left(0.5 \cdot {re}^{2}\right) \cdot im} + \left(-0.041666666666666664 \cdot \left({re}^{4} \cdot im\right) + \left(-im\right)\right) \]
      5. *-commutative6.4%

        \[\leadsto \color{blue}{im \cdot \left(0.5 \cdot {re}^{2}\right)} + \left(-0.041666666666666664 \cdot \left({re}^{4} \cdot im\right) + \left(-im\right)\right) \]
      6. associate-*r*6.4%

        \[\leadsto im \cdot \left(0.5 \cdot {re}^{2}\right) + \left(\color{blue}{\left(-0.041666666666666664 \cdot {re}^{4}\right) \cdot im} + \left(-im\right)\right) \]
      7. neg-mul-16.4%

        \[\leadsto im \cdot \left(0.5 \cdot {re}^{2}\right) + \left(\left(-0.041666666666666664 \cdot {re}^{4}\right) \cdot im + \color{blue}{-1 \cdot im}\right) \]
      8. distribute-rgt-out6.4%

        \[\leadsto im \cdot \left(0.5 \cdot {re}^{2}\right) + \color{blue}{im \cdot \left(-0.041666666666666664 \cdot {re}^{4} + -1\right)} \]
      9. distribute-lft-out29.8%

        \[\leadsto \color{blue}{im \cdot \left(0.5 \cdot {re}^{2} + \left(-0.041666666666666664 \cdot {re}^{4} + -1\right)\right)} \]
      10. *-commutative29.8%

        \[\leadsto im \cdot \left(\color{blue}{{re}^{2} \cdot 0.5} + \left(-0.041666666666666664 \cdot {re}^{4} + -1\right)\right) \]
      11. unpow229.8%

        \[\leadsto im \cdot \left(\color{blue}{\left(re \cdot re\right)} \cdot 0.5 + \left(-0.041666666666666664 \cdot {re}^{4} + -1\right)\right) \]
      12. *-commutative29.8%

        \[\leadsto im \cdot \left(\left(re \cdot re\right) \cdot 0.5 + \left(\color{blue}{{re}^{4} \cdot -0.041666666666666664} + -1\right)\right) \]
    9. Simplified29.8%

      \[\leadsto \color{blue}{im \cdot \left(\left(re \cdot re\right) \cdot 0.5 + \left({re}^{4} \cdot -0.041666666666666664 + -1\right)\right)} \]
    10. Taylor expanded in re around inf 41.1%

      \[\leadsto im \cdot \color{blue}{\left(-0.041666666666666664 \cdot {re}^{4}\right)} \]
    11. Step-by-step derivation
      1. *-commutative41.1%

        \[\leadsto im \cdot \color{blue}{\left({re}^{4} \cdot -0.041666666666666664\right)} \]
    12. Simplified41.1%

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

    if -2.24999999999999991e123 < im < -8.5e9 or 250 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg100.0%

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

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

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

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

        \[\leadsto -\color{blue}{im \cdot \cos re} \]
      3. distribute-lft-neg-in4.5%

        \[\leadsto \color{blue}{\left(-im\right) \cdot \cos re} \]
    6. Simplified4.5%

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

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

        \[\leadsto \color{blue}{\left(-im\right)} + 0.5 \cdot \left({re}^{2} \cdot im\right) \]
      2. +-commutative25.0%

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

        \[\leadsto \color{blue}{0.5 \cdot \left({re}^{2} \cdot im\right) - im} \]
      4. *-commutative25.0%

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

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

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

    if -8.5e9 < im < -1.7e9

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg100.0%

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left(e^{-im} - e^{im}\right) + \color{blue}{\left(-0.25 \cdot {re}^{2}\right) \cdot \left(e^{-im} - e^{im}\right)} \]
      4. distribute-rgt-out0.0%

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

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

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

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

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

      \[\leadsto \color{blue}{-3} \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \]
    8. Step-by-step derivation
      1. distribute-lft-in6.9%

        \[\leadsto \color{blue}{-3 \cdot 0.5 + -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      2. flip-+100.0%

        \[\leadsto \color{blue}{\frac{\left(-3 \cdot 0.5\right) \cdot \left(-3 \cdot 0.5\right) - \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right) \cdot \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right)}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)}} \]
      3. metadata-eval100.0%

        \[\leadsto \frac{\color{blue}{-1.5} \cdot \left(-3 \cdot 0.5\right) - \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right) \cdot \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right)}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      4. metadata-eval100.0%

        \[\leadsto \frac{-1.5 \cdot \color{blue}{-1.5} - \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right) \cdot \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right)}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      5. metadata-eval100.0%

        \[\leadsto \frac{\color{blue}{2.25} - \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right) \cdot \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right)}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{2.25 - \color{blue}{\left(\left(re \cdot \left(re \cdot -0.25\right)\right) \cdot -3\right)} \cdot \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right)}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      7. associate-*r*100.0%

        \[\leadsto \frac{2.25 - \left(\color{blue}{\left(\left(re \cdot re\right) \cdot -0.25\right)} \cdot -3\right) \cdot \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right)}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      8. associate-*l*100.0%

        \[\leadsto \frac{2.25 - \color{blue}{\left(\left(re \cdot re\right) \cdot \left(-0.25 \cdot -3\right)\right)} \cdot \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right)}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      9. metadata-eval100.0%

        \[\leadsto \frac{2.25 - \left(\left(re \cdot re\right) \cdot \color{blue}{0.75}\right) \cdot \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right)}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      10. *-commutative100.0%

        \[\leadsto \frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \color{blue}{\left(\left(re \cdot \left(re \cdot -0.25\right)\right) \cdot -3\right)}}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      11. associate-*r*100.0%

        \[\leadsto \frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \left(\color{blue}{\left(\left(re \cdot re\right) \cdot -0.25\right)} \cdot -3\right)}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      12. associate-*l*100.0%

        \[\leadsto \frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \color{blue}{\left(\left(re \cdot re\right) \cdot \left(-0.25 \cdot -3\right)\right)}}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      13. metadata-eval100.0%

        \[\leadsto \frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \left(\left(re \cdot re\right) \cdot \color{blue}{0.75}\right)}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      14. metadata-eval100.0%

        \[\leadsto \frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \left(\left(re \cdot re\right) \cdot 0.75\right)}{\color{blue}{-1.5} - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      15. *-commutative100.0%

        \[\leadsto \frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \left(\left(re \cdot re\right) \cdot 0.75\right)}{-1.5 - \color{blue}{\left(re \cdot \left(re \cdot -0.25\right)\right) \cdot -3}} \]
      16. associate-*r*100.0%

        \[\leadsto \frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \left(\left(re \cdot re\right) \cdot 0.75\right)}{-1.5 - \color{blue}{\left(\left(re \cdot re\right) \cdot -0.25\right)} \cdot -3} \]
      17. associate-*l*100.0%

        \[\leadsto \frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \left(\left(re \cdot re\right) \cdot 0.75\right)}{-1.5 - \color{blue}{\left(re \cdot re\right) \cdot \left(-0.25 \cdot -3\right)}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \left(\left(re \cdot re\right) \cdot 0.75\right)}{-1.5 - \left(re \cdot re\right) \cdot \color{blue}{0.75}} \]
    9. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \left(\left(re \cdot re\right) \cdot 0.75\right)}{-1.5 - \left(re \cdot re\right) \cdot 0.75}} \]

    if -1.7e9 < im < 250

    1. Initial program 9.9%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg9.9%

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

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

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

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

        \[\leadsto -\color{blue}{im \cdot \cos re} \]
      3. distribute-lft-neg-in97.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -2.25 \cdot 10^{+123}:\\ \;\;\;\;im \cdot \left({re}^{4} \cdot -0.041666666666666664\right)\\ \mathbf{elif}\;im \leq -8500000000:\\ \;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right) - im\\ \mathbf{elif}\;im \leq -1700000000:\\ \;\;\;\;\frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \left(\left(re \cdot re\right) \cdot 0.75\right)}{-1.5 - \left(re \cdot re\right) \cdot 0.75}\\ \mathbf{elif}\;im \leq 250:\\ \;\;\;\;\cos re \cdot \left(-im\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right) - im\\ \end{array} \]

Alternative 12: 60.4% accurate, 2.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.36 \cdot 10^{+17} \lor \neg \left(im \leq 250\right):\\
\;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right) - im\\

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


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

    1. Initial program 100.0%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg100.0%

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

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

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

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

        \[\leadsto -\color{blue}{im \cdot \cos re} \]
      3. distribute-lft-neg-in5.0%

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

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

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

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

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

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

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

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

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

    if -1.36e17 < im < 250

    1. Initial program 12.4%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg12.4%

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

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

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

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

        \[\leadsto -\color{blue}{im \cdot \cos re} \]
      3. distribute-lft-neg-in95.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1.36 \cdot 10^{+17} \lor \neg \left(im \leq 250\right):\\ \;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right) - im\\ \mathbf{else}:\\ \;\;\;\;\cos re \cdot \left(-im\right)\\ \end{array} \]

Alternative 13: 33.0% accurate, 12.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(re \cdot re\right) \cdot 0.75\\ \mathbf{if}\;re \leq 9.6 \cdot 10^{+76}:\\ \;\;\;\;-im\\ \mathbf{elif}\;re \leq 8.5 \cdot 10^{+153}:\\ \;\;\;\;\frac{2.25 - t_0 \cdot t_0}{-1.5 - t_0}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \cdot 27\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (* re re) 0.75)))
   (if (<= re 9.6e+76)
     (- im)
     (if (<= re 8.5e+153)
       (/ (- 2.25 (* t_0 t_0)) (- -1.5 t_0))
       (* (+ 0.5 (* re (* re -0.25))) 27.0)))))
double code(double re, double im) {
	double t_0 = (re * re) * 0.75;
	double tmp;
	if (re <= 9.6e+76) {
		tmp = -im;
	} else if (re <= 8.5e+153) {
		tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0);
	} else {
		tmp = (0.5 + (re * (re * -0.25))) * 27.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 = (re * re) * 0.75d0
    if (re <= 9.6d+76) then
        tmp = -im
    else if (re <= 8.5d+153) then
        tmp = (2.25d0 - (t_0 * t_0)) / ((-1.5d0) - t_0)
    else
        tmp = (0.5d0 + (re * (re * (-0.25d0)))) * 27.0d0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = (re * re) * 0.75;
	double tmp;
	if (re <= 9.6e+76) {
		tmp = -im;
	} else if (re <= 8.5e+153) {
		tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0);
	} else {
		tmp = (0.5 + (re * (re * -0.25))) * 27.0;
	}
	return tmp;
}
def code(re, im):
	t_0 = (re * re) * 0.75
	tmp = 0
	if re <= 9.6e+76:
		tmp = -im
	elif re <= 8.5e+153:
		tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0)
	else:
		tmp = (0.5 + (re * (re * -0.25))) * 27.0
	return tmp
function code(re, im)
	t_0 = Float64(Float64(re * re) * 0.75)
	tmp = 0.0
	if (re <= 9.6e+76)
		tmp = Float64(-im);
	elseif (re <= 8.5e+153)
		tmp = Float64(Float64(2.25 - Float64(t_0 * t_0)) / Float64(-1.5 - t_0));
	else
		tmp = Float64(Float64(0.5 + Float64(re * Float64(re * -0.25))) * 27.0);
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = (re * re) * 0.75;
	tmp = 0.0;
	if (re <= 9.6e+76)
		tmp = -im;
	elseif (re <= 8.5e+153)
		tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0);
	else
		tmp = (0.5 + (re * (re * -0.25))) * 27.0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[(re * re), $MachinePrecision] * 0.75), $MachinePrecision]}, If[LessEqual[re, 9.6e+76], (-im), If[LessEqual[re, 8.5e+153], N[(N[(2.25 - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(-1.5 - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 27.0), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(re \cdot re\right) \cdot 0.75\\
\mathbf{if}\;re \leq 9.6 \cdot 10^{+76}:\\
\;\;\;\;-im\\

\mathbf{elif}\;re \leq 8.5 \cdot 10^{+153}:\\
\;\;\;\;\frac{2.25 - t_0 \cdot t_0}{-1.5 - t_0}\\

\mathbf{else}:\\
\;\;\;\;\left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \cdot 27\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < 9.5999999999999999e76

    1. Initial program 49.5%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg49.5%

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

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

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

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

        \[\leadsto -\color{blue}{im \cdot \cos re} \]
      3. distribute-lft-neg-in56.9%

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

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

      \[\leadsto \color{blue}{-1 \cdot im} \]
    8. Step-by-step derivation
      1. neg-mul-142.6%

        \[\leadsto \color{blue}{-im} \]
    9. Simplified42.6%

      \[\leadsto \color{blue}{-im} \]

    if 9.5999999999999999e76 < re < 8.49999999999999935e153

    1. Initial program 63.4%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg63.4%

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

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

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

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

        \[\leadsto 0.5 \cdot \left(e^{-im} - e^{im}\right) + -0.25 \cdot \color{blue}{\left({re}^{2} \cdot \left(e^{-im} - e^{im}\right)\right)} \]
      3. associate-*r*2.2%

        \[\leadsto 0.5 \cdot \left(e^{-im} - e^{im}\right) + \color{blue}{\left(-0.25 \cdot {re}^{2}\right) \cdot \left(e^{-im} - e^{im}\right)} \]
      4. distribute-rgt-out32.9%

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

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

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

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

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

      \[\leadsto \color{blue}{-3} \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \]
    8. Step-by-step derivation
      1. distribute-lft-in2.5%

        \[\leadsto \color{blue}{-3 \cdot 0.5 + -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      2. flip-+31.4%

        \[\leadsto \color{blue}{\frac{\left(-3 \cdot 0.5\right) \cdot \left(-3 \cdot 0.5\right) - \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right) \cdot \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right)}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)}} \]
      3. metadata-eval31.4%

        \[\leadsto \frac{\color{blue}{-1.5} \cdot \left(-3 \cdot 0.5\right) - \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right) \cdot \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right)}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      4. metadata-eval31.4%

        \[\leadsto \frac{-1.5 \cdot \color{blue}{-1.5} - \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right) \cdot \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right)}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      5. metadata-eval31.4%

        \[\leadsto \frac{\color{blue}{2.25} - \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right) \cdot \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right)}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      6. *-commutative31.4%

        \[\leadsto \frac{2.25 - \color{blue}{\left(\left(re \cdot \left(re \cdot -0.25\right)\right) \cdot -3\right)} \cdot \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right)}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      7. associate-*r*31.4%

        \[\leadsto \frac{2.25 - \left(\color{blue}{\left(\left(re \cdot re\right) \cdot -0.25\right)} \cdot -3\right) \cdot \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right)}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      8. associate-*l*31.4%

        \[\leadsto \frac{2.25 - \color{blue}{\left(\left(re \cdot re\right) \cdot \left(-0.25 \cdot -3\right)\right)} \cdot \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right)}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      9. metadata-eval31.4%

        \[\leadsto \frac{2.25 - \left(\left(re \cdot re\right) \cdot \color{blue}{0.75}\right) \cdot \left(-3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right)}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      10. *-commutative31.4%

        \[\leadsto \frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \color{blue}{\left(\left(re \cdot \left(re \cdot -0.25\right)\right) \cdot -3\right)}}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      11. associate-*r*31.4%

        \[\leadsto \frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \left(\color{blue}{\left(\left(re \cdot re\right) \cdot -0.25\right)} \cdot -3\right)}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      12. associate-*l*31.4%

        \[\leadsto \frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \color{blue}{\left(\left(re \cdot re\right) \cdot \left(-0.25 \cdot -3\right)\right)}}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      13. metadata-eval31.4%

        \[\leadsto \frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \left(\left(re \cdot re\right) \cdot \color{blue}{0.75}\right)}{-3 \cdot 0.5 - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      14. metadata-eval31.4%

        \[\leadsto \frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \left(\left(re \cdot re\right) \cdot 0.75\right)}{\color{blue}{-1.5} - -3 \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)} \]
      15. *-commutative31.4%

        \[\leadsto \frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \left(\left(re \cdot re\right) \cdot 0.75\right)}{-1.5 - \color{blue}{\left(re \cdot \left(re \cdot -0.25\right)\right) \cdot -3}} \]
      16. associate-*r*31.4%

        \[\leadsto \frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \left(\left(re \cdot re\right) \cdot 0.75\right)}{-1.5 - \color{blue}{\left(\left(re \cdot re\right) \cdot -0.25\right)} \cdot -3} \]
      17. associate-*l*31.4%

        \[\leadsto \frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \left(\left(re \cdot re\right) \cdot 0.75\right)}{-1.5 - \color{blue}{\left(re \cdot re\right) \cdot \left(-0.25 \cdot -3\right)}} \]
      18. metadata-eval31.4%

        \[\leadsto \frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \left(\left(re \cdot re\right) \cdot 0.75\right)}{-1.5 - \left(re \cdot re\right) \cdot \color{blue}{0.75}} \]
    9. Applied egg-rr31.4%

      \[\leadsto \color{blue}{\frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \left(\left(re \cdot re\right) \cdot 0.75\right)}{-1.5 - \left(re \cdot re\right) \cdot 0.75}} \]

    if 8.49999999999999935e153 < re

    1. Initial program 42.6%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg42.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(e^{-im} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right)} \]
      5. *-commutative19.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 9.6 \cdot 10^{+76}:\\ \;\;\;\;-im\\ \mathbf{elif}\;re \leq 8.5 \cdot 10^{+153}:\\ \;\;\;\;\frac{2.25 - \left(\left(re \cdot re\right) \cdot 0.75\right) \cdot \left(\left(re \cdot re\right) \cdot 0.75\right)}{-1.5 - \left(re \cdot re\right) \cdot 0.75}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \cdot 27\\ \end{array} \]

Alternative 14: 31.9% accurate, 27.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq 2.85 \cdot 10^{+158}:\\ \;\;\;\;-im\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \cdot 27\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re 2.85e+158) (- im) (* (+ 0.5 (* re (* re -0.25))) 27.0)))
double code(double re, double im) {
	double tmp;
	if (re <= 2.85e+158) {
		tmp = -im;
	} else {
		tmp = (0.5 + (re * (re * -0.25))) * 27.0;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= 2.85d+158) then
        tmp = -im
    else
        tmp = (0.5d0 + (re * (re * (-0.25d0)))) * 27.0d0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= 2.85e+158) {
		tmp = -im;
	} else {
		tmp = (0.5 + (re * (re * -0.25))) * 27.0;
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= 2.85e+158:
		tmp = -im
	else:
		tmp = (0.5 + (re * (re * -0.25))) * 27.0
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= 2.85e+158)
		tmp = Float64(-im);
	else
		tmp = Float64(Float64(0.5 + Float64(re * Float64(re * -0.25))) * 27.0);
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= 2.85e+158)
		tmp = -im;
	else
		tmp = (0.5 + (re * (re * -0.25))) * 27.0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, 2.85e+158], (-im), N[(N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 27.0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.85 \cdot 10^{+158}:\\
\;\;\;\;-im\\

\mathbf{else}:\\
\;\;\;\;\left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \cdot 27\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if re < 2.8500000000000001e158

    1. Initial program 50.1%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg50.1%

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

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

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

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

        \[\leadsto -\color{blue}{im \cdot \cos re} \]
      3. distribute-lft-neg-in56.4%

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

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

      \[\leadsto \color{blue}{-1 \cdot im} \]
    8. Step-by-step derivation
      1. neg-mul-140.3%

        \[\leadsto \color{blue}{-im} \]
    9. Simplified40.3%

      \[\leadsto \color{blue}{-im} \]

    if 2.8500000000000001e158 < re

    1. Initial program 43.8%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg43.8%

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left(e^{-im} - e^{im}\right) + \color{blue}{\left(-0.25 \cdot {re}^{2}\right) \cdot \left(e^{-im} - e^{im}\right)} \]
      4. distribute-rgt-out20.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 2.85 \cdot 10^{+158}:\\ \;\;\;\;-im\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \cdot 27\\ \end{array} \]

Alternative 15: 35.7% accurate, 34.3× speedup?

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

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

    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
  2. Step-by-step derivation
    1. sub0-neg49.3%

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

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

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

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

      \[\leadsto -\color{blue}{im \cdot \cos re} \]
    3. distribute-lft-neg-in57.0%

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left({re}^{2} \cdot im\right) - im} \]
    4. *-commutative41.6%

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

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

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

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

Alternative 16: 31.0% accurate, 43.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq 1.75 \cdot 10^{+190}:\\ \;\;\;\;-im\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(re \cdot 0.75\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re 1.75e+190) (- im) (* re (* re 0.75))))
double code(double re, double im) {
	double tmp;
	if (re <= 1.75e+190) {
		tmp = -im;
	} else {
		tmp = re * (re * 0.75);
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= 1.75d+190) then
        tmp = -im
    else
        tmp = re * (re * 0.75d0)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= 1.75e+190) {
		tmp = -im;
	} else {
		tmp = re * (re * 0.75);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= 1.75e+190:
		tmp = -im
	else:
		tmp = re * (re * 0.75)
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= 1.75e+190)
		tmp = Float64(-im);
	else
		tmp = Float64(re * Float64(re * 0.75));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= 1.75e+190)
		tmp = -im;
	else
		tmp = re * (re * 0.75);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, 1.75e+190], (-im), N[(re * N[(re * 0.75), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.75 \cdot 10^{+190}:\\
\;\;\;\;-im\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if re < 1.7499999999999999e190

    1. Initial program 49.7%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg49.7%

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

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

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

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

        \[\leadsto -\color{blue}{im \cdot \cos re} \]
      3. distribute-lft-neg-in56.7%

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

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

      \[\leadsto \color{blue}{-1 \cdot im} \]
    8. Step-by-step derivation
      1. neg-mul-140.0%

        \[\leadsto \color{blue}{-im} \]
    9. Simplified40.0%

      \[\leadsto \color{blue}{-im} \]

    if 1.7499999999999999e190 < re

    1. Initial program 46.7%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. sub0-neg46.7%

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left(e^{-im} - e^{im}\right) + \color{blue}{\left(-0.25 \cdot {re}^{2}\right) \cdot \left(e^{-im} - e^{im}\right)} \]
      4. distribute-rgt-out21.5%

        \[\leadsto \color{blue}{\left(e^{-im} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot {re}^{2}\right)} \]
      5. *-commutative21.5%

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

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

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

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

      \[\leadsto \color{blue}{-3} \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \]
    8. Taylor expanded in re around inf 18.8%

      \[\leadsto \color{blue}{0.75 \cdot {re}^{2}} \]
    9. Step-by-step derivation
      1. *-commutative18.8%

        \[\leadsto \color{blue}{{re}^{2} \cdot 0.75} \]
      2. unpow218.8%

        \[\leadsto \color{blue}{\left(re \cdot re\right)} \cdot 0.75 \]
      3. associate-*l*18.8%

        \[\leadsto \color{blue}{re \cdot \left(re \cdot 0.75\right)} \]
    10. Simplified18.8%

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

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

Alternative 17: 29.4% accurate, 154.5× speedup?

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

\\
-im
\end{array}
Derivation
  1. Initial program 49.3%

    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
  2. Step-by-step derivation
    1. sub0-neg49.3%

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

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

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

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

      \[\leadsto -\color{blue}{im \cdot \cos re} \]
    3. distribute-lft-neg-in57.0%

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

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

    \[\leadsto \color{blue}{-1 \cdot im} \]
  8. Step-by-step derivation
    1. neg-mul-136.7%

      \[\leadsto \color{blue}{-im} \]
  9. Simplified36.7%

    \[\leadsto \color{blue}{-im} \]
  10. Final simplification36.7%

    \[\leadsto -im \]

Alternative 18: 2.9% accurate, 309.0× speedup?

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

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

    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
  2. Step-by-step derivation
    1. sub0-neg49.3%

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(e^{-im} - e^{im}\right) + -0.25 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot {re}^{2}\right)} \]
    2. *-commutative4.1%

      \[\leadsto 0.5 \cdot \left(e^{-im} - e^{im}\right) + -0.25 \cdot \color{blue}{\left({re}^{2} \cdot \left(e^{-im} - e^{im}\right)\right)} \]
    3. associate-*r*4.1%

      \[\leadsto 0.5 \cdot \left(e^{-im} - e^{im}\right) + \color{blue}{\left(-0.25 \cdot {re}^{2}\right) \cdot \left(e^{-im} - e^{im}\right)} \]
    4. distribute-rgt-out37.3%

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

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

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

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

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

    \[\leadsto \color{blue}{-3} \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \]
  8. Taylor expanded in re around 0 2.8%

    \[\leadsto \color{blue}{-1.5} \]
  9. Final simplification2.8%

    \[\leadsto -1.5 \]

Developer target: 99.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\left|im\right| < 1:\\
\;\;\;\;-\cos 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 \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023199 
(FPCore (re im)
  :name "math.sin on complex, imaginary part"
  :precision binary64

  :herbie-target
  (if (< (fabs im) 1.0) (- (* (cos re) (+ (+ im (* (* (* 0.16666666666666666 im) im) im)) (* (* (* (* (* 0.008333333333333333 im) im) im) im) im)))) (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))

  (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))