math.sin on complex, real part

Percentage Accurate: 100.0% → 100.0%
Time: 6.2s
Alternatives: 10
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \end{array} \]
(FPCore (re im)
 :precision binary64
 (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
	return (0.5 * sin(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 * sin(re)) * (exp((0.0d0 - im)) + exp(im))
end function
public static double code(double re, double im) {
	return (0.5 * Math.sin(re)) * (Math.exp((0.0 - im)) + Math.exp(im));
}
def code(re, im):
	return (0.5 * math.sin(re)) * (math.exp((0.0 - im)) + math.exp(im))
function code(re, im)
	return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(0.0 - im)) + exp(im)))
end
function tmp = code(re, im)
	tmp = (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im));
end
code[re_, im_] := N[(N[(0.5 * N[Sin[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 \sin 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 10 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: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \end{array} \]
(FPCore (re im)
 :precision binary64
 (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
	return (0.5 * sin(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 * sin(re)) * (exp((0.0d0 - im)) + exp(im))
end function
public static double code(double re, double im) {
	return (0.5 * Math.sin(re)) * (Math.exp((0.0 - im)) + Math.exp(im));
}
def code(re, im):
	return (0.5 * math.sin(re)) * (math.exp((0.0 - im)) + math.exp(im))
function code(re, im)
	return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(0.0 - im)) + exp(im)))
end
function tmp = code(re, im)
	tmp = (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im));
end
code[re_, im_] := N[(N[(0.5 * N[Sin[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 \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
\end{array}

Alternative 1: 100.0% accurate, 1.0× speedup?

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

\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right)
\end{array}
Derivation
  1. Initial program 100.0%

    \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
  2. Step-by-step derivation
    1. distribute-lft-in100.0%

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

      \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right)} + \left(0.5 \cdot \sin re\right) \cdot e^{im} \]
    3. cancel-sign-sub100.0%

      \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-0.5 \cdot \sin re\right) \cdot e^{im}} \]
    4. distribute-lft-neg-out100.0%

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

      \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-\color{blue}{e^{im} \cdot \left(0.5 \cdot \sin re\right)}\right) \]
    6. distribute-rgt-neg-out100.0%

      \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{e^{im} \cdot \left(-0.5 \cdot \sin re\right)} \]
    7. neg-mul-1100.0%

      \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - e^{im} \cdot \color{blue}{\left(-1 \cdot \left(0.5 \cdot \sin re\right)\right)} \]
    8. associate-*r*100.0%

      \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{\left(e^{im} \cdot -1\right) \cdot \left(0.5 \cdot \sin re\right)} \]
    9. distribute-rgt-out--100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} - e^{im} \cdot -1\right)} \]
    10. sub-neg100.0%

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(e^{0 - im} + \left(-e^{im} \cdot -1\right)\right)} \]
    11. neg-sub0100.0%

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-e^{im} \cdot -1\right)\right) \]
    12. *-commutative100.0%

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{\left(-e^{im}\right)}\right)\right) \]
    14. remove-double-neg100.0%

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

    \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right)} \]
  4. Final simplification100.0%

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

Alternative 2: 84.7% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.04 \lor \neg \left(im \leq 1.35 \cdot 10^{+154}\right):\\
\;\;\;\;\sin re \cdot \left(0.5 \cdot \left(im \cdot im\right) + 1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 0.0400000000000000008 or 1.35000000000000003e154 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right)} + \left(0.5 \cdot \sin re\right) \cdot e^{im} \]
      3. cancel-sign-sub100.0%

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-0.5 \cdot \sin re\right) \cdot e^{im}} \]
      4. distribute-lft-neg-out100.0%

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

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-\color{blue}{e^{im} \cdot \left(0.5 \cdot \sin re\right)}\right) \]
      6. distribute-rgt-neg-out100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{e^{im} \cdot \left(-0.5 \cdot \sin re\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - e^{im} \cdot \color{blue}{\left(-1 \cdot \left(0.5 \cdot \sin re\right)\right)} \]
      8. associate-*r*100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{\left(e^{im} \cdot -1\right) \cdot \left(0.5 \cdot \sin re\right)} \]
      9. distribute-rgt-out--100.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} - e^{im} \cdot -1\right)} \]
      10. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(e^{0 - im} + \left(-e^{im} \cdot -1\right)\right)} \]
      11. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-e^{im} \cdot -1\right)\right) \]
      12. *-commutative100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{\left(-e^{im}\right)}\right)\right) \]
      14. remove-double-neg100.0%

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

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

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

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

    if 0.0400000000000000008 < im < 1.35000000000000003e154

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right)} + \left(0.5 \cdot \sin re\right) \cdot e^{im} \]
      3. cancel-sign-sub100.0%

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-0.5 \cdot \sin re\right) \cdot e^{im}} \]
      4. distribute-lft-neg-out100.0%

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

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-\color{blue}{e^{im} \cdot \left(0.5 \cdot \sin re\right)}\right) \]
      6. distribute-rgt-neg-out100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{e^{im} \cdot \left(-0.5 \cdot \sin re\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - e^{im} \cdot \color{blue}{\left(-1 \cdot \left(0.5 \cdot \sin re\right)\right)} \]
      8. associate-*r*100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{\left(e^{im} \cdot -1\right) \cdot \left(0.5 \cdot \sin re\right)} \]
      9. distribute-rgt-out--100.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} - e^{im} \cdot -1\right)} \]
      10. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(e^{0 - im} + \left(-e^{im} \cdot -1\right)\right)} \]
      11. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-e^{im} \cdot -1\right)\right) \]
      12. *-commutative100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{\left(-e^{im}\right)}\right)\right) \]
      14. remove-double-neg100.0%

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

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

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

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

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

