math.sin on complex, real part

Percentage Accurate: 100.0% → 100.0%
Time: 9.3s
Alternatives: 14
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 14 alternatives:

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

Initial Program: 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-rgt-in100.0%

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

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

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

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
    6. 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: 77.1% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(0.5 \cdot \sin re\right) \cdot \mathsf{fma}\left(im, im, 2\right)\\ \mathbf{if}\;im \leq 5800:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 5 \cdot 10^{+115}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re\right)\right)\\ \mathbf{elif}\;im \leq 1.9 \cdot 10^{+135}:\\ \;\;\;\;{re}^{-2}\\ \mathbf{elif}\;im \leq 8 \cdot 10^{+148}:\\ \;\;\;\;\mathsf{fma}\left(im, im, 2\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (* 0.5 (sin re)) (fma im im 2.0))))
   (if (<= im 5800.0)
     t_0
     (if (<= im 5e+115)
       (log1p (expm1 re))
       (if (<= im 1.9e+135)
         (pow re -2.0)
         (if (<= im 8e+148) (* (fma im im 2.0) (* 0.5 re)) t_0))))))
double code(double re, double im) {
	double t_0 = (0.5 * sin(re)) * fma(im, im, 2.0);
	double tmp;
	if (im <= 5800.0) {
		tmp = t_0;
	} else if (im <= 5e+115) {
		tmp = log1p(expm1(re));
	} else if (im <= 1.9e+135) {
		tmp = pow(re, -2.0);
	} else if (im <= 8e+148) {
		tmp = fma(im, im, 2.0) * (0.5 * re);
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(re, im)
	t_0 = Float64(Float64(0.5 * sin(re)) * fma(im, im, 2.0))
	tmp = 0.0
	if (im <= 5800.0)
		tmp = t_0;
	elseif (im <= 5e+115)
		tmp = log1p(expm1(re));
	elseif (im <= 1.9e+135)
		tmp = re ^ -2.0;
	elseif (im <= 8e+148)
		tmp = Float64(fma(im, im, 2.0) * Float64(0.5 * re));
	else
		tmp = t_0;
	end
	return tmp
end
code[re_, im_] := Block[{t$95$0 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(im * im + 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 5800.0], t$95$0, If[LessEqual[im, 5e+115], N[Log[1 + N[(Exp[re] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 1.9e+135], N[Power[re, -2.0], $MachinePrecision], If[LessEqual[im, 8e+148], N[(N[(im * im + 2.0), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(0.5 \cdot \sin re\right) \cdot \mathsf{fma}\left(im, im, 2\right)\\
\mathbf{if}\;im \leq 5800:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq 5 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re\right)\right)\\

\mathbf{elif}\;im \leq 1.9 \cdot 10^{+135}:\\
\;\;\;\;{re}^{-2}\\

\mathbf{elif}\;im \leq 8 \cdot 10^{+148}:\\
\;\;\;\;\mathsf{fma}\left(im, im, 2\right) \cdot \left(0.5 \cdot re\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < 5800 or 8.0000000000000004e148 < 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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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 80.4%

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\mathsf{fma}\left(im, im, 2\right)} \]

    if 5800 < im < 5.00000000000000008e115

    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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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. Applied egg-rr10.0%

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

      \[\leadsto \color{blue}{\frac{0.25}{{re}^{2}}} \]
    6. Applied egg-rr42.5%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(re\right)\right)} \]

    if 5.00000000000000008e115 < im < 1.9000000000000001e135

    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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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. Applied egg-rr18.5%

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

      \[\leadsto \color{blue}{\frac{0.25}{{re}^{2}}} \]
    6. Applied egg-rr18.1%

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

    if 1.9000000000000001e135 < im < 8.0000000000000004e148

    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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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 8.2%

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\mathsf{fma}\left(im, im, 2\right)} \]
    6. Taylor expanded in re around 0 0.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 5800:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \mathsf{fma}\left(im, im, 2\right)\\ \mathbf{elif}\;im \leq 5 \cdot 10^{+115}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re\right)\right)\\ \mathbf{elif}\;im \leq 1.9 \cdot 10^{+135}:\\ \;\;\;\;{re}^{-2}\\ \mathbf{elif}\;im \leq 8 \cdot 10^{+148}:\\ \;\;\;\;\mathsf{fma}\left(im, im, 2\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \mathsf{fma}\left(im, im, 2\right)\\ \end{array} \]

Alternative 3: 83.5% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 0.0135 \lor \neg \left(im \leq 1.35 \cdot 10^{+154}\right):\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \mathsf{fma}\left(im, im, 2\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.0135) (not (<= im 1.35e+154)))
   (* (* 0.5 (sin re)) (fma im im 2.0))
   (* (+ (exp (- im)) (exp im)) (* 0.5 re))))
