math.sin on complex, real part

Percentage Accurate: 100.0% → 100.0%
Time: 10.7s
Alternatives: 17
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 17 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. sub0-neg100.0%

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

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin re \cdot \left({im}^{4} \cdot 0.041666666666666664\right)\\ \mathbf{if}\;im \leq -1.16 \cdot 10^{+77}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -2400000000:\\ \;\;\;\;\log \left(\frac{-2}{e^{re}}\right)\\ \mathbf{elif}\;im \leq 6.8:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{elif}\;im \leq 1.15 \cdot 10^{+77}:\\ \;\;\;\;re \cdot \left(0.5 + 0.5 \cdot e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (sin re) (* (pow im 4.0) 0.041666666666666664))))
   (if (<= im -1.16e+77)
     t_0
     (if (<= im -2400000000.0)
       (log (/ -2.0 (exp re)))
       (if (<= im 6.8)
         (* (* 0.5 (sin re)) (+ 2.0 (* im im)))
         (if (<= im 1.15e+77) (* re (+ 0.5 (* 0.5 (exp im)))) t_0))))))
double code(double re, double im) {
	double t_0 = sin(re) * (pow(im, 4.0) * 0.041666666666666664);
	double tmp;
	if (im <= -1.16e+77) {
		tmp = t_0;
	} else if (im <= -2400000000.0) {
		tmp = log((-2.0 / exp(re)));
	} else if (im <= 6.8) {
		tmp = (0.5 * sin(re)) * (2.0 + (im * im));
	} else if (im <= 1.15e+77) {
		tmp = re * (0.5 + (0.5 * exp(im)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sin(re) * ((im ** 4.0d0) * 0.041666666666666664d0)
    if (im <= (-1.16d+77)) then
        tmp = t_0
    else if (im <= (-2400000000.0d0)) then
        tmp = log(((-2.0d0) / exp(re)))
    else if (im <= 6.8d0) then
        tmp = (0.5d0 * sin(re)) * (2.0d0 + (im * im))
    else if (im <= 1.15d+77) then
        tmp = re * (0.5d0 + (0.5d0 * exp(im)))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = Math.sin(re) * (Math.pow(im, 4.0) * 0.041666666666666664);
	double tmp;
	if (im <= -1.16e+77) {
		tmp = t_0;
	} else if (im <= -2400000000.0) {
		tmp = Math.log((-2.0 / Math.exp(re)));
	} else if (im <= 6.8) {
		tmp = (0.5 * Math.sin(re)) * (2.0 + (im * im));
	} else if (im <= 1.15e+77) {
		tmp = re * (0.5 + (0.5 * Math.exp(im)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = math.sin(re) * (math.pow(im, 4.0) * 0.041666666666666664)
	tmp = 0
	if im <= -1.16e+77:
		tmp = t_0
	elif im <= -2400000000.0:
		tmp = math.log((-2.0 / math.exp(re)))
	elif im <= 6.8:
		tmp = (0.5 * math.sin(re)) * (2.0 + (im * im))
	elif im <= 1.15e+77:
		tmp = re * (0.5 + (0.5 * math.exp(im)))
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(sin(re) * Float64((im ^ 4.0) * 0.041666666666666664))
	tmp = 0.0
	if (im <= -1.16e+77)
		tmp = t_0;
	elseif (im <= -2400000000.0)
		tmp = log(Float64(-2.0 / exp(re)));
	elseif (im <= 6.8)
		tmp = Float64(Float64(0.5 * sin(re)) * Float64(2.0 + Float64(im * im)));
	elseif (im <= 1.15e+77)
		tmp = Float64(re * Float64(0.5 + Float64(0.5 * exp(im))));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = sin(re) * ((im ^ 4.0) * 0.041666666666666664);
	tmp = 0.0;
	if (im <= -1.16e+77)
		tmp = t_0;
	elseif (im <= -2400000000.0)
		tmp = log((-2.0 / exp(re)));
	elseif (im <= 6.8)
		tmp = (0.5 * sin(re)) * (2.0 + (im * im));
	elseif (im <= 1.15e+77)
		tmp = re * (0.5 + (0.5 * exp(im)));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[Sin[re], $MachinePrecision] * N[(N[Power[im, 4.0], $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.16e+77], t$95$0, If[LessEqual[im, -2400000000.0], N[Log[N[(-2.0 / N[Exp[re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 6.8], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.15e+77], N[(re * N[(0.5 + N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin re \cdot \left({im}^{4} \cdot 0.041666666666666664\right)\\
\mathbf{if}\;im \leq -1.16 \cdot 10^{+77}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -2400000000:\\
\;\;\;\;\log \left(\frac{-2}{e^{re}}\right)\\

\mathbf{elif}\;im \leq 6.8:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < -1.1600000000000001e77 or 1.14999999999999997e77 < 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. sub0-neg100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(2 + \left({im}^{2} + 0.08333333333333333 \cdot {im}^{4}\right)\right)} \]
    5. Step-by-step derivation
      1. unpow2100.0%

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

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

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

      \[\leadsto \color{blue}{0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)} \]
    8. Step-by-step derivation
      1. *-commutative100.0%

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

        \[\leadsto \color{blue}{\sin re \cdot \left({im}^{4} \cdot 0.041666666666666664\right)} \]
    9. Simplified100.0%

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

    if -1.1600000000000001e77 < im < -2.4e9

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-0100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval100.0%

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Taylor expanded in re around 0 53.3%

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

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

        \[\leadsto re \cdot \left(0.5 \cdot \color{blue}{\left(e^{im} + \frac{1}{e^{im}}\right)}\right) \]
      3. rec-exp53.3%

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

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

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

    if -2.4e9 < im < 6.79999999999999982

    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. sub0-neg100.0%

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

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

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

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

    if 6.79999999999999982 < im < 1.14999999999999997e77

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-0100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval100.0%

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

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

      \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{0.5}\right) \]
    5. Taylor expanded in re around 0 71.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1.16 \cdot 10^{+77}:\\ \;\;\;\;\sin re \cdot \left({im}^{4} \cdot 0.041666666666666664\right)\\ \mathbf{elif}\;im \leq -2400000000:\\ \;\;\;\;\log \left(\frac{-2}{e^{re}}\right)\\ \mathbf{elif}\;im \leq 6.8:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{elif}\;im \leq 1.15 \cdot 10^{+77}:\\ \;\;\;\;re \cdot \left(0.5 + 0.5 \cdot e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left({im}^{4} \cdot 0.041666666666666664\right)\\ \end{array} \]

Alternative 3: 97.0% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq -3.2 \cdot 10^{+72}:\\
\;\;\;\;\sin re \cdot \left({im}^{4} \cdot 0.041666666666666664\right)\\

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

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


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

    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. sub0-neg100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)} \]
    8. Step-by-step derivation
      1. *-commutative98.4%

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

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

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

    if -3.2000000000000001e72 < im < -9.20000000000000028e-10

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff99.8%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/99.8%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-099.8%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval99.8%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{0.5}}{e^{im}}\right) \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Taylor expanded in re around 0 58.1%

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

        \[\leadsto re \cdot \color{blue}{\left(0.5 \cdot e^{im} + 0.5 \cdot \frac{1}{e^{im}}\right)} \]
      2. distribute-lft-in58.1%

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

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

        \[\leadsto \color{blue}{\left(re \cdot e^{im}\right) \cdot 0.5} + re \cdot \left(0.5 \cdot \frac{1}{e^{im}}\right) \]
      5. *-commutative58.1%

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

        \[\leadsto \left(re \cdot e^{im}\right) \cdot 0.5 + \color{blue}{\left(re \cdot \frac{1}{e^{im}}\right) \cdot 0.5} \]
      7. distribute-rgt-in58.1%

        \[\leadsto \color{blue}{0.5 \cdot \left(re \cdot e^{im} + re \cdot \frac{1}{e^{im}}\right)} \]
      8. fma-def58.1%

        \[\leadsto 0.5 \cdot \color{blue}{\mathsf{fma}\left(re, e^{im}, re \cdot \frac{1}{e^{im}}\right)} \]
      9. associate-*r/58.1%

        \[\leadsto 0.5 \cdot \mathsf{fma}\left(re, e^{im}, \color{blue}{\frac{re \cdot 1}{e^{im}}}\right) \]
      10. *-rgt-identity58.1%

        \[\leadsto 0.5 \cdot \mathsf{fma}\left(re, e^{im}, \frac{\color{blue}{re}}{e^{im}}\right) \]
    6. Simplified58.1%

      \[\leadsto \color{blue}{0.5 \cdot \mathsf{fma}\left(re, e^{im}, \frac{re}{e^{im}}\right)} \]
    7. Taylor expanded in im around inf 58.1%

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

    if -9.20000000000000028e-10 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-0100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval100.0%

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Taylor expanded in im around 0 99.5%

      \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{0.5}\right) \]
    5. Step-by-step derivation
      1. fma-udef99.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -3.2 \cdot 10^{+72}:\\ \;\;\;\;\sin re \cdot \left({im}^{4} \cdot 0.041666666666666664\right)\\ \mathbf{elif}\;im \leq -9.2 \cdot 10^{-10}:\\ \;\;\;\;0.5 \cdot \left(\frac{re}{e^{im}} + re \cdot e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(0.5 + 0.5 \cdot e^{im}\right)\\ \end{array} \]

Alternative 4: 97.0% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq -3.2 \cdot 10^{+72}:\\
\;\;\;\;\sin re \cdot \left({im}^{4} \cdot 0.041666666666666664\right)\\

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

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


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

    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. sub0-neg100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)} \]
    8. Step-by-step derivation
      1. *-commutative98.4%

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

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

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

    if -3.2000000000000001e72 < im < -9.20000000000000028e-10

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff99.8%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/99.8%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-099.8%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval99.8%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{0.5}}{e^{im}}\right) \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Taylor expanded in re around 0 58.1%

      \[\leadsto \color{blue}{re \cdot \left(0.5 \cdot \frac{1}{e^{im}} + 0.5 \cdot e^{im}\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-out58.1%

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

        \[\leadsto re \cdot \left(0.5 \cdot \color{blue}{\left(e^{im} + \frac{1}{e^{im}}\right)}\right) \]
      3. rec-exp58.1%

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

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

    if -9.20000000000000028e-10 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-0100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval100.0%

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Taylor expanded in im around 0 99.5%

      \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{0.5}\right) \]
    5. Step-by-step derivation
      1. fma-udef99.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -3.2 \cdot 10^{+72}:\\ \;\;\;\;\sin re \cdot \left({im}^{4} \cdot 0.041666666666666664\right)\\ \mathbf{elif}\;im \leq -9.2 \cdot 10^{-10}:\\ \;\;\;\;re \cdot \left(0.5 \cdot \left(e^{-im} + e^{im}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(0.5 + 0.5 \cdot e^{im}\right)\\ \end{array} \]

Alternative 5: 93.2% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq -7.2 \cdot 10^{+76}:\\
\;\;\;\;\sin re \cdot \left({im}^{4} \cdot 0.041666666666666664\right)\\

\mathbf{elif}\;im \leq -2400000000:\\
\;\;\;\;\log \left(\frac{-2}{e^{re}}\right)\\

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


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

    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. sub0-neg100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(2 + \left({im}^{2} + 0.08333333333333333 \cdot {im}^{4}\right)\right)} \]
    5. Step-by-step derivation
      1. unpow2100.0%

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

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

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

      \[\leadsto \color{blue}{0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)} \]
    8. Step-by-step derivation
      1. *-commutative100.0%

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

        \[\leadsto \color{blue}{\sin re \cdot \left({im}^{4} \cdot 0.041666666666666664\right)} \]
    9. Simplified100.0%

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

    if -7.2000000000000006e76 < im < -2.4e9

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-0100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval100.0%

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Taylor expanded in re around 0 53.3%

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

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

        \[\leadsto re \cdot \left(0.5 \cdot \color{blue}{\left(e^{im} + \frac{1}{e^{im}}\right)}\right) \]
      3. rec-exp53.3%

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

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

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

    if -2.4e9 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-0100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval100.0%

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Taylor expanded in im around 0 97.5%

      \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{0.5}\right) \]
    5. Step-by-step derivation
      1. fma-udef97.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -7.2 \cdot 10^{+76}:\\ \;\;\;\;\sin re \cdot \left({im}^{4} \cdot 0.041666666666666664\right)\\ \mathbf{elif}\;im \leq -2400000000:\\ \;\;\;\;\log \left(\frac{-2}{e^{re}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(0.5 + 0.5 \cdot e^{im}\right)\\ \end{array} \]

Alternative 6: 92.4% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 + im \cdot im\\ t_1 := 0.5 \cdot \sin re\\ t_2 := t_1 \cdot \left(im \cdot im\right)\\ t_3 := t_1 \cdot \frac{t_0 \cdot t_0 - 1.1736111111111112}{t_0 - 1.0833333333333333}\\ \mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;im \leq -9 \cdot 10^{+76}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;im \leq -2400000000:\\ \;\;\;\;\log \left(\frac{-2}{e^{re}}\right)\\ \mathbf{elif}\;im \leq 7:\\ \;\;\;\;t_1 \cdot t_0\\ \mathbf{elif}\;im \leq 1.15 \cdot 10^{+77}:\\ \;\;\;\;re \cdot \left(0.5 + 0.5 \cdot e^{im}\right)\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (+ 2.0 (* im im)))
        (t_1 (* 0.5 (sin re)))
        (t_2 (* t_1 (* im im)))
        (t_3
         (*
          t_1
          (/ (- (* t_0 t_0) 1.1736111111111112) (- t_0 1.0833333333333333)))))
   (if (<= im -1.35e+154)
     t_2
     (if (<= im -9e+76)
       t_3
       (if (<= im -2400000000.0)
         (log (/ -2.0 (exp re)))
         (if (<= im 7.0)
           (* t_1 t_0)
           (if (<= im 1.15e+77)
             (* re (+ 0.5 (* 0.5 (exp im))))
             (if (<= im 1.35e+154) t_3 t_2))))))))