Alternative 3: 84.7% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(im \cdot im\right)\\ \mathbf{if}\;im \leq 0.5:\\ \;\;\;\;\sin re + \sin re \cdot t_0\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(t_0 + 1\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* 0.5 (* im im))))
   (if (<= im 0.5)
     (+ (sin re) (* (sin re) t_0))
     (if (<= im 1.35e+154)
       (* (+ (exp (- im)) (exp im)) (* 0.5 re))
       (* (sin re) (+ t_0 1.0))))))
double code(double re, double im) {
	double t_0 = 0.5 * (im * im);
	double tmp;
	if (im <= 0.5) {
		tmp = sin(re) + (sin(re) * t_0);
	} else if (im <= 1.35e+154) {
		tmp = (exp(-im) + exp(im)) * (0.5 * re);
	} else {
		tmp = sin(re) * (t_0 + 1.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 * im)
    if (im <= 0.5d0) then
        tmp = sin(re) + (sin(re) * t_0)
    else if (im <= 1.35d+154) then
        tmp = (exp(-im) + exp(im)) * (0.5d0 * re)
    else
        tmp = sin(re) * (t_0 + 1.0d0)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = 0.5 * (im * im);
	double tmp;
	if (im <= 0.5) {
		tmp = Math.sin(re) + (Math.sin(re) * t_0);
	} else if (im <= 1.35e+154) {
		tmp = (Math.exp(-im) + Math.exp(im)) * (0.5 * re);
	} else {
		tmp = Math.sin(re) * (t_0 + 1.0);
	}
	return tmp;
}
def code(re, im):
	t_0 = 0.5 * (im * im)
	tmp = 0
	if im <= 0.5:
		tmp = math.sin(re) + (math.sin(re) * t_0)
	elif im <= 1.35e+154:
		tmp = (math.exp(-im) + math.exp(im)) * (0.5 * re)
	else:
		tmp = math.sin(re) * (t_0 + 1.0)
	return tmp
function code(re, im)
	t_0 = Float64(0.5 * Float64(im * im))
	tmp = 0.0
	if (im <= 0.5)
		tmp = Float64(sin(re) + Float64(sin(re) * t_0));
	elseif (im <= 1.35e+154)
		tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * re));
	else
		tmp = Float64(sin(re) * Float64(t_0 + 1.0));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 0.5 * (im * im);
	tmp = 0.0;
	if (im <= 0.5)
		tmp = sin(re) + (sin(re) * t_0);
	elseif (im <= 1.35e+154)
		tmp = (exp(-im) + exp(im)) * (0.5 * re);
	else
		tmp = sin(re) * (t_0 + 1.0);
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 0.5], N[(N[Sin[re], $MachinePrecision] + N[(N[Sin[re], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.35e+154], N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(im \cdot im\right)\\
\mathbf{if}\;im \leq 0.5:\\
\;\;\;\;\sin re + \sin re \cdot t_0\\

\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\

\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(t_0 + 1\right)\\


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

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right)} + \left(0.5 \cdot \sin re\right) \cdot e^{im} \]
      3. cancel-sign-sub100.0%

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-0.5 \cdot \sin re\right) \cdot e^{im}} \]
      4. distribute-lft-neg-out100.0%

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

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-\color{blue}{e^{im} \cdot \left(0.5 \cdot \sin re\right)}\right) \]
      6. distribute-rgt-neg-out100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{e^{im} \cdot \left(-0.5 \cdot \sin re\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - e^{im} \cdot \color{blue}{\left(-1 \cdot \left(0.5 \cdot \sin re\right)\right)} \]
      8. associate-*r*100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{\left(e^{im} \cdot -1\right) \cdot \left(0.5 \cdot \sin re\right)} \]
      9. distribute-rgt-out--100.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} - e^{im} \cdot -1\right)} \]
      10. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(e^{0 - im} + \left(-e^{im} \cdot -1\right)\right)} \]
      11. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-e^{im} \cdot -1\right)\right) \]
      12. *-commutative100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{\left(-e^{im}\right)}\right)\right) \]
      14. remove-double-neg100.0%

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

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

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

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

    if 0.5 < im < 1.35000000000000003e154

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right)} + \left(0.5 \cdot \sin re\right) \cdot e^{im} \]
      3. cancel-sign-sub100.0%

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-0.5 \cdot \sin re\right) \cdot e^{im}} \]
      4. distribute-lft-neg-out100.0%

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

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-\color{blue}{e^{im} \cdot \left(0.5 \cdot \sin re\right)}\right) \]
      6. distribute-rgt-neg-out100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{e^{im} \cdot \left(-0.5 \cdot \sin re\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - e^{im} \cdot \color{blue}{\left(-1 \cdot \left(0.5 \cdot \sin re\right)\right)} \]
      8. associate-*r*100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{\left(e^{im} \cdot -1\right) \cdot \left(0.5 \cdot \sin re\right)} \]
      9. distribute-rgt-out--100.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} - e^{im} \cdot -1\right)} \]
      10. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(e^{0 - im} + \left(-e^{im} \cdot -1\right)\right)} \]
      11. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-e^{im} \cdot -1\right)\right) \]
      12. *-commutative100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{\left(-e^{im}\right)}\right)\right) \]
      14. remove-double-neg100.0%

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

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

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

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

    if 1.35000000000000003e154 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right)} + \left(0.5 \cdot \sin re\right) \cdot e^{im} \]
      3. cancel-sign-sub100.0%

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-0.5 \cdot \sin re\right) \cdot e^{im}} \]
      4. distribute-lft-neg-out100.0%

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

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-\color{blue}{e^{im} \cdot \left(0.5 \cdot \sin re\right)}\right) \]
      6. distribute-rgt-neg-out100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{e^{im} \cdot \left(-0.5 \cdot \sin re\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - e^{im} \cdot \color{blue}{\left(-1 \cdot \left(0.5 \cdot \sin re\right)\right)} \]
      8. associate-*r*100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{\left(e^{im} \cdot -1\right) \cdot \left(0.5 \cdot \sin re\right)} \]
      9. distribute-rgt-out--100.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} - e^{im} \cdot -1\right)} \]
      10. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(e^{0 - im} + \left(-e^{im} \cdot -1\right)\right)} \]
      11. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-e^{im} \cdot -1\right)\right) \]
      12. *-commutative100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{\left(-e^{im}\right)}\right)\right) \]
      14. remove-double-neg100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.5:\\ \;\;\;\;\sin re + \sin re \cdot \left(0.5 \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(0.5 \cdot \left(im \cdot im\right) + 1\right)\\ \end{array} \]