double code(double re, double im) {
	double tmp;
	if ((im <= 0.0135) || !(im <= 1.35e+154)) {
		tmp = (0.5 * sin(re)) * fma(im, im, 2.0);
	} else {
		tmp = (exp(-im) + exp(im)) * (0.5 * re);
	}
	return tmp;
}
function code(re, im)
	tmp = 0.0
	if ((im <= 0.0135) || !(im <= 1.35e+154))
		tmp = Float64(Float64(0.5 * sin(re)) * fma(im, im, 2.0));
	else
		tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * re));
	end
	return tmp
end
code[re_, im_] := If[Or[LessEqual[im, 0.0135], N[Not[LessEqual[im, 1.35e+154]], $MachinePrecision]], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(im * im + 2.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.0135 \lor \neg \left(im \leq 1.35 \cdot 10^{+154}\right):\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \mathsf{fma}\left(im, im, 2\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.0134999999999999998 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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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 82.7%

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\mathsf{fma}\left(im, im, 2\right)} \]

    if 0.0134999999999999998 < 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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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 73.7%

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

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

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

Alternative 4: 62.4% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 580:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.18 \cdot 10^{+107}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(im, im, 2\right) \cdot \left(0.5 \cdot re\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 580.0)
   (sin re)
   (if (<= im 1.18e+107) (log1p (expm1 re)) (* (fma im im 2.0) (* 0.5 re)))))
double code(double re, double im) {
	double tmp;
	if (im <= 580.0) {
		tmp = sin(re);
	} else if (im <= 1.18e+107) {
		tmp = log1p(expm1(re));
	} else {
		tmp = fma(im, im, 2.0) * (0.5 * re);
	}
	return tmp;
}
function code(re, im)
	tmp = 0.0
	if (im <= 580.0)
		tmp = sin(re);
	elseif (im <= 1.18e+107)
		tmp = log1p(expm1(re));
	else
		tmp = Float64(fma(im, im, 2.0) * Float64(0.5 * re));
	end
	return tmp
end
code[re_, im_] := If[LessEqual[im, 580.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.18e+107], N[Log[1 + N[(Exp[re] - 1), $MachinePrecision]], $MachinePrecision], N[(N[(im * im + 2.0), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 1.18 \cdot 10^{+107}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(im, im, 2\right) \cdot \left(0.5 \cdot re\right)\\


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

    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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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 64.1%

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

    if 580 < im < 1.18000000000000005e107

    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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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. Applied egg-rr10.0%

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

      \[\leadsto \color{blue}{\frac{0.25}{{re}^{2}}} \]
    6. Applied egg-rr38.4%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(re\right)\right)} \]

    if 1.18000000000000005e107 < 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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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 74.7%

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\mathsf{fma}\left(im, im, 2\right)} \]
    6. Taylor expanded in re around 0 64.1%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 580:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.18 \cdot 10^{+107}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(im, im, 2\right) \cdot \left(0.5 \cdot re\right)\\ \end{array} \]

Alternative 5: 52.9% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 760:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 6.8 \cdot 10^{+89} \lor \neg \left(im \leq 7.5 \cdot 10^{+115}\right) \land \left(im \leq 2.3 \cdot 10^{+163} \lor \neg \left(im \leq 3.8 \cdot 10^{+206}\right)\right):\\ \;\;\;\;{re}^{-2}\\ \mathbf{else}:\\ \;\;\;\;\left(re + -0.020833333333333332\right) \cdot \left(re + -0.020833333333333332\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 760.0)
   (sin re)
   (if (or (<= im 6.8e+89)
           (and (not (<= im 7.5e+115))
                (or (<= im 2.3e+163) (not (<= im 3.8e+206)))))
     (pow re -2.0)
     (* (+ re -0.020833333333333332) (+ re -0.020833333333333332)))))
