math.sin on complex, imaginary part

Percentage Accurate: 55.1% → 99.9%
Time: 13.1s
Alternatives: 13
Speedup: 13.4×

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 13 alternatives:

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

Initial Program: 55.1% 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.9% accurate, 1.5× speedup?

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

\\
\cos re \cdot \left(0 - \sinh im\right)
\end{array}
Derivation
  1. Initial program 55.8%

    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-*l*N/A

      \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(\cos re \cdot \left(e^{0 - im} - e^{im}\right)\right)} \]
    2. *-commutativeN/A

      \[\leadsto \left(\cos re \cdot \left(e^{0 - im} - e^{im}\right)\right) \cdot \color{blue}{\frac{1}{2}} \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(\cos re \cdot \left(e^{0 - im} - e^{im}\right)\right), \color{blue}{\frac{1}{2}}\right) \]
  4. Applied egg-rr99.9%

    \[\leadsto \color{blue}{\left(\cos re \cdot \left(-2 \cdot \sinh im\right)\right) \cdot 0.5} \]
  5. Step-by-step derivation
    1. remove-double-divN/A

      \[\leadsto \left(\cos re \cdot \frac{1}{\frac{1}{-2 \cdot \sinh im}}\right) \cdot \frac{1}{2} \]
    2. un-div-invN/A

      \[\leadsto \frac{\cos re}{\frac{1}{-2 \cdot \sinh im}} \cdot \frac{1}{2} \]
    3. associate-/l/N/A

      \[\leadsto \frac{\cos re}{\frac{\frac{1}{\sinh im}}{-2}} \cdot \frac{1}{2} \]
    4. associate-/r/N/A

      \[\leadsto \left(\frac{\cos re}{\frac{1}{\sinh im}} \cdot -2\right) \cdot \frac{1}{2} \]
    5. associate-*l*N/A

      \[\leadsto \frac{\cos re}{\frac{1}{\sinh im}} \cdot \color{blue}{\left(-2 \cdot \frac{1}{2}\right)} \]
    6. metadata-evalN/A

      \[\leadsto \frac{\cos re}{\frac{1}{\sinh im}} \cdot -1 \]
    7. *-commutativeN/A

      \[\leadsto -1 \cdot \color{blue}{\frac{\cos re}{\frac{1}{\sinh im}}} \]
    8. neg-mul-1N/A

      \[\leadsto \mathsf{neg}\left(\frac{\cos re}{\frac{1}{\sinh im}}\right) \]
    9. neg-lowering-neg.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\cos re}{\frac{1}{\sinh im}}\right)\right) \]
    10. associate-/r/N/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\cos re}{1} \cdot \sinh im\right)\right) \]
    11. /-rgt-identityN/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\cos re \cdot \sinh im\right)\right) \]
    12. *-lowering-*.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\cos re, \sinh im\right)\right) \]
    13. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \sinh im\right)\right) \]
    14. sinh-lowering-sinh.f6499.9%

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{sinh.f64}\left(im\right)\right)\right) \]
  6. Applied egg-rr99.9%

    \[\leadsto \color{blue}{-\cos re \cdot \sinh im} \]
  7. Final simplification99.9%

    \[\leadsto \cos re \cdot \left(0 - \sinh im\right) \]
  8. Add Preprocessing

Alternative 2: 95.6% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\cos re \leq 0.983:\\ \;\;\;\;\left(\cos re \cdot 0.5\right) \cdot \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot \left(-0.3333333333333333 + \left(im \cdot im\right) \cdot \left(-0.016666666666666666 + \left(im \cdot im\right) \cdot -0.0003968253968253968\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0 - \sinh im\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= (cos re) 0.983)
   (*
    (* (cos re) 0.5)
    (*
     im
     (+
      -2.0
      (*
       (* im im)
       (+
        -0.3333333333333333
        (*
         (* im im)
         (+ -0.016666666666666666 (* (* im im) -0.0003968253968253968))))))))
   (- 0.0 (sinh im))))