double code(double re, double im) {
	double t_0 = 2.0 + (im * im);
	double t_1 = 0.5 * sin(re);
	double t_2 = t_1 * (im * im);
	double t_3 = t_1 * (((t_0 * t_0) - 1.1736111111111112) / (t_0 - 1.0833333333333333));
	double tmp;
	if (im <= -1.35e+154) {
		tmp = t_2;
	} else if (im <= -9e+76) {
		tmp = t_3;
	} else if (im <= -2400000000.0) {
		tmp = log((-2.0 / exp(re)));
	} else if (im <= 7.0) {
		tmp = t_1 * t_0;
	} else if (im <= 1.15e+77) {
		tmp = re * (0.5 + (0.5 * exp(im)));
	} else if (im <= 1.35e+154) {
		tmp = t_3;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = 2.0d0 + (im * im)
    t_1 = 0.5d0 * sin(re)
    t_2 = t_1 * (im * im)
    t_3 = t_1 * (((t_0 * t_0) - 1.1736111111111112d0) / (t_0 - 1.0833333333333333d0))
    if (im <= (-1.35d+154)) then
        tmp = t_2
    else if (im <= (-9d+76)) then
        tmp = t_3
    else if (im <= (-2400000000.0d0)) then
        tmp = log(((-2.0d0) / exp(re)))
    else if (im <= 7.0d0) then
        tmp = t_1 * t_0
    else if (im <= 1.15d+77) then
        tmp = re * (0.5d0 + (0.5d0 * exp(im)))
    else if (im <= 1.35d+154) then
        tmp = t_3
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = 2.0 + (im * im);
	double t_1 = 0.5 * Math.sin(re);
	double t_2 = t_1 * (im * im);
	double t_3 = t_1 * (((t_0 * t_0) - 1.1736111111111112) / (t_0 - 1.0833333333333333));
	double tmp;
	if (im <= -1.35e+154) {
		tmp = t_2;
	} else if (im <= -9e+76) {
		tmp = t_3;
	} else if (im <= -2400000000.0) {
		tmp = Math.log((-2.0 / Math.exp(re)));
	} else if (im <= 7.0) {
		tmp = t_1 * t_0;
	} else if (im <= 1.15e+77) {
		tmp = re * (0.5 + (0.5 * Math.exp(im)));
	} else if (im <= 1.35e+154) {
		tmp = t_3;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(re, im):
	t_0 = 2.0 + (im * im)
	t_1 = 0.5 * math.sin(re)
	t_2 = t_1 * (im * im)
	t_3 = t_1 * (((t_0 * t_0) - 1.1736111111111112) / (t_0 - 1.0833333333333333))
	tmp = 0
	if im <= -1.35e+154:
		tmp = t_2
	elif im <= -9e+76:
		tmp = t_3
	elif im <= -2400000000.0:
		tmp = math.log((-2.0 / math.exp(re)))
	elif im <= 7.0:
		tmp = t_1 * t_0
	elif im <= 1.15e+77:
		tmp = re * (0.5 + (0.5 * math.exp(im)))
	elif im <= 1.35e+154:
		tmp = t_3
	else:
		tmp = t_2
	return tmp
function code(re, im)
	t_0 = Float64(2.0 + Float64(im * im))
	t_1 = Float64(0.5 * sin(re))
	t_2 = Float64(t_1 * Float64(im * im))
	t_3 = Float64(t_1 * Float64(Float64(Float64(t_0 * t_0) - 1.1736111111111112) / Float64(t_0 - 1.0833333333333333)))
	tmp = 0.0
	if (im <= -1.35e+154)
		tmp = t_2;
	elseif (im <= -9e+76)
		tmp = t_3;
	elseif (im <= -2400000000.0)
		tmp = log(Float64(-2.0 / exp(re)));
	elseif (im <= 7.0)
		tmp = Float64(t_1 * t_0);
	elseif (im <= 1.15e+77)
		tmp = Float64(re * Float64(0.5 + Float64(0.5 * exp(im))));
	elseif (im <= 1.35e+154)
		tmp = t_3;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 2.0 + (im * im);
	t_1 = 0.5 * sin(re);
	t_2 = t_1 * (im * im);
	t_3 = t_1 * (((t_0 * t_0) - 1.1736111111111112) / (t_0 - 1.0833333333333333));
	tmp = 0.0;
	if (im <= -1.35e+154)
		tmp = t_2;
	elseif (im <= -9e+76)
		tmp = t_3;
	elseif (im <= -2400000000.0)
		tmp = log((-2.0 / exp(re)));
	elseif (im <= 7.0)
		tmp = t_1 * t_0;
	elseif (im <= 1.15e+77)
		tmp = re * (0.5 + (0.5 * exp(im)));
	elseif (im <= 1.35e+154)
		tmp = t_3;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(im * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] - 1.1736111111111112), $MachinePrecision] / N[(t$95$0 - 1.0833333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.35e+154], t$95$2, If[LessEqual[im, -9e+76], t$95$3, If[LessEqual[im, -2400000000.0], N[Log[N[(-2.0 / N[Exp[re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 7.0], N[(t$95$1 * t$95$0), $MachinePrecision], If[LessEqual[im, 1.15e+77], N[(re * N[(0.5 + N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.35e+154], t$95$3, t$95$2]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 2 + im \cdot im\\
t_1 := 0.5 \cdot \sin re\\
t_2 := t_1 \cdot \left(im \cdot im\right)\\
t_3 := t_1 \cdot \frac{t_0 \cdot t_0 - 1.1736111111111112}{t_0 - 1.0833333333333333}\\
\mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;im \leq -9 \cdot 10^{+76}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;im \leq -2400000000:\\
\;\;\;\;\log \left(\frac{-2}{e^{re}}\right)\\

\mathbf{elif}\;im \leq 7:\\
\;\;\;\;t_1 \cdot t_0\\

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

\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t_3\\

\mathbf{else}:\\
\;\;\;\;t_2\\


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if -1.35000000000000003e154 < im < -8.9999999999999995e76 or 1.14999999999999997e77 < 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. sub0-neg100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(2 + \left({im}^{2} + 0.08333333333333333 \cdot {im}^{4}\right)\right)} \]
    5. Step-by-step derivation
      1. unpow2100.0%

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

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

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(2 + \left(im \cdot im + \color{blue}{1.0833333333333333}\right)\right) \]
    8. Step-by-step derivation
      1. associate-+r+5.4%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\left(2 + im \cdot im\right) + 1.0833333333333333\right)} \]
      2. flip-+100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\frac{\left(2 + im \cdot im\right) \cdot \left(2 + im \cdot im\right) - 1.0833333333333333 \cdot 1.0833333333333333}{\left(2 + im \cdot im\right) - 1.0833333333333333}} \]
      3. metadata-eval100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \frac{\left(2 + im \cdot im\right) \cdot \left(2 + im \cdot im\right) - \color{blue}{1.1736111111111112}}{\left(2 + im \cdot im\right) - 1.0833333333333333} \]
    9. Applied egg-rr100.0%

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\frac{\left(2 + im \cdot im\right) \cdot \left(2 + im \cdot im\right) - 1.1736111111111112}{\left(2 + im \cdot im\right) - 1.0833333333333333}} \]

    if -8.9999999999999995e76 < im < -2.4e9

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-0100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval100.0%

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Taylor expanded in re around 0 53.3%

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

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

        \[\leadsto re \cdot \left(0.5 \cdot \color{blue}{\left(e^{im} + \frac{1}{e^{im}}\right)}\right) \]
      3. rec-exp53.3%

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

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

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

    if -2.4e9 < im < 7

    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. sub0-neg100.0%

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

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

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

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

    if 7 < im < 1.14999999999999997e77

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-0100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval100.0%

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

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

      \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{0.5}\right) \]
    5. Taylor expanded in re around 0 71.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\ \mathbf{elif}\;im \leq -9 \cdot 10^{+76}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \frac{\left(2 + im \cdot im\right) \cdot \left(2 + im \cdot im\right) - 1.1736111111111112}{\left(2 + im \cdot im\right) - 1.0833333333333333}\\ \mathbf{elif}\;im \leq -2400000000:\\ \;\;\;\;\log \left(\frac{-2}{e^{re}}\right)\\ \mathbf{elif}\;im \leq 7:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{elif}\;im \leq 1.15 \cdot 10^{+77}:\\ \;\;\;\;re \cdot \left(0.5 + 0.5 \cdot e^{im}\right)\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \frac{\left(2 + im \cdot im\right) \cdot \left(2 + im \cdot im\right) - 1.1736111111111112}{\left(2 + im \cdot im\right) - 1.0833333333333333}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\ \end{array} \]