double code(double re, double im) {
	double tmp;
	if (im <= 760.0) {
		tmp = sin(re);
	} else if ((im <= 6.8e+89) || (!(im <= 7.5e+115) && ((im <= 2.3e+163) || !(im <= 3.8e+206)))) {
		tmp = pow(re, -2.0);
	} else {
		tmp = (re + -0.020833333333333332) * (re + -0.020833333333333332);
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (im <= 760.0d0) then
        tmp = sin(re)
    else if ((im <= 6.8d+89) .or. (.not. (im <= 7.5d+115)) .and. (im <= 2.3d+163) .or. (.not. (im <= 3.8d+206))) then
        tmp = re ** (-2.0d0)
    else
        tmp = (re + (-0.020833333333333332d0)) * (re + (-0.020833333333333332d0))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 760.0) {
		tmp = Math.sin(re);
	} else if ((im <= 6.8e+89) || (!(im <= 7.5e+115) && ((im <= 2.3e+163) || !(im <= 3.8e+206)))) {
		tmp = Math.pow(re, -2.0);
	} else {
		tmp = (re + -0.020833333333333332) * (re + -0.020833333333333332);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 760.0:
		tmp = math.sin(re)
	elif (im <= 6.8e+89) or (not (im <= 7.5e+115) and ((im <= 2.3e+163) or not (im <= 3.8e+206))):
		tmp = math.pow(re, -2.0)
	else:
		tmp = (re + -0.020833333333333332) * (re + -0.020833333333333332)
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 760.0)
		tmp = sin(re);
	elseif ((im <= 6.8e+89) || (!(im <= 7.5e+115) && ((im <= 2.3e+163) || !(im <= 3.8e+206))))
		tmp = re ^ -2.0;
	else
		tmp = Float64(Float64(re + -0.020833333333333332) * Float64(re + -0.020833333333333332));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 760.0)
		tmp = sin(re);
	elseif ((im <= 6.8e+89) || (~((im <= 7.5e+115)) && ((im <= 2.3e+163) || ~((im <= 3.8e+206)))))
		tmp = re ^ -2.0;
	else
		tmp = (re + -0.020833333333333332) * (re + -0.020833333333333332);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 760.0], N[Sin[re], $MachinePrecision], If[Or[LessEqual[im, 6.8e+89], And[N[Not[LessEqual[im, 7.5e+115]], $MachinePrecision], Or[LessEqual[im, 2.3e+163], N[Not[LessEqual[im, 3.8e+206]], $MachinePrecision]]]], N[Power[re, -2.0], $MachinePrecision], N[(N[(re + -0.020833333333333332), $MachinePrecision] * N[(re + -0.020833333333333332), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 6.8 \cdot 10^{+89} \lor \neg \left(im \leq 7.5 \cdot 10^{+115}\right) \land \left(im \leq 2.3 \cdot 10^{+163} \lor \neg \left(im \leq 3.8 \cdot 10^{+206}\right)\right):\\
\;\;\;\;{re}^{-2}\\

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


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

    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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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 64.1%

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

    if 760 < im < 6.8000000000000004e89 or 7.4999999999999997e115 < im < 2.30000000000000002e163 or 3.7999999999999999e206 < 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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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. Applied egg-rr15.7%

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

      \[\leadsto \color{blue}{\frac{0.25}{{re}^{2}}} \]
    6. Applied egg-rr15.6%

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

    if 6.8000000000000004e89 < im < 7.4999999999999997e115 or 2.30000000000000002e163 < im < 3.7999999999999999e206

    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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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. Applied egg-rr2.0%

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

      \[\leadsto \color{blue}{0.08333333333333333 + 0.25 \cdot \frac{1}{{re}^{2}}} \]
    6. Step-by-step derivation
      1. associate-*r/2.0%

        \[\leadsto 0.08333333333333333 + \color{blue}{\frac{0.25 \cdot 1}{{re}^{2}}} \]
      2. metadata-eval2.0%

        \[\leadsto 0.08333333333333333 + \frac{\color{blue}{0.25}}{{re}^{2}} \]
    7. Simplified2.0%

      \[\leadsto \color{blue}{0.08333333333333333 + \frac{0.25}{{re}^{2}}} \]
    8. Applied egg-rr28.0%

      \[\leadsto \color{blue}{\left(-0.020833333333333332 + re\right) \cdot \left(-0.020833333333333332 + re\right)} \]
    9. Step-by-step derivation
      1. +-commutative28.0%

        \[\leadsto \color{blue}{\left(re + -0.020833333333333332\right)} \cdot \left(-0.020833333333333332 + re\right) \]
      2. +-commutative28.0%

        \[\leadsto \left(re + -0.020833333333333332\right) \cdot \color{blue}{\left(re + -0.020833333333333332\right)} \]
    10. Simplified28.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 760:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 6.8 \cdot 10^{+89} \lor \neg \left(im \leq 7.5 \cdot 10^{+115}\right) \land \left(im \leq 2.3 \cdot 10^{+163} \lor \neg \left(im \leq 3.8 \cdot 10^{+206}\right)\right):\\ \;\;\;\;{re}^{-2}\\ \mathbf{else}:\\ \;\;\;\;\left(re + -0.020833333333333332\right) \cdot \left(re + -0.020833333333333332\right)\\ \end{array} \]

Alternative 6: 61.4% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 600:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 6.5 \cdot 10^{+82}:\\ \;\;\;\;0.08333333333333333 + \frac{0.25}{{re}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(im, im, 2\right) \cdot \left(0.5 \cdot re\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 600.0)
   (sin re)
   (if (<= im 6.5e+82)
     (+ 0.08333333333333333 (/ 0.25 (pow re 2.0)))
     (* (fma im im 2.0) (* 0.5 re)))))
double code(double re, double im) {
	double tmp;
	if (im <= 600.0) {
		tmp = sin(re);
	} else if (im <= 6.5e+82) {
		tmp = 0.08333333333333333 + (0.25 / pow(re, 2.0));
	} else {
		tmp = fma(im, im, 2.0) * (0.5 * re);
	}
	return tmp;
}
function code(re, im)
	tmp = 0.0
	if (im <= 600.0)
		tmp = sin(re);
	elseif (im <= 6.5e+82)
		tmp = Float64(0.08333333333333333 + Float64(0.25 / (re ^ 2.0)));
	else
		tmp = Float64(fma(im, im, 2.0) * Float64(0.5 * re));
	end
	return tmp
end
code[re_, im_] := If[LessEqual[im, 600.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 6.5e+82], N[(0.08333333333333333 + N[(0.25 / N[Power[re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(im * im + 2.0), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 6.5 \cdot 10^{+82}:\\
\;\;\;\;0.08333333333333333 + \frac{0.25}{{re}^{2}}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(im, im, 2\right) \cdot \left(0.5 \cdot re\right)\\


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

    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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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 64.1%

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

    if 600 < im < 6.5000000000000003e82

    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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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. Applied egg-rr11.4%

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

      \[\leadsto \color{blue}{0.08333333333333333 + 0.25 \cdot \frac{1}{{re}^{2}}} \]
    6. Step-by-step derivation
      1. associate-*r/11.4%

        \[\leadsto 0.08333333333333333 + \color{blue}{\frac{0.25 \cdot 1}{{re}^{2}}} \]
      2. metadata-eval11.4%

        \[\leadsto 0.08333333333333333 + \frac{\color{blue}{0.25}}{{re}^{2}} \]
    7. Simplified11.4%

      \[\leadsto \color{blue}{0.08333333333333333 + \frac{0.25}{{re}^{2}}} \]

    if 6.5000000000000003e82 < 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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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 68.5%

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\mathsf{fma}\left(im, im, 2\right)} \]
    6. Taylor expanded in re around 0 60.8%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 600:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 6.5 \cdot 10^{+82}:\\ \;\;\;\;0.08333333333333333 + \frac{0.25}{{re}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(im, im, 2\right) \cdot \left(0.5 \cdot re\right)\\ \end{array} \]

Alternative 7: 61.4% accurate, 2.8× speedup?

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

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

\mathbf{elif}\;im \leq 1.35 \cdot 10^{+81}:\\
\;\;\;\;{re}^{-2}\\

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


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

    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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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 64.1%

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

    if 980 < im < 1.35e81

    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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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. Applied egg-rr11.4%

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

      \[\leadsto \color{blue}{\frac{0.25}{{re}^{2}}} \]
    6. Applied egg-rr11.2%

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

    if 1.35e81 < 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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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 68.5%

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\mathsf{fma}\left(im, im, 2\right)} \]
    6. Taylor expanded in re around 0 60.8%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(im, im, 2\right) \cdot \left(re \cdot 0.5\right)} \]
    9. Taylor expanded in im around 0 60.8%

      \[\leadsto \color{blue}{re + 0.5 \cdot \left({im}^{2} \cdot re\right)} \]
    10. Taylor expanded in im around inf 60.8%

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

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

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

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

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

Alternative 8: 61.4% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 550:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 8.2 \cdot 10^{+82}:\\ \;\;\;\;0.08333333333333333 + \frac{0.25}{{re}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot {im}^{2}\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 550.0)
   (sin re)
   (if (<= im 8.2e+82)
     (+ 0.08333333333333333 (/ 0.25 (pow re 2.0)))
     (* (* 0.5 re) (pow im 2.0)))))
double code(double re, double im) {
	double tmp;
	if (im <= 550.0) {
		tmp = sin(re);
	} else if (im <= 8.2e+82) {
		tmp = 0.08333333333333333 + (0.25 / pow(re, 2.0));
	} else {
		tmp = (0.5 * re) * pow(im, 2.0);
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (im <= 550.0d0) then
        tmp = sin(re)
    else if (im <= 8.2d+82) then
        tmp = 0.08333333333333333d0 + (0.25d0 / (re ** 2.0d0))
    else
        tmp = (0.5d0 * re) * (im ** 2.0d0)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 550.0) {
		tmp = Math.sin(re);
	} else if (im <= 8.2e+82) {
		tmp = 0.08333333333333333 + (0.25 / Math.pow(re, 2.0));
	} else {
		tmp = (0.5 * re) * Math.pow(im, 2.0);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 550.0:
		tmp = math.sin(re)
	elif im <= 8.2e+82:
		tmp = 0.08333333333333333 + (0.25 / math.pow(re, 2.0))
	else:
		tmp = (0.5 * re) * math.pow(im, 2.0)
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 550.0)
		tmp = sin(re);
	elseif (im <= 8.2e+82)
		tmp = Float64(0.08333333333333333 + Float64(0.25 / (re ^ 2.0)));
	else
		tmp = Float64(Float64(0.5 * re) * (im ^ 2.0));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 550.0)
		tmp = sin(re);
	elseif (im <= 8.2e+82)
		tmp = 0.08333333333333333 + (0.25 / (re ^ 2.0));
	else
		tmp = (0.5 * re) * (im ^ 2.0);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 550.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 8.2e+82], N[(0.08333333333333333 + N[(0.25 / N[Power[re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 8.2 \cdot 10^{+82}:\\
\;\;\;\;0.08333333333333333 + \frac{0.25}{{re}^{2}}\\

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


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

    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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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 64.1%

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

    if 550 < im < 8.1999999999999999e82

    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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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. Applied egg-rr11.4%

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

      \[\leadsto \color{blue}{0.08333333333333333 + 0.25 \cdot \frac{1}{{re}^{2}}} \]
    6. Step-by-step derivation
      1. associate-*r/11.4%

        \[\leadsto 0.08333333333333333 + \color{blue}{\frac{0.25 \cdot 1}{{re}^{2}}} \]
      2. metadata-eval11.4%

        \[\leadsto 0.08333333333333333 + \frac{\color{blue}{0.25}}{{re}^{2}} \]
    7. Simplified11.4%

      \[\leadsto \color{blue}{0.08333333333333333 + \frac{0.25}{{re}^{2}}} \]

    if 8.1999999999999999e82 < 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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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 68.5%

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\mathsf{fma}\left(im, im, 2\right)} \]
    6. Taylor expanded in re around 0 60.8%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(im, im, 2\right) \cdot \left(re \cdot 0.5\right)} \]
    9. Taylor expanded in im around 0 60.8%

      \[\leadsto \color{blue}{re + 0.5 \cdot \left({im}^{2} \cdot re\right)} \]
    10. Taylor expanded in im around inf 60.8%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 550:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 8.2 \cdot 10^{+82}:\\ \;\;\;\;0.08333333333333333 + \frac{0.25}{{re}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot {im}^{2}\\ \end{array} \]

Alternative 9: 53.1% accurate, 3.0× speedup?

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

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

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


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

    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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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 64.1%

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

    if 240 < 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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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. Applied egg-rr12.5%

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

      \[\leadsto \color{blue}{0.08333333333333333 + 0.25 \cdot \frac{1}{{re}^{2}}} \]
    6. Step-by-step derivation
      1. associate-*r/12.5%

        \[\leadsto 0.08333333333333333 + \color{blue}{\frac{0.25 \cdot 1}{{re}^{2}}} \]
      2. metadata-eval12.5%

        \[\leadsto 0.08333333333333333 + \frac{\color{blue}{0.25}}{{re}^{2}} \]
    7. Simplified12.5%

      \[\leadsto \color{blue}{0.08333333333333333 + \frac{0.25}{{re}^{2}}} \]
    8. Applied egg-rr14.1%

      \[\leadsto \color{blue}{\left(-0.020833333333333332 + re\right) \cdot \left(-0.020833333333333332 + re\right)} \]
    9. Step-by-step derivation
      1. +-commutative14.1%

        \[\leadsto \color{blue}{\left(re + -0.020833333333333332\right)} \cdot \left(-0.020833333333333332 + re\right) \]
      2. +-commutative14.1%

        \[\leadsto \left(re + -0.020833333333333332\right) \cdot \color{blue}{\left(re + -0.020833333333333332\right)} \]
    10. Simplified14.1%

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

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

Alternative 10: 29.1% accurate, 34.1× speedup?

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

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

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


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

    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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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 78.9%

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\mathsf{fma}\left(im, im, 2\right)} \]
    6. Taylor expanded in re around 0 50.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(im, im, 2\right) \cdot \left(re \cdot 0.5\right)} \]
    9. Taylor expanded in im around 0 35.0%

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

    if 260 < 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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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. Applied egg-rr12.5%

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

      \[\leadsto \color{blue}{0.08333333333333333 + 0.25 \cdot \frac{1}{{re}^{2}}} \]
    6. Step-by-step derivation
      1. associate-*r/12.5%

        \[\leadsto 0.08333333333333333 + \color{blue}{\frac{0.25 \cdot 1}{{re}^{2}}} \]
      2. metadata-eval12.5%

        \[\leadsto 0.08333333333333333 + \frac{\color{blue}{0.25}}{{re}^{2}} \]
    7. Simplified12.5%

      \[\leadsto \color{blue}{0.08333333333333333 + \frac{0.25}{{re}^{2}}} \]
    8. Applied egg-rr14.1%

      \[\leadsto \color{blue}{\left(-0.020833333333333332 + re\right) \cdot \left(-0.020833333333333332 + re\right)} \]
    9. Step-by-step derivation
      1. +-commutative14.1%

        \[\leadsto \color{blue}{\left(re + -0.020833333333333332\right)} \cdot \left(-0.020833333333333332 + re\right) \]
      2. +-commutative14.1%

        \[\leadsto \left(re + -0.020833333333333332\right) \cdot \color{blue}{\left(re + -0.020833333333333332\right)} \]
    10. Simplified14.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 260:\\ \;\;\;\;re\\ \mathbf{else}:\\ \;\;\;\;\left(re + -0.020833333333333332\right) \cdot \left(re + -0.020833333333333332\right)\\ \end{array} \]

