math.cos on complex, imaginary part

Percentage Accurate: 66.0% → 99.8%
Time: 7.9s
Alternatives: 14
Speedup: 2.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 66.0% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.4× speedup?

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

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

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


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

    1. Initial program 100.0%

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

    if -3.9999999999999997e23 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 0.10000000000000001

    1. Initial program 30.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.5% accurate, 0.4× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < -3.9999999999999997e23 or 2.00000000000000012e-9 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))

    1. Initial program 100.0%

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

    if -3.9999999999999997e23 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 2.00000000000000012e-9

    1. Initial program 29.6%

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

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

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

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

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

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

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

Alternative 3: 94.6% accurate, 1.4× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -2.44999999999999995e67 or 5.5999999999999996 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\sin re \cdot {im}^{7}\right) \cdot -0.0001984126984126984} \]
      2. *-commutative94.9%

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

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

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

    if -2.44999999999999995e67 < im < -19.5

    1. Initial program 99.9%

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

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

    if -19.5 < im < 5.5999999999999996

    1. Initial program 30.7%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -2.45 \cdot 10^{+67}:\\ \;\;\;\;{im}^{7} \cdot \left(\sin re \cdot -0.0001984126984126984\right)\\ \mathbf{elif}\;im \leq -19.5:\\ \;\;\;\;0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)\\ \mathbf{elif}\;im \leq 5.6:\\ \;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\ \mathbf{else}:\\ \;\;\;\;{im}^{7} \cdot \left(\sin re \cdot -0.0001984126984126984\right)\\ \end{array} \]

Alternative 4: 94.3% accurate, 1.5× speedup?

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

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

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\sin re \cdot {im}^{7}\right) \cdot -0.0001984126984126984} \]
      2. *-commutative94.9%

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

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

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

    if -2.44999999999999995e67 < im < -19.5

    1. Initial program 99.9%

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

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

    if -19.5 < im < 4.20000000000000018

    1. Initial program 30.7%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -2.45 \cdot 10^{+67}:\\ \;\;\;\;{im}^{7} \cdot \left(\sin re \cdot -0.0001984126984126984\right)\\ \mathbf{elif}\;im \leq -19.5:\\ \;\;\;\;0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)\\ \mathbf{elif}\;im \leq 4.2:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \mathbf{else}:\\ \;\;\;\;{im}^{7} \cdot \left(\sin re \cdot -0.0001984126984126984\right)\\ \end{array} \]

Alternative 5: 92.2% accurate, 1.5× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\sin re \cdot {im}^{7}\right) \cdot -0.0001984126984126984} \]
      2. *-commutative85.4%

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

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

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

    if -4.20000000000000018 < im < 4.20000000000000018

    1. Initial program 30.1%

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

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

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

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

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

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

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

Alternative 6: 59.6% accurate, 2.7× speedup?

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

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

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

\mathbf{elif}\;im \leq 6.4 \cdot 10^{+125}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -3.4e14 or 580 < im < 6.39999999999999967e125

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.4e14 < im < 580

    1. Initial program 33.3%

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

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

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

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

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

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

    if 6.39999999999999967e125 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -3.4 \cdot 10^{+14}:\\ \;\;\;\;0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right)\\ \mathbf{elif}\;im \leq 580:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \mathbf{elif}\;im \leq 6.4 \cdot 10^{+125}:\\ \;\;\;\;0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(-re\right)\\ \end{array} \]

Alternative 7: 81.3% accurate, 2.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq -22000000000000 \lor \neg \left(im \leq 9.4 \cdot 10^{+29}\right):\\
\;\;\;\;{im}^{7} \cdot \left(re \cdot -0.0001984126984126984\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < -2.2e13 or 9.4000000000000004e29 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-0.0001984126984126984 \cdot re\right) \cdot {im}^{7}} \]
      2. *-commutative66.0%

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

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

    if -2.2e13 < im < 9.4000000000000004e29

    1. Initial program 34.7%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -22000000000000 \lor \neg \left(im \leq 9.4 \cdot 10^{+29}\right):\\ \;\;\;\;{im}^{7} \cdot \left(re \cdot -0.0001984126984126984\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \end{array} \]

Alternative 8: 55.7% accurate, 2.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq -6.4 \cdot 10^{+103} \lor \neg \left(im \leq 5.9 \cdot 10^{+134}\right):\\
\;\;\;\;im \cdot \left(-re\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < -6.39999999999999985e103 or 5.90000000000000008e134 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

    if -6.39999999999999985e103 < im < 5.90000000000000008e134

    1. Initial program 50.4%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -6.4 \cdot 10^{+103} \lor \neg \left(im \leq 5.9 \cdot 10^{+134}\right):\\ \;\;\;\;im \cdot \left(-re\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-im\right) \cdot \sin re\\ \end{array} \]

Alternative 9: 32.7% accurate, 77.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 2.7% accurate, 308.0× speedup?

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

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

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

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

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

    \[\leadsto -1.5 \]

Alternative 11: 2.7% accurate, 308.0× speedup?

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

\\
-0.004166666666666667
\end{array}
Derivation
  1. Initial program 65.3%

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

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

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

    \[\leadsto -0.004166666666666667 \]

Alternative 12: 2.8% accurate, 308.0× speedup?

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

\\
-3.9055157630365495 \cdot 10^{-12}
\end{array}
Derivation
  1. Initial program 65.3%

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

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

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

    \[\leadsto -3.9055157630365495 \cdot 10^{-12} \]

Alternative 13: 2.9% accurate, 308.0× speedup?

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

\\
-2.382841615671091 \cdot 10^{-34}
\end{array}
Derivation
  1. Initial program 65.3%

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

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

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

    \[\leadsto -2.382841615671091 \cdot 10^{-34} \]

Alternative 14: 14.8% accurate, 308.0× speedup?

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

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

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

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

    \[\leadsto 0.5 \cdot \color{blue}{0} \]
  4. Final simplification14.6%

    \[\leadsto 0 \]

Developer target: 99.8% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}

Reproduce

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

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

  (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))