Alternative 7: 91.8% accurate, 2.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 + im \cdot im\\ t_1 := 0.5 \cdot \sin re\\ t_2 := t_1 \cdot \left(im \cdot im\right)\\ t_3 := t_1 \cdot \frac{t_0 \cdot t_0 - 1.1736111111111112}{t_0 - 1.0833333333333333}\\ \mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;im \leq -1.55:\\ \;\;\;\;t_3\\ \mathbf{elif}\;im \leq 6.8:\\ \;\;\;\;t_1 \cdot t_0\\ \mathbf{elif}\;im \leq 1.15 \cdot 10^{+77}:\\ \;\;\;\;re \cdot \left(0.5 + 0.5 \cdot e^{im}\right)\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (+ 2.0 (* im im)))
        (t_1 (* 0.5 (sin re)))
        (t_2 (* t_1 (* im im)))
        (t_3
         (*
          t_1
          (/ (- (* t_0 t_0) 1.1736111111111112) (- t_0 1.0833333333333333)))))
   (if (<= im -1.35e+154)
     t_2
     (if (<= im -1.55)
       t_3
       (if (<= im 6.8)
         (* t_1 t_0)
         (if (<= im 1.15e+77)
           (* re (+ 0.5 (* 0.5 (exp im))))
           (if (<= im 1.35e+154) t_3 t_2)))))))
