math.sin on complex, real part

Percentage Accurate: 100.0% → 100.0%
Time: 9.2s
Alternatives: 17
Speedup: 1.0×

Specification

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

\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 17 alternatives:

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

Initial Program: 100.0% accurate, 1.0× speedup?

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

\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
\end{array}

Alternative 1: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \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(Float64(-im)) + exp(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 2: 96.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{if}\;im \leq -2.55 \cdot 10^{+77}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -0.011:\\ \;\;\;\;0.5 \cdot \mathsf{fma}\left(re, e^{im}, \frac{re}{e^{im}}\right)\\ \mathbf{elif}\;im \leq 0.039:\\ \;\;\;\;\sin re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 2.6 \cdot 10^{+77}:\\ \;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(re \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0
         (*
          (sin re)
          (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))))
   (if (<= im -2.55e+77)
     t_0
     (if (<= im -0.011)
       (* 0.5 (fma re (exp im) (/ re (exp im))))
       (if (<= im 0.039)
         (* (sin re) (+ 1.0 (* im (* 0.5 im))))
         (if (<= im 2.6e+77) (* (+ (exp (- im)) (exp im)) (* re 0.5)) t_0))))))
double code(double re, double im) {
	double t_0 = sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	double tmp;
	if (im <= -2.55e+77) {
		tmp = t_0;
	} else if (im <= -0.011) {
		tmp = 0.5 * fma(re, exp(im), (re / exp(im)));
	} else if (im <= 0.039) {
		tmp = sin(re) * (1.0 + (im * (0.5 * im)));
	} else if (im <= 2.6e+77) {
		tmp = (exp(-im) + exp(im)) * (re * 0.5);
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(re, im)
	t_0 = Float64(sin(re) * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664)))))
	tmp = 0.0
	if (im <= -2.55e+77)
		tmp = t_0;
	elseif (im <= -0.011)
		tmp = Float64(0.5 * fma(re, exp(im), Float64(re / exp(im))));
	elseif (im <= 0.039)
		tmp = Float64(sin(re) * Float64(1.0 + Float64(im * Float64(0.5 * im))));
	elseif (im <= 2.6e+77)
		tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(re * 0.5));
	else
		tmp = t_0;
	end
	return tmp
end
code[re_, im_] := Block[{t$95$0 = N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.55e+77], t$95$0, If[LessEqual[im, -0.011], N[(0.5 * N[(re * N[Exp[im], $MachinePrecision] + N[(re / N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 0.039], N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.6e+77], N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(re * 0.5), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq -0.011:\\
\;\;\;\;0.5 \cdot \mathsf{fma}\left(re, e^{im}, \frac{re}{e^{im}}\right)\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < -2.54999999999999985e77 or 2.6000000000000002e77 < 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 100.0%

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

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

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

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

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

        \[\leadsto \sin re \cdot 1 + \left(\left(0.5 \cdot {im}^{2}\right) \cdot \sin re + \color{blue}{\left(0.041666666666666664 \cdot {im}^{4}\right) \cdot \sin re}\right) \]
      6. distribute-rgt-out100.0%

        \[\leadsto \sin re \cdot 1 + \color{blue}{\sin re \cdot \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)} \]
      7. distribute-lft-out100.0%

        \[\leadsto \color{blue}{\sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)\right)} \]
      8. metadata-eval100.0%

        \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{\color{blue}{\left(2 \cdot 2\right)}}\right)\right) \]
      9. pow-sqr100.0%

        \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)}\right)\right) \]
      10. associate-*r*100.0%

        \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + \color{blue}{\left(0.041666666666666664 \cdot {im}^{2}\right) \cdot {im}^{2}}\right)\right) \]
      11. distribute-rgt-out100.0%

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

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

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

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

    if -2.54999999999999985e77 < im < -0.010999999999999999

    1. Initial program 99.9%

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\mathsf{fma}\left(re, e^{im}, re \cdot e^{-im}\right)} \]
      3. exp-neg71.4%

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

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

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

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

    if -0.010999999999999999 < im < 0.0389999999999999999

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

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

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

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

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

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

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

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

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

    if 0.0389999999999999999 < im < 2.6000000000000002e77

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -2.55 \cdot 10^{+77}:\\ \;\;\;\;\sin re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{elif}\;im \leq -0.011:\\ \;\;\;\;0.5 \cdot \mathsf{fma}\left(re, e^{im}, \frac{re}{e^{im}}\right)\\ \mathbf{elif}\;im \leq 0.039:\\ \;\;\;\;\sin re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 2.6 \cdot 10^{+77}:\\ \;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(re \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \end{array} \]