Alternative 4: 81.1% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin re \cdot \left(0.5 \cdot \left(im \cdot im\right) + 1\right)\\ \mathbf{if}\;im \leq 8.6 \cdot 10^{+14}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 6.6 \cdot 10^{+47}:\\ \;\;\;\;{re}^{-512}\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{re \cdot \left(1 - {im}^{4} \cdot 0.25\right)}{1 - im \cdot \left(0.5 \cdot im\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (sin re) (+ (* 0.5 (* im im)) 1.0))))
   (if (<= im 8.6e+14)
     t_0
     (if (<= im 6.6e+47)
       (pow re -512.0)
       (if (<= im 1.35e+154)
         (/ (* re (- 1.0 (* (pow im 4.0) 0.25))) (- 1.0 (* im (* 0.5 im))))
         t_0)))))
double code(double re, double im) {
	double t_0 = sin(re) * ((0.5 * (im * im)) + 1.0);
	double tmp;
	if (im <= 8.6e+14) {
		tmp = t_0;
	} else if (im <= 6.6e+47) {
		tmp = pow(re, -512.0);
	} else if (im <= 1.35e+154) {
		tmp = (re * (1.0 - (pow(im, 4.0) * 0.25))) / (1.0 - (im * (0.5 * 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 = sin(re) * ((0.5d0 * (im * im)) + 1.0d0)
    if (im <= 8.6d+14) then
        tmp = t_0
    else if (im <= 6.6d+47) then
        tmp = re ** (-512.0d0)
    else if (im <= 1.35d+154) then
        tmp = (re * (1.0d0 - ((im ** 4.0d0) * 0.25d0))) / (1.0d0 - (im * (0.5d0 * im)))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = Math.sin(re) * ((0.5 * (im * im)) + 1.0);
	double tmp;
	if (im <= 8.6e+14) {
		tmp = t_0;
	} else if (im <= 6.6e+47) {
		tmp = Math.pow(re, -512.0);
	} else if (im <= 1.35e+154) {
		tmp = (re * (1.0 - (Math.pow(im, 4.0) * 0.25))) / (1.0 - (im * (0.5 * im)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = math.sin(re) * ((0.5 * (im * im)) + 1.0)
	tmp = 0
	if im <= 8.6e+14:
		tmp = t_0
	elif im <= 6.6e+47:
		tmp = math.pow(re, -512.0)
	elif im <= 1.35e+154:
		tmp = (re * (1.0 - (math.pow(im, 4.0) * 0.25))) / (1.0 - (im * (0.5 * im)))
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(sin(re) * Float64(Float64(0.5 * Float64(im * im)) + 1.0))
	tmp = 0.0
	if (im <= 8.6e+14)
		tmp = t_0;
	elseif (im <= 6.6e+47)
		tmp = re ^ -512.0;
	elseif (im <= 1.35e+154)
		tmp = Float64(Float64(re * Float64(1.0 - Float64((im ^ 4.0) * 0.25))) / Float64(1.0 - Float64(im * Float64(0.5 * im))));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = sin(re) * ((0.5 * (im * im)) + 1.0);
	tmp = 0.0;
	if (im <= 8.6e+14)
		tmp = t_0;
	elseif (im <= 6.6e+47)
		tmp = re ^ -512.0;
	elseif (im <= 1.35e+154)
		tmp = (re * (1.0 - ((im ^ 4.0) * 0.25))) / (1.0 - (im * (0.5 * im)));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[Sin[re], $MachinePrecision] * N[(N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 8.6e+14], t$95$0, If[LessEqual[im, 6.6e+47], N[Power[re, -512.0], $MachinePrecision], If[LessEqual[im, 1.35e+154], N[(N[(re * N[(1.0 - N[(N[Power[im, 4.0], $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin re \cdot \left(0.5 \cdot \left(im \cdot im\right) + 1\right)\\
\mathbf{if}\;im \leq 8.6 \cdot 10^{+14}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq 6.6 \cdot 10^{+47}:\\
\;\;\;\;{re}^{-512}\\

\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{re \cdot \left(1 - {im}^{4} \cdot 0.25\right)}{1 - im \cdot \left(0.5 \cdot im\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < 8.6e14 or 1.35000000000000003e154 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right)} + \left(0.5 \cdot \sin re\right) \cdot e^{im} \]
      3. cancel-sign-sub100.0%

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-0.5 \cdot \sin re\right) \cdot e^{im}} \]
      4. distribute-lft-neg-out100.0%

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

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-\color{blue}{e^{im} \cdot \left(0.5 \cdot \sin re\right)}\right) \]
      6. distribute-rgt-neg-out100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{e^{im} \cdot \left(-0.5 \cdot \sin re\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - e^{im} \cdot \color{blue}{\left(-1 \cdot \left(0.5 \cdot \sin re\right)\right)} \]
      8. associate-*r*100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{\left(e^{im} \cdot -1\right) \cdot \left(0.5 \cdot \sin re\right)} \]
      9. distribute-rgt-out--100.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} - e^{im} \cdot -1\right)} \]
      10. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(e^{0 - im} + \left(-e^{im} \cdot -1\right)\right)} \]
      11. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-e^{im} \cdot -1\right)\right) \]
      12. *-commutative100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{\left(-e^{im}\right)}\right)\right) \]
      14. remove-double-neg100.0%

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

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

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

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

    if 8.6e14 < im < 6.5999999999999998e47

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right)} + \left(0.5 \cdot \sin re\right) \cdot e^{im} \]
      3. cancel-sign-sub100.0%

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-0.5 \cdot \sin re\right) \cdot e^{im}} \]
      4. distribute-lft-neg-out100.0%

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

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-\color{blue}{e^{im} \cdot \left(0.5 \cdot \sin re\right)}\right) \]
      6. distribute-rgt-neg-out100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{e^{im} \cdot \left(-0.5 \cdot \sin re\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - e^{im} \cdot \color{blue}{\left(-1 \cdot \left(0.5 \cdot \sin re\right)\right)} \]
      8. associate-*r*100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{\left(e^{im} \cdot -1\right) \cdot \left(0.5 \cdot \sin re\right)} \]
      9. distribute-rgt-out--100.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} - e^{im} \cdot -1\right)} \]
      10. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(e^{0 - im} + \left(-e^{im} \cdot -1\right)\right)} \]
      11. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-e^{im} \cdot -1\right)\right) \]
      12. *-commutative100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{\left(-e^{im}\right)}\right)\right) \]
      14. remove-double-neg100.0%

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

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

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

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

      \[\leadsto \color{blue}{{re}^{-512}} \]

    if 6.5999999999999998e47 < im < 1.35000000000000003e154

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right)} + \left(0.5 \cdot \sin re\right) \cdot e^{im} \]
      3. cancel-sign-sub100.0%

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-0.5 \cdot \sin re\right) \cdot e^{im}} \]
      4. distribute-lft-neg-out100.0%

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

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-\color{blue}{e^{im} \cdot \left(0.5 \cdot \sin re\right)}\right) \]
      6. distribute-rgt-neg-out100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{e^{im} \cdot \left(-0.5 \cdot \sin re\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - e^{im} \cdot \color{blue}{\left(-1 \cdot \left(0.5 \cdot \sin re\right)\right)} \]
      8. associate-*r*100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{\left(e^{im} \cdot -1\right) \cdot \left(0.5 \cdot \sin re\right)} \]
      9. distribute-rgt-out--100.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} - e^{im} \cdot -1\right)} \]
      10. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(e^{0 - im} + \left(-e^{im} \cdot -1\right)\right)} \]
      11. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-e^{im} \cdot -1\right)\right) \]
      12. *-commutative100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{\left(-e^{im}\right)}\right)\right) \]
      14. remove-double-neg100.0%

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

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

      \[\leadsto \color{blue}{\sin re + 0.5 \cdot \left({im}^{2} \cdot \sin re\right)} \]
    5. Simplified4.4%

      \[\leadsto \color{blue}{\sin re + \left(0.5 \cdot \left(im \cdot im\right)\right) \cdot \sin re} \]
    6. Taylor expanded in re around 0 18.8%

      \[\leadsto \sin re + \color{blue}{0.5 \cdot \left({im}^{2} \cdot re\right)} \]
    7. Simplified18.8%

      \[\leadsto \sin re + \color{blue}{0.5 \cdot \left(im \cdot \left(im \cdot re\right)\right)} \]
    8. Taylor expanded in re around 0 18.8%

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

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

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

        \[\leadsto re + re \cdot \left(0.5 \cdot \color{blue}{\left(im \cdot im\right)}\right) \]
      4. *-commutative18.8%

        \[\leadsto re + re \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot 0.5\right)} \]
      5. associate-*r*18.8%

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

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

        \[\leadsto re + \color{blue}{\left(im \cdot re\right)} \cdot \left(im \cdot 0.5\right) \]
      8. +-commutative18.8%

        \[\leadsto \color{blue}{\left(im \cdot re\right) \cdot \left(im \cdot 0.5\right) + re} \]
      9. associate-*r*18.8%

        \[\leadsto \color{blue}{\left(\left(im \cdot re\right) \cdot im\right) \cdot 0.5} + re \]
      10. *-commutative18.8%

        \[\leadsto \left(\color{blue}{\left(re \cdot im\right)} \cdot im\right) \cdot 0.5 + re \]
      11. associate-*r*18.8%

        \[\leadsto \color{blue}{\left(re \cdot \left(im \cdot im\right)\right)} \cdot 0.5 + re \]
      12. *-commutative18.8%

        \[\leadsto \color{blue}{\left(\left(im \cdot im\right) \cdot re\right)} \cdot 0.5 + re \]
      13. associate-*r*18.8%

        \[\leadsto \color{blue}{\left(im \cdot im\right) \cdot \left(re \cdot 0.5\right)} + re \]
      14. fma-def18.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(im \cdot im, re \cdot 0.5, re\right)} \]
    10. Simplified18.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(im \cdot im, re \cdot 0.5, re\right)} \]
    11. Step-by-step derivation
      1. fma-udef18.8%

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

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

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

        \[\leadsto \color{blue}{\left(im \cdot \left(im \cdot 0.5\right)\right)} \cdot re + re \]
      5. +-commutative18.8%

        \[\leadsto \color{blue}{re + \left(im \cdot \left(im \cdot 0.5\right)\right) \cdot re} \]
      6. distribute-rgt1-in18.8%

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

        \[\leadsto \color{blue}{\left(1 + im \cdot \left(im \cdot 0.5\right)\right)} \cdot re \]
      8. flip-+64.1%

        \[\leadsto \color{blue}{\frac{1 \cdot 1 - \left(im \cdot \left(im \cdot 0.5\right)\right) \cdot \left(im \cdot \left(im \cdot 0.5\right)\right)}{1 - im \cdot \left(im \cdot 0.5\right)}} \cdot re \]
      9. associate-*l/64.1%

        \[\leadsto \color{blue}{\frac{\left(1 \cdot 1 - \left(im \cdot \left(im \cdot 0.5\right)\right) \cdot \left(im \cdot \left(im \cdot 0.5\right)\right)\right) \cdot re}{1 - im \cdot \left(im \cdot 0.5\right)}} \]
    12. Applied egg-rr64.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 8.6 \cdot 10^{+14}:\\ \;\;\;\;\sin re \cdot \left(0.5 \cdot \left(im \cdot im\right) + 1\right)\\ \mathbf{elif}\;im \leq 6.6 \cdot 10^{+47}:\\ \;\;\;\;{re}^{-512}\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{re \cdot \left(1 - {im}^{4} \cdot 0.25\right)}{1 - im \cdot \left(0.5 \cdot im\right)}\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(0.5 \cdot \left(im \cdot im\right) + 1\right)\\ \end{array} \]