double code(double re, double im) {
	double t_0 = 2.0 + (im * im);
	double t_1 = 0.5 * sin(re);
	double t_2 = t_1 * (im * im);
	double t_3 = t_1 * (((t_0 * t_0) - 1.1736111111111112) / (t_0 - 1.0833333333333333));
	double tmp;
	if (im <= -1.35e+154) {
		tmp = t_2;
	} else if (im <= -1.55) {
		tmp = t_3;
	} else if (im <= 6.8) {
		tmp = t_1 * t_0;
	} else if (im <= 1.15e+77) {
		tmp = re * (0.5 + (0.5 * exp(im)));
	} else if (im <= 1.35e+154) {
		tmp = t_3;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = 2.0d0 + (im * im)
    t_1 = 0.5d0 * sin(re)
    t_2 = t_1 * (im * im)
    t_3 = t_1 * (((t_0 * t_0) - 1.1736111111111112d0) / (t_0 - 1.0833333333333333d0))
    if (im <= (-1.35d+154)) then
        tmp = t_2
    else if (im <= (-1.55d0)) then
        tmp = t_3
    else if (im <= 6.8d0) then
        tmp = t_1 * t_0
    else if (im <= 1.15d+77) then
        tmp = re * (0.5d0 + (0.5d0 * exp(im)))
    else if (im <= 1.35d+154) then
        tmp = t_3
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = 2.0 + (im * im);
	double t_1 = 0.5 * Math.sin(re);
	double t_2 = t_1 * (im * im);
	double t_3 = t_1 * (((t_0 * t_0) - 1.1736111111111112) / (t_0 - 1.0833333333333333));
	double tmp;
	if (im <= -1.35e+154) {
		tmp = t_2;
	} else if (im <= -1.55) {
		tmp = t_3;
	} else if (im <= 6.8) {
		tmp = t_1 * t_0;
	} else if (im <= 1.15e+77) {
		tmp = re * (0.5 + (0.5 * Math.exp(im)));
	} else if (im <= 1.35e+154) {
		tmp = t_3;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(re, im):
	t_0 = 2.0 + (im * im)
	t_1 = 0.5 * math.sin(re)
	t_2 = t_1 * (im * im)
	t_3 = t_1 * (((t_0 * t_0) - 1.1736111111111112) / (t_0 - 1.0833333333333333))
	tmp = 0
	if im <= -1.35e+154:
		tmp = t_2
	elif im <= -1.55:
		tmp = t_3
	elif im <= 6.8:
		tmp = t_1 * t_0
	elif im <= 1.15e+77:
		tmp = re * (0.5 + (0.5 * math.exp(im)))
	elif im <= 1.35e+154:
		tmp = t_3
	else:
		tmp = t_2
	return tmp
function code(re, im)
	t_0 = Float64(2.0 + Float64(im * im))
	t_1 = Float64(0.5 * sin(re))
	t_2 = Float64(t_1 * Float64(im * im))
	t_3 = Float64(t_1 * Float64(Float64(Float64(t_0 * t_0) - 1.1736111111111112) / Float64(t_0 - 1.0833333333333333)))
	tmp = 0.0
	if (im <= -1.35e+154)
		tmp = t_2;
	elseif (im <= -1.55)
		tmp = t_3;
	elseif (im <= 6.8)
		tmp = Float64(t_1 * t_0);
	elseif (im <= 1.15e+77)
		tmp = Float64(re * Float64(0.5 + Float64(0.5 * exp(im))));
	elseif (im <= 1.35e+154)
		tmp = t_3;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 2.0 + (im * im);
	t_1 = 0.5 * sin(re);
	t_2 = t_1 * (im * im);
	t_3 = t_1 * (((t_0 * t_0) - 1.1736111111111112) / (t_0 - 1.0833333333333333));
	tmp = 0.0;
	if (im <= -1.35e+154)
		tmp = t_2;
	elseif (im <= -1.55)
		tmp = t_3;
	elseif (im <= 6.8)
		tmp = t_1 * t_0;
	elseif (im <= 1.15e+77)
		tmp = re * (0.5 + (0.5 * exp(im)));
	elseif (im <= 1.35e+154)
		tmp = t_3;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(im * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] - 1.1736111111111112), $MachinePrecision] / N[(t$95$0 - 1.0833333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.35e+154], t$95$2, If[LessEqual[im, -1.55], t$95$3, If[LessEqual[im, 6.8], N[(t$95$1 * t$95$0), $MachinePrecision], If[LessEqual[im, 1.15e+77], N[(re * N[(0.5 + N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.35e+154], t$95$3, t$95$2]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 2 + im \cdot im\\
t_1 := 0.5 \cdot \sin re\\
t_2 := t_1 \cdot \left(im \cdot im\right)\\
t_3 := t_1 \cdot \frac{t_0 \cdot t_0 - 1.1736111111111112}{t_0 - 1.0833333333333333}\\
\mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;im \leq -1.55:\\
\;\;\;\;t_3\\

\mathbf{elif}\;im \leq 6.8:\\
\;\;\;\;t_1 \cdot t_0\\

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

\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t_3\\

\mathbf{else}:\\
\;\;\;\;t_2\\


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if -1.35000000000000003e154 < im < -1.55000000000000004 or 1.14999999999999997e77 < 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. sub0-neg100.0%

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

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

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

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(2 + \left(im \cdot im + {im}^{4} \cdot 0.08333333333333333\right)\right)} \]
    7. Applied egg-rr4.9%

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(2 + \left(im \cdot im + \color{blue}{1.0833333333333333}\right)\right) \]
    8. Step-by-step derivation
      1. associate-+r+4.9%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\left(2 + im \cdot im\right) + 1.0833333333333333\right)} \]
      2. flip-+67.4%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\frac{\left(2 + im \cdot im\right) \cdot \left(2 + im \cdot im\right) - 1.0833333333333333 \cdot 1.0833333333333333}{\left(2 + im \cdot im\right) - 1.0833333333333333}} \]
      3. metadata-eval67.4%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \frac{\left(2 + im \cdot im\right) \cdot \left(2 + im \cdot im\right) - \color{blue}{1.1736111111111112}}{\left(2 + im \cdot im\right) - 1.0833333333333333} \]
    9. Applied egg-rr67.4%

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\frac{\left(2 + im \cdot im\right) \cdot \left(2 + im \cdot im\right) - 1.1736111111111112}{\left(2 + im \cdot im\right) - 1.0833333333333333}} \]

    if -1.55000000000000004 < im < 6.79999999999999982

    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. sub0-neg100.0%

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

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

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

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

    if 6.79999999999999982 < im < 1.14999999999999997e77

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-0100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval100.0%

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

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

      \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{0.5}\right) \]
    5. Taylor expanded in re around 0 71.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\ \mathbf{elif}\;im \leq -1.55:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \frac{\left(2 + im \cdot im\right) \cdot \left(2 + im \cdot im\right) - 1.1736111111111112}{\left(2 + im \cdot im\right) - 1.0833333333333333}\\ \mathbf{elif}\;im \leq 6.8:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{elif}\;im \leq 1.15 \cdot 10^{+77}:\\ \;\;\;\;re \cdot \left(0.5 + 0.5 \cdot e^{im}\right)\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \frac{\left(2 + im \cdot im\right) \cdot \left(2 + im \cdot im\right) - 1.1736111111111112}{\left(2 + im \cdot im\right) - 1.0833333333333333}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\ \end{array} \]

Alternative 8: 87.2% accurate, 2.6× speedup?

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

\\
\begin{array}{l}
t_0 := 0.5 \cdot \sin re\\
t_1 := t_0 \cdot \left(im \cdot im\right)\\
\mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq -1.3 \cdot 10^{+95}:\\
\;\;\;\;\frac{\left(0.5 \cdot re\right) \cdot \left(4 - {im}^{4}\right)}{2 - im \cdot im}\\

\mathbf{elif}\;im \leq 5.6:\\
\;\;\;\;t_0 \cdot \left(2 + im \cdot im\right)\\

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

\mathbf{else}:\\
\;\;\;\;t_1\\


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if -1.35000000000000003e154 < im < -1.29999999999999995e95

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-0100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval100.0%

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Taylor expanded in re around 0 64.3%

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

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

        \[\leadsto re \cdot \left(0.5 \cdot \color{blue}{\left(e^{im} + \frac{1}{e^{im}}\right)}\right) \]
      3. rec-exp64.3%

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

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

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

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

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

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

        \[\leadsto \left(re \cdot 0.5\right) \cdot \color{blue}{\frac{2 \cdot 2 - \left(im \cdot im\right) \cdot \left(im \cdot im\right)}{2 - im \cdot im}} \]
      3. associate-*r/64.3%

        \[\leadsto \color{blue}{\frac{\left(re \cdot 0.5\right) \cdot \left(2 \cdot 2 - \left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)}{2 - im \cdot im}} \]
      4. metadata-eval64.3%

        \[\leadsto \frac{\left(re \cdot 0.5\right) \cdot \left(\color{blue}{4} - \left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)}{2 - im \cdot im} \]
      5. pow264.3%

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

        \[\leadsto \frac{\left(re \cdot 0.5\right) \cdot \left(4 - {im}^{2} \cdot \color{blue}{{im}^{2}}\right)}{2 - im \cdot im} \]
      7. pow-prod-up64.3%

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

        \[\leadsto \frac{\left(re \cdot 0.5\right) \cdot \left(4 - {im}^{\color{blue}{4}}\right)}{2 - im \cdot im} \]
    11. Applied egg-rr64.3%

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

    if -1.29999999999999995e95 < im < 5.5999999999999996

    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. sub0-neg100.0%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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. Step-by-step derivation
      1. unpow286.6%

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

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

    if 5.5999999999999996 < im < 1.35000000000000003e154

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-0100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval100.0%

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

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

      \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{0.5}\right) \]
    5. Taylor expanded in re around 0 69.7%

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

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

