math.sin on complex, real part

Percentage Accurate: 100.0% → 100.0%
Time: 9.9s
Alternatives: 23
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 23 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: 85.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.03:\\
\;\;\;\;\sin re + 0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\

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

\mathbf{elif}\;im \leq 5 \cdot 10^{+76}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\sin re \cdot im\right)\right) \cdot \left(0.5 \cdot im\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}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < 0.029999999999999999

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

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

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

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

    if 0.029999999999999999 < im < 1.75000000000000003e50

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

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

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

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

    if 1.75000000000000003e50 < im < 4.99999999999999991e76

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

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

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

        \[\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*7.9%

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

        \[\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*7.9%

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

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

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

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

        \[\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*7.9%

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

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

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

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

      \[\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 im around 0 4.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.99999999999999991e76 < 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.3%

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

        \[\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. *-commutative98.3%

        \[\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*98.3%

        \[\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. *-commutative98.3%

        \[\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*98.3%

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

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

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

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

        \[\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*98.3%

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

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

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

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

      \[\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)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification86.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.03:\\ \;\;\;\;\sin re + 0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 1.75 \cdot 10^{+50}:\\ \;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(re \cdot 0.5\right)\\ \mathbf{elif}\;im \leq 5 \cdot 10^{+76}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\sin re \cdot im\right)\right) \cdot \left(0.5 \cdot im\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: 85.8% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 0.08:\\ \;\;\;\;\sin re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 2.5 \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} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 0.08)
   (* (sin re) (+ 1.0 (* im (* 0.5 im))))
   (if (<= im 2.5e+77)
     (* (+ (exp (- im)) (exp im)) (* re 0.5))
     (*
      (sin re)
      (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664))))))))
double code(double re, double im) {
	double tmp;
	if (im <= 0.08) {
		tmp = sin(re) * (1.0 + (im * (0.5 * im)));
	} else if (im <= 2.5e+77) {
		tmp = (exp(-im) + exp(im)) * (re * 0.5);
	} else {
		tmp = sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (im <= 0.08d0) then
        tmp = sin(re) * (1.0d0 + (im * (0.5d0 * im)))
    else if (im <= 2.5d+77) then
        tmp = (exp(-im) + exp(im)) * (re * 0.5d0)
    else
        tmp = sin(re) * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 0.08) {
		tmp = Math.sin(re) * (1.0 + (im * (0.5 * im)));
	} else if (im <= 2.5e+77) {
		tmp = (Math.exp(-im) + Math.exp(im)) * (re * 0.5);
	} else {
		tmp = Math.sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 0.08:
		tmp = math.sin(re) * (1.0 + (im * (0.5 * im)))
	elif im <= 2.5e+77:
		tmp = (math.exp(-im) + math.exp(im)) * (re * 0.5)
	else:
		tmp = math.sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 0.08)
		tmp = Float64(sin(re) * Float64(1.0 + Float64(im * Float64(0.5 * im))));
	elseif (im <= 2.5e+77)
		tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(re * 0.5));
	else
		tmp = Float64(sin(re) * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664)))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 0.08)
		tmp = sin(re) * (1.0 + (im * (0.5 * im)));
	elseif (im <= 2.5e+77)
		tmp = (exp(-im) + exp(im)) * (re * 0.5);
	else
		tmp = sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 0.08], N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.5e+77], N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(re * 0.5), $MachinePrecision]), $MachinePrecision], 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}

\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.08:\\
\;\;\;\;\sin re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\

\mathbf{elif}\;im \leq 2.5 \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}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < 0.0800000000000000017

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

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

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

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

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

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

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

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

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

    if 0.0800000000000000017 < im < 2.50000000000000002e77

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

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

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

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

    if 2.50000000000000002e77 < 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)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification86.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.08:\\ \;\;\;\;\sin re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 2.5 \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.8% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 0.058:\\ \;\;\;\;\sin re + 0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 2.5 \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} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 0.058)
   (+ (sin re) (* 0.5 (* (sin re) (* im im))))
   (if (<= im 2.5e+77)
     (* (+ (exp (- im)) (exp im)) (* re 0.5))
     (*
      (sin re)
      (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664))))))))