Alternative 11: 29.1% accurate, 61.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;re \cdot re\\


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

    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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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 78.5%

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\mathsf{fma}\left(im, im, 2\right)} \]
    6. Taylor expanded in re around 0 49.8%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(im, im, 2\right) \cdot \left(re \cdot 0.5\right)} \]
    9. Taylor expanded in im around 0 34.8%

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

    if 6200 < 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-rgt-in100.0%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
      6. 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. Applied egg-rr12.7%

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

      \[\leadsto \color{blue}{\frac{0.25}{{re}^{2}}} \]
    6. Applied egg-rr14.1%

      \[\leadsto \color{blue}{re \cdot re} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification29.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 6200:\\ \;\;\;\;re\\ \mathbf{else}:\\ \;\;\;\;re \cdot re\\ \end{array} \]

Alternative 12: 4.2% accurate, 309.0× speedup?

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

\\
0.08333333333333333
\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-rgt-in100.0%

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

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

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

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
    6. 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. Applied egg-rr8.2%

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

    \[\leadsto \color{blue}{0.08333333333333333 + 0.25 \cdot \frac{1}{{re}^{2}}} \]
  6. Step-by-step derivation
    1. associate-*r/8.1%

      \[\leadsto 0.08333333333333333 + \color{blue}{\frac{0.25 \cdot 1}{{re}^{2}}} \]
    2. metadata-eval8.1%

      \[\leadsto 0.08333333333333333 + \frac{\color{blue}{0.25}}{{re}^{2}} \]
  7. Simplified8.1%

    \[\leadsto \color{blue}{0.08333333333333333 + \frac{0.25}{{re}^{2}}} \]
  8. Taylor expanded in re around inf 3.5%

    \[\leadsto \color{blue}{0.08333333333333333} \]
  9. Final simplification3.5%

    \[\leadsto 0.08333333333333333 \]