Alternative 3: 96.9% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;im \leq -0.0125:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;im \leq 2.6 \cdot 10^{+77}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -2.54999999999999985e77 or 2.6000000000000002e77 < 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 100.0%

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

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

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

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

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

        \[\leadsto \sin re \cdot 1 + \left(\left(0.5 \cdot {im}^{2}\right) \cdot \sin re + \color{blue}{\left(0.041666666666666664 \cdot {im}^{4}\right) \cdot \sin re}\right) \]
      6. distribute-rgt-out100.0%

        \[\leadsto \sin re \cdot 1 + \color{blue}{\sin re \cdot \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)} \]
      7. distribute-lft-out100.0%

        \[\leadsto \color{blue}{\sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)\right)} \]
      8. metadata-eval100.0%

        \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{\color{blue}{\left(2 \cdot 2\right)}}\right)\right) \]
      9. pow-sqr100.0%

        \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)}\right)\right) \]
      10. associate-*r*100.0%

        \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + \color{blue}{\left(0.041666666666666664 \cdot {im}^{2}\right) \cdot {im}^{2}}\right)\right) \]
      11. distribute-rgt-out100.0%

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

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

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

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

    if -2.54999999999999985e77 < im < -0.012500000000000001 or 0.021999999999999999 < im < 2.6000000000000002e77

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

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

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

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

    if -0.012500000000000001 < im < 0.021999999999999999

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

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

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

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

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

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

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

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

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

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

Alternative 4: 85.2% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\ t_1 := re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{if}\;im \leq -2.35 \cdot 10^{+156}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -0.00075:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq 370:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 3.6 \cdot 10^{+137}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* 0.5 (* (sin re) (* im im))))
        (t_1
         (*
          re
          (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))))
   (if (<= im -2.35e+156)
     t_0
     (if (<= im -0.00075)
       t_1
       (if (<= im 370.0) (sin re) (if (<= im 3.6e+137) t_1 t_0))))))
double code(double re, double im) {
	double t_0 = 0.5 * (sin(re) * (im * im));
	double t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	double tmp;
	if (im <= -2.35e+156) {
		tmp = t_0;
	} else if (im <= -0.00075) {
		tmp = t_1;
	} else if (im <= 370.0) {
		tmp = sin(re);
	} else if (im <= 3.6e+137) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 0.5d0 * (sin(re) * (im * im))
    t_1 = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
    if (im <= (-2.35d+156)) then
        tmp = t_0
    else if (im <= (-0.00075d0)) then
        tmp = t_1
    else if (im <= 370.0d0) then
        tmp = sin(re)
    else if (im <= 3.6d+137) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = 0.5 * (Math.sin(re) * (im * im));
	double t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	double tmp;
	if (im <= -2.35e+156) {
		tmp = t_0;
	} else if (im <= -0.00075) {
		tmp = t_1;
	} else if (im <= 370.0) {
		tmp = Math.sin(re);
	} else if (im <= 3.6e+137) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = 0.5 * (math.sin(re) * (im * im))
	t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))))
	tmp = 0
	if im <= -2.35e+156:
		tmp = t_0
	elif im <= -0.00075:
		tmp = t_1
	elif im <= 370.0:
		tmp = math.sin(re)
	elif im <= 3.6e+137:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(0.5 * Float64(sin(re) * Float64(im * im)))
	t_1 = Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664)))))
	tmp = 0.0
	if (im <= -2.35e+156)
		tmp = t_0;
	elseif (im <= -0.00075)
		tmp = t_1;
	elseif (im <= 370.0)
		tmp = sin(re);
	elseif (im <= 3.6e+137)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 0.5 * (sin(re) * (im * im));
	t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	tmp = 0.0;
	if (im <= -2.35e+156)
		tmp = t_0;
	elseif (im <= -0.00075)
		tmp = t_1;
	elseif (im <= 370.0)
		tmp = sin(re);
	elseif (im <= 3.6e+137)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[Sin[re], $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.35e+156], t$95$0, If[LessEqual[im, -0.00075], t$95$1, If[LessEqual[im, 370.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 3.6e+137], t$95$1, t$95$0]]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;im \leq 3.6 \cdot 10^{+137}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -2.35e156 or 3.6e137 < 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 98.5%

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(im \cdot im\right)} \cdot 0.5 + 1\right) \cdot \sin re \]
      6. associate-*l*98.5%

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

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

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

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

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

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

    if -2.35e156 < im < -7.5000000000000002e-4 or 370 < im < 3.6e137

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

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

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

        \[\leadsto \sin re \cdot 1 + \left(0.5 \cdot \color{blue}{\left({im}^{2} \cdot \sin re\right)} + 0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\right) \]
      3. associate-*r*40.5%

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

        \[\leadsto \sin re \cdot 1 + \left(\left(0.5 \cdot {im}^{2}\right) \cdot \sin re + 0.041666666666666664 \cdot \color{blue}{\left({im}^{4} \cdot \sin re\right)}\right) \]
      5. associate-*r*40.5%

        \[\leadsto \sin re \cdot 1 + \left(\left(0.5 \cdot {im}^{2}\right) \cdot \sin re + \color{blue}{\left(0.041666666666666664 \cdot {im}^{4}\right) \cdot \sin re}\right) \]
      6. distribute-rgt-out40.5%

        \[\leadsto \sin re \cdot 1 + \color{blue}{\sin re \cdot \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)} \]
      7. distribute-lft-out40.5%

        \[\leadsto \color{blue}{\sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)\right)} \]
      8. metadata-eval40.5%

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

        \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)}\right)\right) \]
      10. associate-*r*40.5%

        \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + \color{blue}{\left(0.041666666666666664 \cdot {im}^{2}\right) \cdot {im}^{2}}\right)\right) \]
      11. distribute-rgt-out40.5%

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

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

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

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

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

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

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

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

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

    if -7.5000000000000002e-4 < im < 370

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -2.35 \cdot 10^{+156}:\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;im \leq -0.00075:\\ \;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{elif}\;im \leq 370:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 3.6 \cdot 10^{+137}:\\ \;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\ \end{array} \]