double code(double re, double im) {
	double tmp;
	if (im <= 0.058) {
		tmp = sin(re) + (0.5 * (sin(re) * (im * im)));
	} else if (im <= 2.5e+77) {
		tmp = (exp(-im) + exp(im)) * (re * 0.5);
	} else {
		tmp = sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (im <= 0.058d0) then
        tmp = sin(re) + (0.5d0 * (sin(re) * (im * im)))
    else if (im <= 2.5d+77) then
        tmp = (exp(-im) + exp(im)) * (re * 0.5d0)
    else
        tmp = sin(re) * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 0.058) {
		tmp = Math.sin(re) + (0.5 * (Math.sin(re) * (im * im)));
	} else if (im <= 2.5e+77) {
		tmp = (Math.exp(-im) + Math.exp(im)) * (re * 0.5);
	} else {
		tmp = Math.sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 0.058:
		tmp = math.sin(re) + (0.5 * (math.sin(re) * (im * im)))
	elif im <= 2.5e+77:
		tmp = (math.exp(-im) + math.exp(im)) * (re * 0.5)
	else:
		tmp = math.sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 0.058)
		tmp = Float64(sin(re) + Float64(0.5 * Float64(sin(re) * Float64(im * im))));
	elseif (im <= 2.5e+77)
		tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(re * 0.5));
	else
		tmp = Float64(sin(re) * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664)))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 0.058)
		tmp = sin(re) + (0.5 * (sin(re) * (im * im)));
	elseif (im <= 2.5e+77)
		tmp = (exp(-im) + exp(im)) * (re * 0.5);
	else
		tmp = sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 0.058], N[(N[Sin[re], $MachinePrecision] + N[(0.5 * N[(N[Sin[re], $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.5e+77], N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(re * 0.5), $MachinePrecision]), $MachinePrecision], 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}

\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.058:\\
\;\;\;\;\sin re + 0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\

\mathbf{elif}\;im \leq 2.5 \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}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < 0.0580000000000000029

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

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

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

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

    if 0.0580000000000000029 < im < 2.50000000000000002e77

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

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

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

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

    if 2.50000000000000002e77 < 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)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification86.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.058:\\ \;\;\;\;\sin re + 0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 2.5 \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 5: 88.5% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 480 \lor \neg \left(im \leq 5 \cdot 10^{+76}\right):\\ \;\;\;\;\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{else}:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(re \cdot 0.5 + {re}^{3} \cdot -0.08333333333333333\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (or (<= im 480.0) (not (<= im 5e+76)))
   (*
    (sin re)
    (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))
   (* (* im im) (+ (* re 0.5) (* (pow re 3.0) -0.08333333333333333)))))
double code(double re, double im) {
	double tmp;
	if ((im <= 480.0) || !(im <= 5e+76)) {
		tmp = sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	} else {
		tmp = (im * im) * ((re * 0.5) + (pow(re, 3.0) * -0.08333333333333333));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if ((im <= 480.0d0) .or. (.not. (im <= 5d+76))) then
        tmp = sin(re) * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
    else
        tmp = (im * im) * ((re * 0.5d0) + ((re ** 3.0d0) * (-0.08333333333333333d0)))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if ((im <= 480.0) || !(im <= 5e+76)) {
		tmp = Math.sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	} else {
		tmp = (im * im) * ((re * 0.5) + (Math.pow(re, 3.0) * -0.08333333333333333));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if (im <= 480.0) or not (im <= 5e+76):
		tmp = math.sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))))
	else:
		tmp = (im * im) * ((re * 0.5) + (math.pow(re, 3.0) * -0.08333333333333333))
	return tmp