Alternative 13: 4.8% accurate, 309.0× speedup?

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

\\
0.9795918367346939
\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-rgt-in100.0%

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

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

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

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
    6. 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. Applied egg-rr8.2%

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

    \[\leadsto \color{blue}{0.08333333333333333 + 0.25 \cdot \frac{1}{{re}^{2}}} \]
  6. Step-by-step derivation
    1. associate-*r/8.1%

      \[\leadsto 0.08333333333333333 + \color{blue}{\frac{0.25 \cdot 1}{{re}^{2}}} \]
    2. metadata-eval8.1%

      \[\leadsto 0.08333333333333333 + \frac{\color{blue}{0.25}}{{re}^{2}} \]
  7. Simplified8.1%

    \[\leadsto \color{blue}{0.08333333333333333 + \frac{0.25}{{re}^{2}}} \]
  8. Applied egg-rr3.8%

    \[\leadsto \color{blue}{\frac{re + 0.0005787037037037037}{re + \left(0.006944444444444444 - -0.020833333333333332 \cdot re\right)}} \]
  9. Step-by-step derivation
    1. +-commutative3.8%

      \[\leadsto \frac{re + 0.0005787037037037037}{\color{blue}{\left(0.006944444444444444 - -0.020833333333333332 \cdot re\right) + re}} \]
    2. associate-+l-3.8%

      \[\leadsto \frac{re + 0.0005787037037037037}{\color{blue}{0.006944444444444444 - \left(-0.020833333333333332 \cdot re - re\right)}} \]
    3. *-lft-identity3.8%

      \[\leadsto \frac{re + 0.0005787037037037037}{0.006944444444444444 - \left(-0.020833333333333332 \cdot re - \color{blue}{1 \cdot re}\right)} \]
    4. distribute-rgt-out--3.8%

      \[\leadsto \frac{re + 0.0005787037037037037}{0.006944444444444444 - \color{blue}{re \cdot \left(-0.020833333333333332 - 1\right)}} \]
    5. metadata-eval3.8%

      \[\leadsto \frac{re + 0.0005787037037037037}{0.006944444444444444 - re \cdot \color{blue}{-1.0208333333333333}} \]
  10. Simplified3.8%

    \[\leadsto \color{blue}{\frac{re + 0.0005787037037037037}{0.006944444444444444 - re \cdot -1.0208333333333333}} \]
  11. Taylor expanded in re around inf 3.8%

    \[\leadsto \color{blue}{0.9795918367346939} \]
  12. Final simplification3.8%

    \[\leadsto 0.9795918367346939 \]

Alternative 14: 26.1% 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-rgt-in100.0%

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

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

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

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + \left(-\left(-e^{im}\right)\right)\right) \]
    6. 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 71.2%

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

    \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\mathsf{fma}\left(im, im, 2\right)} \]
  6. Taylor expanded in re around 0 48.6%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(im, im, 2\right) \cdot \left(re \cdot 0.5\right)} \]
  9. Taylor expanded in im around 0 26.8%

    \[\leadsto \color{blue}{re} \]
  10. Final simplification26.8%

    \[\leadsto re \]

Reproduce

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