double code(double re, double im) {
	double tmp;
	if (cos(re) <= 0.983) {
		tmp = (cos(re) * 0.5) * (im * (-2.0 + ((im * im) * (-0.3333333333333333 + ((im * im) * (-0.016666666666666666 + ((im * im) * -0.0003968253968253968)))))));
	} else {
		tmp = 0.0 - sinh(im);
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (cos(re) <= 0.983d0) then
        tmp = (cos(re) * 0.5d0) * (im * ((-2.0d0) + ((im * im) * ((-0.3333333333333333d0) + ((im * im) * ((-0.016666666666666666d0) + ((im * im) * (-0.0003968253968253968d0))))))))
    else
        tmp = 0.0d0 - sinh(im)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (Math.cos(re) <= 0.983) {
		tmp = (Math.cos(re) * 0.5) * (im * (-2.0 + ((im * im) * (-0.3333333333333333 + ((im * im) * (-0.016666666666666666 + ((im * im) * -0.0003968253968253968)))))));
	} else {
		tmp = 0.0 - Math.sinh(im);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if math.cos(re) <= 0.983:
		tmp = (math.cos(re) * 0.5) * (im * (-2.0 + ((im * im) * (-0.3333333333333333 + ((im * im) * (-0.016666666666666666 + ((im * im) * -0.0003968253968253968)))))))
	else:
		tmp = 0.0 - math.sinh(im)
	return tmp
function code(re, im)
	tmp = 0.0
	if (cos(re) <= 0.983)
		tmp = Float64(Float64(cos(re) * 0.5) * Float64(im * Float64(-2.0 + Float64(Float64(im * im) * Float64(-0.3333333333333333 + Float64(Float64(im * im) * Float64(-0.016666666666666666 + Float64(Float64(im * im) * -0.0003968253968253968))))))));
	else
		tmp = Float64(0.0 - sinh(im));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (cos(re) <= 0.983)
		tmp = (cos(re) * 0.5) * (im * (-2.0 + ((im * im) * (-0.3333333333333333 + ((im * im) * (-0.016666666666666666 + ((im * im) * -0.0003968253968253968)))))));
	else
		tmp = 0.0 - sinh(im);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[N[Cos[re], $MachinePrecision], 0.983], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(im * N[(-2.0 + N[(N[(im * im), $MachinePrecision] * N[(-0.3333333333333333 + N[(N[(im * im), $MachinePrecision] * N[(-0.016666666666666666 + N[(N[(im * im), $MachinePrecision] * -0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 - N[Sinh[im], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\cos re \leq 0.983:\\
\;\;\;\;\left(\cos re \cdot 0.5\right) \cdot \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot \left(-0.3333333333333333 + \left(im \cdot im\right) \cdot \left(-0.016666666666666666 + \left(im \cdot im\right) \cdot -0.0003968253968253968\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0 - \sinh im\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (cos.f64 re) < 0.982999999999999985

    1. Initial program 55.6%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \color{blue}{\left(im \cdot \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right)\right)}\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right)}\right)\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) + \color{blue}{\left(\mathsf{neg}\left(2\right)\right)}\right)\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) + -2\right)\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \left(-2 + \color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)}\right)\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)}\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)}\right)\right)\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\left(im \cdot im\right), \left(\color{blue}{{im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)} - \frac{1}{3}\right)\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{{im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)} - \frac{1}{3}\right)\right)\right)\right)\right) \]
      9. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{3}\right)\right)}\right)\right)\right)\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) + \frac{-1}{3}\right)\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{3} + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)}\right)\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)}\right)\right)\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)}\right)\right)\right)\right)\right)\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\left(im \cdot im\right), \left(\color{blue}{\frac{-1}{2520} \cdot {im}^{2}} - \frac{1}{60}\right)\right)\right)\right)\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{\frac{-1}{2520} \cdot {im}^{2}} - \frac{1}{60}\right)\right)\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{2520} \cdot {im}^{2} + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{60}\right)\right)}\right)\right)\right)\right)\right)\right)\right) \]
      17. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{2520} \cdot {im}^{2} + \frac{-1}{60}\right)\right)\right)\right)\right)\right)\right) \]
      18. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{60} + \color{blue}{\frac{-1}{2520} \cdot {im}^{2}}\right)\right)\right)\right)\right)\right)\right) \]
      19. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{60}, \color{blue}{\left(\frac{-1}{2520} \cdot {im}^{2}\right)}\right)\right)\right)\right)\right)\right)\right) \]
      20. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{60}, \left({im}^{2} \cdot \color{blue}{\frac{-1}{2520}}\right)\right)\right)\right)\right)\right)\right)\right) \]
      21. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{60}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\frac{-1}{2520}}\right)\right)\right)\right)\right)\right)\right)\right) \]
      22. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{60}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{-1}{2520}\right)\right)\right)\right)\right)\right)\right)\right) \]
      23. *-lowering-*.f6496.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{60}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{2520}\right)\right)\right)\right)\right)\right)\right)\right) \]
    5. Simplified96.8%

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

    if 0.982999999999999985 < (cos.f64 re)

    1. Initial program 56.1%

      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*N/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(\cos re \cdot \left(e^{0 - im} - e^{im}\right)\right)} \]
      2. *-commutativeN/A

        \[\leadsto \left(\cos re \cdot \left(e^{0 - im} - e^{im}\right)\right) \cdot \color{blue}{\frac{1}{2}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\cos re \cdot \left(e^{0 - im} - e^{im}\right)\right), \color{blue}{\frac{1}{2}}\right) \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\left(\cos re \cdot \left(-2 \cdot \sinh im\right)\right) \cdot 0.5} \]
    5. Step-by-step derivation
      1. remove-double-divN/A

        \[\leadsto \left(\cos re \cdot \frac{1}{\frac{1}{-2 \cdot \sinh im}}\right) \cdot \frac{1}{2} \]
      2. un-div-invN/A

        \[\leadsto \frac{\cos re}{\frac{1}{-2 \cdot \sinh im}} \cdot \frac{1}{2} \]
      3. associate-/l/N/A

        \[\leadsto \frac{\cos re}{\frac{\frac{1}{\sinh im}}{-2}} \cdot \frac{1}{2} \]
      4. associate-/r/N/A

        \[\leadsto \left(\frac{\cos re}{\frac{1}{\sinh im}} \cdot -2\right) \cdot \frac{1}{2} \]
      5. associate-*l*N/A

        \[\leadsto \frac{\cos re}{\frac{1}{\sinh im}} \cdot \color{blue}{\left(-2 \cdot \frac{1}{2}\right)} \]
      6. metadata-evalN/A

        \[\leadsto \frac{\cos re}{\frac{1}{\sinh im}} \cdot -1 \]
      7. *-commutativeN/A

        \[\leadsto -1 \cdot \color{blue}{\frac{\cos re}{\frac{1}{\sinh im}}} \]
      8. neg-mul-1N/A

        \[\leadsto \mathsf{neg}\left(\frac{\cos re}{\frac{1}{\sinh im}}\right) \]
      9. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\cos re}{\frac{1}{\sinh im}}\right)\right) \]
      10. associate-/r/N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\cos re}{1} \cdot \sinh im\right)\right) \]
      11. /-rgt-identityN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\cos re \cdot \sinh im\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\cos re, \sinh im\right)\right) \]
      13. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \sinh im\right)\right) \]
      14. sinh-lowering-sinh.f64100.0%

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{sinh.f64}\left(im\right)\right)\right) \]
    6. Applied egg-rr100.0%

      \[\leadsto \color{blue}{-\cos re \cdot \sinh im} \]
    7. Taylor expanded in re around 0

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\color{blue}{1}, \mathsf{sinh.f64}\left(im\right)\right)\right) \]
    8. Step-by-step derivation
      1. Simplified99.9%

        \[\leadsto -\color{blue}{1} \cdot \sinh im \]
    9. Recombined 2 regimes into one program.
    10. Final simplification98.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\cos re \leq 0.983:\\ \;\;\;\;\left(\cos re \cdot 0.5\right) \cdot \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot \left(-0.3333333333333333 + \left(im \cdot im\right) \cdot \left(-0.016666666666666666 + \left(im \cdot im\right) \cdot -0.0003968253968253968\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0 - \sinh im\\ \end{array} \]
    11. Add Preprocessing

    Alternative 3: 94.2% accurate, 1.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\cos re \leq 0.983:\\ \;\;\;\;im \cdot \left(\cos re \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot -0.008333333333333333\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0 - \sinh im\\ \end{array} \end{array} \]
    (FPCore (re im)
     :precision binary64
     (if (<= (cos re) 0.983)
       (*
        im
        (*
         (cos re)
         (+
          -1.0
          (*
           (* im im)
           (+ -0.16666666666666666 (* (* im im) -0.008333333333333333))))))
       (- 0.0 (sinh im))))
    double code(double re, double im) {
    	double tmp;
    	if (cos(re) <= 0.983) {
    		tmp = im * (cos(re) * (-1.0 + ((im * im) * (-0.16666666666666666 + ((im * im) * -0.008333333333333333)))));
    	} else {
    		tmp = 0.0 - sinh(im);
    	}
    	return tmp;
    }
    
    real(8) function code(re, im)
        real(8), intent (in) :: re
        real(8), intent (in) :: im
        real(8) :: tmp
        if (cos(re) <= 0.983d0) then
            tmp = im * (cos(re) * ((-1.0d0) + ((im * im) * ((-0.16666666666666666d0) + ((im * im) * (-0.008333333333333333d0))))))
        else
            tmp = 0.0d0 - sinh(im)
        end if
        code = tmp
    end function
    
    public static double code(double re, double im) {
    	double tmp;
    	if (Math.cos(re) <= 0.983) {
    		tmp = im * (Math.cos(re) * (-1.0 + ((im * im) * (-0.16666666666666666 + ((im * im) * -0.008333333333333333)))));
    	} else {
    		tmp = 0.0 - Math.sinh(im);
    	}
    	return tmp;
    }
    
    def code(re, im):
    	tmp = 0
    	if math.cos(re) <= 0.983:
    		tmp = im * (math.cos(re) * (-1.0 + ((im * im) * (-0.16666666666666666 + ((im * im) * -0.008333333333333333)))))
    	else:
    		tmp = 0.0 - math.sinh(im)
    	return tmp
    
    function code(re, im)
    	tmp = 0.0
    	if (cos(re) <= 0.983)
    		tmp = Float64(im * Float64(cos(re) * Float64(-1.0 + Float64(Float64(im * im) * Float64(-0.16666666666666666 + Float64(Float64(im * im) * -0.008333333333333333))))));
    	else
    		tmp = Float64(0.0 - sinh(im));
    	end
    	return tmp
    end
    
    function tmp_2 = code(re, im)
    	tmp = 0.0;
    	if (cos(re) <= 0.983)
    		tmp = im * (cos(re) * (-1.0 + ((im * im) * (-0.16666666666666666 + ((im * im) * -0.008333333333333333)))));
    	else
    		tmp = 0.0 - sinh(im);
    	end
    	tmp_2 = tmp;
    end
    
    code[re_, im_] := If[LessEqual[N[Cos[re], $MachinePrecision], 0.983], N[(im * N[(N[Cos[re], $MachinePrecision] * N[(-1.0 + N[(N[(im * im), $MachinePrecision] * N[(-0.16666666666666666 + N[(N[(im * im), $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 - N[Sinh[im], $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;\cos re \leq 0.983:\\
    \;\;\;\;im \cdot \left(\cos re \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot -0.008333333333333333\right)\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;0 - \sinh im\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (cos.f64 re) < 0.982999999999999985

      1. Initial program 55.6%

        \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
      2. Add Preprocessing
      3. Taylor expanded in im around 0

        \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)} \]
      4. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(im, \color{blue}{\left(-1 \cdot \cos re + {im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)}\right) \]
        2. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re + \frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right)\right)\right) \]
        3. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + {im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right) + \color{blue}{\frac{-1}{6} \cdot \cos re}\right)\right)\right) \]
        4. distribute-lft-inN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot \left({im}^{2} \cdot \cos re\right)\right) + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{6} \cdot \cos re\right)}\right)\right)\right) \]
        5. associate-*r*N/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left({im}^{2} \cdot \left(\left(\frac{-1}{120} \cdot {im}^{2}\right) \cdot \cos re\right) + {im}^{\color{blue}{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
        6. associate-*r*N/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \color{blue}{{im}^{2}} \cdot \left(\frac{-1}{6} \cdot \cos re\right)\right)\right)\right) \]
        7. associate-*r*N/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left({im}^{2} \cdot \frac{-1}{6}\right) \cdot \color{blue}{\cos re}\right)\right)\right) \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \left(\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right)\right) \cdot \cos re + \left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \cos \color{blue}{re}\right)\right)\right) \]
        9. distribute-rgt-outN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot -1 + \cos re \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)}\right)\right) \]
        10. distribute-lft-outN/A

          \[\leadsto \mathsf{*.f64}\left(im, \left(\cos re \cdot \color{blue}{\left(-1 + \left({im}^{2} \cdot \left(\frac{-1}{120} \cdot {im}^{2}\right) + \frac{-1}{6} \cdot {im}^{2}\right)\right)}\right)\right) \]
      5. Simplified95.4%

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

      if 0.982999999999999985 < (cos.f64 re)

      1. Initial program 56.1%

        \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. associate-*l*N/A

          \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(\cos re \cdot \left(e^{0 - im} - e^{im}\right)\right)} \]
        2. *-commutativeN/A

          \[\leadsto \left(\cos re \cdot \left(e^{0 - im} - e^{im}\right)\right) \cdot \color{blue}{\frac{1}{2}} \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\left(\cos re \cdot \left(e^{0 - im} - e^{im}\right)\right), \color{blue}{\frac{1}{2}}\right) \]
      4. Applied egg-rr100.0%

        \[\leadsto \color{blue}{\left(\cos re \cdot \left(-2 \cdot \sinh im\right)\right) \cdot 0.5} \]
      5. Step-by-step derivation
        1. remove-double-divN/A

          \[\leadsto \left(\cos re \cdot \frac{1}{\frac{1}{-2 \cdot \sinh im}}\right) \cdot \frac{1}{2} \]
        2. un-div-invN/A

          \[\leadsto \frac{\cos re}{\frac{1}{-2 \cdot \sinh im}} \cdot \frac{1}{2} \]
        3. associate-/l/N/A

          \[\leadsto \frac{\cos re}{\frac{\frac{1}{\sinh im}}{-2}} \cdot \frac{1}{2} \]
        4. associate-/r/N/A

          \[\leadsto \left(\frac{\cos re}{\frac{1}{\sinh im}} \cdot -2\right) \cdot \frac{1}{2} \]
        5. associate-*l*N/A

          \[\leadsto \frac{\cos re}{\frac{1}{\sinh im}} \cdot \color{blue}{\left(-2 \cdot \frac{1}{2}\right)} \]
        6. metadata-evalN/A

          \[\leadsto \frac{\cos re}{\frac{1}{\sinh im}} \cdot -1 \]
        7. *-commutativeN/A

          \[\leadsto -1 \cdot \color{blue}{\frac{\cos re}{\frac{1}{\sinh im}}} \]
        8. neg-mul-1N/A

          \[\leadsto \mathsf{neg}\left(\frac{\cos re}{\frac{1}{\sinh im}}\right) \]
        9. neg-lowering-neg.f64N/A

          \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\cos re}{\frac{1}{\sinh im}}\right)\right) \]
        10. associate-/r/N/A

          \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\cos re}{1} \cdot \sinh im\right)\right) \]
        11. /-rgt-identityN/A

          \[\leadsto \mathsf{neg.f64}\left(\left(\cos re \cdot \sinh im\right)\right) \]
        12. *-lowering-*.f64N/A

          \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\cos re, \sinh im\right)\right) \]
        13. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \sinh im\right)\right) \]
        14. sinh-lowering-sinh.f64100.0%

          \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{sinh.f64}\left(im\right)\right)\right) \]
      6. Applied egg-rr100.0%

        \[\leadsto \color{blue}{-\cos re \cdot \sinh im} \]
      7. Taylor expanded in re around 0

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\color{blue}{1}, \mathsf{sinh.f64}\left(im\right)\right)\right) \]
      8. Step-by-step derivation
        1. Simplified99.9%

          \[\leadsto -\color{blue}{1} \cdot \sinh im \]
      9. Recombined 2 regimes into one program.
      10. Final simplification97.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\cos re \leq 0.983:\\ \;\;\;\;im \cdot \left(\cos re \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot -0.008333333333333333\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0 - \sinh im\\ \end{array} \]
      11. Add Preprocessing

      Alternative 4: 89.3% accurate, 2.6× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos re \cdot \left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\\ \mathbf{if}\;im \leq 0.00013:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;im \leq 1.05 \cdot 10^{+103}:\\ \;\;\;\;0 - \sinh im\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (re im)
       :precision binary64
       (let* ((t_0 (* (cos re) (* im (+ -1.0 (* (* im im) -0.16666666666666666))))))
         (if (<= im 0.00013) t_0 (if (<= im 1.05e+103) (- 0.0 (sinh im)) t_0))))
      double code(double re, double im) {
      	double t_0 = cos(re) * (im * (-1.0 + ((im * im) * -0.16666666666666666)));
      	double tmp;
      	if (im <= 0.00013) {
      		tmp = t_0;
      	} else if (im <= 1.05e+103) {
      		tmp = 0.0 - sinh(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 = cos(re) * (im * ((-1.0d0) + ((im * im) * (-0.16666666666666666d0))))
          if (im <= 0.00013d0) then
              tmp = t_0
          else if (im <= 1.05d+103) then
              tmp = 0.0d0 - sinh(im)
          else
              tmp = t_0
          end if
          code = tmp
      end function
      
      public static double code(double re, double im) {
      	double t_0 = Math.cos(re) * (im * (-1.0 + ((im * im) * -0.16666666666666666)));
      	double tmp;
      	if (im <= 0.00013) {
      		tmp = t_0;
      	} else if (im <= 1.05e+103) {
      		tmp = 0.0 - Math.sinh(im);
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      def code(re, im):
      	t_0 = math.cos(re) * (im * (-1.0 + ((im * im) * -0.16666666666666666)))
      	tmp = 0
      	if im <= 0.00013:
      		tmp = t_0
      	elif im <= 1.05e+103:
      		tmp = 0.0 - math.sinh(im)
      	else:
      		tmp = t_0
      	return tmp
      
      function code(re, im)
      	t_0 = Float64(cos(re) * Float64(im * Float64(-1.0 + Float64(Float64(im * im) * -0.16666666666666666))))
      	tmp = 0.0
      	if (im <= 0.00013)
      		tmp = t_0;
      	elseif (im <= 1.05e+103)
      		tmp = Float64(0.0 - sinh(im));
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      function tmp_2 = code(re, im)
      	t_0 = cos(re) * (im * (-1.0 + ((im * im) * -0.16666666666666666)));
      	tmp = 0.0;
      	if (im <= 0.00013)
      		tmp = t_0;
      	elseif (im <= 1.05e+103)
      		tmp = 0.0 - sinh(im);
      	else
      		tmp = t_0;
      	end
      	tmp_2 = tmp;
      end
      
      code[re_, im_] := Block[{t$95$0 = N[(N[Cos[re], $MachinePrecision] * N[(im * N[(-1.0 + N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 0.00013], t$95$0, If[LessEqual[im, 1.05e+103], N[(0.0 - N[Sinh[im], $MachinePrecision]), $MachinePrecision], t$95$0]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \cos re \cdot \left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\\
      \mathbf{if}\;im \leq 0.00013:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;im \leq 1.05 \cdot 10^{+103}:\\
      \;\;\;\;0 - \sinh im\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if im < 1.29999999999999989e-4 or 1.0500000000000001e103 < im

        1. Initial program 51.6%

          \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
        2. Add Preprocessing
        3. Taylor expanded in im around 0

          \[\leadsto \color{blue}{im \cdot \left(-1 \cdot \cos re + \frac{-1}{6} \cdot \left({im}^{2} \cdot \cos re\right)\right)} \]
        4. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left({im}^{2} \cdot \cos re\right) + \color{blue}{-1 \cdot \cos re}\right) \]
          2. *-commutativeN/A

            \[\leadsto im \cdot \left(\frac{-1}{6} \cdot \left(\cos re \cdot {im}^{2}\right) + -1 \cdot \cos re\right) \]
          3. associate-*r*N/A

            \[\leadsto im \cdot \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2} + \color{blue}{-1} \cdot \cos re\right) \]
          4. +-commutativeN/A

            \[\leadsto im \cdot \left(-1 \cdot \cos re + \color{blue}{\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}}\right) \]
          5. distribute-lft-inN/A

            \[\leadsto im \cdot \left(-1 \cdot \cos re\right) + \color{blue}{im \cdot \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right)} \]
          6. associate-*r*N/A

            \[\leadsto \left(im \cdot -1\right) \cdot \cos re + \color{blue}{im} \cdot \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) \]
          7. *-commutativeN/A

            \[\leadsto \left(-1 \cdot im\right) \cdot \cos re + im \cdot \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) \]
          8. neg-mul-1N/A

            \[\leadsto \left(\mathsf{neg}\left(im\right)\right) \cdot \cos re + im \cdot \left(\left(\frac{-1}{6} \cdot \cos re\right) \cdot {im}^{2}\right) \]
          9. associate-*r*N/A

            \[\leadsto \left(\mathsf{neg}\left(im\right)\right) \cdot \cos re + im \cdot \left(\frac{-1}{6} \cdot \color{blue}{\left(\cos re \cdot {im}^{2}\right)}\right) \]
          10. *-commutativeN/A

            \[\leadsto \left(\mathsf{neg}\left(im\right)\right) \cdot \cos re + im \cdot \left(\frac{-1}{6} \cdot \left({im}^{2} \cdot \color{blue}{\cos re}\right)\right) \]
          11. associate-*r*N/A

            \[\leadsto \left(\mathsf{neg}\left(im\right)\right) \cdot \cos re + im \cdot \left(\left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \color{blue}{\cos re}\right) \]
          12. associate-*r*N/A

            \[\leadsto \left(\mathsf{neg}\left(im\right)\right) \cdot \cos re + \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right)\right) \cdot \color{blue}{\cos re} \]
          13. distribute-rgt-outN/A

            \[\leadsto \cos re \cdot \color{blue}{\left(\left(\mathsf{neg}\left(im\right)\right) + im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right)\right)} \]
          14. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\cos re, \color{blue}{\left(\left(\mathsf{neg}\left(im\right)\right) + im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right)\right)}\right) \]
          15. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(\color{blue}{\left(\mathsf{neg}\left(im\right)\right)} + im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right)\right)\right) \]
          16. neg-mul-1N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(-1 \cdot im + \color{blue}{im} \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right)\right)\right) \]
          17. *-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \left(im \cdot -1 + \color{blue}{im} \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right)\right)\right) \]
        5. Simplified94.6%

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

        if 1.29999999999999989e-4 < im < 1.0500000000000001e103

        1. Initial program 100.0%

          \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. associate-*l*N/A

            \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(\cos re \cdot \left(e^{0 - im} - e^{im}\right)\right)} \]
          2. *-commutativeN/A

            \[\leadsto \left(\cos re \cdot \left(e^{0 - im} - e^{im}\right)\right) \cdot \color{blue}{\frac{1}{2}} \]
          3. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\left(\cos re \cdot \left(e^{0 - im} - e^{im}\right)\right), \color{blue}{\frac{1}{2}}\right) \]
        4. Applied egg-rr100.0%

          \[\leadsto \color{blue}{\left(\cos re \cdot \left(-2 \cdot \sinh im\right)\right) \cdot 0.5} \]
        5. Step-by-step derivation
          1. remove-double-divN/A

            \[\leadsto \left(\cos re \cdot \frac{1}{\frac{1}{-2 \cdot \sinh im}}\right) \cdot \frac{1}{2} \]
          2. un-div-invN/A

            \[\leadsto \frac{\cos re}{\frac{1}{-2 \cdot \sinh im}} \cdot \frac{1}{2} \]
          3. associate-/l/N/A

            \[\leadsto \frac{\cos re}{\frac{\frac{1}{\sinh im}}{-2}} \cdot \frac{1}{2} \]
          4. associate-/r/N/A

            \[\leadsto \left(\frac{\cos re}{\frac{1}{\sinh im}} \cdot -2\right) \cdot \frac{1}{2} \]
          5. associate-*l*N/A

            \[\leadsto \frac{\cos re}{\frac{1}{\sinh im}} \cdot \color{blue}{\left(-2 \cdot \frac{1}{2}\right)} \]
          6. metadata-evalN/A

            \[\leadsto \frac{\cos re}{\frac{1}{\sinh im}} \cdot -1 \]
          7. *-commutativeN/A

            \[\leadsto -1 \cdot \color{blue}{\frac{\cos re}{\frac{1}{\sinh im}}} \]
          8. neg-mul-1N/A

            \[\leadsto \mathsf{neg}\left(\frac{\cos re}{\frac{1}{\sinh im}}\right) \]
          9. neg-lowering-neg.f64N/A

            \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\cos re}{\frac{1}{\sinh im}}\right)\right) \]
          10. associate-/r/N/A

            \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\cos re}{1} \cdot \sinh im\right)\right) \]
          11. /-rgt-identityN/A

            \[\leadsto \mathsf{neg.f64}\left(\left(\cos re \cdot \sinh im\right)\right) \]
          12. *-lowering-*.f64N/A

            \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\cos re, \sinh im\right)\right) \]
          13. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \sinh im\right)\right) \]
          14. sinh-lowering-sinh.f64100.0%

            \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{sinh.f64}\left(im\right)\right)\right) \]
        6. Applied egg-rr100.0%

          \[\leadsto \color{blue}{-\cos re \cdot \sinh im} \]
        7. Taylor expanded in re around 0

          \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\color{blue}{1}, \mathsf{sinh.f64}\left(im\right)\right)\right) \]
        8. Step-by-step derivation
          1. Simplified64.3%

            \[\leadsto -\color{blue}{1} \cdot \sinh im \]
        9. Recombined 2 regimes into one program.
        10. Final simplification92.0%

          \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.00013:\\ \;\;\;\;\cos re \cdot \left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\\ \mathbf{elif}\;im \leq 1.05 \cdot 10^{+103}:\\ \;\;\;\;0 - \sinh im\\ \mathbf{else}:\\ \;\;\;\;\cos re \cdot \left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\\ \end{array} \]
        11. Add Preprocessing

        Alternative 5: 68.8% accurate, 2.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 0.00012:\\ \;\;\;\;0 - \cos re \cdot im\\ \mathbf{else}:\\ \;\;\;\;0 - \sinh im\\ \end{array} \end{array} \]
        (FPCore (re im)
         :precision binary64
         (if (<= im 0.00012) (- 0.0 (* (cos re) im)) (- 0.0 (sinh im))))
        double code(double re, double im) {
        	double tmp;
        	if (im <= 0.00012) {
        		tmp = 0.0 - (cos(re) * im);
        	} else {
        		tmp = 0.0 - sinh(im);
        	}
        	return tmp;
        }
        
        real(8) function code(re, im)
            real(8), intent (in) :: re
            real(8), intent (in) :: im
            real(8) :: tmp
            if (im <= 0.00012d0) then
                tmp = 0.0d0 - (cos(re) * im)
            else
                tmp = 0.0d0 - sinh(im)
            end if
            code = tmp
        end function
        
        public static double code(double re, double im) {
        	double tmp;
        	if (im <= 0.00012) {
        		tmp = 0.0 - (Math.cos(re) * im);
        	} else {
        		tmp = 0.0 - Math.sinh(im);
        	}
        	return tmp;
        }
        
        def code(re, im):
        	tmp = 0
        	if im <= 0.00012:
        		tmp = 0.0 - (math.cos(re) * im)
        	else:
        		tmp = 0.0 - math.sinh(im)
        	return tmp
        
        function code(re, im)
        	tmp = 0.0
        	if (im <= 0.00012)
        		tmp = Float64(0.0 - Float64(cos(re) * im));
        	else
        		tmp = Float64(0.0 - sinh(im));
        	end
        	return tmp
        end
        
        function tmp_2 = code(re, im)
        	tmp = 0.0;
        	if (im <= 0.00012)
        		tmp = 0.0 - (cos(re) * im);
        	else
        		tmp = 0.0 - sinh(im);
        	end
        	tmp_2 = tmp;
        end
        
        code[re_, im_] := If[LessEqual[im, 0.00012], N[(0.0 - N[(N[Cos[re], $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], N[(0.0 - N[Sinh[im], $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;im \leq 0.00012:\\
        \;\;\;\;0 - \cos re \cdot im\\
        
        \mathbf{else}:\\
        \;\;\;\;0 - \sinh im\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if im < 1.20000000000000003e-4

          1. Initial program 40.4%

            \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
          2. Add Preprocessing
          3. Taylor expanded in im around 0

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

              \[\leadsto \mathsf{neg}\left(im \cdot \cos re\right) \]
            2. neg-sub0N/A

              \[\leadsto 0 - \color{blue}{im \cdot \cos re} \]
            3. --lowering--.f64N/A

              \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left(im \cdot \cos re\right)}\right) \]
            4. *-lowering-*.f64N/A

              \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \color{blue}{\cos re}\right)\right) \]
            5. cos-lowering-cos.f6465.9%

              \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
          5. Simplified65.9%

            \[\leadsto \color{blue}{0 - im \cdot \cos re} \]
          6. Step-by-step derivation
            1. sub0-negN/A

              \[\leadsto \mathsf{neg}\left(im \cdot \cos re\right) \]
            2. neg-lowering-neg.f64N/A

              \[\leadsto \mathsf{neg.f64}\left(\left(im \cdot \cos re\right)\right) \]
            3. *-commutativeN/A

              \[\leadsto \mathsf{neg.f64}\left(\left(\cos re \cdot im\right)\right) \]
            4. *-lowering-*.f64N/A

              \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\cos re, im\right)\right) \]
            5. cos-lowering-cos.f6465.9%

              \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), im\right)\right) \]
          7. Applied egg-rr65.9%

            \[\leadsto \color{blue}{-\cos re \cdot im} \]

          if 1.20000000000000003e-4 < im

          1. Initial program 100.0%

            \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. associate-*l*N/A

              \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(\cos re \cdot \left(e^{0 - im} - e^{im}\right)\right)} \]
            2. *-commutativeN/A

              \[\leadsto \left(\cos re \cdot \left(e^{0 - im} - e^{im}\right)\right) \cdot \color{blue}{\frac{1}{2}} \]
            3. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\left(\cos re \cdot \left(e^{0 - im} - e^{im}\right)\right), \color{blue}{\frac{1}{2}}\right) \]
          4. Applied egg-rr100.0%

            \[\leadsto \color{blue}{\left(\cos re \cdot \left(-2 \cdot \sinh im\right)\right) \cdot 0.5} \]
          5. Step-by-step derivation
            1. remove-double-divN/A

              \[\leadsto \left(\cos re \cdot \frac{1}{\frac{1}{-2 \cdot \sinh im}}\right) \cdot \frac{1}{2} \]
            2. un-div-invN/A

              \[\leadsto \frac{\cos re}{\frac{1}{-2 \cdot \sinh im}} \cdot \frac{1}{2} \]
            3. associate-/l/N/A

              \[\leadsto \frac{\cos re}{\frac{\frac{1}{\sinh im}}{-2}} \cdot \frac{1}{2} \]
            4. associate-/r/N/A

              \[\leadsto \left(\frac{\cos re}{\frac{1}{\sinh im}} \cdot -2\right) \cdot \frac{1}{2} \]
            5. associate-*l*N/A

              \[\leadsto \frac{\cos re}{\frac{1}{\sinh im}} \cdot \color{blue}{\left(-2 \cdot \frac{1}{2}\right)} \]
            6. metadata-evalN/A

              \[\leadsto \frac{\cos re}{\frac{1}{\sinh im}} \cdot -1 \]
            7. *-commutativeN/A

              \[\leadsto -1 \cdot \color{blue}{\frac{\cos re}{\frac{1}{\sinh im}}} \]
            8. neg-mul-1N/A

              \[\leadsto \mathsf{neg}\left(\frac{\cos re}{\frac{1}{\sinh im}}\right) \]
            9. neg-lowering-neg.f64N/A

              \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\cos re}{\frac{1}{\sinh im}}\right)\right) \]
            10. associate-/r/N/A

              \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\cos re}{1} \cdot \sinh im\right)\right) \]
            11. /-rgt-identityN/A

              \[\leadsto \mathsf{neg.f64}\left(\left(\cos re \cdot \sinh im\right)\right) \]
            12. *-lowering-*.f64N/A

              \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\cos re, \sinh im\right)\right) \]
            13. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \sinh im\right)\right) \]
            14. sinh-lowering-sinh.f64100.0%

              \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{sinh.f64}\left(im\right)\right)\right) \]
          6. Applied egg-rr100.0%

            \[\leadsto \color{blue}{-\cos re \cdot \sinh im} \]
          7. Taylor expanded in re around 0

            \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\color{blue}{1}, \mathsf{sinh.f64}\left(im\right)\right)\right) \]
          8. Step-by-step derivation
            1. Simplified77.5%

              \[\leadsto -\color{blue}{1} \cdot \sinh im \]
          9. Recombined 2 regimes into one program.
          10. Final simplification68.9%

            \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.00012:\\ \;\;\;\;0 - \cos re \cdot im\\ \mathbf{else}:\\ \;\;\;\;0 - \sinh im\\ \end{array} \]
          11. Add Preprocessing

          Alternative 6: 65.4% accurate, 3.0× speedup?

          \[\begin{array}{l} \\ 0 - \sinh im \end{array} \]
          (FPCore (re im) :precision binary64 (- 0.0 (sinh im)))
          double code(double re, double im) {
          	return 0.0 - sinh(im);
          }
          
          real(8) function code(re, im)
              real(8), intent (in) :: re
              real(8), intent (in) :: im
              code = 0.0d0 - sinh(im)
          end function
          
          public static double code(double re, double im) {
          	return 0.0 - Math.sinh(im);
          }
          
          def code(re, im):
          	return 0.0 - math.sinh(im)
          
          function code(re, im)
          	return Float64(0.0 - sinh(im))
          end
          
          function tmp = code(re, im)
          	tmp = 0.0 - sinh(im);
          end
          
          code[re_, im_] := N[(0.0 - N[Sinh[im], $MachinePrecision]), $MachinePrecision]
          
          \begin{array}{l}
          
          \\
          0 - \sinh im
          \end{array}
          
          Derivation
          1. Initial program 55.8%

            \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. associate-*l*N/A

              \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(\cos re \cdot \left(e^{0 - im} - e^{im}\right)\right)} \]
            2. *-commutativeN/A

              \[\leadsto \left(\cos re \cdot \left(e^{0 - im} - e^{im}\right)\right) \cdot \color{blue}{\frac{1}{2}} \]
            3. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\left(\cos re \cdot \left(e^{0 - im} - e^{im}\right)\right), \color{blue}{\frac{1}{2}}\right) \]
          4. Applied egg-rr99.9%

            \[\leadsto \color{blue}{\left(\cos re \cdot \left(-2 \cdot \sinh im\right)\right) \cdot 0.5} \]
          5. Step-by-step derivation
            1. remove-double-divN/A

              \[\leadsto \left(\cos re \cdot \frac{1}{\frac{1}{-2 \cdot \sinh im}}\right) \cdot \frac{1}{2} \]
            2. un-div-invN/A

              \[\leadsto \frac{\cos re}{\frac{1}{-2 \cdot \sinh im}} \cdot \frac{1}{2} \]
            3. associate-/l/N/A

              \[\leadsto \frac{\cos re}{\frac{\frac{1}{\sinh im}}{-2}} \cdot \frac{1}{2} \]
            4. associate-/r/N/A

              \[\leadsto \left(\frac{\cos re}{\frac{1}{\sinh im}} \cdot -2\right) \cdot \frac{1}{2} \]
            5. associate-*l*N/A

              \[\leadsto \frac{\cos re}{\frac{1}{\sinh im}} \cdot \color{blue}{\left(-2 \cdot \frac{1}{2}\right)} \]
            6. metadata-evalN/A

              \[\leadsto \frac{\cos re}{\frac{1}{\sinh im}} \cdot -1 \]
            7. *-commutativeN/A

              \[\leadsto -1 \cdot \color{blue}{\frac{\cos re}{\frac{1}{\sinh im}}} \]
            8. neg-mul-1N/A

              \[\leadsto \mathsf{neg}\left(\frac{\cos re}{\frac{1}{\sinh im}}\right) \]
            9. neg-lowering-neg.f64N/A

              \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\cos re}{\frac{1}{\sinh im}}\right)\right) \]
            10. associate-/r/N/A

              \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\cos re}{1} \cdot \sinh im\right)\right) \]
            11. /-rgt-identityN/A

              \[\leadsto \mathsf{neg.f64}\left(\left(\cos re \cdot \sinh im\right)\right) \]
            12. *-lowering-*.f64N/A

              \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\cos re, \sinh im\right)\right) \]
            13. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \sinh im\right)\right) \]
            14. sinh-lowering-sinh.f6499.9%

              \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(re\right), \mathsf{sinh.f64}\left(im\right)\right)\right) \]
          6. Applied egg-rr99.9%

            \[\leadsto \color{blue}{-\cos re \cdot \sinh im} \]
          7. Taylor expanded in re around 0

            \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\color{blue}{1}, \mathsf{sinh.f64}\left(im\right)\right)\right) \]
          8. Step-by-step derivation
            1. Simplified64.9%

              \[\leadsto -\color{blue}{1} \cdot \sinh im \]
            2. Final simplification64.9%

              \[\leadsto 0 - \sinh im \]
            3. Add Preprocessing

            Alternative 7: 54.3% accurate, 11.4× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\\ t_1 := 0.5 \cdot t\_0\\ \mathbf{if}\;im \leq 5.6 \cdot 10^{+20}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;im \leq 3 \cdot 10^{+132}:\\ \;\;\;\;t\_0 \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
            (FPCore (re im)
             :precision binary64
             (let* ((t_0 (* im (+ -2.0 (* im (* im -0.3333333333333333)))))
                    (t_1 (* 0.5 t_0)))
               (if (<= im 5.6e+20)
                 t_1
                 (if (<= im 3e+132) (* t_0 (+ 0.5 (* (* re re) -0.25))) t_1))))
            double code(double re, double im) {
            	double t_0 = im * (-2.0 + (im * (im * -0.3333333333333333)));
            	double t_1 = 0.5 * t_0;
            	double tmp;
            	if (im <= 5.6e+20) {
            		tmp = t_1;
            	} else if (im <= 3e+132) {
            		tmp = t_0 * (0.5 + ((re * re) * -0.25));
            	} 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 * ((-2.0d0) + (im * (im * (-0.3333333333333333d0))))
                t_1 = 0.5d0 * t_0
                if (im <= 5.6d+20) then
                    tmp = t_1
                else if (im <= 3d+132) then
                    tmp = t_0 * (0.5d0 + ((re * re) * (-0.25d0)))
                else
                    tmp = t_1
                end if
                code = tmp
            end function
            
            public static double code(double re, double im) {
            	double t_0 = im * (-2.0 + (im * (im * -0.3333333333333333)));
            	double t_1 = 0.5 * t_0;
            	double tmp;
            	if (im <= 5.6e+20) {
            		tmp = t_1;
            	} else if (im <= 3e+132) {
            		tmp = t_0 * (0.5 + ((re * re) * -0.25));
            	} else {
            		tmp = t_1;
            	}
            	return tmp;
            }
            
            def code(re, im):
            	t_0 = im * (-2.0 + (im * (im * -0.3333333333333333)))
            	t_1 = 0.5 * t_0
            	tmp = 0
            	if im <= 5.6e+20:
            		tmp = t_1
            	elif im <= 3e+132:
            		tmp = t_0 * (0.5 + ((re * re) * -0.25))
            	else:
            		tmp = t_1
            	return tmp
            
            function code(re, im)
            	t_0 = Float64(im * Float64(-2.0 + Float64(im * Float64(im * -0.3333333333333333))))
            	t_1 = Float64(0.5 * t_0)
            	tmp = 0.0
            	if (im <= 5.6e+20)
            		tmp = t_1;
            	elseif (im <= 3e+132)
            		tmp = Float64(t_0 * Float64(0.5 + Float64(Float64(re * re) * -0.25)));
            	else
            		tmp = t_1;
            	end
            	return tmp
            end
            
            function tmp_2 = code(re, im)
            	t_0 = im * (-2.0 + (im * (im * -0.3333333333333333)));
            	t_1 = 0.5 * t_0;
            	tmp = 0.0;
            	if (im <= 5.6e+20)
            		tmp = t_1;
            	elseif (im <= 3e+132)
            		tmp = t_0 * (0.5 + ((re * re) * -0.25));
            	else
            		tmp = t_1;
            	end
            	tmp_2 = tmp;
            end
            
            code[re_, im_] := Block[{t$95$0 = N[(im * N[(-2.0 + N[(im * N[(im * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * t$95$0), $MachinePrecision]}, If[LessEqual[im, 5.6e+20], t$95$1, If[LessEqual[im, 3e+132], N[(t$95$0 * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\\
            t_1 := 0.5 \cdot t\_0\\
            \mathbf{if}\;im \leq 5.6 \cdot 10^{+20}:\\
            \;\;\;\;t\_1\\
            
            \mathbf{elif}\;im \leq 3 \cdot 10^{+132}:\\
            \;\;\;\;t\_0 \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_1\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if im < 5.6e20 or 2.9999999999999998e132 < im

              1. Initial program 51.0%

                \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
              2. Add Preprocessing
              3. Taylor expanded in im around 0

                \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \color{blue}{\left(im \cdot \left(\frac{-1}{3} \cdot {im}^{2} - 2\right)\right)}\right) \]
              4. Step-by-step derivation
                1. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{3} \cdot {im}^{2} - 2\right)}\right)\right) \]
                2. sub-negN/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \left(\frac{-1}{3} \cdot {im}^{2} + \color{blue}{\left(\mathsf{neg}\left(2\right)\right)}\right)\right)\right) \]
                3. metadata-evalN/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \left(\frac{-1}{3} \cdot {im}^{2} + -2\right)\right)\right) \]
                4. +-commutativeN/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \left(-2 + \color{blue}{\frac{-1}{3} \cdot {im}^{2}}\right)\right)\right) \]
                5. +-lowering-+.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \color{blue}{\left(\frac{-1}{3} \cdot {im}^{2}\right)}\right)\right)\right) \]
                6. *-commutativeN/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \left({im}^{2} \cdot \color{blue}{\frac{-1}{3}}\right)\right)\right)\right) \]
                7. unpow2N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \left(\left(im \cdot im\right) \cdot \frac{-1}{3}\right)\right)\right)\right) \]
                8. associate-*l*N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \left(im \cdot \color{blue}{\left(im \cdot \frac{-1}{3}\right)}\right)\right)\right)\right) \]
                9. *-lowering-*.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(im, \color{blue}{\left(im \cdot \frac{-1}{3}\right)}\right)\right)\right)\right) \]
                10. *-lowering-*.f6493.7%

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\frac{-1}{3}}\right)\right)\right)\right)\right) \]
              5. Simplified93.7%

                \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)} \]
              6. Taylor expanded in re around 0

                \[\leadsto \mathsf{*.f64}\left(\color{blue}{\frac{1}{2}}, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{3}\right)\right)\right)\right)\right) \]
              7. Step-by-step derivation
                1. Simplified59.7%

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

                if 5.6e20 < im < 2.9999999999999998e132

                1. Initial program 100.0%

                  \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                2. Add Preprocessing
                3. Taylor expanded in im around 0

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \color{blue}{\left(im \cdot \left(\frac{-1}{3} \cdot {im}^{2} - 2\right)\right)}\right) \]
                4. Step-by-step derivation
                  1. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{3} \cdot {im}^{2} - 2\right)}\right)\right) \]
                  2. sub-negN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \left(\frac{-1}{3} \cdot {im}^{2} + \color{blue}{\left(\mathsf{neg}\left(2\right)\right)}\right)\right)\right) \]
                  3. metadata-evalN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \left(\frac{-1}{3} \cdot {im}^{2} + -2\right)\right)\right) \]
                  4. +-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \left(-2 + \color{blue}{\frac{-1}{3} \cdot {im}^{2}}\right)\right)\right) \]
                  5. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \color{blue}{\left(\frac{-1}{3} \cdot {im}^{2}\right)}\right)\right)\right) \]
                  6. *-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \left({im}^{2} \cdot \color{blue}{\frac{-1}{3}}\right)\right)\right)\right) \]
                  7. unpow2N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \left(\left(im \cdot im\right) \cdot \frac{-1}{3}\right)\right)\right)\right) \]
                  8. associate-*l*N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \left(im \cdot \color{blue}{\left(im \cdot \frac{-1}{3}\right)}\right)\right)\right)\right) \]
                  9. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(im, \color{blue}{\left(im \cdot \frac{-1}{3}\right)}\right)\right)\right)\right) \]
                  10. *-lowering-*.f6425.3%

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\frac{-1}{3}}\right)\right)\right)\right)\right) \]
                5. Simplified25.3%

                  \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)} \]
                6. Taylor expanded in re around 0

                  \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{1}{2} + \frac{-1}{4} \cdot {re}^{2}\right)}, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{3}\right)\right)\right)\right)\right) \]
                7. Step-by-step derivation
                  1. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{-1}{4} \cdot {re}^{2}\right)\right), \mathsf{*.f64}\left(\color{blue}{im}, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{3}\right)\right)\right)\right)\right) \]
                  2. *-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \left({re}^{2} \cdot \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{3}\right)\right)\right)\right)\right) \]
                  3. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\left({re}^{2}\right), \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{3}\right)\right)\right)\right)\right) \]
                  4. unpow2N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\left(re \cdot re\right), \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{3}\right)\right)\right)\right)\right) \]
                  5. *-lowering-*.f6450.4%

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \frac{-1}{4}\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{3}\right)\right)\right)\right)\right) \]
                8. Simplified50.4%

                  \[\leadsto \color{blue}{\left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)} \cdot \left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right) \]
              8. Recombined 2 regimes into one program.
              9. Final simplification58.8%

                \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 5.6 \cdot 10^{+20}:\\ \;\;\;\;0.5 \cdot \left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)\\ \mathbf{elif}\;im \leq 3 \cdot 10^{+132}:\\ \;\;\;\;\left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)\\ \end{array} \]
              10. Add Preprocessing

              Alternative 8: 54.2% accurate, 13.4× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)\\ \mathbf{if}\;im \leq 1.75 \cdot 10^{+30}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;im \leq 6 \cdot 10^{+103}:\\ \;\;\;\;\left(re \cdot re\right) \cdot \left(im \cdot \left(0.5 + \frac{-1}{re \cdot re}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
              (FPCore (re im)
               :precision binary64
               (let* ((t_0 (* 0.5 (* im (+ -2.0 (* im (* im -0.3333333333333333)))))))
                 (if (<= im 1.75e+30)
                   t_0
                   (if (<= im 6e+103) (* (* re re) (* im (+ 0.5 (/ -1.0 (* re re))))) t_0))))
              double code(double re, double im) {
              	double t_0 = 0.5 * (im * (-2.0 + (im * (im * -0.3333333333333333))));
              	double tmp;
              	if (im <= 1.75e+30) {
              		tmp = t_0;
              	} else if (im <= 6e+103) {
              		tmp = (re * re) * (im * (0.5 + (-1.0 / (re * re))));
              	} else {
              		tmp = t_0;
              	}
              	return tmp;
              }
              
              real(8) function code(re, im)
                  real(8), intent (in) :: re
                  real(8), intent (in) :: im
                  real(8) :: t_0
                  real(8) :: tmp
                  t_0 = 0.5d0 * (im * ((-2.0d0) + (im * (im * (-0.3333333333333333d0)))))
                  if (im <= 1.75d+30) then
                      tmp = t_0
                  else if (im <= 6d+103) then
                      tmp = (re * re) * (im * (0.5d0 + ((-1.0d0) / (re * re))))
                  else
                      tmp = t_0
                  end if
                  code = tmp
              end function
              
              public static double code(double re, double im) {
              	double t_0 = 0.5 * (im * (-2.0 + (im * (im * -0.3333333333333333))));
              	double tmp;
              	if (im <= 1.75e+30) {
              		tmp = t_0;
              	} else if (im <= 6e+103) {
              		tmp = (re * re) * (im * (0.5 + (-1.0 / (re * re))));
              	} else {
              		tmp = t_0;
              	}
              	return tmp;
              }
              
              def code(re, im):
              	t_0 = 0.5 * (im * (-2.0 + (im * (im * -0.3333333333333333))))
              	tmp = 0
              	if im <= 1.75e+30:
              		tmp = t_0
              	elif im <= 6e+103:
              		tmp = (re * re) * (im * (0.5 + (-1.0 / (re * re))))
              	else:
              		tmp = t_0
              	return tmp
              
              function code(re, im)
              	t_0 = Float64(0.5 * Float64(im * Float64(-2.0 + Float64(im * Float64(im * -0.3333333333333333)))))
              	tmp = 0.0
              	if (im <= 1.75e+30)
              		tmp = t_0;
              	elseif (im <= 6e+103)
              		tmp = Float64(Float64(re * re) * Float64(im * Float64(0.5 + Float64(-1.0 / Float64(re * re)))));
              	else
              		tmp = t_0;
              	end
              	return tmp
              end
              
              function tmp_2 = code(re, im)
              	t_0 = 0.5 * (im * (-2.0 + (im * (im * -0.3333333333333333))));
              	tmp = 0.0;
              	if (im <= 1.75e+30)
              		tmp = t_0;
              	elseif (im <= 6e+103)
              		tmp = (re * re) * (im * (0.5 + (-1.0 / (re * re))));
              	else
              		tmp = t_0;
              	end
              	tmp_2 = tmp;
              end
              
              code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(im * N[(-2.0 + N[(im * N[(im * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 1.75e+30], t$95$0, If[LessEqual[im, 6e+103], N[(N[(re * re), $MachinePrecision] * N[(im * N[(0.5 + N[(-1.0 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := 0.5 \cdot \left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)\\
              \mathbf{if}\;im \leq 1.75 \cdot 10^{+30}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;im \leq 6 \cdot 10^{+103}:\\
              \;\;\;\;\left(re \cdot re\right) \cdot \left(im \cdot \left(0.5 + \frac{-1}{re \cdot re}\right)\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_0\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if im < 1.75000000000000011e30 or 6e103 < im

                1. Initial program 52.7%

                  \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                2. Add Preprocessing
                3. Taylor expanded in im around 0

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \color{blue}{\left(im \cdot \left(\frac{-1}{3} \cdot {im}^{2} - 2\right)\right)}\right) \]
                4. Step-by-step derivation
                  1. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{3} \cdot {im}^{2} - 2\right)}\right)\right) \]
                  2. sub-negN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \left(\frac{-1}{3} \cdot {im}^{2} + \color{blue}{\left(\mathsf{neg}\left(2\right)\right)}\right)\right)\right) \]
                  3. metadata-evalN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \left(\frac{-1}{3} \cdot {im}^{2} + -2\right)\right)\right) \]
                  4. +-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \left(-2 + \color{blue}{\frac{-1}{3} \cdot {im}^{2}}\right)\right)\right) \]
                  5. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \color{blue}{\left(\frac{-1}{3} \cdot {im}^{2}\right)}\right)\right)\right) \]
                  6. *-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \left({im}^{2} \cdot \color{blue}{\frac{-1}{3}}\right)\right)\right)\right) \]
                  7. unpow2N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \left(\left(im \cdot im\right) \cdot \frac{-1}{3}\right)\right)\right)\right) \]
                  8. associate-*l*N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \left(im \cdot \color{blue}{\left(im \cdot \frac{-1}{3}\right)}\right)\right)\right)\right) \]
                  9. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(im, \color{blue}{\left(im \cdot \frac{-1}{3}\right)}\right)\right)\right)\right) \]
                  10. *-lowering-*.f6492.7%

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\frac{-1}{3}}\right)\right)\right)\right)\right) \]
                5. Simplified92.7%

                  \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)} \]
                6. Taylor expanded in re around 0

                  \[\leadsto \mathsf{*.f64}\left(\color{blue}{\frac{1}{2}}, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{3}\right)\right)\right)\right)\right) \]
                7. Step-by-step derivation
                  1. Simplified59.0%

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

                  if 1.75000000000000011e30 < im < 6e103

                  1. Initial program 100.0%

                    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                  2. Add Preprocessing
                  3. Taylor expanded in im around 0

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

                      \[\leadsto \mathsf{neg}\left(im \cdot \cos re\right) \]
                    2. neg-sub0N/A

                      \[\leadsto 0 - \color{blue}{im \cdot \cos re} \]
                    3. --lowering--.f64N/A

                      \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left(im \cdot \cos re\right)}\right) \]
                    4. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \color{blue}{\cos re}\right)\right) \]
                    5. cos-lowering-cos.f643.8%

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
                  5. Simplified3.8%

                    \[\leadsto \color{blue}{0 - im \cdot \cos re} \]
                  6. Taylor expanded in re around 0

                    \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)}\right)\right) \]
                  7. Step-by-step derivation
                    1. +-lowering-+.f64N/A

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {re}^{2}\right)}\right)\right)\right) \]
                    2. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right)\right) \]
                    3. unpow2N/A

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right)\right) \]
                    4. *-lowering-*.f6431.7%

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right)\right) \]
                  8. Simplified31.7%

                    \[\leadsto 0 - im \cdot \color{blue}{\left(1 + -0.5 \cdot \left(re \cdot re\right)\right)} \]
                  9. Taylor expanded in re around inf

                    \[\leadsto \color{blue}{{re}^{2} \cdot \left(-1 \cdot \frac{im}{{re}^{2}} - \frac{-1}{2} \cdot im\right)} \]
                  10. Step-by-step derivation
                    1. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\left({re}^{2}\right), \color{blue}{\left(-1 \cdot \frac{im}{{re}^{2}} - \frac{-1}{2} \cdot im\right)}\right) \]
                    2. unpow2N/A

                      \[\leadsto \mathsf{*.f64}\left(\left(re \cdot re\right), \left(\color{blue}{-1 \cdot \frac{im}{{re}^{2}}} - \frac{-1}{2} \cdot im\right)\right) \]
                    3. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \left(\color{blue}{-1 \cdot \frac{im}{{re}^{2}}} - \frac{-1}{2} \cdot im\right)\right) \]
                    4. cancel-sign-sub-invN/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \left(-1 \cdot \frac{im}{{re}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{-1}{2}\right)\right) \cdot im}\right)\right) \]
                    5. metadata-evalN/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \left(-1 \cdot \frac{im}{{re}^{2}} + \frac{1}{2} \cdot im\right)\right) \]
                    6. associate-*r/N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \left(\frac{-1 \cdot im}{{re}^{2}} + \color{blue}{\frac{1}{2}} \cdot im\right)\right) \]
                    7. *-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \left(\frac{im \cdot -1}{{re}^{2}} + \frac{1}{2} \cdot im\right)\right) \]
                    8. associate-/l*N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \left(im \cdot \frac{-1}{{re}^{2}} + \color{blue}{\frac{1}{2}} \cdot im\right)\right) \]
                    9. *-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \left(im \cdot \frac{-1}{{re}^{2}} + im \cdot \color{blue}{\frac{1}{2}}\right)\right) \]
                    10. distribute-lft-outN/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \left(im \cdot \color{blue}{\left(\frac{-1}{{re}^{2}} + \frac{1}{2}\right)}\right)\right) \]
                    11. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{{re}^{2}} + \frac{1}{2}\right)}\right)\right) \]
                    12. +-lowering-+.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\left(\frac{-1}{{re}^{2}}\right), \color{blue}{\frac{1}{2}}\right)\right)\right) \]
                    13. /-lowering-/.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\mathsf{/.f64}\left(-1, \left({re}^{2}\right)\right), \frac{1}{2}\right)\right)\right) \]
                    14. unpow2N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\mathsf{/.f64}\left(-1, \left(re \cdot re\right)\right), \frac{1}{2}\right)\right)\right) \]
                    15. *-lowering-*.f6442.6%

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(\mathsf{/.f64}\left(-1, \mathsf{*.f64}\left(re, re\right)\right), \frac{1}{2}\right)\right)\right) \]
                  11. Simplified42.6%

                    \[\leadsto \color{blue}{\left(re \cdot re\right) \cdot \left(im \cdot \left(\frac{-1}{re \cdot re} + 0.5\right)\right)} \]
                8. Recombined 2 regimes into one program.
                9. Final simplification57.9%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 1.75 \cdot 10^{+30}:\\ \;\;\;\;0.5 \cdot \left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)\\ \mathbf{elif}\;im \leq 6 \cdot 10^{+103}:\\ \;\;\;\;\left(re \cdot re\right) \cdot \left(im \cdot \left(0.5 + \frac{-1}{re \cdot re}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)\\ \end{array} \]
                10. Add Preprocessing

                Alternative 9: 60.2% accurate, 13.4× speedup?

                \[\begin{array}{l} \\ \left(-2 + \left(im \cdot im\right) \cdot \left(-0.3333333333333333 + \left(im \cdot im\right) \cdot \left(-0.016666666666666666 + \left(im \cdot im\right) \cdot -0.0003968253968253968\right)\right)\right) \cdot \left(im \cdot 0.5\right) \end{array} \]
                (FPCore (re im)
                 :precision binary64
                 (*
                  (+
                   -2.0
                   (*
                    (* im im)
                    (+
                     -0.3333333333333333
                     (*
                      (* im im)
                      (+ -0.016666666666666666 (* (* im im) -0.0003968253968253968))))))
                  (* im 0.5)))
                double code(double re, double im) {
                	return (-2.0 + ((im * im) * (-0.3333333333333333 + ((im * im) * (-0.016666666666666666 + ((im * im) * -0.0003968253968253968)))))) * (im * 0.5);
                }
                
                real(8) function code(re, im)
                    real(8), intent (in) :: re
                    real(8), intent (in) :: im
                    code = ((-2.0d0) + ((im * im) * ((-0.3333333333333333d0) + ((im * im) * ((-0.016666666666666666d0) + ((im * im) * (-0.0003968253968253968d0))))))) * (im * 0.5d0)
                end function
                
                public static double code(double re, double im) {
                	return (-2.0 + ((im * im) * (-0.3333333333333333 + ((im * im) * (-0.016666666666666666 + ((im * im) * -0.0003968253968253968)))))) * (im * 0.5);
                }
                
                def code(re, im):
                	return (-2.0 + ((im * im) * (-0.3333333333333333 + ((im * im) * (-0.016666666666666666 + ((im * im) * -0.0003968253968253968)))))) * (im * 0.5)
                
                function code(re, im)
                	return Float64(Float64(-2.0 + Float64(Float64(im * im) * Float64(-0.3333333333333333 + Float64(Float64(im * im) * Float64(-0.016666666666666666 + Float64(Float64(im * im) * -0.0003968253968253968)))))) * Float64(im * 0.5))
                end
                
                function tmp = code(re, im)
                	tmp = (-2.0 + ((im * im) * (-0.3333333333333333 + ((im * im) * (-0.016666666666666666 + ((im * im) * -0.0003968253968253968)))))) * (im * 0.5);
                end
                
                code[re_, im_] := N[(N[(-2.0 + N[(N[(im * im), $MachinePrecision] * N[(-0.3333333333333333 + N[(N[(im * im), $MachinePrecision] * N[(-0.016666666666666666 + N[(N[(im * im), $MachinePrecision] * -0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision]
                
                \begin{array}{l}
                
                \\
                \left(-2 + \left(im \cdot im\right) \cdot \left(-0.3333333333333333 + \left(im \cdot im\right) \cdot \left(-0.016666666666666666 + \left(im \cdot im\right) \cdot -0.0003968253968253968\right)\right)\right) \cdot \left(im \cdot 0.5\right)
                \end{array}
                
                Derivation
                1. Initial program 55.8%

                  \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                2. Add Preprocessing
                3. Taylor expanded in im around 0

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \color{blue}{\left(im \cdot \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right)\right)}\right) \]
                4. Step-by-step derivation
                  1. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right)}\right)\right) \]
                  2. sub-negN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) + \color{blue}{\left(\mathsf{neg}\left(2\right)\right)}\right)\right)\right) \]
                  3. metadata-evalN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) + -2\right)\right)\right) \]
                  4. +-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \left(-2 + \color{blue}{{im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)}\right)\right)\right) \]
                  5. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)\right)}\right)\right)\right) \]
                  6. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right)}\right)\right)\right)\right) \]
                  7. unpow2N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\left(im \cdot im\right), \left(\color{blue}{{im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)} - \frac{1}{3}\right)\right)\right)\right)\right) \]
                  8. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{{im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)} - \frac{1}{3}\right)\right)\right)\right)\right) \]
                  9. sub-negN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{3}\right)\right)}\right)\right)\right)\right)\right) \]
                  10. metadata-evalN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) + \frac{-1}{3}\right)\right)\right)\right)\right) \]
                  11. +-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{3} + \color{blue}{{im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)}\right)\right)\right)\right)\right) \]
                  12. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \color{blue}{\left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)\right)}\right)\right)\right)\right)\right) \]
                  13. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right)}\right)\right)\right)\right)\right)\right) \]
                  14. unpow2N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\left(im \cdot im\right), \left(\color{blue}{\frac{-1}{2520} \cdot {im}^{2}} - \frac{1}{60}\right)\right)\right)\right)\right)\right)\right) \]
                  15. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\color{blue}{\frac{-1}{2520} \cdot {im}^{2}} - \frac{1}{60}\right)\right)\right)\right)\right)\right)\right) \]
                  16. sub-negN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{2520} \cdot {im}^{2} + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{60}\right)\right)}\right)\right)\right)\right)\right)\right)\right) \]
                  17. metadata-evalN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{2520} \cdot {im}^{2} + \frac{-1}{60}\right)\right)\right)\right)\right)\right)\right) \]
                  18. +-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \left(\frac{-1}{60} + \color{blue}{\frac{-1}{2520} \cdot {im}^{2}}\right)\right)\right)\right)\right)\right)\right) \]
                  19. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{60}, \color{blue}{\left(\frac{-1}{2520} \cdot {im}^{2}\right)}\right)\right)\right)\right)\right)\right)\right) \]
                  20. *-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{60}, \left({im}^{2} \cdot \color{blue}{\frac{-1}{2520}}\right)\right)\right)\right)\right)\right)\right)\right) \]
                  21. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{60}, \mathsf{*.f64}\left(\left({im}^{2}\right), \color{blue}{\frac{-1}{2520}}\right)\right)\right)\right)\right)\right)\right)\right) \]
                  22. unpow2N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{60}, \mathsf{*.f64}\left(\left(im \cdot im\right), \frac{-1}{2520}\right)\right)\right)\right)\right)\right)\right)\right) \]
                  23. *-lowering-*.f6494.7%

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \mathsf{+.f64}\left(\frac{-1}{60}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(im, im\right), \frac{-1}{2520}\right)\right)\right)\right)\right)\right)\right)\right) \]
                5. Simplified94.7%

                  \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot \left(-0.3333333333333333 + \left(im \cdot im\right) \cdot \left(-0.016666666666666666 + \left(im \cdot im\right) \cdot -0.0003968253968253968\right)\right)\right)\right)} \]
                6. Taylor expanded in re around 0

                  \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(im \cdot \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right)\right)} \]
                7. Step-by-step derivation
                  1. associate-*r*N/A

                    \[\leadsto \left(\frac{1}{2} \cdot im\right) \cdot \color{blue}{\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right)} \]
                  2. metadata-evalN/A

                    \[\leadsto \left(\left(\mathsf{neg}\left(\frac{-1}{2}\right)\right) \cdot im\right) \cdot \left(\color{blue}{{im}^{2}} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \]
                  3. *-commutativeN/A

                    \[\leadsto \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\frac{-1}{2}\right)\right) \cdot im\right)} \]
                  4. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right), \color{blue}{\left(\left(\mathsf{neg}\left(\frac{-1}{2}\right)\right) \cdot im\right)}\right) \]
                8. Simplified60.4%

                  \[\leadsto \color{blue}{\left(-2 + \left(im \cdot im\right) \cdot \left(-0.3333333333333333 + \left(im \cdot im\right) \cdot \left(-0.016666666666666666 + \left(im \cdot im\right) \cdot -0.0003968253968253968\right)\right)\right) \cdot \left(im \cdot 0.5\right)} \]
                9. Add Preprocessing

                Alternative 10: 33.4% accurate, 22.0× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 2.1 \cdot 10^{+22}:\\ \;\;\;\;0 - im\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(-1 + 0.5 \cdot \left(re \cdot re\right)\right)\\ \end{array} \end{array} \]
                (FPCore (re im)
                 :precision binary64
                 (if (<= im 2.1e+22) (- 0.0 im) (* im (+ -1.0 (* 0.5 (* re re))))))
                double code(double re, double im) {
                	double tmp;
                	if (im <= 2.1e+22) {
                		tmp = 0.0 - im;
                	} else {
                		tmp = im * (-1.0 + (0.5 * (re * re)));
                	}
                	return tmp;
                }
                
                real(8) function code(re, im)
                    real(8), intent (in) :: re
                    real(8), intent (in) :: im
                    real(8) :: tmp
                    if (im <= 2.1d+22) then
                        tmp = 0.0d0 - im
                    else
                        tmp = im * ((-1.0d0) + (0.5d0 * (re * re)))
                    end if
                    code = tmp
                end function
                
                public static double code(double re, double im) {
                	double tmp;
                	if (im <= 2.1e+22) {
                		tmp = 0.0 - im;
                	} else {
                		tmp = im * (-1.0 + (0.5 * (re * re)));
                	}
                	return tmp;
                }
                
                def code(re, im):
                	tmp = 0
                	if im <= 2.1e+22:
                		tmp = 0.0 - im
                	else:
                		tmp = im * (-1.0 + (0.5 * (re * re)))
                	return tmp
                
                function code(re, im)
                	tmp = 0.0
                	if (im <= 2.1e+22)
                		tmp = Float64(0.0 - im);
                	else
                		tmp = Float64(im * Float64(-1.0 + Float64(0.5 * Float64(re * re))));
                	end
                	return tmp
                end
                
                function tmp_2 = code(re, im)
                	tmp = 0.0;
                	if (im <= 2.1e+22)
                		tmp = 0.0 - im;
                	else
                		tmp = im * (-1.0 + (0.5 * (re * re)));
                	end
                	tmp_2 = tmp;
                end
                
                code[re_, im_] := If[LessEqual[im, 2.1e+22], N[(0.0 - im), $MachinePrecision], N[(im * N[(-1.0 + N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;im \leq 2.1 \cdot 10^{+22}:\\
                \;\;\;\;0 - im\\
                
                \mathbf{else}:\\
                \;\;\;\;im \cdot \left(-1 + 0.5 \cdot \left(re \cdot re\right)\right)\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if im < 2.0999999999999998e22

                  1. Initial program 41.4%

                    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                  2. Add Preprocessing
                  3. Taylor expanded in im around 0

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

                      \[\leadsto \mathsf{neg}\left(im \cdot \cos re\right) \]
                    2. neg-sub0N/A

                      \[\leadsto 0 - \color{blue}{im \cdot \cos re} \]
                    3. --lowering--.f64N/A

                      \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left(im \cdot \cos re\right)}\right) \]
                    4. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \color{blue}{\cos re}\right)\right) \]
                    5. cos-lowering-cos.f6464.9%

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
                  5. Simplified64.9%

                    \[\leadsto \color{blue}{0 - im \cdot \cos re} \]
                  6. Taylor expanded in re around 0

                    \[\leadsto \color{blue}{-1 \cdot im} \]
                  7. Step-by-step derivation
                    1. mul-1-negN/A

                      \[\leadsto \mathsf{neg}\left(im\right) \]
                    2. neg-sub0N/A

                      \[\leadsto 0 - \color{blue}{im} \]
                    3. --lowering--.f6436.2%

                      \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{im}\right) \]
                  8. Simplified36.2%

                    \[\leadsto \color{blue}{0 - im} \]
                  9. Step-by-step derivation
                    1. sub0-negN/A

                      \[\leadsto \mathsf{neg}\left(im\right) \]
                    2. neg-lowering-neg.f6436.2%

                      \[\leadsto \mathsf{neg.f64}\left(im\right) \]
                  10. Applied egg-rr36.2%

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

                  if 2.0999999999999998e22 < im

                  1. Initial program 100.0%

                    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                  2. Add Preprocessing
                  3. Taylor expanded in im around 0

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

                      \[\leadsto \mathsf{neg}\left(im \cdot \cos re\right) \]
                    2. neg-sub0N/A

                      \[\leadsto 0 - \color{blue}{im \cdot \cos re} \]
                    3. --lowering--.f64N/A

                      \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left(im \cdot \cos re\right)}\right) \]
                    4. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \color{blue}{\cos re}\right)\right) \]
                    5. cos-lowering-cos.f645.6%

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
                  5. Simplified5.6%

                    \[\leadsto \color{blue}{0 - im \cdot \cos re} \]
                  6. Taylor expanded in re around 0

                    \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)}\right)\right) \]
                  7. Step-by-step derivation
                    1. +-lowering-+.f64N/A

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {re}^{2}\right)}\right)\right)\right) \]
                    2. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right)\right) \]
                    3. unpow2N/A

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right)\right) \]
                    4. *-lowering-*.f6420.5%

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right)\right) \]
                  8. Simplified20.5%

                    \[\leadsto 0 - im \cdot \color{blue}{\left(1 + -0.5 \cdot \left(re \cdot re\right)\right)} \]
                  9. Step-by-step derivation
                    1. sub0-negN/A

                      \[\leadsto \mathsf{neg}\left(im \cdot \left(1 + \frac{-1}{2} \cdot \left(re \cdot re\right)\right)\right) \]
                    2. *-commutativeN/A

                      \[\leadsto \mathsf{neg}\left(\left(1 + \frac{-1}{2} \cdot \left(re \cdot re\right)\right) \cdot im\right) \]
                    3. distribute-lft-neg-inN/A

                      \[\leadsto \left(\mathsf{neg}\left(\left(1 + \frac{-1}{2} \cdot \left(re \cdot re\right)\right)\right)\right) \cdot \color{blue}{im} \]
                    4. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\left(\mathsf{neg}\left(\left(1 + \frac{-1}{2} \cdot \left(re \cdot re\right)\right)\right)\right), \color{blue}{im}\right) \]
                    5. distribute-neg-inN/A

                      \[\leadsto \mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(1\right)\right) + \left(\mathsf{neg}\left(\frac{-1}{2} \cdot \left(re \cdot re\right)\right)\right)\right), im\right) \]
                    6. metadata-evalN/A

                      \[\leadsto \mathsf{*.f64}\left(\left(-1 + \left(\mathsf{neg}\left(\frac{-1}{2} \cdot \left(re \cdot re\right)\right)\right)\right), im\right) \]
                    7. +-lowering-+.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \left(\mathsf{neg}\left(\frac{-1}{2} \cdot \left(re \cdot re\right)\right)\right)\right), im\right) \]
                    8. *-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \left(\mathsf{neg}\left(\left(re \cdot re\right) \cdot \frac{-1}{2}\right)\right)\right), im\right) \]
                    9. distribute-rgt-neg-inN/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \left(\left(re \cdot re\right) \cdot \left(\mathsf{neg}\left(\frac{-1}{2}\right)\right)\right)\right), im\right) \]
                    10. metadata-evalN/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \left(\left(re \cdot re\right) \cdot \frac{1}{2}\right)\right), im\right) \]
                    11. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left(re \cdot re\right), \frac{1}{2}\right)\right), im\right) \]
                    12. *-lowering-*.f6420.5%

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(re, re\right), \frac{1}{2}\right)\right), im\right) \]
                  10. Applied egg-rr20.5%

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

                  \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 2.1 \cdot 10^{+22}:\\ \;\;\;\;0 - im\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(-1 + 0.5 \cdot \left(re \cdot re\right)\right)\\ \end{array} \]
                5. Add Preprocessing

                Alternative 11: 32.8% accurate, 25.7× speedup?

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

                  1. Initial program 42.6%

                    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                  2. Add Preprocessing
                  3. Taylor expanded in im around 0

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

                      \[\leadsto \mathsf{neg}\left(im \cdot \cos re\right) \]
                    2. neg-sub0N/A

                      \[\leadsto 0 - \color{blue}{im \cdot \cos re} \]
                    3. --lowering--.f64N/A

                      \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left(im \cdot \cos re\right)}\right) \]
                    4. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \color{blue}{\cos re}\right)\right) \]
                    5. cos-lowering-cos.f6463.7%

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
                  5. Simplified63.7%

                    \[\leadsto \color{blue}{0 - im \cdot \cos re} \]
                  6. Taylor expanded in re around 0

                    \[\leadsto \color{blue}{-1 \cdot im} \]
                  7. Step-by-step derivation
                    1. mul-1-negN/A

                      \[\leadsto \mathsf{neg}\left(im\right) \]
                    2. neg-sub0N/A

                      \[\leadsto 0 - \color{blue}{im} \]
                    3. --lowering--.f6435.6%

                      \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{im}\right) \]
                  8. Simplified35.6%

                    \[\leadsto \color{blue}{0 - im} \]
                  9. Step-by-step derivation
                    1. sub0-negN/A

                      \[\leadsto \mathsf{neg}\left(im\right) \]
                    2. neg-lowering-neg.f6435.6%

                      \[\leadsto \mathsf{neg.f64}\left(im\right) \]
                  10. Applied egg-rr35.6%

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

                  if 3.7e32 < im

                  1. Initial program 100.0%

                    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                  2. Add Preprocessing
                  3. Taylor expanded in im around 0

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

                      \[\leadsto \mathsf{neg}\left(im \cdot \cos re\right) \]
                    2. neg-sub0N/A

                      \[\leadsto 0 - \color{blue}{im \cdot \cos re} \]
                    3. --lowering--.f64N/A

                      \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left(im \cdot \cos re\right)}\right) \]
                    4. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \color{blue}{\cos re}\right)\right) \]
                    5. cos-lowering-cos.f645.7%

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
                  5. Simplified5.7%

                    \[\leadsto \color{blue}{0 - im \cdot \cos re} \]
                  6. Taylor expanded in re around 0

                    \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \color{blue}{\left(1 + \frac{-1}{2} \cdot {re}^{2}\right)}\right)\right) \]
                  7. Step-by-step derivation
                    1. +-lowering-+.f64N/A

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {re}^{2}\right)}\right)\right)\right) \]
                    2. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \color{blue}{\left({re}^{2}\right)}\right)\right)\right)\right) \]
                    3. unpow2N/A

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(re \cdot \color{blue}{re}\right)\right)\right)\right)\right) \]
                    4. *-lowering-*.f6421.7%

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right)\right)\right) \]
                  8. Simplified21.7%

                    \[\leadsto 0 - im \cdot \color{blue}{\left(1 + -0.5 \cdot \left(re \cdot re\right)\right)} \]
                  9. Taylor expanded in re around inf

                    \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(im \cdot {re}^{2}\right)} \]
                  10. Step-by-step derivation
                    1. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(im \cdot {re}^{2}\right)}\right) \]
                    2. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \color{blue}{\left({re}^{2}\right)}\right)\right) \]
                    3. unpow2N/A

                      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \left(re \cdot \color{blue}{re}\right)\right)\right) \]
                    4. *-lowering-*.f6419.5%

                      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(re, \color{blue}{re}\right)\right)\right) \]
                  11. Simplified19.5%

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

                  \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 3.7 \cdot 10^{+32}:\\ \;\;\;\;0 - im\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right)\\ \end{array} \]
                5. Add Preprocessing

                Alternative 12: 52.9% accurate, 28.1× speedup?

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

                  \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                2. Add Preprocessing
                3. Taylor expanded in im around 0

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \color{blue}{\left(im \cdot \left(\frac{-1}{3} \cdot {im}^{2} - 2\right)\right)}\right) \]
                4. Step-by-step derivation
                  1. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \color{blue}{\left(\frac{-1}{3} \cdot {im}^{2} - 2\right)}\right)\right) \]
                  2. sub-negN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \left(\frac{-1}{3} \cdot {im}^{2} + \color{blue}{\left(\mathsf{neg}\left(2\right)\right)}\right)\right)\right) \]
                  3. metadata-evalN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \left(\frac{-1}{3} \cdot {im}^{2} + -2\right)\right)\right) \]
                  4. +-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \left(-2 + \color{blue}{\frac{-1}{3} \cdot {im}^{2}}\right)\right)\right) \]
                  5. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \color{blue}{\left(\frac{-1}{3} \cdot {im}^{2}\right)}\right)\right)\right) \]
                  6. *-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \left({im}^{2} \cdot \color{blue}{\frac{-1}{3}}\right)\right)\right)\right) \]
                  7. unpow2N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \left(\left(im \cdot im\right) \cdot \frac{-1}{3}\right)\right)\right)\right) \]
                  8. associate-*l*N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \left(im \cdot \color{blue}{\left(im \cdot \frac{-1}{3}\right)}\right)\right)\right)\right) \]
                  9. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(im, \color{blue}{\left(im \cdot \frac{-1}{3}\right)}\right)\right)\right)\right) \]
                  10. *-lowering-*.f6487.1%

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{cos.f64}\left(re\right)\right), \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \color{blue}{\frac{-1}{3}}\right)\right)\right)\right)\right) \]
                5. Simplified87.1%

                  \[\leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{\left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)} \]
                6. Taylor expanded in re around 0

                  \[\leadsto \mathsf{*.f64}\left(\color{blue}{\frac{1}{2}}, \mathsf{*.f64}\left(im, \mathsf{+.f64}\left(-2, \mathsf{*.f64}\left(im, \mathsf{*.f64}\left(im, \frac{-1}{3}\right)\right)\right)\right)\right) \]
                7. Step-by-step derivation
                  1. Simplified55.3%

                    \[\leadsto \color{blue}{0.5} \cdot \left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right) \]
                  2. Add Preprocessing

                  Alternative 13: 29.1% accurate, 103.0× speedup?

                  \[\begin{array}{l} \\ 0 - im \end{array} \]
                  (FPCore (re im) :precision binary64 (- 0.0 im))
                  double code(double re, double im) {
                  	return 0.0 - im;
                  }
                  
                  real(8) function code(re, im)
                      real(8), intent (in) :: re
                      real(8), intent (in) :: im
                      code = 0.0d0 - im
                  end function
                  
                  public static double code(double re, double im) {
                  	return 0.0 - im;
                  }
                  
                  def code(re, im):
                  	return 0.0 - im
                  
                  function code(re, im)
                  	return Float64(0.0 - im)
                  end
                  
                  function tmp = code(re, im)
                  	tmp = 0.0 - im;
                  end
                  
                  code[re_, im_] := N[(0.0 - im), $MachinePrecision]
                  
                  \begin{array}{l}
                  
                  \\
                  0 - im
                  \end{array}
                  
                  Derivation
                  1. Initial program 55.8%

                    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right) \]
                  2. Add Preprocessing
                  3. Taylor expanded in im around 0

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

                      \[\leadsto \mathsf{neg}\left(im \cdot \cos re\right) \]
                    2. neg-sub0N/A

                      \[\leadsto 0 - \color{blue}{im \cdot \cos re} \]
                    3. --lowering--.f64N/A

                      \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left(im \cdot \cos re\right)}\right) \]
                    4. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \color{blue}{\cos re}\right)\right) \]
                    5. cos-lowering-cos.f6450.3%

                      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(im, \mathsf{cos.f64}\left(re\right)\right)\right) \]
                  5. Simplified50.3%

                    \[\leadsto \color{blue}{0 - im \cdot \cos re} \]
                  6. Taylor expanded in re around 0

                    \[\leadsto \color{blue}{-1 \cdot im} \]
                  7. Step-by-step derivation
                    1. mul-1-negN/A

                      \[\leadsto \mathsf{neg}\left(im\right) \]
                    2. neg-sub0N/A

                      \[\leadsto 0 - \color{blue}{im} \]
                    3. --lowering--.f6428.5%

                      \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{im}\right) \]
                  8. Simplified28.5%

                    \[\leadsto \color{blue}{0 - im} \]
                  9. Step-by-step derivation
                    1. sub0-negN/A

                      \[\leadsto \mathsf{neg}\left(im\right) \]
                    2. neg-lowering-neg.f6428.5%

                      \[\leadsto \mathsf{neg.f64}\left(im\right) \]
                  10. Applied egg-rr28.5%

                    \[\leadsto \color{blue}{-im} \]
                  11. Final simplification28.5%

                    \[\leadsto 0 - im \]
                  12. Add Preprocessing

                  Developer Target 1: 99.8% accurate, 0.7× 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 2024164 
                  (FPCore (re im)
                    :name "math.sin on complex, imaginary part"
                    :precision binary64
                  
                    :alt
                    (! :herbie-platform default (if (< (fabs im) 1) (- (* (cos re) (+ im (* 1/6 im im im) (* 1/120 im im im im im)))) (* (* 1/2 (cos re)) (- (exp (- 0 im)) (exp im)))))
                  
                    (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))