function code(re, im)
	tmp = 0.0
	if ((im <= 480.0) || !(im <= 5e+76))
		tmp = Float64(sin(re) * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664)))));
	else
		tmp = Float64(Float64(im * im) * Float64(Float64(re * 0.5) + Float64((re ^ 3.0) * -0.08333333333333333)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if ((im <= 480.0) || ~((im <= 5e+76)))
		tmp = sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	else
		tmp = (im * im) * ((re * 0.5) + ((re ^ 3.0) * -0.08333333333333333));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[Or[LessEqual[im, 480.0], N[Not[LessEqual[im, 5e+76]], $MachinePrecision]], 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], N[(N[(im * im), $MachinePrecision] * N[(N[(re * 0.5), $MachinePrecision] + N[(N[Power[re, 3.0], $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;im \leq 480 \lor \neg \left(im \leq 5 \cdot 10^{+76}\right):\\
\;\;\;\;\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{else}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(re \cdot 0.5 + {re}^{3} \cdot -0.08333333333333333\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 480 or 4.99999999999999991e76 < 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 92.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-identity92.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. *-commutative92.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*92.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. *-commutative92.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*92.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-out92.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-out92.0%

        \[\leadsto \color{blue}{\sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)\right)} \]
      8. metadata-eval92.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-sqr92.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*92.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-out92.0%

        \[\leadsto \sin re \cdot \left(1 + \color{blue}{{im}^{2} \cdot \left(0.5 + 0.041666666666666664 \cdot {im}^{2}\right)}\right) \]
      12. unpow292.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. unpow292.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. Simplified92.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 480 < im < 4.99999999999999991e76

    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 4.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-identity4.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. *-commutative4.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*4.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. *-commutative4.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*4.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-out4.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-out4.6%

        \[\leadsto \color{blue}{\sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)\right)} \]
      8. metadata-eval4.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-sqr4.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*4.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-out4.6%

        \[\leadsto \sin re \cdot \left(1 + \color{blue}{{im}^{2} \cdot \left(0.5 + 0.041666666666666664 \cdot {im}^{2}\right)}\right) \]
      12. unpow24.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. unpow24.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. Simplified4.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 im around 0 3.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(im \cdot im\right) \cdot \left(\color{blue}{re \cdot 0.5} + -0.08333333333333333 \cdot {re}^{3}\right) \]
      7. *-commutative29.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 480 \lor \neg \left(im \leq 5 \cdot 10^{+76}\right):\\ \;\;\;\;\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{else}:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(re \cdot 0.5 + {re}^{3} \cdot -0.08333333333333333\right)\\ \end{array} \]

Alternative 6: 80.5% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\ \mathbf{if}\;im \leq 400:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 3.3 \cdot 10^{+78}:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(re \cdot 0.5 + {re}^{3} \cdot -0.08333333333333333\right)\\ \mathbf{elif}\;im \leq 1.85 \cdot 10^{+154}:\\ \;\;\;\;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}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (sin re) (+ 1.0 (* im (* 0.5 im))))))
   (if (<= im 400.0)
     t_0
     (if (<= im 3.3e+78)
       (* (* im im) (+ (* re 0.5) (* (pow re 3.0) -0.08333333333333333)))
       (if (<= im 1.85e+154)
         (*
          re
          (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))
         t_0)))))