Alternative 5: 85.5% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\ t_1 := re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{if}\;im \leq -2.35 \cdot 10^{+156}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -0.014:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq 950:\\ \;\;\;\;\sin re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 3.6 \cdot 10^{+137}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* 0.5 (* (sin re) (* im im))))
        (t_1
         (*
          re
          (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))))
   (if (<= im -2.35e+156)
     t_0
     (if (<= im -0.014)
       t_1
       (if (<= im 950.0)
         (* (sin re) (+ 1.0 (* im (* 0.5 im))))
         (if (<= im 3.6e+137) t_1 t_0))))))
double code(double re, double im) {
	double t_0 = 0.5 * (sin(re) * (im * im));
	double t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	double tmp;
	if (im <= -2.35e+156) {
		tmp = t_0;
	} else if (im <= -0.014) {
		tmp = t_1;
	} else if (im <= 950.0) {
		tmp = sin(re) * (1.0 + (im * (0.5 * im)));
	} else if (im <= 3.6e+137) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 0.5d0 * (sin(re) * (im * im))
    t_1 = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
    if (im <= (-2.35d+156)) then
        tmp = t_0
    else if (im <= (-0.014d0)) then
        tmp = t_1
    else if (im <= 950.0d0) then
        tmp = sin(re) * (1.0d0 + (im * (0.5d0 * im)))
    else if (im <= 3.6d+137) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = 0.5 * (Math.sin(re) * (im * im));
	double t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	double tmp;
	if (im <= -2.35e+156) {
		tmp = t_0;
	} else if (im <= -0.014) {
		tmp = t_1;
	} else if (im <= 950.0) {
		tmp = Math.sin(re) * (1.0 + (im * (0.5 * im)));
	} else if (im <= 3.6e+137) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = 0.5 * (math.sin(re) * (im * im))
	t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))))
	tmp = 0
	if im <= -2.35e+156:
		tmp = t_0
	elif im <= -0.014:
		tmp = t_1
	elif im <= 950.0:
		tmp = math.sin(re) * (1.0 + (im * (0.5 * im)))
	elif im <= 3.6e+137:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(0.5 * Float64(sin(re) * Float64(im * im)))
	t_1 = Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664)))))
	tmp = 0.0
	if (im <= -2.35e+156)
		tmp = t_0;
	elseif (im <= -0.014)
		tmp = t_1;
	elseif (im <= 950.0)
		tmp = Float64(sin(re) * Float64(1.0 + Float64(im * Float64(0.5 * im))));
	elseif (im <= 3.6e+137)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 0.5 * (sin(re) * (im * im));
	t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	tmp = 0.0;
	if (im <= -2.35e+156)
		tmp = t_0;
	elseif (im <= -0.014)
		tmp = t_1;
	elseif (im <= 950.0)
		tmp = sin(re) * (1.0 + (im * (0.5 * im)));
	elseif (im <= 3.6e+137)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[Sin[re], $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.35e+156], t$95$0, If[LessEqual[im, -0.014], t$95$1, If[LessEqual[im, 950.0], N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.6e+137], t$95$1, t$95$0]]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;im \leq 3.6 \cdot 10^{+137}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -2.35e156 or 3.6e137 < 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 98.5%

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(im \cdot im\right)} \cdot 0.5 + 1\right) \cdot \sin re \]
      6. associate-*l*98.5%

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

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

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

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

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

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

    if -2.35e156 < im < -0.0140000000000000003 or 950 < im < 3.6e137

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

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

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

        \[\leadsto \sin re \cdot 1 + \left(0.5 \cdot \color{blue}{\left({im}^{2} \cdot \sin re\right)} + 0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\right) \]
      3. associate-*r*40.5%

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

        \[\leadsto \sin re \cdot 1 + \left(\left(0.5 \cdot {im}^{2}\right) \cdot \sin re + 0.041666666666666664 \cdot \color{blue}{\left({im}^{4} \cdot \sin re\right)}\right) \]
      5. associate-*r*40.5%

        \[\leadsto \sin re \cdot 1 + \left(\left(0.5 \cdot {im}^{2}\right) \cdot \sin re + \color{blue}{\left(0.041666666666666664 \cdot {im}^{4}\right) \cdot \sin re}\right) \]
      6. distribute-rgt-out40.5%

        \[\leadsto \sin re \cdot 1 + \color{blue}{\sin re \cdot \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)} \]
      7. distribute-lft-out40.5%

        \[\leadsto \color{blue}{\sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)\right)} \]
      8. metadata-eval40.5%

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

        \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)}\right)\right) \]
      10. associate-*r*40.5%

        \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + \color{blue}{\left(0.041666666666666664 \cdot {im}^{2}\right) \cdot {im}^{2}}\right)\right) \]
      11. distribute-rgt-out40.5%

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

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

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

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

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

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

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

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

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

    if -0.0140000000000000003 < im < 950

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -2.35 \cdot 10^{+156}:\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;im \leq -0.014:\\ \;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{elif}\;im \leq 950:\\ \;\;\;\;\sin re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 3.6 \cdot 10^{+137}:\\ \;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\ \end{array} \]