Alternative 9: 78.9% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\ t_1 := 8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \left(re \cdot re\right) \cdot 1774888885392349700\right)\\ \mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -2300000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq 3 \cdot 10^{+56}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.3 \cdot 10^{+139}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (* 0.5 (sin re)) (* im im)))
        (t_1
         (+
          8874444426961748000.0
          (+
           (/ 26623333280885244000.0 (* re re))
           (* (* re re) 1774888885392349700.0)))))
   (if (<= im -1.35e+154)
     t_0
     (if (<= im -2300000000000.0)
       t_1
       (if (<= im 3e+56) (sin re) (if (<= im 2.3e+139) t_1 t_0))))))
double code(double re, double im) {
	double t_0 = (0.5 * sin(re)) * (im * im);
	double t_1 = 8874444426961748000.0 + ((26623333280885244000.0 / (re * re)) + ((re * re) * 1774888885392349700.0));
	double tmp;
	if (im <= -1.35e+154) {
		tmp = t_0;
	} else if (im <= -2300000000000.0) {
		tmp = t_1;
	} else if (im <= 3e+56) {
		tmp = sin(re);
	} else if (im <= 2.3e+139) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (0.5d0 * sin(re)) * (im * im)
    t_1 = 8874444426961748000.0d0 + ((26623333280885244000.0d0 / (re * re)) + ((re * re) * 1774888885392349700.0d0))
    if (im <= (-1.35d+154)) then
        tmp = t_0
    else if (im <= (-2300000000000.0d0)) then
        tmp = t_1
    else if (im <= 3d+56) then
        tmp = sin(re)
    else if (im <= 2.3d+139) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = (0.5 * Math.sin(re)) * (im * im);
	double t_1 = 8874444426961748000.0 + ((26623333280885244000.0 / (re * re)) + ((re * re) * 1774888885392349700.0));
	double tmp;
	if (im <= -1.35e+154) {
		tmp = t_0;
	} else if (im <= -2300000000000.0) {
		tmp = t_1;
	} else if (im <= 3e+56) {
		tmp = Math.sin(re);
	} else if (im <= 2.3e+139) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = (0.5 * math.sin(re)) * (im * im)
	t_1 = 8874444426961748000.0 + ((26623333280885244000.0 / (re * re)) + ((re * re) * 1774888885392349700.0))
	tmp = 0
	if im <= -1.35e+154:
		tmp = t_0
	elif im <= -2300000000000.0:
		tmp = t_1
	elif im <= 3e+56:
		tmp = math.sin(re)
	elif im <= 2.3e+139:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(Float64(0.5 * sin(re)) * Float64(im * im))
	t_1 = Float64(8874444426961748000.0 + Float64(Float64(26623333280885244000.0 / Float64(re * re)) + Float64(Float64(re * re) * 1774888885392349700.0)))
	tmp = 0.0
	if (im <= -1.35e+154)
		tmp = t_0;
	elseif (im <= -2300000000000.0)
		tmp = t_1;
	elseif (im <= 3e+56)
		tmp = sin(re);
	elseif (im <= 2.3e+139)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = (0.5 * sin(re)) * (im * im);
	t_1 = 8874444426961748000.0 + ((26623333280885244000.0 / (re * re)) + ((re * re) * 1774888885392349700.0));
	tmp = 0.0;
	if (im <= -1.35e+154)
		tmp = t_0;
	elseif (im <= -2300000000000.0)
		tmp = t_1;
	elseif (im <= 3e+56)
		tmp = sin(re);
	elseif (im <= 2.3e+139)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(8874444426961748000.0 + N[(N[(26623333280885244000.0 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 1774888885392349700.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.35e+154], t$95$0, If[LessEqual[im, -2300000000000.0], t$95$1, If[LessEqual[im, 3e+56], N[Sin[re], $MachinePrecision], If[LessEqual[im, 2.3e+139], t$95$1, t$95$0]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\
t_1 := 8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \left(re \cdot re\right) \cdot 1774888885392349700\right)\\
\mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -2300000000000:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq 3 \cdot 10^{+56}:\\
\;\;\;\;\sin re\\

\mathbf{elif}\;im \leq 2.3 \cdot 10^{+139}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -1.35000000000000003e154 or 2.3e139 < 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. sub0-neg100.0%

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

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

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

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

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

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

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

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

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

    if -1.35000000000000003e154 < im < -2.3e12 or 3.00000000000000006e56 < im < 2.3e139

    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. sub0-neg100.0%

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(2 + \left(im \cdot im + \color{blue}{{im}^{4} \cdot 0.08333333333333333}\right)\right) \]
    6. Simplified66.3%

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(2 + \left(im \cdot im + {im}^{4} \cdot 0.08333333333333333\right)\right)} \]
    7. Applied egg-rr16.9%

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

      \[\leadsto \color{blue}{8874444426961748000 + \left(26623333280885244000 \cdot \frac{1}{{re}^{2}} + 1774888885392349700 \cdot {re}^{2}\right)} \]
    9. Step-by-step derivation
      1. associate-*r/24.6%

        \[\leadsto 8874444426961748000 + \left(\color{blue}{\frac{26623333280885244000 \cdot 1}{{re}^{2}}} + 1774888885392349700 \cdot {re}^{2}\right) \]
      2. metadata-eval24.6%

        \[\leadsto 8874444426961748000 + \left(\frac{\color{blue}{26623333280885244000}}{{re}^{2}} + 1774888885392349700 \cdot {re}^{2}\right) \]
      3. unpow224.6%

        \[\leadsto 8874444426961748000 + \left(\frac{26623333280885244000}{\color{blue}{re \cdot re}} + 1774888885392349700 \cdot {re}^{2}\right) \]
      4. *-commutative24.6%

        \[\leadsto 8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \color{blue}{{re}^{2} \cdot 1774888885392349700}\right) \]
      5. unpow224.6%

        \[\leadsto 8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \color{blue}{\left(re \cdot re\right)} \cdot 1774888885392349700\right) \]
    10. Simplified24.6%

      \[\leadsto \color{blue}{8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \left(re \cdot re\right) \cdot 1774888885392349700\right)} \]

    if -2.3e12 < im < 3.00000000000000006e56

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-0100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval100.0%

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Taylor expanded in im around 0 90.0%

      \[\leadsto \color{blue}{\sin re} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification78.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\ \mathbf{elif}\;im \leq -2300000000000:\\ \;\;\;\;8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \left(re \cdot re\right) \cdot 1774888885392349700\right)\\ \mathbf{elif}\;im \leq 3 \cdot 10^{+56}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.3 \cdot 10^{+139}:\\ \;\;\;\;8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \left(re \cdot re\right) \cdot 1774888885392349700\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\ \end{array} \]

Alternative 10: 86.3% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\ \mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -2300000000000:\\ \;\;\;\;8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \left(re \cdot re\right) \cdot 1774888885392349700\right)\\ \mathbf{elif}\;im \leq 3.8:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;re \cdot \left(0.5 + 0.5 \cdot e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (* 0.5 (sin re)) (* im im))))
   (if (<= im -1.35e+154)
     t_0
     (if (<= im -2300000000000.0)
       (+
        8874444426961748000.0
        (+
         (/ 26623333280885244000.0 (* re re))
         (* (* re re) 1774888885392349700.0)))
       (if (<= im 3.8)
         (sin re)
         (if (<= im 1.35e+154) (* re (+ 0.5 (* 0.5 (exp im)))) t_0))))))