Alternative 5: 78.4% accurate, 2.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 8.6 \cdot 10^{+14} \lor \neg \left(im \leq 1.35 \cdot 10^{+154}\right):\\
\;\;\;\;\sin re \cdot \left(0.5 \cdot \left(im \cdot im\right) + 1\right)\\

\mathbf{else}:\\
\;\;\;\;{re}^{-512}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 8.6e14 or 1.35000000000000003e154 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right)} + \left(0.5 \cdot \sin re\right) \cdot e^{im} \]
      3. cancel-sign-sub100.0%

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-0.5 \cdot \sin re\right) \cdot e^{im}} \]
      4. distribute-lft-neg-out100.0%

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

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-\color{blue}{e^{im} \cdot \left(0.5 \cdot \sin re\right)}\right) \]
      6. distribute-rgt-neg-out100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{e^{im} \cdot \left(-0.5 \cdot \sin re\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - e^{im} \cdot \color{blue}{\left(-1 \cdot \left(0.5 \cdot \sin re\right)\right)} \]
      8. associate-*r*100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{\left(e^{im} \cdot -1\right) \cdot \left(0.5 \cdot \sin re\right)} \]
      9. distribute-rgt-out--100.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} - e^{im} \cdot -1\right)} \]
      10. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(e^{0 - im} + \left(-e^{im} \cdot -1\right)\right)} \]
      11. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-e^{im} \cdot -1\right)\right) \]
      12. *-commutative100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{\left(-e^{im}\right)}\right)\right) \]
      14. remove-double-neg100.0%

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

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

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

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

    if 8.6e14 < im < 1.35000000000000003e154

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right)} + \left(0.5 \cdot \sin re\right) \cdot e^{im} \]
      3. cancel-sign-sub100.0%

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-0.5 \cdot \sin re\right) \cdot e^{im}} \]
      4. distribute-lft-neg-out100.0%

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

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-\color{blue}{e^{im} \cdot \left(0.5 \cdot \sin re\right)}\right) \]
      6. distribute-rgt-neg-out100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{e^{im} \cdot \left(-0.5 \cdot \sin re\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - e^{im} \cdot \color{blue}{\left(-1 \cdot \left(0.5 \cdot \sin re\right)\right)} \]
      8. associate-*r*100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{\left(e^{im} \cdot -1\right) \cdot \left(0.5 \cdot \sin re\right)} \]
      9. distribute-rgt-out--100.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} - e^{im} \cdot -1\right)} \]
      10. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(e^{0 - im} + \left(-e^{im} \cdot -1\right)\right)} \]
      11. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-e^{im} \cdot -1\right)\right) \]
      12. *-commutative100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{\left(-e^{im}\right)}\right)\right) \]
      14. remove-double-neg100.0%

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

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

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

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

      \[\leadsto \color{blue}{{re}^{-512}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification80.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 8.6 \cdot 10^{+14} \lor \neg \left(im \leq 1.35 \cdot 10^{+154}\right):\\ \;\;\;\;\sin re \cdot \left(0.5 \cdot \left(im \cdot im\right) + 1\right)\\ \mathbf{else}:\\ \;\;\;\;{re}^{-512}\\ \end{array} \]

Alternative 6: 62.7% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 8.6 \cdot 10^{+14}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.55 \cdot 10^{+148}:\\ \;\;\;\;{re}^{-512}\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 8.6e+14)
   (sin re)
   (if (<= im 1.55e+148) (pow re -512.0) (* re (+ 1.0 (* im (* 0.5 im)))))))