Alternative 6: 88.3% accurate, 2.7× speedup?

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

\\
\sin re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\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. Taylor expanded in im around 0 84.6%

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

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

      \[\leadsto \sin re \cdot 1 + \left(0.5 \cdot \color{blue}{\left({im}^{2} \cdot \sin re\right)} + 0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\right) \]
    3. associate-*r*84.6%

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

      \[\leadsto \sin re \cdot 1 + \left(\left(0.5 \cdot {im}^{2}\right) \cdot \sin re + 0.041666666666666664 \cdot \color{blue}{\left({im}^{4} \cdot \sin re\right)}\right) \]
    5. associate-*r*84.6%

      \[\leadsto \sin re \cdot 1 + \left(\left(0.5 \cdot {im}^{2}\right) \cdot \sin re + \color{blue}{\left(0.041666666666666664 \cdot {im}^{4}\right) \cdot \sin re}\right) \]
    6. distribute-rgt-out84.6%

      \[\leadsto \sin re \cdot 1 + \color{blue}{\sin re \cdot \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)} \]
    7. distribute-lft-out84.6%

      \[\leadsto \color{blue}{\sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)\right)} \]
    8. metadata-eval84.6%

      \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{\color{blue}{\left(2 \cdot 2\right)}}\right)\right) \]
    9. pow-sqr84.6%

      \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)}\right)\right) \]
    10. associate-*r*84.6%

      \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + \color{blue}{\left(0.041666666666666664 \cdot {im}^{2}\right) \cdot {im}^{2}}\right)\right) \]
    11. distribute-rgt-out84.6%

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

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

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

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

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

