math.sin on complex, real part

Percentage Accurate: 100.0% → 100.0%
Time: 7.9s
Alternatives: 15
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 15 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: 64.7% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 9 \cdot 10^{+14}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 7.2 \cdot 10^{+46}:\\ \;\;\;\;\log \left(\frac{-2}{e^{re}}\right)\\ \mathbf{elif}\;im \leq 6.2 \cdot 10^{+78}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot {im}^{2}\\ \mathbf{elif}\;im \leq 1.15 \cdot 10^{+144}:\\ \;\;\;\;{\left(\sin re \cdot -2\right)}^{-2}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot {im}^{2}\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 9e+14)
   (sin re)
   (if (<= im 7.2e+46)
     (log (/ -2.0 (exp re)))
     (if (<= im 6.2e+78)
       (* (* 0.5 re) (pow im 2.0))
       (if (<= im 1.15e+144)
         (pow (* (sin re) -2.0) -2.0)
         (* (* 0.5 (sin re)) (pow im 2.0)))))))
double code(double re, double im) {
	double tmp;
	if (im <= 9e+14) {
		tmp = sin(re);
	} else if (im <= 7.2e+46) {
		tmp = log((-2.0 / exp(re)));
	} else if (im <= 6.2e+78) {
		tmp = (0.5 * re) * pow(im, 2.0);
	} else if (im <= 1.15e+144) {
		tmp = pow((sin(re) * -2.0), -2.0);
	} else {
		tmp = (0.5 * sin(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 <= 9d+14) then
        tmp = sin(re)
    else if (im <= 7.2d+46) then
        tmp = log(((-2.0d0) / exp(re)))
    else if (im <= 6.2d+78) then
        tmp = (0.5d0 * re) * (im ** 2.0d0)
    else if (im <= 1.15d+144) then
        tmp = (sin(re) * (-2.0d0)) ** (-2.0d0)
    else
        tmp = (0.5d0 * sin(re)) * (im ** 2.0d0)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 9e+14) {
		tmp = Math.sin(re);
	} else if (im <= 7.2e+46) {
		tmp = Math.log((-2.0 / Math.exp(re)));
	} else if (im <= 6.2e+78) {
		tmp = (0.5 * re) * Math.pow(im, 2.0);
	} else if (im <= 1.15e+144) {
		tmp = Math.pow((Math.sin(re) * -2.0), -2.0);
	} else {
		tmp = (0.5 * Math.sin(re)) * Math.pow(im, 2.0);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 9e+14:
		tmp = math.sin(re)
	elif im <= 7.2e+46:
		tmp = math.log((-2.0 / math.exp(re)))
	elif im <= 6.2e+78:
		tmp = (0.5 * re) * math.pow(im, 2.0)
	elif im <= 1.15e+144:
		tmp = math.pow((math.sin(re) * -2.0), -2.0)
	else:
		tmp = (0.5 * math.sin(re)) * math.pow(im, 2.0)
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 9e+14)
		tmp = sin(re);
	elseif (im <= 7.2e+46)
		tmp = log(Float64(-2.0 / exp(re)));
	elseif (im <= 6.2e+78)
		tmp = Float64(Float64(0.5 * re) * (im ^ 2.0));
	elseif (im <= 1.15e+144)
		tmp = Float64(sin(re) * -2.0) ^ -2.0;
	else
		tmp = Float64(Float64(0.5 * sin(re)) * (im ^ 2.0));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 9e+14)
		tmp = sin(re);
	elseif (im <= 7.2e+46)
		tmp = log((-2.0 / exp(re)));
	elseif (im <= 6.2e+78)
		tmp = (0.5 * re) * (im ^ 2.0);
	elseif (im <= 1.15e+144)
		tmp = (sin(re) * -2.0) ^ -2.0;
	else
		tmp = (0.5 * sin(re)) * (im ^ 2.0);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 9e+14], N[Sin[re], $MachinePrecision], If[LessEqual[im, 7.2e+46], N[Log[N[(-2.0 / N[Exp[re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 6.2e+78], N[(N[(0.5 * re), $MachinePrecision] * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.15e+144], N[Power[N[(N[Sin[re], $MachinePrecision] * -2.0), $MachinePrecision], -2.0], $MachinePrecision], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 7.2 \cdot 10^{+46}:\\
\;\;\;\;\log \left(\frac{-2}{e^{re}}\right)\\

\mathbf{elif}\;im \leq 6.2 \cdot 10^{+78}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot {im}^{2}\\

\mathbf{elif}\;im \leq 1.15 \cdot 10^{+144}:\\
\;\;\;\;{\left(\sin re \cdot -2\right)}^{-2}\\

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


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

    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 66.1%

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

    if 9e14 < im < 7.1999999999999997e46

    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.1%

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

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

      \[\leadsto \color{blue}{\log \left(\frac{-2}{e^{re}}\right)} \]

    if 7.1999999999999997e46 < im < 6.2e78

    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 3.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.2e78 < im < 1.1500000000000001e144

    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-rr44.3%

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

    if 1.1500000000000001e144 < 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 96.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 9 \cdot 10^{+14}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 7.2 \cdot 10^{+46}:\\ \;\;\;\;\log \left(\frac{-2}{e^{re}}\right)\\ \mathbf{elif}\;im \leq 6.2 \cdot 10^{+78}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot {im}^{2}\\ \mathbf{elif}\;im \leq 1.15 \cdot 10^{+144}:\\ \;\;\;\;{\left(\sin re \cdot -2\right)}^{-2}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot {im}^{2}\\ \end{array} \]

Alternative 3: 77.6% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \sin re\\ \mathbf{if}\;im \leq 9 \cdot 10^{+14}:\\ \;\;\;\;t_0 \cdot \mathsf{fma}\left(im, im, 2\right)\\ \mathbf{elif}\;im \leq 4 \cdot 10^{+43}:\\ \;\;\;\;\log \left(\frac{-2}{e^{re}}\right)\\ \mathbf{elif}\;im \leq 1.1 \cdot 10^{+79}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot {im}^{2}\\ \mathbf{elif}\;im \leq 1.15 \cdot 10^{+144}:\\ \;\;\;\;{\left(\sin re \cdot -2\right)}^{-2}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot {im}^{2}\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* 0.5 (sin re))))
   (if (<= im 9e+14)
     (* t_0 (fma im im 2.0))
     (if (<= im 4e+43)
       (log (/ -2.0 (exp re)))
       (if (<= im 1.1e+79)
         (* (* 0.5 re) (pow im 2.0))
         (if (<= im 1.15e+144)
           (pow (* (sin re) -2.0) -2.0)
           (* t_0 (pow im 2.0))))))))
double code(double re, double im) {
	double t_0 = 0.5 * sin(re);
	double tmp;
	if (im <= 9e+14) {
		tmp = t_0 * fma(im, im, 2.0);
	} else if (im <= 4e+43) {
		tmp = log((-2.0 / exp(re)));
	} else if (im <= 1.1e+79) {
		tmp = (0.5 * re) * pow(im, 2.0);
	} else if (im <= 1.15e+144) {
		tmp = pow((sin(re) * -2.0), -2.0);
	} else {
		tmp = t_0 * pow(im, 2.0);
	}
	return tmp;
}
function code(re, im)
	t_0 = Float64(0.5 * sin(re))
	tmp = 0.0
	if (im <= 9e+14)
		tmp = Float64(t_0 * fma(im, im, 2.0));
	elseif (im <= 4e+43)
		tmp = log(Float64(-2.0 / exp(re)));
	elseif (im <= 1.1e+79)
		tmp = Float64(Float64(0.5 * re) * (im ^ 2.0));
	elseif (im <= 1.15e+144)
		tmp = Float64(sin(re) * -2.0) ^ -2.0;
	else
		tmp = Float64(t_0 * (im ^ 2.0));
	end
	return tmp
end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 9e+14], N[(t$95$0 * N[(im * im + 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4e+43], N[Log[N[(-2.0 / N[Exp[re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 1.1e+79], N[(N[(0.5 * re), $MachinePrecision] * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.15e+144], N[Power[N[(N[Sin[re], $MachinePrecision] * -2.0), $MachinePrecision], -2.0], $MachinePrecision], N[(t$95$0 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 4 \cdot 10^{+43}:\\
\;\;\;\;\log \left(\frac{-2}{e^{re}}\right)\\

\mathbf{elif}\;im \leq 1.1 \cdot 10^{+79}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot {im}^{2}\\

\mathbf{elif}\;im \leq 1.15 \cdot 10^{+144}:\\
\;\;\;\;{\left(\sin re \cdot -2\right)}^{-2}\\

\mathbf{else}:\\
\;\;\;\;t_0 \cdot {im}^{2}\\


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

    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 85.0%

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

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

    if 9e14 < im < 4.00000000000000006e43

    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.1%

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

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

      \[\leadsto \color{blue}{\log \left(\frac{-2}{e^{re}}\right)} \]

    if 4.00000000000000006e43 < im < 1.0999999999999999e79

    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 3.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.0999999999999999e79 < im < 1.1500000000000001e144

    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-rr44.3%

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

    if 1.1500000000000001e144 < 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 96.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 9 \cdot 10^{+14}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \mathsf{fma}\left(im, im, 2\right)\\ \mathbf{elif}\;im \leq 4 \cdot 10^{+43}:\\ \;\;\;\;\log \left(\frac{-2}{e^{re}}\right)\\ \mathbf{elif}\;im \leq 1.1 \cdot 10^{+79}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot {im}^{2}\\ \mathbf{elif}\;im \leq 1.15 \cdot 10^{+144}:\\ \;\;\;\;{\left(\sin re \cdot -2\right)}^{-2}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot {im}^{2}\\ \end{array} \]

Alternative 4: 61.6% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 9 \cdot 10^{+14}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 8.2 \cdot 10^{+46}:\\ \;\;\;\;\log \left(\frac{-2}{e^{re}}\right)\\ \mathbf{elif}\;im \leq 5 \cdot 10^{+78}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot {im}^{2}\\ \mathbf{elif}\;im \leq 6.8 \cdot 10^{+141}:\\ \;\;\;\;{\left(\sin re \cdot -2\right)}^{-2}\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.5 \cdot \mathsf{fma}\left(im, im, 2\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 9e+14)
   (sin re)
   (if (<= im 8.2e+46)
     (log (/ -2.0 (exp re)))
     (if (<= im 5e+78)
       (* (* 0.5 re) (pow im 2.0))
       (if (<= im 6.8e+141)
         (pow (* (sin re) -2.0) -2.0)
         (* re (* 0.5 (fma im im 2.0))))))))
double code(double re, double im) {
	double tmp;
	if (im <= 9e+14) {
		tmp = sin(re);
	} else if (im <= 8.2e+46) {
		tmp = log((-2.0 / exp(re)));
	} else if (im <= 5e+78) {
		tmp = (0.5 * re) * pow(im, 2.0);
	} else if (im <= 6.8e+141) {
		tmp = pow((sin(re) * -2.0), -2.0);
	} else {
		tmp = re * (0.5 * fma(im, im, 2.0));
	}
	return tmp;
}
function code(re, im)
	tmp = 0.0
	if (im <= 9e+14)
		tmp = sin(re);
	elseif (im <= 8.2e+46)
		tmp = log(Float64(-2.0 / exp(re)));
	elseif (im <= 5e+78)
		tmp = Float64(Float64(0.5 * re) * (im ^ 2.0));
	elseif (im <= 6.8e+141)
		tmp = Float64(sin(re) * -2.0) ^ -2.0;
	else
		tmp = Float64(re * Float64(0.5 * fma(im, im, 2.0)));
	end
	return tmp
end
code[re_, im_] := If[LessEqual[im, 9e+14], N[Sin[re], $MachinePrecision], If[LessEqual[im, 8.2e+46], N[Log[N[(-2.0 / N[Exp[re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 5e+78], N[(N[(0.5 * re), $MachinePrecision] * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 6.8e+141], N[Power[N[(N[Sin[re], $MachinePrecision] * -2.0), $MachinePrecision], -2.0], $MachinePrecision], N[(re * N[(0.5 * N[(im * im + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 8.2 \cdot 10^{+46}:\\
\;\;\;\;\log \left(\frac{-2}{e^{re}}\right)\\

\mathbf{elif}\;im \leq 5 \cdot 10^{+78}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot {im}^{2}\\

\mathbf{elif}\;im \leq 6.8 \cdot 10^{+141}:\\
\;\;\;\;{\left(\sin re \cdot -2\right)}^{-2}\\

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


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

    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 66.1%

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

    if 9e14 < im < 8.19999999999999999e46

    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.1%

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

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

      \[\leadsto \color{blue}{\log \left(\frac{-2}{e^{re}}\right)} \]

    if 8.19999999999999999e46 < im < 4.99999999999999984e78

    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 3.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.99999999999999984e78 < im < 6.7999999999999996e141

    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-rr44.3%

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

    if 6.7999999999999996e141 < 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 96.9%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 9 \cdot 10^{+14}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 8.2 \cdot 10^{+46}:\\ \;\;\;\;\log \left(\frac{-2}{e^{re}}\right)\\ \mathbf{elif}\;im \leq 5 \cdot 10^{+78}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot {im}^{2}\\ \mathbf{elif}\;im \leq 6.8 \cdot 10^{+141}:\\ \;\;\;\;{\left(\sin re \cdot -2\right)}^{-2}\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.5 \cdot \mathsf{fma}\left(im, im, 2\right)\right)\\ \end{array} \]

Alternative 5: 85.4% accurate, 1.5× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;t_0 \cdot {im}^{2}\\


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

    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 86.6%

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

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

    if 0.00949999999999999976 < 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 71.9%

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

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

    if 1.35000000000000003e154 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. distribute-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 100.0%

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

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

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

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

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

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

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

Alternative 6: 61.6% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 9 \cdot 10^{+14}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 7.2 \cdot 10^{+46}:\\ \;\;\;\;\log \left(\frac{-2}{e^{re}}\right)\\ \mathbf{elif}\;im \leq 5 \cdot 10^{+78}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot {im}^{2}\\ \mathbf{elif}\;im \leq 1.1 \cdot 10^{+142}:\\ \;\;\;\;0.08333333333333333 + \frac{0.25}{{re}^{2}}\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.5 \cdot \mathsf{fma}\left(im, im, 2\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 9e+14)
   (sin re)
   (if (<= im 7.2e+46)
     (log (/ -2.0 (exp re)))
     (if (<= im 5e+78)
       (* (* 0.5 re) (pow im 2.0))
       (if (<= im 1.1e+142)
         (+ 0.08333333333333333 (/ 0.25 (pow re 2.0)))
         (* re (* 0.5 (fma im im 2.0))))))))
double code(double re, double im) {
	double tmp;
	if (im <= 9e+14) {
		tmp = sin(re);
	} else if (im <= 7.2e+46) {
		tmp = log((-2.0 / exp(re)));
	} else if (im <= 5e+78) {
		tmp = (0.5 * re) * pow(im, 2.0);
	} else if (im <= 1.1e+142) {
		tmp = 0.08333333333333333 + (0.25 / pow(re, 2.0));
	} else {
		tmp = re * (0.5 * fma(im, im, 2.0));
	}
	return tmp;
}
function code(re, im)
	tmp = 0.0
	if (im <= 9e+14)
		tmp = sin(re);
	elseif (im <= 7.2e+46)
		tmp = log(Float64(-2.0 / exp(re)));
	elseif (im <= 5e+78)
		tmp = Float64(Float64(0.5 * re) * (im ^ 2.0));
	elseif (im <= 1.1e+142)
		tmp = Float64(0.08333333333333333 + Float64(0.25 / (re ^ 2.0)));
	else
		tmp = Float64(re * Float64(0.5 * fma(im, im, 2.0)));
	end
	return tmp
end
code[re_, im_] := If[LessEqual[im, 9e+14], N[Sin[re], $MachinePrecision], If[LessEqual[im, 7.2e+46], N[Log[N[(-2.0 / N[Exp[re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 5e+78], N[(N[(0.5 * re), $MachinePrecision] * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+142], N[(0.08333333333333333 + N[(0.25 / N[Power[re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(0.5 * N[(im * im + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 7.2 \cdot 10^{+46}:\\
\;\;\;\;\log \left(\frac{-2}{e^{re}}\right)\\

\mathbf{elif}\;im \leq 5 \cdot 10^{+78}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot {im}^{2}\\

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

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


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

    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 66.1%

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

    if 9e14 < im < 7.1999999999999997e46

    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.1%

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

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

      \[\leadsto \color{blue}{\log \left(\frac{-2}{e^{re}}\right)} \]

    if 7.1999999999999997e46 < im < 4.99999999999999984e78

    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 3.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.99999999999999984e78 < im < 1.09999999999999993e142

    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-rr44.3%

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

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

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

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

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

    if 1.09999999999999993e142 < 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 96.9%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 9 \cdot 10^{+14}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 7.2 \cdot 10^{+46}:\\ \;\;\;\;\log \left(\frac{-2}{e^{re}}\right)\\ \mathbf{elif}\;im \leq 5 \cdot 10^{+78}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot {im}^{2}\\ \mathbf{elif}\;im \leq 1.1 \cdot 10^{+142}:\\ \;\;\;\;0.08333333333333333 + \frac{0.25}{{re}^{2}}\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.5 \cdot \mathsf{fma}\left(im, im, 2\right)\right)\\ \end{array} \]

Alternative 7: 61.0% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 1.45 \cdot 10^{-28}:\\ \;\;\;\;\sin re\\ \mathbf{else}:\\ \;\;\;\;re + 0.5 \cdot \left(re \cdot {im}^{2}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 1.45e-28) (sin re) (+ re (* 0.5 (* re (pow im 2.0))))))
double code(double re, double im) {
	double tmp;
	if (im <= 1.45e-28) {
		tmp = sin(re);
	} else {
		tmp = re + (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 <= 1.45d-28) then
        tmp = sin(re)
    else
        tmp = re + (0.5d0 * (re * (im ** 2.0d0)))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 1.45e-28) {
		tmp = Math.sin(re);
	} else {
		tmp = re + (0.5 * (re * Math.pow(im, 2.0)));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 1.45e-28:
		tmp = math.sin(re)
	else:
		tmp = re + (0.5 * (re * math.pow(im, 2.0)))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 1.45e-28)
		tmp = sin(re);
	else
		tmp = Float64(re + Float64(0.5 * Float64(re * (im ^ 2.0))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 1.45e-28)
		tmp = sin(re);
	else
		tmp = re + (0.5 * (re * (im ^ 2.0)));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 1.45e-28], N[Sin[re], $MachinePrecision], N[(re + N[(0.5 * N[(re * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    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 66.7%

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

    if 1.45000000000000006e-28 < 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 52.9%

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

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

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

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

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

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

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

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

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

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

Alternative 8: 61.0% accurate, 2.8× speedup?

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

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

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


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

    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 66.7%

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

    if 1.45000000000000006e-28 < 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 52.9%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 1.45 \cdot 10^{-28}:\\ \;\;\;\;\sin re\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.5 \cdot \mathsf{fma}\left(im, im, 2\right)\right)\\ \end{array} \]

Alternative 9: 61.8% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 3.3 \cdot 10^{+42}:\\ \;\;\;\;\sin re\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot {im}^{2}\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 3.3e+42) (sin re) (* (* 0.5 re) (pow im 2.0))))
double code(double re, double im) {
	double tmp;
	if (im <= 3.3e+42) {
		tmp = sin(re);
	} 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 <= 3.3d+42) then
        tmp = sin(re)
    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 <= 3.3e+42) {
		tmp = Math.sin(re);
	} else {
		tmp = (0.5 * re) * Math.pow(im, 2.0);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 3.3e+42:
		tmp = math.sin(re)
	else:
		tmp = (0.5 * re) * math.pow(im, 2.0)
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 3.3e+42)
		tmp = sin(re);
	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 <= 3.3e+42)
		tmp = sin(re);
	else
		tmp = (0.5 * re) * (im ^ 2.0);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 3.3e+42], N[Sin[re], $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    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.6%

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

    if 3.2999999999999999e42 < 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 56.8%

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

      \[\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 51.8%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 54.1% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 880:\\ \;\;\;\;\sin re\\ \mathbf{else}:\\ \;\;\;\;{re}^{-2}\\ \end{array} \end{array} \]
(FPCore (re im) :precision binary64 (if (<= im 880.0) (sin re) (pow re -2.0)))
double code(double re, double im) {
	double tmp;
	if (im <= 880.0) {
		tmp = sin(re);
	} else {
		tmp = pow(re, -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 <= 880.0d0) then
        tmp = sin(re)
    else
        tmp = re ** (-2.0d0)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 880.0) {
		tmp = Math.sin(re);
	} else {
		tmp = Math.pow(re, -2.0);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 880.0:
		tmp = math.sin(re)
	else:
		tmp = math.pow(re, -2.0)
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 880.0)
		tmp = sin(re);
	else
		tmp = re ^ -2.0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 880.0)
		tmp = sin(re);
	else
		tmp = re ^ -2.0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 880.0], N[Sin[re], $MachinePrecision], N[Power[re, -2.0], $MachinePrecision]]
\begin{array}{l}

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

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


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

    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 67.1%

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

    if 880 < 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-rr20.2%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 880:\\ \;\;\;\;\sin re\\ \mathbf{else}:\\ \;\;\;\;{re}^{-2}\\ \end{array} \]

Alternative 11: 54.1% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 310:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 4.2 \cdot 10^{+157} \lor \neg \left(im \leq 3.2 \cdot 10^{+295}\right):\\ \;\;\;\;0.08333333333333333 + re \cdot re\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(re \cdot -2\right) \cdot \left(re \cdot -2\right) - 0.00043402777777777775}{re \cdot -2 - -0.020833333333333332}\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 310.0)
   (sin re)
   (if (or (<= im 4.2e+157) (not (<= im 3.2e+295)))
     (+ 0.08333333333333333 (* re re))
     (/
      (- (* (* re -2.0) (* re -2.0)) 0.00043402777777777775)
      (- (* re -2.0) -0.020833333333333332)))))
double code(double re, double im) {
	double tmp;
	if (im <= 310.0) {
		tmp = sin(re);
	} else if ((im <= 4.2e+157) || !(im <= 3.2e+295)) {
		tmp = 0.08333333333333333 + (re * re);
	} else {
		tmp = (((re * -2.0) * (re * -2.0)) - 0.00043402777777777775) / ((re * -2.0) - -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 <= 310.0d0) then
        tmp = sin(re)
    else if ((im <= 4.2d+157) .or. (.not. (im <= 3.2d+295))) then
        tmp = 0.08333333333333333d0 + (re * re)
    else
        tmp = (((re * (-2.0d0)) * (re * (-2.0d0))) - 0.00043402777777777775d0) / ((re * (-2.0d0)) - (-0.020833333333333332d0))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 310.0) {
		tmp = Math.sin(re);
	} else if ((im <= 4.2e+157) || !(im <= 3.2e+295)) {
		tmp = 0.08333333333333333 + (re * re);
	} else {
		tmp = (((re * -2.0) * (re * -2.0)) - 0.00043402777777777775) / ((re * -2.0) - -0.020833333333333332);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 310.0:
		tmp = math.sin(re)
	elif (im <= 4.2e+157) or not (im <= 3.2e+295):
		tmp = 0.08333333333333333 + (re * re)
	else:
		tmp = (((re * -2.0) * (re * -2.0)) - 0.00043402777777777775) / ((re * -2.0) - -0.020833333333333332)
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 310.0)
		tmp = sin(re);
	elseif ((im <= 4.2e+157) || !(im <= 3.2e+295))
		tmp = Float64(0.08333333333333333 + Float64(re * re));
	else
		tmp = Float64(Float64(Float64(Float64(re * -2.0) * Float64(re * -2.0)) - 0.00043402777777777775) / Float64(Float64(re * -2.0) - -0.020833333333333332));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 310.0)
		tmp = sin(re);
	elseif ((im <= 4.2e+157) || ~((im <= 3.2e+295)))
		tmp = 0.08333333333333333 + (re * re);
	else
		tmp = (((re * -2.0) * (re * -2.0)) - 0.00043402777777777775) / ((re * -2.0) - -0.020833333333333332);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 310.0], N[Sin[re], $MachinePrecision], If[Or[LessEqual[im, 4.2e+157], N[Not[LessEqual[im, 3.2e+295]], $MachinePrecision]], N[(0.08333333333333333 + N[(re * re), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(re * -2.0), $MachinePrecision] * N[(re * -2.0), $MachinePrecision]), $MachinePrecision] - 0.00043402777777777775), $MachinePrecision] / N[(N[(re * -2.0), $MachinePrecision] - -0.020833333333333332), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 4.2 \cdot 10^{+157} \lor \neg \left(im \leq 3.2 \cdot 10^{+295}\right):\\
\;\;\;\;0.08333333333333333 + re \cdot re\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(re \cdot -2\right) \cdot \left(re \cdot -2\right) - 0.00043402777777777775}{re \cdot -2 - -0.020833333333333332}\\


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

    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 67.1%

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

    if 310 < im < 4.2e157 or 3.20000000000000021e295 < 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-rr24.9%

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

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

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

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

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

      \[\leadsto 0.08333333333333333 + \color{blue}{re \cdot re} \]

    if 4.2e157 < im < 3.20000000000000021e295

    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-rr13.7%

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(-2, re, -0.020833333333333332\right)} \]
    9. Step-by-step derivation
      1. fma-udef2.2%

        \[\leadsto \color{blue}{-2 \cdot re + -0.020833333333333332} \]
      2. *-commutative2.2%

        \[\leadsto \color{blue}{re \cdot -2} + -0.020833333333333332 \]
      3. fma-def2.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(re, -2, -0.020833333333333332\right)} \]
    10. Simplified2.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(re, -2, -0.020833333333333332\right)} \]
    11. Step-by-step derivation
      1. fma-udef2.2%

        \[\leadsto \color{blue}{re \cdot -2 + -0.020833333333333332} \]
      2. flip-+9.8%

        \[\leadsto \color{blue}{\frac{\left(re \cdot -2\right) \cdot \left(re \cdot -2\right) - -0.020833333333333332 \cdot -0.020833333333333332}{re \cdot -2 - -0.020833333333333332}} \]
      3. metadata-eval9.8%

        \[\leadsto \frac{\left(re \cdot -2\right) \cdot \left(re \cdot -2\right) - \color{blue}{0.00043402777777777775}}{re \cdot -2 - -0.020833333333333332} \]
    12. Applied egg-rr9.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 310:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 4.2 \cdot 10^{+157} \lor \neg \left(im \leq 3.2 \cdot 10^{+295}\right):\\ \;\;\;\;0.08333333333333333 + re \cdot re\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(re \cdot -2\right) \cdot \left(re \cdot -2\right) - 0.00043402777777777775}{re \cdot -2 - -0.020833333333333332}\\ \end{array} \]

Alternative 12: 29.7% accurate, 61.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq 2.9 \cdot 10^{+135}:\\ \;\;\;\;re\\ \mathbf{else}:\\ \;\;\;\;re \cdot re\\ \end{array} \end{array} \]
(FPCore (re im) :precision binary64 (if (<= re 2.9e+135) re (* re re)))
double code(double re, double im) {
	double tmp;
	if (re <= 2.9e+135) {
		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 (re <= 2.9d+135) then
        tmp = re
    else
        tmp = re * re
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= 2.9e+135) {
		tmp = re;
	} else {
		tmp = re * re;
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= 2.9e+135:
		tmp = re
	else:
		tmp = re * re
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= 2.9e+135)
		tmp = re;
	else
		tmp = Float64(re * re);
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= 2.9e+135)
		tmp = re;
	else
		tmp = re * re;
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, 2.9e+135], re, N[(re * re), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.9 \cdot 10^{+135}:\\
\;\;\;\;re\\

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


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

    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.4%

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

      \[\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 58.7%

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

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

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

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

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

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

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

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

    if 2.8999999999999999e135 < re

    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-rr5.2%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 2.9 \cdot 10^{+135}:\\ \;\;\;\;re\\ \mathbf{else}:\\ \;\;\;\;re \cdot re\\ \end{array} \]

Alternative 13: 4.7% accurate, 309.0× speedup?

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

\\
-1.0212765957446808
\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-rr10.7%

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

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

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

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

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

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

      \[\leadsto \frac{0.0005787037037037037 - re}{0.006944444444444444 + \left(re + \color{blue}{-0.020833333333333332 \cdot re}\right)} \]
    2. distribute-rgt1-in4.7%

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

      \[\leadsto \frac{0.0005787037037037037 - re}{0.006944444444444444 + \color{blue}{0.9791666666666666} \cdot re} \]
  10. Simplified4.7%

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

    \[\leadsto \color{blue}{-1.0212765957446808} \]
  12. Final simplification4.6%

    \[\leadsto -1.0212765957446808 \]

Alternative 14: 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-rr10.7%

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

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

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

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

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

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

    \[\leadsto 0.08333333333333333 \]

Alternative 15: 27.0% 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 77.8%

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

    \[\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 55.4%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{re} \]
  10. Final simplification33.1%

    \[\leadsto re \]

Reproduce

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