math.sin on complex, real part

Percentage Accurate: 100.0% → 100.0%
Time: 10.6s
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, 0.8× speedup?

\[\begin{array}{l} \\ \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right) \end{array} \]
(FPCore (re im)
 :precision binary64
 (* (sin re) (fma 0.5 (exp im) (/ 0.5 (exp im)))))
double code(double re, double im) {
	return sin(re) * fma(0.5, exp(im), (0.5 / exp(im)));
}
function code(re, im)
	return Float64(sin(re) * fma(0.5, exp(im), Float64(0.5 / exp(im))))
end
code[re_, im_] := N[(N[Sin[re], $MachinePrecision] * N[(0.5 * N[Exp[im], $MachinePrecision] + N[(0.5 / N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)
\end{array}
Derivation
  1. Initial program 100.0%

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

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

      \[\leadsto \color{blue}{\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. Final simplification100.0%

    \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right) \]

Alternative 2: 100.0% accurate, 1.0× speedup?

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

\\
\sin re \cdot \left(0.5 \cdot \left(e^{im} + e^{-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. *-commutative100.0%

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

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

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

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

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

Alternative 3: 93.4% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {im}^{4} \cdot \left(\sin re \cdot 0.041666666666666664\right)\\ \mathbf{if}\;im \leq -4.5 \cdot 10^{+72}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -460:\\ \;\;\;\;0.5 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(re \cdot \left(im \cdot im\right)\right)\right)\\ \mathbf{elif}\;im \leq 10:\\ \;\;\;\;\sin re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 4.2 \cdot 10^{+68}:\\ \;\;\;\;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 (* (pow im 4.0) (* (sin re) 0.041666666666666664))))
   (if (<= im -4.5e+72)
     t_0
     (if (<= im -460.0)
       (* 0.5 (log1p (expm1 (* re (* im im)))))
       (if (<= im 10.0)
         (* (sin re) (+ 1.0 (* 0.5 (* im im))))
         (if (<= im 4.2e+68) (* re (+ 0.5 (* 0.5 (exp im)))) t_0))))))
double code(double re, double im) {
	double t_0 = pow(im, 4.0) * (sin(re) * 0.041666666666666664);
	double tmp;
	if (im <= -4.5e+72) {
		tmp = t_0;
	} else if (im <= -460.0) {
		tmp = 0.5 * log1p(expm1((re * (im * im))));
	} else if (im <= 10.0) {
		tmp = sin(re) * (1.0 + (0.5 * (im * im)));
	} else if (im <= 4.2e+68) {
		tmp = re * (0.5 + (0.5 * exp(im)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
public static double code(double re, double im) {
	double t_0 = Math.pow(im, 4.0) * (Math.sin(re) * 0.041666666666666664);
	double tmp;
	if (im <= -4.5e+72) {
		tmp = t_0;
	} else if (im <= -460.0) {
		tmp = 0.5 * Math.log1p(Math.expm1((re * (im * im))));
	} else if (im <= 10.0) {
		tmp = Math.sin(re) * (1.0 + (0.5 * (im * im)));
	} else if (im <= 4.2e+68) {
		tmp = re * (0.5 + (0.5 * Math.exp(im)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = math.pow(im, 4.0) * (math.sin(re) * 0.041666666666666664)
	tmp = 0
	if im <= -4.5e+72:
		tmp = t_0
	elif im <= -460.0:
		tmp = 0.5 * math.log1p(math.expm1((re * (im * im))))
	elif im <= 10.0:
		tmp = math.sin(re) * (1.0 + (0.5 * (im * im)))
	elif im <= 4.2e+68:
		tmp = re * (0.5 + (0.5 * math.exp(im)))
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64((im ^ 4.0) * Float64(sin(re) * 0.041666666666666664))
	tmp = 0.0
	if (im <= -4.5e+72)
		tmp = t_0;
	elseif (im <= -460.0)
		tmp = Float64(0.5 * log1p(expm1(Float64(re * Float64(im * im)))));
	elseif (im <= 10.0)
		tmp = Float64(sin(re) * Float64(1.0 + Float64(0.5 * Float64(im * im))));
	elseif (im <= 4.2e+68)
		tmp = Float64(re * Float64(0.5 + Float64(0.5 * exp(im))));
	else
		tmp = t_0;
	end
	return tmp
end
code[re_, im_] := Block[{t$95$0 = N[(N[Power[im, 4.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -4.5e+72], t$95$0, If[LessEqual[im, -460.0], N[(0.5 * N[Log[1 + N[(Exp[N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 10.0], N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.2e+68], 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 := {im}^{4} \cdot \left(\sin re \cdot 0.041666666666666664\right)\\
\mathbf{if}\;im \leq -4.5 \cdot 10^{+72}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -460:\\
\;\;\;\;0.5 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(re \cdot \left(im \cdot im\right)\right)\right)\\

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

\mathbf{elif}\;im \leq 4.2 \cdot 10^{+68}:\\
\;\;\;\;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 < -4.4999999999999998e72 or 4.20000000000000002e68 < 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. *-commutative100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.4999999999999998e72 < im < -460

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(im \cdot \left(im \cdot re\right)\right)} \]
    13. Step-by-step derivation
      1. log1p-expm1-u59.4%

        \[\leadsto 0.5 \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(im \cdot \left(im \cdot re\right)\right)\right)} \]
      2. associate-*r*59.4%

        \[\leadsto 0.5 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{\left(im \cdot im\right) \cdot re}\right)\right) \]
      3. *-commutative59.4%

        \[\leadsto 0.5 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{re \cdot \left(im \cdot im\right)}\right)\right) \]
    14. Applied egg-rr59.4%

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

    if -460 < im < 10

    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-in99.9%

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

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

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

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

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

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

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

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

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

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

    if 10 < im < 4.20000000000000002e68

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -4.5 \cdot 10^{+72}:\\ \;\;\;\;{im}^{4} \cdot \left(\sin re \cdot 0.041666666666666664\right)\\ \mathbf{elif}\;im \leq -460:\\ \;\;\;\;0.5 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(re \cdot \left(im \cdot im\right)\right)\right)\\ \mathbf{elif}\;im \leq 10:\\ \;\;\;\;\sin re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 4.2 \cdot 10^{+68}:\\ \;\;\;\;re \cdot \left(0.5 + 0.5 \cdot e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;{im}^{4} \cdot \left(\sin re \cdot 0.041666666666666664\right)\\ \end{array} \]

Alternative 4: 91.8% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {im}^{4} \cdot \left(\sin re \cdot 0.041666666666666664\right)\\ \mathbf{if}\;im \leq -3.7:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 10:\\ \;\;\;\;\sin re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 4.2 \cdot 10^{+68}:\\ \;\;\;\;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 (* (pow im 4.0) (* (sin re) 0.041666666666666664))))
   (if (<= im -3.7)
     t_0
     (if (<= im 10.0)
       (* (sin re) (+ 1.0 (* 0.5 (* im im))))
       (if (<= im 4.2e+68) (* re (+ 0.5 (* 0.5 (exp im)))) t_0)))))
double code(double re, double im) {
	double t_0 = pow(im, 4.0) * (sin(re) * 0.041666666666666664);
	double tmp;
	if (im <= -3.7) {
		tmp = t_0;
	} else if (im <= 10.0) {
		tmp = sin(re) * (1.0 + (0.5 * (im * im)));
	} else if (im <= 4.2e+68) {
		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 = (im ** 4.0d0) * (sin(re) * 0.041666666666666664d0)
    if (im <= (-3.7d0)) then
        tmp = t_0
    else if (im <= 10.0d0) then
        tmp = sin(re) * (1.0d0 + (0.5d0 * (im * im)))
    else if (im <= 4.2d+68) 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.pow(im, 4.0) * (Math.sin(re) * 0.041666666666666664);
	double tmp;
	if (im <= -3.7) {
		tmp = t_0;
	} else if (im <= 10.0) {
		tmp = Math.sin(re) * (1.0 + (0.5 * (im * im)));
	} else if (im <= 4.2e+68) {
		tmp = re * (0.5 + (0.5 * Math.exp(im)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = math.pow(im, 4.0) * (math.sin(re) * 0.041666666666666664)
	tmp = 0
	if im <= -3.7:
		tmp = t_0
	elif im <= 10.0:
		tmp = math.sin(re) * (1.0 + (0.5 * (im * im)))
	elif im <= 4.2e+68:
		tmp = re * (0.5 + (0.5 * math.exp(im)))
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64((im ^ 4.0) * Float64(sin(re) * 0.041666666666666664))
	tmp = 0.0
	if (im <= -3.7)
		tmp = t_0;
	elseif (im <= 10.0)
		tmp = Float64(sin(re) * Float64(1.0 + Float64(0.5 * Float64(im * im))));
	elseif (im <= 4.2e+68)
		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 = (im ^ 4.0) * (sin(re) * 0.041666666666666664);
	tmp = 0.0;
	if (im <= -3.7)
		tmp = t_0;
	elseif (im <= 10.0)
		tmp = sin(re) * (1.0 + (0.5 * (im * im)));
	elseif (im <= 4.2e+68)
		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[Power[im, 4.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.7], t$95$0, If[LessEqual[im, 10.0], N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.2e+68], 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 := {im}^{4} \cdot \left(\sin re \cdot 0.041666666666666664\right)\\
\mathbf{if}\;im \leq -3.7:\\
\;\;\;\;t_0\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -3.7000000000000002 or 4.20000000000000002e68 < 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. *-commutative100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.7000000000000002 < im < 10

    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-in99.9%

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

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

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

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

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

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

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

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

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

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

    if 10 < im < 4.20000000000000002e68

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

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

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

Alternative 5: 97.1% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -4.5 \cdot 10^{+72}:\\ \;\;\;\;{im}^{4} \cdot \left(\sin re \cdot 0.041666666666666664\right)\\ \mathbf{elif}\;im \leq -6.9 \cdot 10^{-6}:\\ \;\;\;\;0.5 \cdot \left(re \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 -4.5e+72)
   (* (pow im 4.0) (* (sin re) 0.041666666666666664))
   (if (<= im -6.9e-6)
     (* 0.5 (* re (+ (exp im) (exp (- im)))))
     (* (sin re) (+ 0.5 (* 0.5 (exp im)))))))
double code(double re, double im) {
	double tmp;
	if (im <= -4.5e+72) {
		tmp = pow(im, 4.0) * (sin(re) * 0.041666666666666664);
	} else if (im <= -6.9e-6) {
		tmp = 0.5 * (re * (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 <= (-4.5d+72)) then
        tmp = (im ** 4.0d0) * (sin(re) * 0.041666666666666664d0)
    else if (im <= (-6.9d-6)) then
        tmp = 0.5d0 * (re * (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 <= -4.5e+72) {
		tmp = Math.pow(im, 4.0) * (Math.sin(re) * 0.041666666666666664);
	} else if (im <= -6.9e-6) {
		tmp = 0.5 * (re * (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 <= -4.5e+72:
		tmp = math.pow(im, 4.0) * (math.sin(re) * 0.041666666666666664)
	elif im <= -6.9e-6:
		tmp = 0.5 * (re * (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 <= -4.5e+72)
		tmp = Float64((im ^ 4.0) * Float64(sin(re) * 0.041666666666666664));
	elseif (im <= -6.9e-6)
		tmp = Float64(0.5 * Float64(re * Float64(exp(im) + exp(Float64(-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 <= -4.5e+72)
		tmp = (im ^ 4.0) * (sin(re) * 0.041666666666666664);
	elseif (im <= -6.9e-6)
		tmp = 0.5 * (re * (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, -4.5e+72], N[(N[Power[im, 4.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -6.9e-6], N[(0.5 * N[(re * 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 -4.5 \cdot 10^{+72}:\\
\;\;\;\;{im}^{4} \cdot \left(\sin re \cdot 0.041666666666666664\right)\\

\mathbf{elif}\;im \leq -6.9 \cdot 10^{-6}:\\
\;\;\;\;0.5 \cdot \left(re \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 < -4.4999999999999998e72

    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. *-commutative100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.4999999999999998e72 < im < -6.9e-6

    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. *-commutative100.0%

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

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

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

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

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

    if -6.9e-6 < 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 98.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -4.5 \cdot 10^{+72}:\\ \;\;\;\;{im}^{4} \cdot \left(\sin re \cdot 0.041666666666666664\right)\\ \mathbf{elif}\;im \leq -6.9 \cdot 10^{-6}:\\ \;\;\;\;0.5 \cdot \left(re \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 6: 94.8% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -4.5 \cdot 10^{+72}:\\ \;\;\;\;{im}^{4} \cdot \left(\sin re \cdot 0.041666666666666664\right)\\ \mathbf{elif}\;im \leq -510:\\ \;\;\;\;0.5 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(re \cdot \left(im \cdot im\right)\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 -4.5e+72)
   (* (pow im 4.0) (* (sin re) 0.041666666666666664))
   (if (<= im -510.0)
     (* 0.5 (log1p (expm1 (* re (* im im)))))
     (* (sin re) (+ 0.5 (* 0.5 (exp im)))))))
double code(double re, double im) {
	double tmp;
	if (im <= -4.5e+72) {
		tmp = pow(im, 4.0) * (sin(re) * 0.041666666666666664);
	} else if (im <= -510.0) {
		tmp = 0.5 * log1p(expm1((re * (im * im))));
	} else {
		tmp = sin(re) * (0.5 + (0.5 * exp(im)));
	}
	return tmp;
}
public static double code(double re, double im) {
	double tmp;
	if (im <= -4.5e+72) {
		tmp = Math.pow(im, 4.0) * (Math.sin(re) * 0.041666666666666664);
	} else if (im <= -510.0) {
		tmp = 0.5 * Math.log1p(Math.expm1((re * (im * im))));
	} else {
		tmp = Math.sin(re) * (0.5 + (0.5 * Math.exp(im)));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= -4.5e+72:
		tmp = math.pow(im, 4.0) * (math.sin(re) * 0.041666666666666664)
	elif im <= -510.0:
		tmp = 0.5 * math.log1p(math.expm1((re * (im * im))))
	else:
		tmp = math.sin(re) * (0.5 + (0.5 * math.exp(im)))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= -4.5e+72)
		tmp = Float64((im ^ 4.0) * Float64(sin(re) * 0.041666666666666664));
	elseif (im <= -510.0)
		tmp = Float64(0.5 * log1p(expm1(Float64(re * Float64(im * im)))));
	else
		tmp = Float64(sin(re) * Float64(0.5 + Float64(0.5 * exp(im))));
	end
	return tmp
end
code[re_, im_] := If[LessEqual[im, -4.5e+72], N[(N[Power[im, 4.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -510.0], N[(0.5 * N[Log[1 + N[(Exp[N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]] - 1), $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 -4.5 \cdot 10^{+72}:\\
\;\;\;\;{im}^{4} \cdot \left(\sin re \cdot 0.041666666666666664\right)\\

\mathbf{elif}\;im \leq -510:\\
\;\;\;\;0.5 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(re \cdot \left(im \cdot im\right)\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 < -4.4999999999999998e72

    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. *-commutative100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.4999999999999998e72 < im < -510

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(im \cdot \left(im \cdot re\right)\right)} \]
    13. Step-by-step derivation
      1. log1p-expm1-u59.4%

        \[\leadsto 0.5 \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(im \cdot \left(im \cdot re\right)\right)\right)} \]
      2. associate-*r*59.4%

        \[\leadsto 0.5 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{\left(im \cdot im\right) \cdot re}\right)\right) \]
      3. *-commutative59.4%

        \[\leadsto 0.5 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{re \cdot \left(im \cdot im\right)}\right)\right) \]
    14. Applied egg-rr59.4%

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

    if -510 < 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 98.7%

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

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

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

Alternative 7: 89.1% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(im \cdot im\right) \cdot \left(\sin re \cdot 0.5\right)\\ \mathbf{if}\;im \leq -3 \cdot 10^{+196}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -200:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + \left(im \cdot im + {im}^{4} \cdot 0.08333333333333333\right)\right)\right)\\ \mathbf{elif}\;im \leq 10:\\ \;\;\;\;\sin re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+150}:\\ \;\;\;\;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 (* (* im im) (* (sin re) 0.5))))
   (if (<= im -3e+196)
     t_0
     (if (<= im -200.0)
       (*
        0.5
        (* re (+ 2.0 (+ (* im im) (* (pow im 4.0) 0.08333333333333333)))))
       (if (<= im 10.0)
         (* (sin re) (+ 1.0 (* 0.5 (* im im))))
         (if (<= im 1.35e+150) (* re (+ 0.5 (* 0.5 (exp im)))) t_0))))))
double code(double re, double im) {
	double t_0 = (im * im) * (sin(re) * 0.5);
	double tmp;
	if (im <= -3e+196) {
		tmp = t_0;
	} else if (im <= -200.0) {
		tmp = 0.5 * (re * (2.0 + ((im * im) + (pow(im, 4.0) * 0.08333333333333333))));
	} else if (im <= 10.0) {
		tmp = sin(re) * (1.0 + (0.5 * (im * im)));
	} else if (im <= 1.35e+150) {
		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 = (im * im) * (sin(re) * 0.5d0)
    if (im <= (-3d+196)) then
        tmp = t_0
    else if (im <= (-200.0d0)) then
        tmp = 0.5d0 * (re * (2.0d0 + ((im * im) + ((im ** 4.0d0) * 0.08333333333333333d0))))
    else if (im <= 10.0d0) then
        tmp = sin(re) * (1.0d0 + (0.5d0 * (im * im)))
    else if (im <= 1.35d+150) 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 = (im * im) * (Math.sin(re) * 0.5);
	double tmp;
	if (im <= -3e+196) {
		tmp = t_0;
	} else if (im <= -200.0) {
		tmp = 0.5 * (re * (2.0 + ((im * im) + (Math.pow(im, 4.0) * 0.08333333333333333))));
	} else if (im <= 10.0) {
		tmp = Math.sin(re) * (1.0 + (0.5 * (im * im)));
	} else if (im <= 1.35e+150) {
		tmp = re * (0.5 + (0.5 * Math.exp(im)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = (im * im) * (math.sin(re) * 0.5)
	tmp = 0
	if im <= -3e+196:
		tmp = t_0
	elif im <= -200.0:
		tmp = 0.5 * (re * (2.0 + ((im * im) + (math.pow(im, 4.0) * 0.08333333333333333))))
	elif im <= 10.0:
		tmp = math.sin(re) * (1.0 + (0.5 * (im * im)))
	elif im <= 1.35e+150:
		tmp = re * (0.5 + (0.5 * math.exp(im)))
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(Float64(im * im) * Float64(sin(re) * 0.5))
	tmp = 0.0
	if (im <= -3e+196)
		tmp = t_0;
	elseif (im <= -200.0)
		tmp = Float64(0.5 * Float64(re * Float64(2.0 + Float64(Float64(im * im) + Float64((im ^ 4.0) * 0.08333333333333333)))));
	elseif (im <= 10.0)
		tmp = Float64(sin(re) * Float64(1.0 + Float64(0.5 * Float64(im * im))));
	elseif (im <= 1.35e+150)
		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 = (im * im) * (sin(re) * 0.5);
	tmp = 0.0;
	if (im <= -3e+196)
		tmp = t_0;
	elseif (im <= -200.0)
		tmp = 0.5 * (re * (2.0 + ((im * im) + ((im ^ 4.0) * 0.08333333333333333))));
	elseif (im <= 10.0)
		tmp = sin(re) * (1.0 + (0.5 * (im * im)));
	elseif (im <= 1.35e+150)
		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[(im * im), $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3e+196], t$95$0, If[LessEqual[im, -200.0], N[(0.5 * N[(re * N[(2.0 + N[(N[(im * im), $MachinePrecision] + N[(N[Power[im, 4.0], $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 10.0], N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.35e+150], 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(im \cdot im\right) \cdot \left(\sin re \cdot 0.5\right)\\
\mathbf{if}\;im \leq -3 \cdot 10^{+196}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -200:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(2 + \left(im \cdot im + {im}^{4} \cdot 0.08333333333333333\right)\right)\right)\\

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

\mathbf{elif}\;im \leq 1.35 \cdot 10^{+150}:\\
\;\;\;\;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 < -2.9999999999999999e196 or 1.35000000000000004e150 < 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 98.6%

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

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

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

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

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

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

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

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

    if -2.9999999999999999e196 < im < -200

    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. *-commutative100.0%

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

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

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

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

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

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

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

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

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

    if -200 < im < 10

    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-in99.9%

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

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

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

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

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

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

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

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

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

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

    if 10 < im < 1.35000000000000004e150

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

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

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

Alternative 8: 72.5% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := im \cdot \left(0.5 \cdot \left(\sin re \cdot im\right)\right)\\ t_1 := re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\ \mathbf{if}\;im \leq -2.35 \cdot 10^{+198}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -0.00042:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq 3 \cdot 10^{+28}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.03 \cdot 10^{+210} \lor \neg \left(im \leq 2.45 \cdot 10^{+227}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* im (* 0.5 (* (sin re) im))))
        (t_1 (* re (+ 1.0 (* 0.5 (* im im))))))
   (if (<= im -2.35e+198)
     t_0
     (if (<= im -0.00042)
       t_1
       (if (<= im 3e+28)
         (sin re)
         (if (or (<= im 2.03e+210) (not (<= im 2.45e+227))) t_1 t_0))))))
double code(double re, double im) {
	double t_0 = im * (0.5 * (sin(re) * im));
	double t_1 = re * (1.0 + (0.5 * (im * im)));
	double tmp;
	if (im <= -2.35e+198) {
		tmp = t_0;
	} else if (im <= -0.00042) {
		tmp = t_1;
	} else if (im <= 3e+28) {
		tmp = sin(re);
	} else if ((im <= 2.03e+210) || !(im <= 2.45e+227)) {
		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 = im * (0.5d0 * (sin(re) * im))
    t_1 = re * (1.0d0 + (0.5d0 * (im * im)))
    if (im <= (-2.35d+198)) then
        tmp = t_0
    else if (im <= (-0.00042d0)) then
        tmp = t_1
    else if (im <= 3d+28) then
        tmp = sin(re)
    else if ((im <= 2.03d+210) .or. (.not. (im <= 2.45d+227))) 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 = im * (0.5 * (Math.sin(re) * im));
	double t_1 = re * (1.0 + (0.5 * (im * im)));
	double tmp;
	if (im <= -2.35e+198) {
		tmp = t_0;
	} else if (im <= -0.00042) {
		tmp = t_1;
	} else if (im <= 3e+28) {
		tmp = Math.sin(re);
	} else if ((im <= 2.03e+210) || !(im <= 2.45e+227)) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = im * (0.5 * (math.sin(re) * im))
	t_1 = re * (1.0 + (0.5 * (im * im)))
	tmp = 0
	if im <= -2.35e+198:
		tmp = t_0
	elif im <= -0.00042:
		tmp = t_1
	elif im <= 3e+28:
		tmp = math.sin(re)
	elif (im <= 2.03e+210) or not (im <= 2.45e+227):
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(im * Float64(0.5 * Float64(sin(re) * im)))
	t_1 = Float64(re * Float64(1.0 + Float64(0.5 * Float64(im * im))))
	tmp = 0.0
	if (im <= -2.35e+198)
		tmp = t_0;
	elseif (im <= -0.00042)
		tmp = t_1;
	elseif (im <= 3e+28)
		tmp = sin(re);
	elseif ((im <= 2.03e+210) || !(im <= 2.45e+227))
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = im * (0.5 * (sin(re) * im));
	t_1 = re * (1.0 + (0.5 * (im * im)));
	tmp = 0.0;
	if (im <= -2.35e+198)
		tmp = t_0;
	elseif (im <= -0.00042)
		tmp = t_1;
	elseif (im <= 3e+28)
		tmp = sin(re);
	elseif ((im <= 2.03e+210) || ~((im <= 2.45e+227)))
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(0.5 * N[(N[Sin[re], $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re * N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.35e+198], t$95$0, If[LessEqual[im, -0.00042], t$95$1, If[LessEqual[im, 3e+28], N[Sin[re], $MachinePrecision], If[Or[LessEqual[im, 2.03e+210], N[Not[LessEqual[im, 2.45e+227]], $MachinePrecision]], t$95$1, t$95$0]]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;im \leq 2.03 \cdot 10^{+210} \lor \neg \left(im \leq 2.45 \cdot 10^{+227}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -2.3500000000000001e198 or 2.0299999999999999e210 < im < 2.45000000000000002e227

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

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

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

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

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

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

        \[\leadsto \color{blue}{im \cdot \left(0.5 \cdot \left(\sin re \cdot im\right)\right)} \]
      6. *-commutative88.7%

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

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

    if -2.3500000000000001e198 < im < -4.2000000000000002e-4 or 3.0000000000000001e28 < im < 2.0299999999999999e210 or 2.45000000000000002e227 < 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 39.4%

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

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

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

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

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

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

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

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

    if -4.2000000000000002e-4 < im < 3.0000000000000001e28

    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. *-commutative100.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -2.35 \cdot 10^{+198}:\\ \;\;\;\;im \cdot \left(0.5 \cdot \left(\sin re \cdot im\right)\right)\\ \mathbf{elif}\;im \leq -0.00042:\\ \;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 3 \cdot 10^{+28}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.03 \cdot 10^{+210} \lor \neg \left(im \leq 2.45 \cdot 10^{+227}\right):\\ \;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(0.5 \cdot \left(\sin re \cdot im\right)\right)\\ \end{array} \]

Alternative 9: 77.2% accurate, 2.7× speedup?

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

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

\mathbf{elif}\;im \leq -1760:\\
\;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\

\mathbf{elif}\;im \leq 3.8 \cdot 10^{+30}:\\
\;\;\;\;\sin re\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < -2.60000000000000012e196 or 1.35000000000000004e150 < 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 98.6%

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

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

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

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

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

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

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

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

    if -2.60000000000000012e196 < im < -1760

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

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

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

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

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

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

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

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

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

    if -1760 < im < 3.8000000000000001e30

    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. *-commutative100.0%

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

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

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

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

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

    if 3.8000000000000001e30 < im < 1.35000000000000004e150

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 84.7% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(im \cdot im\right) \cdot \left(\sin re \cdot 0.5\right)\\ \mathbf{if}\;im \leq -2.6 \cdot 10^{+196}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -650:\\ \;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 10:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+150}:\\ \;\;\;\;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 (* (* im im) (* (sin re) 0.5))))
   (if (<= im -2.6e+196)
     t_0
     (if (<= im -650.0)
       (* re (+ 1.0 (* 0.5 (* im im))))
       (if (<= im 10.0)
         (sin re)
         (if (<= im 1.35e+150) (* re (+ 0.5 (* 0.5 (exp im)))) t_0))))))
double code(double re, double im) {
	double t_0 = (im * im) * (sin(re) * 0.5);
	double tmp;
	if (im <= -2.6e+196) {
		tmp = t_0;
	} else if (im <= -650.0) {
		tmp = re * (1.0 + (0.5 * (im * im)));
	} else if (im <= 10.0) {
		tmp = sin(re);
	} else if (im <= 1.35e+150) {
		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 = (im * im) * (sin(re) * 0.5d0)
    if (im <= (-2.6d+196)) then
        tmp = t_0
    else if (im <= (-650.0d0)) then
        tmp = re * (1.0d0 + (0.5d0 * (im * im)))
    else if (im <= 10.0d0) then
        tmp = sin(re)
    else if (im <= 1.35d+150) 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 = (im * im) * (Math.sin(re) * 0.5);
	double tmp;
	if (im <= -2.6e+196) {
		tmp = t_0;
	} else if (im <= -650.0) {
		tmp = re * (1.0 + (0.5 * (im * im)));
	} else if (im <= 10.0) {
		tmp = Math.sin(re);
	} else if (im <= 1.35e+150) {
		tmp = re * (0.5 + (0.5 * Math.exp(im)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = (im * im) * (math.sin(re) * 0.5)
	tmp = 0
	if im <= -2.6e+196:
		tmp = t_0
	elif im <= -650.0:
		tmp = re * (1.0 + (0.5 * (im * im)))
	elif im <= 10.0:
		tmp = math.sin(re)
	elif im <= 1.35e+150:
		tmp = re * (0.5 + (0.5 * math.exp(im)))
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(Float64(im * im) * Float64(sin(re) * 0.5))
	tmp = 0.0
	if (im <= -2.6e+196)
		tmp = t_0;
	elseif (im <= -650.0)
		tmp = Float64(re * Float64(1.0 + Float64(0.5 * Float64(im * im))));
	elseif (im <= 10.0)
		tmp = sin(re);
	elseif (im <= 1.35e+150)
		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 = (im * im) * (sin(re) * 0.5);
	tmp = 0.0;
	if (im <= -2.6e+196)
		tmp = t_0;
	elseif (im <= -650.0)
		tmp = re * (1.0 + (0.5 * (im * im)));
	elseif (im <= 10.0)
		tmp = sin(re);
	elseif (im <= 1.35e+150)
		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[(im * im), $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.6e+196], t$95$0, If[LessEqual[im, -650.0], N[(re * N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 10.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.35e+150], 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(im \cdot im\right) \cdot \left(\sin re \cdot 0.5\right)\\
\mathbf{if}\;im \leq -2.6 \cdot 10^{+196}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -650:\\
\;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\

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

\mathbf{elif}\;im \leq 1.35 \cdot 10^{+150}:\\
\;\;\;\;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 < -2.60000000000000012e196 or 1.35000000000000004e150 < 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 98.6%

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

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

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

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

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

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

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

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

    if -2.60000000000000012e196 < im < -650

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

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

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

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

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

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

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

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

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

    if -650 < im < 10

    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. *-commutative100.0%

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

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

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

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

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

    if 10 < im < 1.35000000000000004e150

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

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

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

Alternative 11: 88.8% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(im \cdot im\right) \cdot \left(\sin re \cdot 0.5\right)\\ \mathbf{if}\;im \leq -2.6 \cdot 10^{+196}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -300:\\ \;\;\;\;0.5 \cdot \left({im}^{4} \cdot \left(re \cdot 0.08333333333333333\right)\right)\\ \mathbf{elif}\;im \leq 10:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+150}:\\ \;\;\;\;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 (* (* im im) (* (sin re) 0.5))))
   (if (<= im -2.6e+196)
     t_0
     (if (<= im -300.0)
       (* 0.5 (* (pow im 4.0) (* re 0.08333333333333333)))
       (if (<= im 10.0)
         (sin re)
         (if (<= im 1.35e+150) (* re (+ 0.5 (* 0.5 (exp im)))) t_0))))))
double code(double re, double im) {
	double t_0 = (im * im) * (sin(re) * 0.5);
	double tmp;
	if (im <= -2.6e+196) {
		tmp = t_0;
	} else if (im <= -300.0) {
		tmp = 0.5 * (pow(im, 4.0) * (re * 0.08333333333333333));
	} else if (im <= 10.0) {
		tmp = sin(re);
	} else if (im <= 1.35e+150) {
		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 = (im * im) * (sin(re) * 0.5d0)
    if (im <= (-2.6d+196)) then
        tmp = t_0
    else if (im <= (-300.0d0)) then
        tmp = 0.5d0 * ((im ** 4.0d0) * (re * 0.08333333333333333d0))
    else if (im <= 10.0d0) then
        tmp = sin(re)
    else if (im <= 1.35d+150) 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 = (im * im) * (Math.sin(re) * 0.5);
	double tmp;
	if (im <= -2.6e+196) {
		tmp = t_0;
	} else if (im <= -300.0) {
		tmp = 0.5 * (Math.pow(im, 4.0) * (re * 0.08333333333333333));
	} else if (im <= 10.0) {
		tmp = Math.sin(re);
	} else if (im <= 1.35e+150) {
		tmp = re * (0.5 + (0.5 * Math.exp(im)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = (im * im) * (math.sin(re) * 0.5)
	tmp = 0
	if im <= -2.6e+196:
		tmp = t_0
	elif im <= -300.0:
		tmp = 0.5 * (math.pow(im, 4.0) * (re * 0.08333333333333333))
	elif im <= 10.0:
		tmp = math.sin(re)
	elif im <= 1.35e+150:
		tmp = re * (0.5 + (0.5 * math.exp(im)))
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(Float64(im * im) * Float64(sin(re) * 0.5))
	tmp = 0.0
	if (im <= -2.6e+196)
		tmp = t_0;
	elseif (im <= -300.0)
		tmp = Float64(0.5 * Float64((im ^ 4.0) * Float64(re * 0.08333333333333333)));
	elseif (im <= 10.0)
		tmp = sin(re);
	elseif (im <= 1.35e+150)
		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 = (im * im) * (sin(re) * 0.5);
	tmp = 0.0;
	if (im <= -2.6e+196)
		tmp = t_0;
	elseif (im <= -300.0)
		tmp = 0.5 * ((im ^ 4.0) * (re * 0.08333333333333333));
	elseif (im <= 10.0)
		tmp = sin(re);
	elseif (im <= 1.35e+150)
		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[(im * im), $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.6e+196], t$95$0, If[LessEqual[im, -300.0], N[(0.5 * N[(N[Power[im, 4.0], $MachinePrecision] * N[(re * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 10.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.35e+150], 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(im \cdot im\right) \cdot \left(\sin re \cdot 0.5\right)\\
\mathbf{if}\;im \leq -2.6 \cdot 10^{+196}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -300:\\
\;\;\;\;0.5 \cdot \left({im}^{4} \cdot \left(re \cdot 0.08333333333333333\right)\right)\\

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

\mathbf{elif}\;im \leq 1.35 \cdot 10^{+150}:\\
\;\;\;\;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 < -2.60000000000000012e196 or 1.35000000000000004e150 < 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 98.6%

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

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

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

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

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

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

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

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

    if -2.60000000000000012e196 < im < -300

    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. *-commutative100.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(0.08333333333333333 \cdot \left(re \cdot {im}^{4}\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*r*60.0%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left({im}^{4} \cdot \left(0.08333333333333333 \cdot re\right)\right)} \]
    10. Simplified60.0%

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

    if -300 < im < 10

    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. *-commutative100.0%

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

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

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

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

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

    if 10 < im < 1.35000000000000004e150

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

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

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

Alternative 12: 89.1% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(im \cdot im\right) \cdot \left(\sin re \cdot 0.5\right)\\ \mathbf{if}\;im \leq -2 \cdot 10^{+198}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -420:\\ \;\;\;\;0.5 \cdot \left({im}^{4} \cdot \left(re \cdot 0.08333333333333333\right)\right)\\ \mathbf{elif}\;im \leq 10:\\ \;\;\;\;\sin re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+150}:\\ \;\;\;\;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 (* (* im im) (* (sin re) 0.5))))
   (if (<= im -2e+198)
     t_0
     (if (<= im -420.0)
       (* 0.5 (* (pow im 4.0) (* re 0.08333333333333333)))
       (if (<= im 10.0)
         (* (sin re) (+ 1.0 (* 0.5 (* im im))))
         (if (<= im 1.35e+150) (* re (+ 0.5 (* 0.5 (exp im)))) t_0))))))
double code(double re, double im) {
	double t_0 = (im * im) * (sin(re) * 0.5);
	double tmp;
	if (im <= -2e+198) {
		tmp = t_0;
	} else if (im <= -420.0) {
		tmp = 0.5 * (pow(im, 4.0) * (re * 0.08333333333333333));
	} else if (im <= 10.0) {
		tmp = sin(re) * (1.0 + (0.5 * (im * im)));
	} else if (im <= 1.35e+150) {
		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 = (im * im) * (sin(re) * 0.5d0)
    if (im <= (-2d+198)) then
        tmp = t_0
    else if (im <= (-420.0d0)) then
        tmp = 0.5d0 * ((im ** 4.0d0) * (re * 0.08333333333333333d0))
    else if (im <= 10.0d0) then
        tmp = sin(re) * (1.0d0 + (0.5d0 * (im * im)))
    else if (im <= 1.35d+150) 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 = (im * im) * (Math.sin(re) * 0.5);
	double tmp;
	if (im <= -2e+198) {
		tmp = t_0;
	} else if (im <= -420.0) {
		tmp = 0.5 * (Math.pow(im, 4.0) * (re * 0.08333333333333333));
	} else if (im <= 10.0) {
		tmp = Math.sin(re) * (1.0 + (0.5 * (im * im)));
	} else if (im <= 1.35e+150) {
		tmp = re * (0.5 + (0.5 * Math.exp(im)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = (im * im) * (math.sin(re) * 0.5)
	tmp = 0
	if im <= -2e+198:
		tmp = t_0
	elif im <= -420.0:
		tmp = 0.5 * (math.pow(im, 4.0) * (re * 0.08333333333333333))
	elif im <= 10.0:
		tmp = math.sin(re) * (1.0 + (0.5 * (im * im)))
	elif im <= 1.35e+150:
		tmp = re * (0.5 + (0.5 * math.exp(im)))
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(Float64(im * im) * Float64(sin(re) * 0.5))
	tmp = 0.0
	if (im <= -2e+198)
		tmp = t_0;
	elseif (im <= -420.0)
		tmp = Float64(0.5 * Float64((im ^ 4.0) * Float64(re * 0.08333333333333333)));
	elseif (im <= 10.0)
		tmp = Float64(sin(re) * Float64(1.0 + Float64(0.5 * Float64(im * im))));
	elseif (im <= 1.35e+150)
		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 = (im * im) * (sin(re) * 0.5);
	tmp = 0.0;
	if (im <= -2e+198)
		tmp = t_0;
	elseif (im <= -420.0)
		tmp = 0.5 * ((im ^ 4.0) * (re * 0.08333333333333333));
	elseif (im <= 10.0)
		tmp = sin(re) * (1.0 + (0.5 * (im * im)));
	elseif (im <= 1.35e+150)
		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[(im * im), $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2e+198], t$95$0, If[LessEqual[im, -420.0], N[(0.5 * N[(N[Power[im, 4.0], $MachinePrecision] * N[(re * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 10.0], N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.35e+150], 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(im \cdot im\right) \cdot \left(\sin re \cdot 0.5\right)\\
\mathbf{if}\;im \leq -2 \cdot 10^{+198}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -420:\\
\;\;\;\;0.5 \cdot \left({im}^{4} \cdot \left(re \cdot 0.08333333333333333\right)\right)\\

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

\mathbf{elif}\;im \leq 1.35 \cdot 10^{+150}:\\
\;\;\;\;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 < -2.00000000000000004e198 or 1.35000000000000004e150 < 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 98.6%

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

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

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

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

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

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

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

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

    if -2.00000000000000004e198 < im < -420

    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. *-commutative100.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(0.08333333333333333 \cdot \left(re \cdot {im}^{4}\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*r*60.0%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left({im}^{4} \cdot \left(0.08333333333333333 \cdot re\right)\right)} \]
    10. Simplified60.0%

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

    if -420 < im < 10

    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-in99.9%

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

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

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

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

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

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

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

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

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

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

    if 10 < im < 1.35000000000000004e150

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

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

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

Alternative 13: 72.0% accurate, 2.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq -0.000102 \lor \neg \left(im \leq 2.8 \cdot 10^{+30}\right):\\
\;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < -1.01999999999999999e-4 or 2.79999999999999983e30 < 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 54.4%

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

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

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

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

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

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

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

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

    if -1.01999999999999999e-4 < im < 2.79999999999999983e30

    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. *-commutative100.0%

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

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

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

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

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

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

Alternative 14: 43.0% accurate, 27.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < -1.4199999999999999 or 0.0085000000000000006 < 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 53.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.4199999999999999 < im < 0.0085000000000000006

    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-in99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 48.7% accurate, 27.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -1.42 \lor \neg \left(im \leq 0.0085\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 -1.42) (not (<= im 0.0085))) (* 0.5 (* re (* im im))) re))
double code(double re, double im) {
	double tmp;
	if ((im <= -1.42) || !(im <= 0.0085)) {
		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 <= (-1.42d0)) .or. (.not. (im <= 0.0085d0))) 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 <= -1.42) || !(im <= 0.0085)) {
		tmp = 0.5 * (re * (im * im));
	} else {
		tmp = re;
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if (im <= -1.42) or not (im <= 0.0085):
		tmp = 0.5 * (re * (im * im))
	else:
		tmp = re
	return tmp
function code(re, im)
	tmp = 0.0
	if ((im <= -1.42) || !(im <= 0.0085))
		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 <= -1.42) || ~((im <= 0.0085)))
		tmp = 0.5 * (re * (im * im));
	else
		tmp = re;
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[Or[LessEqual[im, -1.42], N[Not[LessEqual[im, 0.0085]], $MachinePrecision]], N[(0.5 * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], re]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.42 \lor \neg \left(im \leq 0.0085\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 < -1.4199999999999999 or 0.0085000000000000006 < 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 53.5%

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

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

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

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

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

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

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

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

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

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

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

    if -1.4199999999999999 < im < 0.0085000000000000006

    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-in99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 48.9% accurate, 34.3× speedup?

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

\\
re \cdot \left(1 + 0.5 \cdot \left(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 im around 0 75.8%

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

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

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

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

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

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

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

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

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

Alternative 17: 26.6% 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 im around 0 75.8%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{re} \]
  11. Final simplification28.0%

    \[\leadsto re \]

Reproduce

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