Alternative 7: 80.7% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -2.3 \cdot 10^{+243}:\\ \;\;\;\;0.5 \cdot \left(im \cdot \left(\sin re \cdot im\right)\right)\\ \mathbf{elif}\;im \leq -0.00014 \lor \neg \left(im \leq 400\right):\\ \;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im -2.3e+243)
   (* 0.5 (* im (* (sin re) im)))
   (if (or (<= im -0.00014) (not (<= im 400.0)))
     (* re (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))
     (sin re))))
double code(double re, double im) {
	double tmp;
	if (im <= -2.3e+243) {
		tmp = 0.5 * (im * (sin(re) * im));
	} else if ((im <= -0.00014) || !(im <= 400.0)) {
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	} 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 <= (-2.3d+243)) then
        tmp = 0.5d0 * (im * (sin(re) * im))
    else if ((im <= (-0.00014d0)) .or. (.not. (im <= 400.0d0))) then
        tmp = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
    else
        tmp = sin(re)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= -2.3e+243) {
		tmp = 0.5 * (im * (Math.sin(re) * im));
	} else if ((im <= -0.00014) || !(im <= 400.0)) {
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	} else {
		tmp = Math.sin(re);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= -2.3e+243:
		tmp = 0.5 * (im * (math.sin(re) * im))
	elif (im <= -0.00014) or not (im <= 400.0):
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))))
	else:
		tmp = math.sin(re)
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= -2.3e+243)
		tmp = Float64(0.5 * Float64(im * Float64(sin(re) * im)));
	elseif ((im <= -0.00014) || !(im <= 400.0))
		tmp = Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664)))));
	else
		tmp = sin(re);
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= -2.3e+243)
		tmp = 0.5 * (im * (sin(re) * im));
	elseif ((im <= -0.00014) || ~((im <= 400.0)))
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	else
		tmp = sin(re);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, -2.3e+243], N[(0.5 * N[(im * N[(N[Sin[re], $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, -0.00014], N[Not[LessEqual[im, 400.0]], $MachinePrecision]], N[(re * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[re], $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq -0.00014 \lor \neg \left(im \leq 400\right):\\
\;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.29999999999999987e243 < im < -1.3999999999999999e-4 or 400 < 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 65.5%

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

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

        \[\leadsto \sin re \cdot 1 + \left(0.5 \cdot \color{blue}{\left({im}^{2} \cdot \sin re\right)} + 0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\right) \]
      3. associate-*r*65.5%

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

        \[\leadsto \sin re \cdot 1 + \left(\left(0.5 \cdot {im}^{2}\right) \cdot \sin re + 0.041666666666666664 \cdot \color{blue}{\left({im}^{4} \cdot \sin re\right)}\right) \]
      5. associate-*r*65.5%

        \[\leadsto \sin re \cdot 1 + \left(\left(0.5 \cdot {im}^{2}\right) \cdot \sin re + \color{blue}{\left(0.041666666666666664 \cdot {im}^{4}\right) \cdot \sin re}\right) \]
      6. distribute-rgt-out65.5%

        \[\leadsto \sin re \cdot 1 + \color{blue}{\sin re \cdot \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)} \]
      7. distribute-lft-out65.5%

        \[\leadsto \color{blue}{\sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)\right)} \]
      8. metadata-eval65.5%

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

        \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)}\right)\right) \]
      10. associate-*r*65.5%

        \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + \color{blue}{\left(0.041666666666666664 \cdot {im}^{2}\right) \cdot {im}^{2}}\right)\right) \]
      11. distribute-rgt-out65.5%

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

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

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

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

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

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

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

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

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

    if -1.3999999999999999e-4 < im < 400

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -2.3 \cdot 10^{+243}:\\ \;\;\;\;0.5 \cdot \left(im \cdot \left(\sin re \cdot im\right)\right)\\ \mathbf{elif}\;im \leq -0.00014 \lor \neg \left(im \leq 400\right):\\ \;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re\\ \end{array} \]