double code(double re, double im) {
	double t_0 = sin(re) * (1.0 + (im * (0.5 * im)));
	double tmp;
	if (im <= 400.0) {
		tmp = t_0;
	} else if (im <= 3.3e+78) {
		tmp = (im * im) * ((re * 0.5) + (pow(re, 3.0) * -0.08333333333333333));
	} else if (im <= 1.85e+154) {
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sin(re) * (1.0d0 + (im * (0.5d0 * im)))
    if (im <= 400.0d0) then
        tmp = t_0
    else if (im <= 3.3d+78) then
        tmp = (im * im) * ((re * 0.5d0) + ((re ** 3.0d0) * (-0.08333333333333333d0)))
    else if (im <= 1.85d+154) then
        tmp = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = Math.sin(re) * (1.0 + (im * (0.5 * im)));
	double tmp;
	if (im <= 400.0) {
		tmp = t_0;
	} else if (im <= 3.3e+78) {
		tmp = (im * im) * ((re * 0.5) + (Math.pow(re, 3.0) * -0.08333333333333333));
	} else if (im <= 1.85e+154) {
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = math.sin(re) * (1.0 + (im * (0.5 * im)))
	tmp = 0
	if im <= 400.0:
		tmp = t_0
	elif im <= 3.3e+78:
		tmp = (im * im) * ((re * 0.5) + (math.pow(re, 3.0) * -0.08333333333333333))
	elif im <= 1.85e+154:
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))))
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(sin(re) * Float64(1.0 + Float64(im * Float64(0.5 * im))))
	tmp = 0.0
	if (im <= 400.0)
		tmp = t_0;
	elseif (im <= 3.3e+78)
		tmp = Float64(Float64(im * im) * Float64(Float64(re * 0.5) + Float64((re ^ 3.0) * -0.08333333333333333)));
	elseif (im <= 1.85e+154)
		tmp = Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664)))));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = sin(re) * (1.0 + (im * (0.5 * im)));
	tmp = 0.0;
	if (im <= 400.0)
		tmp = t_0;
	elseif (im <= 3.3e+78)
		tmp = (im * im) * ((re * 0.5) + ((re ^ 3.0) * -0.08333333333333333));
	elseif (im <= 1.85e+154)
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 400.0], t$95$0, If[LessEqual[im, 3.3e+78], N[(N[(im * im), $MachinePrecision] * N[(N[(re * 0.5), $MachinePrecision] + N[(N[Power[re, 3.0], $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.85e+154], 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], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\
\mathbf{if}\;im \leq 400:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq 3.3 \cdot 10^{+78}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(re \cdot 0.5 + {re}^{3} \cdot -0.08333333333333333\right)\\

\mathbf{elif}\;im \leq 1.85 \cdot 10^{+154}:\\
\;\;\;\;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}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < 400 or 1.84999999999999997e154 < 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 86.7%

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

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

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

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

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

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

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

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

    if 400 < im < 3.3e78

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

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

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

        \[\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*9.4%

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

        \[\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*9.4%

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

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

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

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

        \[\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*9.4%

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

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

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

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

      \[\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 im around 0 3.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(im \cdot im\right)} \cdot \left(0.5 \cdot re + -0.08333333333333333 \cdot {re}^{3}\right) \]
      6. *-commutative31.8%

        \[\leadsto \left(im \cdot im\right) \cdot \left(\color{blue}{re \cdot 0.5} + -0.08333333333333333 \cdot {re}^{3}\right) \]
      7. *-commutative31.8%

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

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

    if 3.3e78 < im < 1.84999999999999997e154

    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)} \]
    7. Taylor expanded in re around 0 80.0%

      \[\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. *-commutative80.0%

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

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

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

      \[\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} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification81.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 400:\\ \;\;\;\;\sin re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 3.3 \cdot 10^{+78}:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(re \cdot 0.5 + {re}^{3} \cdot -0.08333333333333333\right)\\ \mathbf{elif}\;im \leq 1.85 \cdot 10^{+154}:\\ \;\;\;\;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 \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\ \end{array} \]

Alternative 7: 80.2% accurate, 2.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 7 \cdot 10^{+24} \lor \neg \left(im \leq 1.85 \cdot 10^{+154}\right):\\
\;\;\;\;\sin re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\

\mathbf{else}:\\
\;\;\;\;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}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 7.0000000000000004e24 or 1.84999999999999997e154 < 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 85.2%

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

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

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

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

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

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

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

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

    if 7.0000000000000004e24 < im < 1.84999999999999997e154

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

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

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

        \[\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*60.4%

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

        \[\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*60.4%

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

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

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

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

        \[\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*60.4%

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

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

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

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

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

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

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

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

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

      \[\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} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification80.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 7 \cdot 10^{+24} \lor \neg \left(im \leq 1.85 \cdot 10^{+154}\right):\\ \;\;\;\;\sin re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;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 8: 66.2% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 6 \cdot 10^{+24}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.8 \cdot 10^{+182}:\\ \;\;\;\;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(im \cdot \left(\sin re \cdot im\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 6e+24)
   (sin re)
   (if (<= im 2.8e+182)
     (* re (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))
     (* 0.5 (* im (* (sin re) im))))))
double code(double re, double im) {
	double tmp;
	if (im <= 6e+24) {
		tmp = sin(re);
	} else if (im <= 2.8e+182) {
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	} else {
		tmp = 0.5 * (im * (sin(re) * im));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (im <= 6d+24) then
        tmp = sin(re)
    else if (im <= 2.8d+182) then
        tmp = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
    else
        tmp = 0.5d0 * (im * (sin(re) * im))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 6e+24) {
		tmp = Math.sin(re);
	} else if (im <= 2.8e+182) {
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	} else {
		tmp = 0.5 * (im * (Math.sin(re) * im));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 6e+24:
		tmp = math.sin(re)
	elif im <= 2.8e+182:
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))))
	else:
		tmp = 0.5 * (im * (math.sin(re) * im))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 6e+24)
		tmp = sin(re);
	elseif (im <= 2.8e+182)
		tmp = Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664)))));
	else
		tmp = Float64(0.5 * Float64(im * Float64(sin(re) * im)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 6e+24)
		tmp = sin(re);
	elseif (im <= 2.8e+182)
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	else
		tmp = 0.5 * (im * (sin(re) * im));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 6e+24], N[Sin[re], $MachinePrecision], If[LessEqual[im, 2.8e+182], 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[(0.5 * N[(im * N[(N[Sin[re], $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 2.8 \cdot 10^{+182}:\\
\;\;\;\;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(im \cdot \left(\sin re \cdot im\right)\right)\\


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

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

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

    if 5.9999999999999999e24 < im < 2.80000000000000006e182

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

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

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

        \[\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*66.9%

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

        \[\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*66.9%

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

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

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

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

        \[\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*66.9%

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

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

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

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

      \[\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 56.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. *-commutative56.7%

        \[\leadsto \left(1 + \color{blue}{{im}^{2} \cdot \left(0.5 + 0.041666666666666664 \cdot {im}^{2}\right)}\right) \cdot re \]
      2. unpow256.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. unpow256.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. Simplified56.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 2.80000000000000006e182 < 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 + 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*84.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 6 \cdot 10^{+24}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.8 \cdot 10^{+182}:\\ \;\;\;\;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(im \cdot \left(\sin re \cdot im\right)\right)\\ \end{array} \]

Alternative 9: 65.6% accurate, 3.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;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}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 7.0000000000000004e24

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

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

    if 7.0000000000000004e24 < 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 79.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-identity79.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. *-commutative79.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*79.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. *-commutative79.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*79.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-out79.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-out79.0%

        \[\leadsto \color{blue}{\sin re \cdot \left(1 + \left(0.5 \cdot {im}^{2} + 0.041666666666666664 \cdot {im}^{4}\right)\right)} \]
      8. metadata-eval79.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-sqr79.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*79.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-out79.0%

        \[\leadsto \sin re \cdot \left(1 + \color{blue}{{im}^{2} \cdot \left(0.5 + 0.041666666666666664 \cdot {im}^{2}\right)}\right) \]
      12. unpow279.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. unpow279.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. Simplified79.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)} \]
    7. Taylor expanded in re around 0 62.3%

      \[\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. *-commutative62.3%

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

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

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

      \[\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} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification65.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 7 \cdot 10^{+24}:\\ \;\;\;\;\sin re\\ \mathbf{else}:\\ \;\;\;\;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 10: 55.1% 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 85.8%

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

      \[\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. *-commutative85.8%

      \[\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*85.8%

      \[\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. *-commutative85.8%

      \[\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*85.8%

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

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

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

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

      \[\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*85.8%

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

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

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

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

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

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

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

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

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

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

    \[\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 11: 37.2% accurate, 27.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.5 \cdot 10^{-15}:\\
\;\;\;\;re\\

\mathbf{elif}\;im \leq 1.52 \cdot 10^{+100}:\\
\;\;\;\;0.08333333333333333 + \frac{0.25}{re \cdot re}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < 1.5e-15

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

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

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

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

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

    if 1.5e-15 < im < 1.52e100

    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. Applied egg-rr13.8%

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

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

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

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

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

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

    if 1.52e100 < 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)} \]
    7. Taylor expanded in im around 0 69.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(im \cdot im\right)} \cdot \left(re \cdot 0.5\right) \]
    15. Simplified56.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 1.5 \cdot 10^{-15}:\\ \;\;\;\;re\\ \mathbf{elif}\;im \leq 1.52 \cdot 10^{+100}:\\ \;\;\;\;0.08333333333333333 + \frac{0.25}{re \cdot re}\\ \mathbf{else}:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(re \cdot 0.5\right)\\ \end{array} \]

Alternative 12: 36.9% accurate, 34.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.5 \cdot 10^{-15}:\\
\;\;\;\;re\\

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


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

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

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

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

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

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

    if 1.5e-15 < 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 75.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-identity75.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. *-commutative75.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*75.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. *-commutative75.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*75.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-out75.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-out74.9%

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

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

        \[\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*74.9%

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

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

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

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

      \[\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 im around 0 48.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 1.5 \cdot 10^{-15}:\\ \;\;\;\;re\\ \mathbf{else}:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(re \cdot 0.5\right)\\ \end{array} \]

Alternative 13: 46.9% accurate, 34.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 29.1% accurate, 43.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 850:\\ \;\;\;\;re\\ \mathbf{else}:\\ \;\;\;\;\frac{0.25}{re \cdot re}\\ \end{array} \end{array} \]
(FPCore (re im) :precision binary64 (if (<= im 850.0) re (/ 0.25 (* re re))))
double code(double re, double im) {
	double tmp;
	if (im <= 850.0) {
		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 <= 850.0d0) 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 <= 850.0) {
		tmp = re;
	} else {
		tmp = 0.25 / (re * re);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 850.0:
		tmp = re
	else:
		tmp = 0.25 / (re * re)
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 850.0)
		tmp = re;
	else
		tmp = Float64(0.25 / Float64(re * re));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 850.0)
		tmp = re;
	else
		tmp = 0.25 / (re * re);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 850.0], re, N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    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 57.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*57.5%

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

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

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

    if 850 < 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-rr12.7%

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

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

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

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

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

Alternative 15: 29.1% accurate, 43.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 850:\\ \;\;\;\;re\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{0.25}{re}}{re}\\ \end{array} \end{array} \]
(FPCore (re im) :precision binary64 (if (<= im 850.0) re (/ (/ 0.25 re) re)))
double code(double re, double im) {
	double tmp;
	if (im <= 850.0) {
		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 <= 850.0d0) 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 <= 850.0) {
		tmp = re;
	} else {
		tmp = (0.25 / re) / re;
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 850.0:
		tmp = re
	else:
		tmp = (0.25 / re) / re
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 850.0)
		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 <= 850.0)
		tmp = re;
	else
		tmp = (0.25 / re) / re;
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 850.0], re, N[(N[(0.25 / re), $MachinePrecision] / re), $MachinePrecision]]
\begin{array}{l}

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

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


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

    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 57.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*57.5%

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

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

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

    if 850 < 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-rr12.7%

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

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

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

      \[\leadsto \color{blue}{\frac{0.25}{re \cdot re}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt12.6%

        \[\leadsto \color{blue}{\sqrt{\frac{0.25}{re \cdot re}} \cdot \sqrt{\frac{0.25}{re \cdot re}}} \]
      2. sqrt-div12.6%

        \[\leadsto \color{blue}{\frac{\sqrt{0.25}}{\sqrt{re \cdot re}}} \cdot \sqrt{\frac{0.25}{re \cdot re}} \]
      3. metadata-eval12.6%

        \[\leadsto \frac{\color{blue}{0.5}}{\sqrt{re \cdot re}} \cdot \sqrt{\frac{0.25}{re \cdot re}} \]
      4. sqrt-prod12.1%

        \[\leadsto \frac{0.5}{\color{blue}{\sqrt{re} \cdot \sqrt{re}}} \cdot \sqrt{\frac{0.25}{re \cdot re}} \]
      5. add-sqr-sqrt28.4%

        \[\leadsto \frac{0.5}{\color{blue}{re}} \cdot \sqrt{\frac{0.25}{re \cdot re}} \]
      6. sqrt-div28.4%

        \[\leadsto \frac{0.5}{re} \cdot \color{blue}{\frac{\sqrt{0.25}}{\sqrt{re \cdot re}}} \]
      7. metadata-eval28.4%

        \[\leadsto \frac{0.5}{re} \cdot \frac{\color{blue}{0.5}}{\sqrt{re \cdot re}} \]
      8. sqrt-prod12.1%

        \[\leadsto \frac{0.5}{re} \cdot \frac{0.5}{\color{blue}{\sqrt{re} \cdot \sqrt{re}}} \]
      9. add-sqr-sqrt12.6%

        \[\leadsto \frac{0.5}{re} \cdot \frac{0.5}{\color{blue}{re}} \]
    9. Applied egg-rr12.6%

      \[\leadsto \color{blue}{\frac{0.5}{re} \cdot \frac{0.5}{re}} \]
    10. Taylor expanded in re around 0 12.6%

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

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

        \[\leadsto \color{blue}{\frac{\frac{0.25}{re}}{re}} \]
    12. Simplified12.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 850:\\ \;\;\;\;re\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{0.25}{re}}{re}\\ \end{array} \]

Alternative 16: 3.9% 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 85.8%

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

      \[\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. *-commutative85.8%

      \[\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*85.8%

      \[\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. *-commutative85.8%

      \[\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*85.8%

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

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

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

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

      \[\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*85.8%

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

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

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

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

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

    \[\leadsto \color{blue}{-512} \]
  8. Final simplification3.5%

    \[\leadsto -512 \]

Alternative 17: 4.9% 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 85.8%

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

      \[\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. *-commutative85.8%

      \[\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*85.8%

      \[\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. *-commutative85.8%

      \[\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*85.8%

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

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

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

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

      \[\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*85.8%

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

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

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

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

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

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

    \[\leadsto -1 \]

Alternative 18: 4.0% accurate, 309.0× speedup?

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

\\
0.015625
\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 85.8%

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

      \[\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. *-commutative85.8%

      \[\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*85.8%

      \[\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. *-commutative85.8%

      \[\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*85.8%

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

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

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

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

      \[\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*85.8%

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

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

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

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

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

    \[\leadsto \color{blue}{0.015625} \]
  8. Final simplification4.3%

    \[\leadsto 0.015625 \]

Alternative 19: 4.1% accurate, 309.0× speedup?

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

\\
0.0625
\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 85.8%

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

      \[\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. *-commutative85.8%

      \[\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*85.8%

      \[\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. *-commutative85.8%

      \[\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*85.8%

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

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

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

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

      \[\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*85.8%

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

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

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

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

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

    \[\leadsto \color{blue}{0.0625} \]
  8. Final simplification4.5%

    \[\leadsto 0.0625 \]

Alternative 20: 4.4% accurate, 309.0× speedup?

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

\\
0.25
\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 85.8%

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

      \[\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. *-commutative85.8%

      \[\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*85.8%

      \[\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. *-commutative85.8%

      \[\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*85.8%

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

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

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

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

      \[\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*85.8%

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

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

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

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

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

    \[\leadsto \color{blue}{0.25} \]
  8. Final simplification4.7%

    \[\leadsto 0.25 \]

Alternative 21: 4.6% accurate, 309.0× speedup?

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

\\
0.5
\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 85.8%

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

      \[\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. *-commutative85.8%

      \[\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*85.8%

      \[\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. *-commutative85.8%

      \[\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*85.8%

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

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

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

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

      \[\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*85.8%

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

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

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

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

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

    \[\leadsto \color{blue}{0.5} \]
  8. Final simplification5.2%

    \[\leadsto 0.5 \]

Alternative 22: 4.7% accurate, 309.0× speedup?

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

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

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

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

      \[\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. *-commutative85.8%

      \[\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*85.8%

      \[\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. *-commutative85.8%

      \[\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*85.8%

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

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

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

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

      \[\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*85.8%

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

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

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

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

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

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

    \[\leadsto 1 \]

Alternative 23: 26.5% 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 61.6%

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

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

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

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

    \[\leadsto re \]

Reproduce

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