double code(double re, double im) {
	double tmp;
	if (im <= 8.6e+14) {
		tmp = sin(re);
	} else if (im <= 1.55e+148) {
		tmp = pow(re, -512.0);
	} else {
		tmp = re * (1.0 + (im * (0.5 * im)));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (im <= 8.6d+14) then
        tmp = sin(re)
    else if (im <= 1.55d+148) then
        tmp = re ** (-512.0d0)
    else
        tmp = re * (1.0d0 + (im * (0.5d0 * im)))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 8.6e+14) {
		tmp = Math.sin(re);
	} else if (im <= 1.55e+148) {
		tmp = Math.pow(re, -512.0);
	} else {
		tmp = re * (1.0 + (im * (0.5 * im)));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 8.6e+14:
		tmp = math.sin(re)
	elif im <= 1.55e+148:
		tmp = math.pow(re, -512.0)
	else:
		tmp = re * (1.0 + (im * (0.5 * im)))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 8.6e+14)
		tmp = sin(re);
	elseif (im <= 1.55e+148)
		tmp = re ^ -512.0;
	else
		tmp = Float64(re * Float64(1.0 + Float64(im * Float64(0.5 * im))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 8.6e+14)
		tmp = sin(re);
	elseif (im <= 1.55e+148)
		tmp = re ^ -512.0;
	else
		tmp = re * (1.0 + (im * (0.5 * im)));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 8.6e+14], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.55e+148], N[Power[re, -512.0], $MachinePrecision], N[(re * N[(1.0 + N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;im \leq 8.6 \cdot 10^{+14}:\\
\;\;\;\;\sin re\\

\mathbf{elif}\;im \leq 1.55 \cdot 10^{+148}:\\
\;\;\;\;{re}^{-512}\\

\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < 8.6e14

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right)} + \left(0.5 \cdot \sin re\right) \cdot e^{im} \]
      3. cancel-sign-sub100.0%

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-0.5 \cdot \sin re\right) \cdot e^{im}} \]
      4. distribute-lft-neg-out100.0%

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

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-\color{blue}{e^{im} \cdot \left(0.5 \cdot \sin re\right)}\right) \]
      6. distribute-rgt-neg-out100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{e^{im} \cdot \left(-0.5 \cdot \sin re\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - e^{im} \cdot \color{blue}{\left(-1 \cdot \left(0.5 \cdot \sin re\right)\right)} \]
      8. associate-*r*100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{\left(e^{im} \cdot -1\right) \cdot \left(0.5 \cdot \sin re\right)} \]
      9. distribute-rgt-out--100.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} - e^{im} \cdot -1\right)} \]
      10. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(e^{0 - im} + \left(-e^{im} \cdot -1\right)\right)} \]
      11. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-e^{im} \cdot -1\right)\right) \]
      12. *-commutative100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{\left(-e^{im}\right)}\right)\right) \]
      14. remove-double-neg100.0%

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

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

      \[\leadsto \color{blue}{\sin re} \]

    if 8.6e14 < im < 1.54999999999999988e148

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right)} + \left(0.5 \cdot \sin re\right) \cdot e^{im} \]
      3. cancel-sign-sub100.0%

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-0.5 \cdot \sin re\right) \cdot e^{im}} \]
      4. distribute-lft-neg-out100.0%

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

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-\color{blue}{e^{im} \cdot \left(0.5 \cdot \sin re\right)}\right) \]
      6. distribute-rgt-neg-out100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{e^{im} \cdot \left(-0.5 \cdot \sin re\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - e^{im} \cdot \color{blue}{\left(-1 \cdot \left(0.5 \cdot \sin re\right)\right)} \]
      8. associate-*r*100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{\left(e^{im} \cdot -1\right) \cdot \left(0.5 \cdot \sin re\right)} \]
      9. distribute-rgt-out--100.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} - e^{im} \cdot -1\right)} \]
      10. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(e^{0 - im} + \left(-e^{im} \cdot -1\right)\right)} \]
      11. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-e^{im} \cdot -1\right)\right) \]
      12. *-commutative100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{\left(-e^{im}\right)}\right)\right) \]
      14. remove-double-neg100.0%

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

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

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

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

      \[\leadsto \color{blue}{{re}^{-512}} \]

    if 1.54999999999999988e148 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right)} + \left(0.5 \cdot \sin re\right) \cdot e^{im} \]
      3. cancel-sign-sub100.0%

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-0.5 \cdot \sin re\right) \cdot e^{im}} \]
      4. distribute-lft-neg-out100.0%

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

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-\color{blue}{e^{im} \cdot \left(0.5 \cdot \sin re\right)}\right) \]
      6. distribute-rgt-neg-out100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{e^{im} \cdot \left(-0.5 \cdot \sin re\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - e^{im} \cdot \color{blue}{\left(-1 \cdot \left(0.5 \cdot \sin re\right)\right)} \]
      8. associate-*r*100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{\left(e^{im} \cdot -1\right) \cdot \left(0.5 \cdot \sin re\right)} \]
      9. distribute-rgt-out--100.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} - e^{im} \cdot -1\right)} \]
      10. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(e^{0 - im} + \left(-e^{im} \cdot -1\right)\right)} \]
      11. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-e^{im} \cdot -1\right)\right) \]
      12. *-commutative100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{\left(-e^{im}\right)}\right)\right) \]
      14. remove-double-neg100.0%

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

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

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

      \[\leadsto \color{blue}{\sin re + \left(0.5 \cdot \left(im \cdot im\right)\right) \cdot \sin re} \]
    6. Taylor expanded in re around 0 66.8%

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

      \[\leadsto \sin re + \color{blue}{0.5 \cdot \left(im \cdot \left(im \cdot re\right)\right)} \]
    8. Taylor expanded in re around 0 66.8%

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

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

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

        \[\leadsto re \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot 0.5\right)}\right) \]
    10. Simplified66.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 8.6 \cdot 10^{+14}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.55 \cdot 10^{+148}:\\ \;\;\;\;{re}^{-512}\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\ \end{array} \]