Alternative 8: 80.1% accurate, 2.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq -0.00037 \lor \neg \left(im \leq 250\right):\\
\;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < -3.6999999999999999e-4 or 250 < 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 69.5%

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

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

        \[\leadsto \sin re \cdot 1 + \left(0.5 \cdot \color{blue}{\left({im}^{2} \cdot \sin re\right)} + 0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\right) \]
      3. associate-*r*69.5%

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

        \[\leadsto \sin re \cdot 1 + \left(\left(0.5 \cdot {im}^{2}\right) \cdot \sin re + 0.041666666666666664 \cdot \color{blue}{\left({im}^{4} \cdot \sin re\right)}\right) \]
      5. associate-*r*69.5%

        \[\leadsto \sin re \cdot 1 + \left(\left(0.5 \cdot {im}^{2}\right) \cdot \sin re + \color{blue}{\left(0.041666666666666664 \cdot {im}^{4}\right) \cdot \sin re}\right) \]
      6. distribute-rgt-out69.5%

        \[\leadsto \sin re \cdot 1 + \color{blue}{\sin re \cdot \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)} \]
      7. distribute-lft-out69.5%

        \[\leadsto \color{blue}{\sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)\right)} \]
      8. metadata-eval69.5%

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

        \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)}\right)\right) \]
      10. associate-*r*69.5%

        \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + \color{blue}{\left(0.041666666666666664 \cdot {im}^{2}\right) \cdot {im}^{2}}\right)\right) \]
      11. distribute-rgt-out69.5%

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

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

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

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

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

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

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

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

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

    if -3.6999999999999999e-4 < im < 250

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -0.00037 \lor \neg \left(im \leq 250\right):\\ \;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re\\ \end{array} \]

Alternative 9: 56.6% accurate, 20.6× speedup?

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

\\
re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\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. Taylor expanded in im around 0 84.6%

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

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

      \[\leadsto \sin re \cdot 1 + \left(0.5 \cdot \color{blue}{\left({im}^{2} \cdot \sin re\right)} + 0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\right) \]
    3. associate-*r*84.6%

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

      \[\leadsto \sin re \cdot 1 + \left(\left(0.5 \cdot {im}^{2}\right) \cdot \sin re + 0.041666666666666664 \cdot \color{blue}{\left({im}^{4} \cdot \sin re\right)}\right) \]
    5. associate-*r*84.6%

      \[\leadsto \sin re \cdot 1 + \left(\left(0.5 \cdot {im}^{2}\right) \cdot \sin re + \color{blue}{\left(0.041666666666666664 \cdot {im}^{4}\right) \cdot \sin re}\right) \]
    6. distribute-rgt-out84.6%

      \[\leadsto \sin re \cdot 1 + \color{blue}{\sin re \cdot \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)} \]
    7. distribute-lft-out84.6%

      \[\leadsto \color{blue}{\sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)\right)} \]
    8. metadata-eval84.6%

      \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{\color{blue}{\left(2 \cdot 2\right)}}\right)\right) \]
    9. pow-sqr84.6%

      \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)}\right)\right) \]
    10. associate-*r*84.6%

      \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + \color{blue}{\left(0.041666666666666664 \cdot {im}^{2}\right) \cdot {im}^{2}}\right)\right) \]
    11. distribute-rgt-out84.6%

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

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

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

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

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

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

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

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

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

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

Alternative 10: 41.1% accurate, 27.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -1.42 \lor \neg \left(im \leq 1.28 \cdot 10^{-33}\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 1.28e-33))) (* 0.5 (* im (* re im))) re))
double code(double re, double im) {
	double tmp;
	if ((im <= -1.42) || !(im <= 1.28e-33)) {
		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 <= 1.28d-33))) 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 <= 1.28e-33)) {
		tmp = 0.5 * (im * (re * im));
	} else {
		tmp = re;
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if (im <= -1.42) or not (im <= 1.28e-33):
		tmp = 0.5 * (im * (re * im))
	else:
		tmp = re
	return tmp
function code(re, im)
	tmp = 0.0
	if ((im <= -1.42) || !(im <= 1.28e-33))
		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 <= 1.28e-33)))
		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, 1.28e-33]], $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 1.28 \cdot 10^{-33}\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 1.28000000000000001e-33 < 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 52.7%

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(im \cdot im\right)} \cdot 0.5 + 1\right) \cdot \sin re \]
      6. associate-*l*52.7%

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

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

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

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

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

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

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

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

    if -1.4199999999999999 < im < 1.28000000000000001e-33

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

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

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

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

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

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