double code(double re, double im) {
	double t_0 = (0.5 * sin(re)) * (im * im);
	double tmp;
	if (im <= -1.35e+154) {
		tmp = t_0;
	} else if (im <= -2300000000000.0) {
		tmp = 8874444426961748000.0 + ((26623333280885244000.0 / (re * re)) + ((re * re) * 1774888885392349700.0));
	} else if (im <= 3.8) {
		tmp = sin(re);
	} else if (im <= 1.35e+154) {
		tmp = re * (0.5 + (0.5 * exp(im)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (0.5d0 * sin(re)) * (im * im)
    if (im <= (-1.35d+154)) then
        tmp = t_0
    else if (im <= (-2300000000000.0d0)) then
        tmp = 8874444426961748000.0d0 + ((26623333280885244000.0d0 / (re * re)) + ((re * re) * 1774888885392349700.0d0))
    else if (im <= 3.8d0) then
        tmp = sin(re)
    else if (im <= 1.35d+154) then
        tmp = re * (0.5d0 + (0.5d0 * exp(im)))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = (0.5 * Math.sin(re)) * (im * im);
	double tmp;
	if (im <= -1.35e+154) {
		tmp = t_0;
	} else if (im <= -2300000000000.0) {
		tmp = 8874444426961748000.0 + ((26623333280885244000.0 / (re * re)) + ((re * re) * 1774888885392349700.0));
	} else if (im <= 3.8) {
		tmp = Math.sin(re);
	} else if (im <= 1.35e+154) {
		tmp = re * (0.5 + (0.5 * Math.exp(im)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = (0.5 * math.sin(re)) * (im * im)
	tmp = 0
	if im <= -1.35e+154:
		tmp = t_0
	elif im <= -2300000000000.0:
		tmp = 8874444426961748000.0 + ((26623333280885244000.0 / (re * re)) + ((re * re) * 1774888885392349700.0))
	elif im <= 3.8:
		tmp = math.sin(re)
	elif im <= 1.35e+154:
		tmp = re * (0.5 + (0.5 * math.exp(im)))
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(Float64(0.5 * sin(re)) * Float64(im * im))
	tmp = 0.0
	if (im <= -1.35e+154)
		tmp = t_0;
	elseif (im <= -2300000000000.0)
		tmp = Float64(8874444426961748000.0 + Float64(Float64(26623333280885244000.0 / Float64(re * re)) + Float64(Float64(re * re) * 1774888885392349700.0)));
	elseif (im <= 3.8)
		tmp = sin(re);
	elseif (im <= 1.35e+154)
		tmp = Float64(re * Float64(0.5 + Float64(0.5 * exp(im))));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = (0.5 * sin(re)) * (im * im);
	tmp = 0.0;
	if (im <= -1.35e+154)
		tmp = t_0;
	elseif (im <= -2300000000000.0)
		tmp = 8874444426961748000.0 + ((26623333280885244000.0 / (re * re)) + ((re * re) * 1774888885392349700.0));
	elseif (im <= 3.8)
		tmp = sin(re);
	elseif (im <= 1.35e+154)
		tmp = re * (0.5 + (0.5 * exp(im)));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.35e+154], t$95$0, If[LessEqual[im, -2300000000000.0], N[(8874444426961748000.0 + N[(N[(26623333280885244000.0 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 1774888885392349700.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.8], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.35e+154], N[(re * N[(0.5 + N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq -2300000000000:\\
\;\;\;\;8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \left(re \cdot re\right) \cdot 1774888885392349700\right)\\

\mathbf{elif}\;im \leq 3.8:\\
\;\;\;\;\sin re\\

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if -1.35000000000000003e154 < im < -2.3e12

    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. sub0-neg100.0%

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(2 + \left({im}^{2} + 0.08333333333333333 \cdot {im}^{4}\right)\right)} \]
    5. Step-by-step derivation
      1. unpow255.3%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(2 + \left(im \cdot im + \color{blue}{{im}^{4} \cdot 0.08333333333333333}\right)\right) \]
    6. Simplified55.3%

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

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

      \[\leadsto \color{blue}{8874444426961748000 + \left(26623333280885244000 \cdot \frac{1}{{re}^{2}} + 1774888885392349700 \cdot {re}^{2}\right)} \]
    9. Step-by-step derivation
      1. associate-*r/21.2%

        \[\leadsto 8874444426961748000 + \left(\color{blue}{\frac{26623333280885244000 \cdot 1}{{re}^{2}}} + 1774888885392349700 \cdot {re}^{2}\right) \]
      2. metadata-eval21.2%

        \[\leadsto 8874444426961748000 + \left(\frac{\color{blue}{26623333280885244000}}{{re}^{2}} + 1774888885392349700 \cdot {re}^{2}\right) \]
      3. unpow221.2%

        \[\leadsto 8874444426961748000 + \left(\frac{26623333280885244000}{\color{blue}{re \cdot re}} + 1774888885392349700 \cdot {re}^{2}\right) \]
      4. *-commutative21.2%

        \[\leadsto 8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \color{blue}{{re}^{2} \cdot 1774888885392349700}\right) \]
      5. unpow221.2%

        \[\leadsto 8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \color{blue}{\left(re \cdot re\right)} \cdot 1774888885392349700\right) \]
    10. Simplified21.2%

      \[\leadsto \color{blue}{8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \left(re \cdot re\right) \cdot 1774888885392349700\right)} \]

    if -2.3e12 < im < 3.7999999999999998

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-0100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval100.0%

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Taylor expanded in im around 0 96.6%

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

    if 3.7999999999999998 < im < 1.35000000000000003e154

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-0100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval100.0%

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

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

      \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{0.5}\right) \]
    5. Taylor expanded in re around 0 69.7%

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

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

Alternative 11: 86.6% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \sin re\\ t_1 := t_0 \cdot \left(im \cdot im\right)\\ \mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq -2300000000000:\\ \;\;\;\;8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \left(re \cdot re\right) \cdot 1774888885392349700\right)\\ \mathbf{elif}\;im \leq 7.4:\\ \;\;\;\;t_0 \cdot \left(2 + im \cdot im\right)\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;re \cdot \left(0.5 + 0.5 \cdot e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* 0.5 (sin re))) (t_1 (* t_0 (* im im))))
   (if (<= im -1.35e+154)
     t_1
     (if (<= im -2300000000000.0)
       (+
        8874444426961748000.0
        (+
         (/ 26623333280885244000.0 (* re re))
         (* (* re re) 1774888885392349700.0)))
       (if (<= im 7.4)
         (* t_0 (+ 2.0 (* im im)))
         (if (<= im 1.35e+154) (* re (+ 0.5 (* 0.5 (exp im)))) t_1))))))
double code(double re, double im) {
	double t_0 = 0.5 * sin(re);
	double t_1 = t_0 * (im * im);
	double tmp;
	if (im <= -1.35e+154) {
		tmp = t_1;
	} else if (im <= -2300000000000.0) {
		tmp = 8874444426961748000.0 + ((26623333280885244000.0 / (re * re)) + ((re * re) * 1774888885392349700.0));
	} else if (im <= 7.4) {
		tmp = t_0 * (2.0 + (im * im));
	} else if (im <= 1.35e+154) {
		tmp = re * (0.5 + (0.5 * exp(im)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 0.5d0 * sin(re)
    t_1 = t_0 * (im * im)
    if (im <= (-1.35d+154)) then
        tmp = t_1
    else if (im <= (-2300000000000.0d0)) then
        tmp = 8874444426961748000.0d0 + ((26623333280885244000.0d0 / (re * re)) + ((re * re) * 1774888885392349700.0d0))
    else if (im <= 7.4d0) then
        tmp = t_0 * (2.0d0 + (im * im))
    else if (im <= 1.35d+154) then
        tmp = re * (0.5d0 + (0.5d0 * exp(im)))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = 0.5 * Math.sin(re);
	double t_1 = t_0 * (im * im);
	double tmp;
	if (im <= -1.35e+154) {
		tmp = t_1;
	} else if (im <= -2300000000000.0) {
		tmp = 8874444426961748000.0 + ((26623333280885244000.0 / (re * re)) + ((re * re) * 1774888885392349700.0));
	} else if (im <= 7.4) {
		tmp = t_0 * (2.0 + (im * im));
	} else if (im <= 1.35e+154) {
		tmp = re * (0.5 + (0.5 * Math.exp(im)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(re, im):
	t_0 = 0.5 * math.sin(re)
	t_1 = t_0 * (im * im)
	tmp = 0
	if im <= -1.35e+154:
		tmp = t_1
	elif im <= -2300000000000.0:
		tmp = 8874444426961748000.0 + ((26623333280885244000.0 / (re * re)) + ((re * re) * 1774888885392349700.0))
	elif im <= 7.4:
		tmp = t_0 * (2.0 + (im * im))
	elif im <= 1.35e+154:
		tmp = re * (0.5 + (0.5 * math.exp(im)))
	else:
		tmp = t_1
	return tmp
function code(re, im)
	t_0 = Float64(0.5 * sin(re))
	t_1 = Float64(t_0 * Float64(im * im))
	tmp = 0.0
	if (im <= -1.35e+154)
		tmp = t_1;
	elseif (im <= -2300000000000.0)
		tmp = Float64(8874444426961748000.0 + Float64(Float64(26623333280885244000.0 / Float64(re * re)) + Float64(Float64(re * re) * 1774888885392349700.0)));
	elseif (im <= 7.4)
		tmp = Float64(t_0 * Float64(2.0 + Float64(im * im)));
	elseif (im <= 1.35e+154)
		tmp = Float64(re * Float64(0.5 + Float64(0.5 * exp(im))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 0.5 * sin(re);
	t_1 = t_0 * (im * im);
	tmp = 0.0;
	if (im <= -1.35e+154)
		tmp = t_1;
	elseif (im <= -2300000000000.0)
		tmp = 8874444426961748000.0 + ((26623333280885244000.0 / (re * re)) + ((re * re) * 1774888885392349700.0));
	elseif (im <= 7.4)
		tmp = t_0 * (2.0 + (im * im));
	elseif (im <= 1.35e+154)
		tmp = re * (0.5 + (0.5 * exp(im)));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(im * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.35e+154], t$95$1, If[LessEqual[im, -2300000000000.0], N[(8874444426961748000.0 + N[(N[(26623333280885244000.0 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 1774888885392349700.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 7.4], N[(t$95$0 * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.35e+154], N[(re * N[(0.5 + N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \sin re\\
t_1 := t_0 \cdot \left(im \cdot im\right)\\
\mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq -2300000000000:\\
\;\;\;\;8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \left(re \cdot re\right) \cdot 1774888885392349700\right)\\

\mathbf{elif}\;im \leq 7.4:\\
\;\;\;\;t_0 \cdot \left(2 + im \cdot im\right)\\

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

\mathbf{else}:\\
\;\;\;\;t_1\\


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if -1.35000000000000003e154 < im < -2.3e12

    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. sub0-neg100.0%

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(2 + \left({im}^{2} + 0.08333333333333333 \cdot {im}^{4}\right)\right)} \]
    5. Step-by-step derivation
      1. unpow255.3%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(2 + \left(im \cdot im + \color{blue}{{im}^{4} \cdot 0.08333333333333333}\right)\right) \]
    6. Simplified55.3%

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

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

      \[\leadsto \color{blue}{8874444426961748000 + \left(26623333280885244000 \cdot \frac{1}{{re}^{2}} + 1774888885392349700 \cdot {re}^{2}\right)} \]
    9. Step-by-step derivation
      1. associate-*r/21.2%

        \[\leadsto 8874444426961748000 + \left(\color{blue}{\frac{26623333280885244000 \cdot 1}{{re}^{2}}} + 1774888885392349700 \cdot {re}^{2}\right) \]
      2. metadata-eval21.2%

        \[\leadsto 8874444426961748000 + \left(\frac{\color{blue}{26623333280885244000}}{{re}^{2}} + 1774888885392349700 \cdot {re}^{2}\right) \]
      3. unpow221.2%

        \[\leadsto 8874444426961748000 + \left(\frac{26623333280885244000}{\color{blue}{re \cdot re}} + 1774888885392349700 \cdot {re}^{2}\right) \]
      4. *-commutative21.2%

        \[\leadsto 8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \color{blue}{{re}^{2} \cdot 1774888885392349700}\right) \]
      5. unpow221.2%

        \[\leadsto 8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \color{blue}{\left(re \cdot re\right)} \cdot 1774888885392349700\right) \]
    10. Simplified21.2%

      \[\leadsto \color{blue}{8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \left(re \cdot re\right) \cdot 1774888885392349700\right)} \]

    if -2.3e12 < im < 7.4000000000000004

    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. sub0-neg100.0%

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

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

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

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

    if 7.4000000000000004 < im < 1.35000000000000003e154

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-0100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval100.0%

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

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

      \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{0.5}\right) \]
    5. Taylor expanded in re around 0 69.7%

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

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

Alternative 12: 72.7% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\ t_1 := 8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \left(re \cdot re\right) \cdot 1774888885392349700\right)\\ \mathbf{if}\;im \leq -8.2 \cdot 10^{+152}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -2300000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq 3 \cdot 10^{+56}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.3 \cdot 10^{+138}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* 0.5 (* re (* im im))))
        (t_1
         (+
          8874444426961748000.0
          (+
           (/ 26623333280885244000.0 (* re re))
           (* (* re re) 1774888885392349700.0)))))
   (if (<= im -8.2e+152)
     t_0
     (if (<= im -2300000000000.0)
       t_1
       (if (<= im 3e+56) (sin re) (if (<= im 2.3e+138) t_1 t_0))))))
double code(double re, double im) {
	double t_0 = 0.5 * (re * (im * im));
	double t_1 = 8874444426961748000.0 + ((26623333280885244000.0 / (re * re)) + ((re * re) * 1774888885392349700.0));
	double tmp;
	if (im <= -8.2e+152) {
		tmp = t_0;
	} else if (im <= -2300000000000.0) {
		tmp = t_1;
	} else if (im <= 3e+56) {
		tmp = sin(re);
	} else if (im <= 2.3e+138) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 0.5d0 * (re * (im * im))
    t_1 = 8874444426961748000.0d0 + ((26623333280885244000.0d0 / (re * re)) + ((re * re) * 1774888885392349700.0d0))
    if (im <= (-8.2d+152)) then
        tmp = t_0
    else if (im <= (-2300000000000.0d0)) then
        tmp = t_1
    else if (im <= 3d+56) then
        tmp = sin(re)
    else if (im <= 2.3d+138) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = 0.5 * (re * (im * im));
	double t_1 = 8874444426961748000.0 + ((26623333280885244000.0 / (re * re)) + ((re * re) * 1774888885392349700.0));
	double tmp;
	if (im <= -8.2e+152) {
		tmp = t_0;
	} else if (im <= -2300000000000.0) {
		tmp = t_1;
	} else if (im <= 3e+56) {
		tmp = Math.sin(re);
	} else if (im <= 2.3e+138) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = 0.5 * (re * (im * im))
	t_1 = 8874444426961748000.0 + ((26623333280885244000.0 / (re * re)) + ((re * re) * 1774888885392349700.0))
	tmp = 0
	if im <= -8.2e+152:
		tmp = t_0
	elif im <= -2300000000000.0:
		tmp = t_1
	elif im <= 3e+56:
		tmp = math.sin(re)
	elif im <= 2.3e+138:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(0.5 * Float64(re * Float64(im * im)))
	t_1 = Float64(8874444426961748000.0 + Float64(Float64(26623333280885244000.0 / Float64(re * re)) + Float64(Float64(re * re) * 1774888885392349700.0)))
	tmp = 0.0
	if (im <= -8.2e+152)
		tmp = t_0;
	elseif (im <= -2300000000000.0)
		tmp = t_1;
	elseif (im <= 3e+56)
		tmp = sin(re);
	elseif (im <= 2.3e+138)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 0.5 * (re * (im * im));
	t_1 = 8874444426961748000.0 + ((26623333280885244000.0 / (re * re)) + ((re * re) * 1774888885392349700.0));
	tmp = 0.0;
	if (im <= -8.2e+152)
		tmp = t_0;
	elseif (im <= -2300000000000.0)
		tmp = t_1;
	elseif (im <= 3e+56)
		tmp = sin(re);
	elseif (im <= 2.3e+138)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(8874444426961748000.0 + N[(N[(26623333280885244000.0 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 1774888885392349700.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -8.2e+152], t$95$0, If[LessEqual[im, -2300000000000.0], t$95$1, If[LessEqual[im, 3e+56], N[Sin[re], $MachinePrecision], If[LessEqual[im, 2.3e+138], t$95$1, t$95$0]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\
t_1 := 8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \left(re \cdot re\right) \cdot 1774888885392349700\right)\\
\mathbf{if}\;im \leq -8.2 \cdot 10^{+152}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -2300000000000:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq 3 \cdot 10^{+56}:\\
\;\;\;\;\sin re\\

\mathbf{elif}\;im \leq 2.3 \cdot 10^{+138}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -8.1999999999999996e152 or 2.30000000000000008e138 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-0100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval100.0%

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

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

      \[\leadsto \color{blue}{re \cdot \left(0.5 \cdot \frac{1}{e^{im}} + 0.5 \cdot e^{im}\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-out75.0%

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\left(im \cdot im\right)}\right) \]
    12. Simplified75.0%

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

    if -8.1999999999999996e152 < im < -2.3e12 or 3.00000000000000006e56 < im < 2.30000000000000008e138

    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. sub0-neg100.0%

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(2 + \left(im \cdot im + \color{blue}{{im}^{4} \cdot 0.08333333333333333}\right)\right) \]
    6. Simplified66.3%

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(2 + \left(im \cdot im + {im}^{4} \cdot 0.08333333333333333\right)\right)} \]
    7. Applied egg-rr16.9%

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

      \[\leadsto \color{blue}{8874444426961748000 + \left(26623333280885244000 \cdot \frac{1}{{re}^{2}} + 1774888885392349700 \cdot {re}^{2}\right)} \]
    9. Step-by-step derivation
      1. associate-*r/24.6%

        \[\leadsto 8874444426961748000 + \left(\color{blue}{\frac{26623333280885244000 \cdot 1}{{re}^{2}}} + 1774888885392349700 \cdot {re}^{2}\right) \]
      2. metadata-eval24.6%

        \[\leadsto 8874444426961748000 + \left(\frac{\color{blue}{26623333280885244000}}{{re}^{2}} + 1774888885392349700 \cdot {re}^{2}\right) \]
      3. unpow224.6%

        \[\leadsto 8874444426961748000 + \left(\frac{26623333280885244000}{\color{blue}{re \cdot re}} + 1774888885392349700 \cdot {re}^{2}\right) \]
      4. *-commutative24.6%

        \[\leadsto 8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \color{blue}{{re}^{2} \cdot 1774888885392349700}\right) \]
      5. unpow224.6%

        \[\leadsto 8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \color{blue}{\left(re \cdot re\right)} \cdot 1774888885392349700\right) \]
    10. Simplified24.6%

      \[\leadsto \color{blue}{8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \left(re \cdot re\right) \cdot 1774888885392349700\right)} \]

    if -2.3e12 < im < 3.00000000000000006e56

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-0100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval100.0%

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Taylor expanded in im around 0 90.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -8.2 \cdot 10^{+152}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;im \leq -2300000000000:\\ \;\;\;\;8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \left(re \cdot re\right) \cdot 1774888885392349700\right)\\ \mathbf{elif}\;im \leq 3 \cdot 10^{+56}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.3 \cdot 10^{+138}:\\ \;\;\;\;8874444426961748000 + \left(\frac{26623333280885244000}{re \cdot re} + \left(re \cdot re\right) \cdot 1774888885392349700\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\ \end{array} \]

Alternative 13: 46.6% accurate, 27.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq -19.5 \lor \neg \left(im \leq 1.45\right):\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < -19.5 or 1.44999999999999996 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-0100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval100.0%

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Taylor expanded in re around 0 68.7%

      \[\leadsto \color{blue}{re \cdot \left(0.5 \cdot \frac{1}{e^{im}} + 0.5 \cdot e^{im}\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-out68.7%

        \[\leadsto re \cdot \color{blue}{\left(0.5 \cdot \left(\frac{1}{e^{im}} + e^{im}\right)\right)} \]
      2. +-commutative68.7%

        \[\leadsto re \cdot \left(0.5 \cdot \color{blue}{\left(e^{im} + \frac{1}{e^{im}}\right)}\right) \]
      3. rec-exp68.7%

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

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

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

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

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

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

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

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

    if -19.5 < im < 1.44999999999999996

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-0100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval100.0%

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Taylor expanded in re around 0 46.7%

      \[\leadsto \color{blue}{re \cdot \left(0.5 \cdot \frac{1}{e^{im}} + 0.5 \cdot e^{im}\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-out46.7%

        \[\leadsto re \cdot \color{blue}{\left(0.5 \cdot \left(\frac{1}{e^{im}} + e^{im}\right)\right)} \]
      2. +-commutative46.7%

        \[\leadsto re \cdot \left(0.5 \cdot \color{blue}{\left(e^{im} + \frac{1}{e^{im}}\right)}\right) \]
      3. rec-exp46.7%

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

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

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

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

Alternative 14: 31.6% accurate, 33.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.5 \cdot 10^{+37} \lor \neg \left(im \leq 4.7 \cdot 10^{+47}\right):\\
\;\;\;\;\frac{26623333280885244000}{re \cdot re}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < -1.50000000000000011e37 or 4.69999999999999964e47 < 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. sub0-neg100.0%

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(2 + \left({im}^{2} + 0.08333333333333333 \cdot {im}^{4}\right)\right)} \]
    5. Step-by-step derivation
      1. unpow288.0%

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

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

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

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

      \[\leadsto \color{blue}{\frac{26623333280885244000}{{re}^{2}}} \]
    9. Step-by-step derivation
      1. unpow214.1%

        \[\leadsto \frac{26623333280885244000}{\color{blue}{re \cdot re}} \]
    10. Simplified14.1%

      \[\leadsto \color{blue}{\frac{26623333280885244000}{re \cdot re}} \]

    if -1.50000000000000011e37 < im < 4.69999999999999964e47

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
      10. exp-diff100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
      11. associate-*l/100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
      12. exp-0100.0%

        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
      13. metadata-eval100.0%

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Taylor expanded in re around 0 48.1%

      \[\leadsto \color{blue}{re \cdot \left(0.5 \cdot \frac{1}{e^{im}} + 0.5 \cdot e^{im}\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-out48.1%

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

        \[\leadsto re \cdot \left(0.5 \cdot \color{blue}{\left(e^{im} + \frac{1}{e^{im}}\right)}\right) \]
      3. rec-exp48.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1.5 \cdot 10^{+37} \lor \neg \left(im \leq 4.7 \cdot 10^{+47}\right):\\ \;\;\;\;\frac{26623333280885244000}{re \cdot re}\\ \mathbf{else}:\\ \;\;\;\;re\\ \end{array} \]

Alternative 15: 46.8% accurate, 34.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
    10. exp-diff100.0%

      \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
    11. associate-*l/100.0%

      \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
    12. exp-0100.0%

      \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
    13. metadata-eval100.0%

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

    \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
  4. Taylor expanded in re around 0 57.7%

    \[\leadsto \color{blue}{re \cdot \left(0.5 \cdot \frac{1}{e^{im}} + 0.5 \cdot e^{im}\right)} \]
  5. Step-by-step derivation
    1. distribute-lft-out57.7%

      \[\leadsto re \cdot \color{blue}{\left(0.5 \cdot \left(\frac{1}{e^{im}} + e^{im}\right)\right)} \]
    2. +-commutative57.7%

      \[\leadsto re \cdot \left(0.5 \cdot \color{blue}{\left(e^{im} + \frac{1}{e^{im}}\right)}\right) \]
    3. rec-exp57.7%

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

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

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

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

    \[\leadsto re \cdot \left(0.5 \cdot \color{blue}{\left(2 + im \cdot im\right)}\right) \]
  10. Final simplification43.5%

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

Alternative 16: 4.7% accurate, 309.0× speedup?

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

\\
1
\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. sub0-neg100.0%

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

    \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(2 + \left({im}^{2} + 0.08333333333333333 \cdot {im}^{4}\right)\right)} \]
  5. Step-by-step derivation
    1. unpow288.0%

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

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

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

    \[\leadsto \color{blue}{\frac{\sin re - \sin re \cdot 1.9380669946781485 \cdot 10^{-10}}{\sin re - \sin re \cdot 1.9380669946781485 \cdot 10^{-10}}} \]
  8. Step-by-step derivation
    1. *-inverses4.4%

      \[\leadsto \color{blue}{1} \]
  9. Simplified4.4%

    \[\leadsto \color{blue}{1} \]
  10. Final simplification4.4%

    \[\leadsto 1 \]

Alternative 17: 26.3% accurate, 309.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(0.5, e^{im}, e^{0 - im} \cdot 0.5\right)} \]
    10. exp-diff100.0%

      \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0}}{e^{im}}} \cdot 0.5\right) \]
    11. associate-*l/100.0%

      \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{e^{0} \cdot 0.5}{e^{im}}}\right) \]
    12. exp-0100.0%

      \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{1} \cdot 0.5}{e^{im}}\right) \]
    13. metadata-eval100.0%

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

    \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
  4. Taylor expanded in re around 0 57.7%

    \[\leadsto \color{blue}{re \cdot \left(0.5 \cdot \frac{1}{e^{im}} + 0.5 \cdot e^{im}\right)} \]
  5. Step-by-step derivation
    1. distribute-lft-out57.7%

      \[\leadsto re \cdot \color{blue}{\left(0.5 \cdot \left(\frac{1}{e^{im}} + e^{im}\right)\right)} \]
    2. +-commutative57.7%

      \[\leadsto re \cdot \left(0.5 \cdot \color{blue}{\left(e^{im} + \frac{1}{e^{im}}\right)}\right) \]
    3. rec-exp57.7%

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

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

    \[\leadsto \color{blue}{re} \]
  8. Final simplification24.5%

    \[\leadsto re \]

Reproduce

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