Alternative 7: 61.3% accurate, 3.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 5.1 \cdot 10^{-5}:\\
\;\;\;\;\sin re\\

\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 5.09999999999999996e-5

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right)} + \left(0.5 \cdot \sin re\right) \cdot e^{im} \]
      3. cancel-sign-sub100.0%

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-0.5 \cdot \sin re\right) \cdot e^{im}} \]
      4. distribute-lft-neg-out100.0%

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

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-\color{blue}{e^{im} \cdot \left(0.5 \cdot \sin re\right)}\right) \]
      6. distribute-rgt-neg-out100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{e^{im} \cdot \left(-0.5 \cdot \sin re\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - e^{im} \cdot \color{blue}{\left(-1 \cdot \left(0.5 \cdot \sin re\right)\right)} \]
      8. associate-*r*100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{\left(e^{im} \cdot -1\right) \cdot \left(0.5 \cdot \sin re\right)} \]
      9. distribute-rgt-out--100.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} - e^{im} \cdot -1\right)} \]
      10. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(e^{0 - im} + \left(-e^{im} \cdot -1\right)\right)} \]
      11. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-e^{im} \cdot -1\right)\right) \]
      12. *-commutative100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{\left(-e^{im}\right)}\right)\right) \]
      14. remove-double-neg100.0%

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

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

      \[\leadsto \color{blue}{\sin re} \]

    if 5.09999999999999996e-5 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right)} + \left(0.5 \cdot \sin re\right) \cdot e^{im} \]
      3. cancel-sign-sub100.0%

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-0.5 \cdot \sin re\right) \cdot e^{im}} \]
      4. distribute-lft-neg-out100.0%

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

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-\color{blue}{e^{im} \cdot \left(0.5 \cdot \sin re\right)}\right) \]
      6. distribute-rgt-neg-out100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{e^{im} \cdot \left(-0.5 \cdot \sin re\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - e^{im} \cdot \color{blue}{\left(-1 \cdot \left(0.5 \cdot \sin re\right)\right)} \]
      8. associate-*r*100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{\left(e^{im} \cdot -1\right) \cdot \left(0.5 \cdot \sin re\right)} \]
      9. distribute-rgt-out--100.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} - e^{im} \cdot -1\right)} \]
      10. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(e^{0 - im} + \left(-e^{im} \cdot -1\right)\right)} \]
      11. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-e^{im} \cdot -1\right)\right) \]
      12. *-commutative100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{\left(-e^{im}\right)}\right)\right) \]
      14. remove-double-neg100.0%

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

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

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

      \[\leadsto \color{blue}{\sin re + \left(0.5 \cdot \left(im \cdot im\right)\right) \cdot \sin re} \]
    6. Taylor expanded in re around 0 43.6%

      \[\leadsto \sin re + \color{blue}{0.5 \cdot \left({im}^{2} \cdot re\right)} \]
    7. Simplified29.1%

      \[\leadsto \sin re + \color{blue}{0.5 \cdot \left(im \cdot \left(im \cdot re\right)\right)} \]
    8. Taylor expanded in re around 0 43.6%

      \[\leadsto \color{blue}{re \cdot \left(1 + 0.5 \cdot {im}^{2}\right)} \]
    9. Step-by-step derivation
      1. unpow243.6%

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

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

        \[\leadsto re \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot 0.5\right)}\right) \]
    10. Simplified43.6%

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

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