Alternative 11: 47.2% accurate, 27.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -1.42 \lor \neg \left(im \leq 1.28 \cdot 10^{-33}\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 1.28e-33))) (* 0.5 (* re (* im im))) re))
double code(double re, double im) {
	double tmp;
	if ((im <= -1.42) || !(im <= 1.28e-33)) {
		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 <= 1.28d-33))) 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 <= 1.28e-33)) {
		tmp = 0.5 * (re * (im * im));
	} else {
		tmp = re;
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if (im <= -1.42) or not (im <= 1.28e-33):
		tmp = 0.5 * (re * (im * im))
	else:
		tmp = re
	return tmp
function code(re, im)
	tmp = 0.0
	if ((im <= -1.42) || !(im <= 1.28e-33))
		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 <= 1.28e-33)))
		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, 1.28e-33]], $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 1.28 \cdot 10^{-33}\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 1.28000000000000001e-33 < 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 52.7%

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(im \cdot im\right)} \cdot 0.5 + 1\right) \cdot \sin re \]
      6. associate-*l*52.7%

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

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

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

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

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

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

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

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

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

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

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

    if -1.4199999999999999 < im < 1.28000000000000001e-33

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

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

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

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

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

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

Alternative 12: 30.7% accurate, 33.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq -1800000000000 \lor \neg \left(im \leq 1.28 \cdot 10^{-33}\right):\\
\;\;\;\;\frac{0.25}{re \cdot re}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < -1.8e12 or 1.28000000000000001e-33 < 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. Applied egg-rr13.1%

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

      \[\leadsto \color{blue}{\frac{0.25}{{re}^{2}}} \]
    6. Step-by-step derivation
      1. unpow212.7%

        \[\leadsto \frac{0.25}{\color{blue}{re \cdot re}} \]
    7. Simplified12.7%

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

    if -1.8e12 < im < 1.28000000000000001e-33

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1800000000000 \lor \neg \left(im \leq 1.28 \cdot 10^{-33}\right):\\ \;\;\;\;\frac{0.25}{re \cdot re}\\ \mathbf{else}:\\ \;\;\;\;re\\ \end{array} \]

Alternative 13: 30.7% accurate, 33.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -1800000000000:\\ \;\;\;\;\frac{0.25}{re \cdot re}\\ \mathbf{elif}\;im \leq 1.28 \cdot 10^{-33}:\\ \;\;\;\;re\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{0.25}{re}}{re}\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im -1800000000000.0)
   (/ 0.25 (* re re))
   (if (<= im 1.28e-33) re (/ (/ 0.25 re) re))))
double code(double re, double im) {
	double tmp;
	if (im <= -1800000000000.0) {
		tmp = 0.25 / (re * re);
	} else if (im <= 1.28e-33) {
		tmp = re;
	} else {
		tmp = (0.25 / re) / re;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (im <= (-1800000000000.0d0)) then
        tmp = 0.25d0 / (re * re)
    else if (im <= 1.28d-33) then
        tmp = re
    else
        tmp = (0.25d0 / re) / re
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= -1800000000000.0) {
		tmp = 0.25 / (re * re);
	} else if (im <= 1.28e-33) {
		tmp = re;
	} else {
		tmp = (0.25 / re) / re;
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= -1800000000000.0:
		tmp = 0.25 / (re * re)
	elif im <= 1.28e-33:
		tmp = re
	else:
		tmp = (0.25 / re) / re
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= -1800000000000.0)
		tmp = Float64(0.25 / Float64(re * re));
	elseif (im <= 1.28e-33)
		tmp = re;
	else
		tmp = Float64(Float64(0.25 / re) / re);
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= -1800000000000.0)
		tmp = 0.25 / (re * re);
	elseif (im <= 1.28e-33)
		tmp = re;
	else
		tmp = (0.25 / re) / re;
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, -1800000000000.0], N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.28e-33], re, N[(N[(0.25 / re), $MachinePrecision] / re), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;im \leq -1800000000000:\\
\;\;\;\;\frac{0.25}{re \cdot re}\\

\mathbf{elif}\;im \leq 1.28 \cdot 10^{-33}:\\
\;\;\;\;re\\

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


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

    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. Applied egg-rr9.0%

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

      \[\leadsto \color{blue}{\frac{0.25}{{re}^{2}}} \]
    6. Step-by-step derivation
      1. unpow29.0%

        \[\leadsto \frac{0.25}{\color{blue}{re \cdot re}} \]
    7. Simplified9.0%

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

    if -1.8e12 < im < 1.28000000000000001e-33

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

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

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

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

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

    if 1.28000000000000001e-33 < 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. Applied egg-rr18.0%

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

      \[\leadsto \color{blue}{\frac{0.25}{{re}^{2}}} \]
    6. Step-by-step derivation
      1. unpow217.2%

        \[\leadsto \frac{0.25}{\color{blue}{re \cdot re}} \]
    7. Simplified17.2%

      \[\leadsto \color{blue}{\frac{0.25}{re \cdot re}} \]
    8. Taylor expanded in re around 0 17.2%

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

        \[\leadsto \frac{0.25}{\color{blue}{re \cdot re}} \]
      2. associate-/r*17.2%

        \[\leadsto \color{blue}{\frac{\frac{0.25}{re}}{re}} \]
    10. Simplified17.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1800000000000:\\ \;\;\;\;\frac{0.25}{re \cdot re}\\ \mathbf{elif}\;im \leq 1.28 \cdot 10^{-33}:\\ \;\;\;\;re\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{0.25}{re}}{re}\\ \end{array} \]

Alternative 14: 48.7% 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. *-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 75.5%

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\left(im \cdot im\right)} \cdot 0.5 + 1\right) \cdot \sin re \]
    6. associate-*l*75.5%

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

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

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

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

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

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

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

Alternative 15: 3.7% accurate, 309.0× speedup?

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

\\
-512
\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. Taylor expanded in im around 0 84.6%

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

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

      \[\leadsto \sin re \cdot 1 + \left(0.5 \cdot \color{blue}{\left({im}^{2} \cdot \sin re\right)} + 0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\right) \]
    3. associate-*r*84.6%

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

      \[\leadsto \sin re \cdot 1 + \left(\left(0.5 \cdot {im}^{2}\right) \cdot \sin re + 0.041666666666666664 \cdot \color{blue}{\left({im}^{4} \cdot \sin re\right)}\right) \]
    5. associate-*r*84.6%

      \[\leadsto \sin re \cdot 1 + \left(\left(0.5 \cdot {im}^{2}\right) \cdot \sin re + \color{blue}{\left(0.041666666666666664 \cdot {im}^{4}\right) \cdot \sin re}\right) \]
    6. distribute-rgt-out84.6%

      \[\leadsto \sin re \cdot 1 + \color{blue}{\sin re \cdot \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)} \]
    7. distribute-lft-out84.6%

      \[\leadsto \color{blue}{\sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)\right)} \]
    8. metadata-eval84.6%

      \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{\color{blue}{\left(2 \cdot 2\right)}}\right)\right) \]
    9. pow-sqr84.6%

      \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)}\right)\right) \]
    10. associate-*r*84.6%

      \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + \color{blue}{\left(0.041666666666666664 \cdot {im}^{2}\right) \cdot {im}^{2}}\right)\right) \]
    11. distribute-rgt-out84.6%

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

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

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

    \[\leadsto \color{blue}{\sin re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right)\right)} \]
  7. Applied egg-rr4.0%

    \[\leadsto \color{blue}{-512} \]
  8. Final simplification4.0%

    \[\leadsto -512 \]

Alternative 16: 4.6% accurate, 309.0× speedup?

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

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

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

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

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

      \[\leadsto \sin re \cdot 1 + \left(0.5 \cdot \color{blue}{\left({im}^{2} \cdot \sin re\right)} + 0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\right) \]
    3. associate-*r*84.6%

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

      \[\leadsto \sin re \cdot 1 + \left(\left(0.5 \cdot {im}^{2}\right) \cdot \sin re + 0.041666666666666664 \cdot \color{blue}{\left({im}^{4} \cdot \sin re\right)}\right) \]
    5. associate-*r*84.6%

      \[\leadsto \sin re \cdot 1 + \left(\left(0.5 \cdot {im}^{2}\right) \cdot \sin re + \color{blue}{\left(0.041666666666666664 \cdot {im}^{4}\right) \cdot \sin re}\right) \]
    6. distribute-rgt-out84.6%

      \[\leadsto \sin re \cdot 1 + \color{blue}{\sin re \cdot \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)} \]
    7. distribute-lft-out84.6%

      \[\leadsto \color{blue}{\sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)\right)} \]
    8. metadata-eval84.6%

      \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{\color{blue}{\left(2 \cdot 2\right)}}\right)\right) \]
    9. pow-sqr84.6%

      \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)}\right)\right) \]
    10. associate-*r*84.6%

      \[\leadsto \sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + \color{blue}{\left(0.041666666666666664 \cdot {im}^{2}\right) \cdot {im}^{2}}\right)\right) \]
    11. distribute-rgt-out84.6%

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

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

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

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

    \[\leadsto \color{blue}{-1} \]
  8. Final simplification5.1%

    \[\leadsto -1 \]

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. *-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 62.1%

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

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

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

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

    \[\leadsto re \]

Reproduce

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