Alternative 8: 37.0% accurate, 34.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 450:\\
\;\;\;\;re\\

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


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

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right)} + \left(0.5 \cdot \sin re\right) \cdot e^{im} \]
      3. cancel-sign-sub100.0%

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-0.5 \cdot \sin re\right) \cdot e^{im}} \]
      4. distribute-lft-neg-out100.0%

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

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-\color{blue}{e^{im} \cdot \left(0.5 \cdot \sin re\right)}\right) \]
      6. distribute-rgt-neg-out100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{e^{im} \cdot \left(-0.5 \cdot \sin re\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - e^{im} \cdot \color{blue}{\left(-1 \cdot \left(0.5 \cdot \sin re\right)\right)} \]
      8. associate-*r*100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{\left(e^{im} \cdot -1\right) \cdot \left(0.5 \cdot \sin re\right)} \]
      9. distribute-rgt-out--100.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} - e^{im} \cdot -1\right)} \]
      10. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(e^{0 - im} + \left(-e^{im} \cdot -1\right)\right)} \]
      11. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-e^{im} \cdot -1\right)\right) \]
      12. *-commutative100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{\left(-e^{im}\right)}\right)\right) \]
      14. remove-double-neg100.0%

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

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

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

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

      \[\leadsto \color{blue}{re} \]

    if 450 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right)} + \left(0.5 \cdot \sin re\right) \cdot e^{im} \]
      3. cancel-sign-sub100.0%

        \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-0.5 \cdot \sin re\right) \cdot e^{im}} \]
      4. distribute-lft-neg-out100.0%

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

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-\color{blue}{e^{im} \cdot \left(0.5 \cdot \sin re\right)}\right) \]
      6. distribute-rgt-neg-out100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{e^{im} \cdot \left(-0.5 \cdot \sin re\right)} \]
      7. neg-mul-1100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - e^{im} \cdot \color{blue}{\left(-1 \cdot \left(0.5 \cdot \sin re\right)\right)} \]
      8. associate-*r*100.0%

        \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{\left(e^{im} \cdot -1\right) \cdot \left(0.5 \cdot \sin re\right)} \]
      9. distribute-rgt-out--100.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} - e^{im} \cdot -1\right)} \]
      10. sub-neg100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(e^{0 - im} + \left(-e^{im} \cdot -1\right)\right)} \]
      11. neg-sub0100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-e^{im} \cdot -1\right)\right) \]
      12. *-commutative100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{\left(-e^{im}\right)}\right)\right) \]
      14. remove-double-neg100.0%

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

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

      \[\leadsto \color{blue}{\sin re + 0.5 \cdot \left({im}^{2} \cdot \sin re\right)} \]
    5. Simplified56.7%

      \[\leadsto \color{blue}{\sin re + \left(0.5 \cdot \left(im \cdot im\right)\right) \cdot \sin re} \]
    6. Taylor expanded in re around 0 43.3%

      \[\leadsto \sin re + \color{blue}{0.5 \cdot \left({im}^{2} \cdot re\right)} \]
    7. Simplified28.4%

      \[\leadsto \sin re + \color{blue}{0.5 \cdot \left(im \cdot \left(im \cdot re\right)\right)} \]
    8. Taylor expanded in re around 0 43.3%

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

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

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

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

        \[\leadsto re + re \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot 0.5\right)} \]
      5. associate-*r*43.3%

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

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

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

        \[\leadsto \color{blue}{\left(im \cdot re\right) \cdot \left(im \cdot 0.5\right) + re} \]
      9. associate-*r*28.4%

        \[\leadsto \color{blue}{\left(\left(im \cdot re\right) \cdot im\right) \cdot 0.5} + re \]
      10. *-commutative28.4%

        \[\leadsto \left(\color{blue}{\left(re \cdot im\right)} \cdot im\right) \cdot 0.5 + re \]
      11. associate-*r*43.3%

        \[\leadsto \color{blue}{\left(re \cdot \left(im \cdot im\right)\right)} \cdot 0.5 + re \]
      12. *-commutative43.3%

        \[\leadsto \color{blue}{\left(\left(im \cdot im\right) \cdot re\right)} \cdot 0.5 + re \]
      13. associate-*r*43.3%

        \[\leadsto \color{blue}{\left(im \cdot im\right) \cdot \left(re \cdot 0.5\right)} + re \]
      14. fma-def43.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(im \cdot im, re \cdot 0.5, re\right)} \]
    10. Simplified43.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(im \cdot im, re \cdot 0.5, re\right)} \]
    11. Taylor expanded in im around inf 43.3%

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

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

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

        \[\leadsto \color{blue}{\left(re \cdot \left(im \cdot im\right)\right)} \cdot 0.5 \]
      4. associate-*r*43.3%

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

        \[\leadsto re \cdot \color{blue}{\left(0.5 \cdot \left(im \cdot im\right)\right)} \]
    13. Simplified43.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 450:\\ \;\;\;\;re\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.5 \cdot \left(im \cdot im\right)\right)\\ \end{array} \]

Alternative 9: 47.8% accurate, 34.3× speedup?

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

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

    \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
  2. Step-by-step derivation
    1. distribute-lft-in100.0%

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

      \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right)} + \left(0.5 \cdot \sin re\right) \cdot e^{im} \]
    3. cancel-sign-sub100.0%

      \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-0.5 \cdot \sin re\right) \cdot e^{im}} \]
    4. distribute-lft-neg-out100.0%

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

      \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-\color{blue}{e^{im} \cdot \left(0.5 \cdot \sin re\right)}\right) \]
    6. distribute-rgt-neg-out100.0%

      \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{e^{im} \cdot \left(-0.5 \cdot \sin re\right)} \]
    7. neg-mul-1100.0%

      \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - e^{im} \cdot \color{blue}{\left(-1 \cdot \left(0.5 \cdot \sin re\right)\right)} \]
    8. associate-*r*100.0%

      \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{\left(e^{im} \cdot -1\right) \cdot \left(0.5 \cdot \sin re\right)} \]
    9. distribute-rgt-out--100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} - e^{im} \cdot -1\right)} \]
    10. sub-neg100.0%

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(e^{0 - im} + \left(-e^{im} \cdot -1\right)\right)} \]
    11. neg-sub0100.0%

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-e^{im} \cdot -1\right)\right) \]
    12. *-commutative100.0%

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{\left(-e^{im}\right)}\right)\right) \]
    14. remove-double-neg100.0%

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

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

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

    \[\leadsto \color{blue}{\sin re + \left(0.5 \cdot \left(im \cdot im\right)\right) \cdot \sin re} \]
  6. Taylor expanded in re around 0 66.1%

    \[\leadsto \sin re + \color{blue}{0.5 \cdot \left({im}^{2} \cdot re\right)} \]
  7. Simplified58.8%

    \[\leadsto \sin re + \color{blue}{0.5 \cdot \left(im \cdot \left(im \cdot re\right)\right)} \]
  8. Taylor expanded in re around 0 50.9%

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

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

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

      \[\leadsto re \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot 0.5\right)}\right) \]
  10. Simplified50.9%

    \[\leadsto \color{blue}{re \cdot \left(1 + im \cdot \left(im \cdot 0.5\right)\right)} \]
  11. Final simplification50.9%

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

Alternative 10: 26.4% accurate, 309.0× speedup?

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

\\
re
\end{array}
Derivation
  1. Initial program 100.0%

    \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
  2. Step-by-step derivation
    1. distribute-lft-in100.0%

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

      \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right)} + \left(0.5 \cdot \sin re\right) \cdot e^{im} \]
    3. cancel-sign-sub100.0%

      \[\leadsto \color{blue}{e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-0.5 \cdot \sin re\right) \cdot e^{im}} \]
    4. distribute-lft-neg-out100.0%

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

      \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \left(-\color{blue}{e^{im} \cdot \left(0.5 \cdot \sin re\right)}\right) \]
    6. distribute-rgt-neg-out100.0%

      \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{e^{im} \cdot \left(-0.5 \cdot \sin re\right)} \]
    7. neg-mul-1100.0%

      \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - e^{im} \cdot \color{blue}{\left(-1 \cdot \left(0.5 \cdot \sin re\right)\right)} \]
    8. associate-*r*100.0%

      \[\leadsto e^{0 - im} \cdot \left(0.5 \cdot \sin re\right) - \color{blue}{\left(e^{im} \cdot -1\right) \cdot \left(0.5 \cdot \sin re\right)} \]
    9. distribute-rgt-out--100.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} - e^{im} \cdot -1\right)} \]
    10. sub-neg100.0%

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(e^{0 - im} + \left(-e^{im} \cdot -1\right)\right)} \]
    11. neg-sub0100.0%

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-e^{im} \cdot -1\right)\right) \]
    12. *-commutative100.0%

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{\left(-e^{im}\right)}\right)\right) \]
    14. remove-double-neg100.0%

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

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

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

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

    \[\leadsto \color{blue}{re} \]
  7. Final simplification28.3%

    \[\leadsto re \]

Reproduce

?
herbie shell --seed 2023292 
(FPCore (re im)
  :name "math.sin on complex, real part"
  :precision binary64
  (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))