math.sin on complex, real part

Percentage Accurate: 100.0% → 100.0%
Time: 9.3s
Alternatives: 22
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 22 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: 95.9% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(re \cdot 0.5\right) \cdot \left(e^{-im} + e^{im}\right)\\ \mathbf{if}\;im \leq -2.35 \cdot 10^{+103}:\\ \;\;\;\;\sin re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{elif}\;im \leq -0.0225:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 4.7 \cdot 10^{-5}:\\ \;\;\;\;\sin re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 2.8 \cdot 10^{+70}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (* re 0.5) (+ (exp (- im)) (exp im)))))
   (if (<= im -2.35e+103)
     (*
      (sin re)
      (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))
     (if (<= im -0.0225)
       t_0
       (if (<= im 4.7e-5)
         (* (sin re) (+ 1.0 (* im (* 0.5 im))))
         (if (<= im 2.8e+70)
           t_0
           (* 0.041666666666666664 (* (sin re) (pow im 4.0)))))))))
double code(double re, double im) {
	double t_0 = (re * 0.5) * (exp(-im) + exp(im));
	double tmp;
	if (im <= -2.35e+103) {
		tmp = sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	} else if (im <= -0.0225) {
		tmp = t_0;
	} else if (im <= 4.7e-5) {
		tmp = sin(re) * (1.0 + (im * (0.5 * im)));
	} else if (im <= 2.8e+70) {
		tmp = t_0;
	} else {
		tmp = 0.041666666666666664 * (sin(re) * pow(im, 4.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 = (re * 0.5d0) * (exp(-im) + exp(im))
    if (im <= (-2.35d+103)) then
        tmp = sin(re) * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
    else if (im <= (-0.0225d0)) then
        tmp = t_0
    else if (im <= 4.7d-5) then
        tmp = sin(re) * (1.0d0 + (im * (0.5d0 * im)))
    else if (im <= 2.8d+70) then
        tmp = t_0
    else
        tmp = 0.041666666666666664d0 * (sin(re) * (im ** 4.0d0))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = (re * 0.5) * (Math.exp(-im) + Math.exp(im));
	double tmp;
	if (im <= -2.35e+103) {
		tmp = Math.sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	} else if (im <= -0.0225) {
		tmp = t_0;
	} else if (im <= 4.7e-5) {
		tmp = Math.sin(re) * (1.0 + (im * (0.5 * im)));
	} else if (im <= 2.8e+70) {
		tmp = t_0;
	} else {
		tmp = 0.041666666666666664 * (Math.sin(re) * Math.pow(im, 4.0));
	}
	return tmp;
}
def code(re, im):
	t_0 = (re * 0.5) * (math.exp(-im) + math.exp(im))
	tmp = 0
	if im <= -2.35e+103:
		tmp = math.sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))))
	elif im <= -0.0225:
		tmp = t_0
	elif im <= 4.7e-5:
		tmp = math.sin(re) * (1.0 + (im * (0.5 * im)))
	elif im <= 2.8e+70:
		tmp = t_0
	else:
		tmp = 0.041666666666666664 * (math.sin(re) * math.pow(im, 4.0))
	return tmp
function code(re, im)
	t_0 = Float64(Float64(re * 0.5) * Float64(exp(Float64(-im)) + exp(im)))
	tmp = 0.0
	if (im <= -2.35e+103)
		tmp = Float64(sin(re) * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664)))));
	elseif (im <= -0.0225)
		tmp = t_0;
	elseif (im <= 4.7e-5)
		tmp = Float64(sin(re) * Float64(1.0 + Float64(im * Float64(0.5 * im))));
	elseif (im <= 2.8e+70)
		tmp = t_0;
	else
		tmp = Float64(0.041666666666666664 * Float64(sin(re) * (im ^ 4.0)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = (re * 0.5) * (exp(-im) + exp(im));
	tmp = 0.0;
	if (im <= -2.35e+103)
		tmp = sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	elseif (im <= -0.0225)
		tmp = t_0;
	elseif (im <= 4.7e-5)
		tmp = sin(re) * (1.0 + (im * (0.5 * im)));
	elseif (im <= 2.8e+70)
		tmp = t_0;
	else
		tmp = 0.041666666666666664 * (sin(re) * (im ^ 4.0));
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[(re * 0.5), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.35e+103], N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -0.0225], t$95$0, If[LessEqual[im, 4.7e-5], N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.8e+70], t$95$0, N[(0.041666666666666664 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;im \leq 2.8 \cdot 10^{+70}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < -2.35000000000000016e103

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.35000000000000016e103 < im < -0.022499999999999999 or 4.69999999999999972e-5 < im < 2.7999999999999999e70

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

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

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

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

    if -0.022499999999999999 < im < 4.69999999999999972e-5

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.7999999999999999e70 < 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.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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 inf 98.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -2.35 \cdot 10^{+103}:\\ \;\;\;\;\sin re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{elif}\;im \leq -0.0225:\\ \;\;\;\;\left(re \cdot 0.5\right) \cdot \left(e^{-im} + e^{im}\right)\\ \mathbf{elif}\;im \leq 4.7 \cdot 10^{-5}:\\ \;\;\;\;\sin re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 2.8 \cdot 10^{+70}:\\ \;\;\;\;\left(re \cdot 0.5\right) \cdot \left(e^{-im} + e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\\ \end{array} \]

Alternative 3: 86.8% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\ t_1 := 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ t_2 := re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{if}\;im \leq -5.8 \cdot 10^{+174}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -2.4 \cdot 10^{+68}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;im \leq -210000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq 450:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 3.8 \cdot 10^{+55}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq 1.8 \cdot 10^{+150}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* 0.5 (* (sin re) (* im im))))
        (t_1
         (+
          0.08333333333333333
          (+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666))))
        (t_2
         (*
          re
          (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))))
   (if (<= im -5.8e+174)
     t_0
     (if (<= im -2.4e+68)
       t_2
       (if (<= im -210000000000.0)
         t_1
         (if (<= im 450.0)
           (sin re)
           (if (<= im 3.8e+55) t_1 (if (<= im 1.8e+150) t_2 t_0))))))))
double code(double re, double im) {
	double t_0 = 0.5 * (sin(re) * (im * im));
	double t_1 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	double t_2 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	double tmp;
	if (im <= -5.8e+174) {
		tmp = t_0;
	} else if (im <= -2.4e+68) {
		tmp = t_2;
	} else if (im <= -210000000000.0) {
		tmp = t_1;
	} else if (im <= 450.0) {
		tmp = sin(re);
	} else if (im <= 3.8e+55) {
		tmp = t_1;
	} else if (im <= 1.8e+150) {
		tmp = t_2;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = 0.5d0 * (sin(re) * (im * im))
    t_1 = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
    t_2 = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
    if (im <= (-5.8d+174)) then
        tmp = t_0
    else if (im <= (-2.4d+68)) then
        tmp = t_2
    else if (im <= (-210000000000.0d0)) then
        tmp = t_1
    else if (im <= 450.0d0) then
        tmp = sin(re)
    else if (im <= 3.8d+55) then
        tmp = t_1
    else if (im <= 1.8d+150) then
        tmp = t_2
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = 0.5 * (Math.sin(re) * (im * im));
	double t_1 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	double t_2 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	double tmp;
	if (im <= -5.8e+174) {
		tmp = t_0;
	} else if (im <= -2.4e+68) {
		tmp = t_2;
	} else if (im <= -210000000000.0) {
		tmp = t_1;
	} else if (im <= 450.0) {
		tmp = Math.sin(re);
	} else if (im <= 3.8e+55) {
		tmp = t_1;
	} else if (im <= 1.8e+150) {
		tmp = t_2;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = 0.5 * (math.sin(re) * (im * im))
	t_1 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666))
	t_2 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))))
	tmp = 0
	if im <= -5.8e+174:
		tmp = t_0
	elif im <= -2.4e+68:
		tmp = t_2
	elif im <= -210000000000.0:
		tmp = t_1
	elif im <= 450.0:
		tmp = math.sin(re)
	elif im <= 3.8e+55:
		tmp = t_1
	elif im <= 1.8e+150:
		tmp = t_2
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(0.5 * Float64(sin(re) * Float64(im * im)))
	t_1 = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666)))
	t_2 = Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664)))))
	tmp = 0.0
	if (im <= -5.8e+174)
		tmp = t_0;
	elseif (im <= -2.4e+68)
		tmp = t_2;
	elseif (im <= -210000000000.0)
		tmp = t_1;
	elseif (im <= 450.0)
		tmp = sin(re);
	elseif (im <= 3.8e+55)
		tmp = t_1;
	elseif (im <= 1.8e+150)
		tmp = t_2;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 0.5 * (sin(re) * (im * im));
	t_1 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	t_2 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	tmp = 0.0;
	if (im <= -5.8e+174)
		tmp = t_0;
	elseif (im <= -2.4e+68)
		tmp = t_2;
	elseif (im <= -210000000000.0)
		tmp = t_1;
	elseif (im <= 450.0)
		tmp = sin(re);
	elseif (im <= 3.8e+55)
		tmp = t_1;
	elseif (im <= 1.8e+150)
		tmp = t_2;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[Sin[re], $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(re * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5.8e+174], t$95$0, If[LessEqual[im, -2.4e+68], t$95$2, If[LessEqual[im, -210000000000.0], t$95$1, If[LessEqual[im, 450.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 3.8e+55], t$95$1, If[LessEqual[im, 1.8e+150], t$95$2, t$95$0]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\
t_1 := 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\
t_2 := re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\mathbf{if}\;im \leq -5.8 \cdot 10^{+174}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -2.4 \cdot 10^{+68}:\\
\;\;\;\;t_2\\

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

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

\mathbf{elif}\;im \leq 3.8 \cdot 10^{+55}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq 1.8 \cdot 10^{+150}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < -5.7999999999999999e174 or 1.79999999999999993e150 < 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 + 0.5 \cdot \left(\sin re \cdot {im}^{2}\right)} \]
    5. Step-by-step derivation
      1. *-commutative98.3%

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

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

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

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

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

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

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

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

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

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

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

    if -5.7999999999999999e174 < im < -2.40000000000000008e68 or 3.8e55 < im < 1.79999999999999993e150

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.40000000000000008e68 < im < -2.1e11 or 450 < im < 3.8e55

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

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

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

        \[\leadsto 0.08333333333333333 + \left(\color{blue}{\frac{0.25 \cdot 1}{{re}^{2}}} + 0.016666666666666666 \cdot {re}^{2}\right) \]
      2. metadata-eval47.4%

        \[\leadsto 0.08333333333333333 + \left(\frac{\color{blue}{0.25}}{{re}^{2}} + 0.016666666666666666 \cdot {re}^{2}\right) \]
      3. unpow247.4%

        \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{\color{blue}{re \cdot re}} + 0.016666666666666666 \cdot {re}^{2}\right) \]
      4. *-commutative47.4%

        \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \color{blue}{{re}^{2} \cdot 0.016666666666666666}\right) \]
      5. unpow247.4%

        \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \color{blue}{\left(re \cdot re\right)} \cdot 0.016666666666666666\right) \]
    7. Simplified47.4%

      \[\leadsto \color{blue}{0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)} \]

    if -2.1e11 < im < 450

    1. Initial program 100.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -5.8 \cdot 10^{+174}:\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;im \leq -2.4 \cdot 10^{+68}:\\ \;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{elif}\;im \leq -210000000000:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \mathbf{elif}\;im \leq 450:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 3.8 \cdot 10^{+55}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \mathbf{elif}\;im \leq 1.8 \cdot 10^{+150}:\\ \;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\ \end{array} \]

Alternative 4: 86.9% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\ t_1 := 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ t_2 := re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{if}\;im \leq -5.8 \cdot 10^{+174}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -1.2 \cdot 10^{+71}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;im \leq -2.7 \cdot 10^{+21}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq 700:\\ \;\;\;\;\sin re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 4.8 \cdot 10^{+54}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq 1.8 \cdot 10^{+150}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* 0.5 (* (sin re) (* im im))))
        (t_1
         (+
          0.08333333333333333
          (+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666))))
        (t_2
         (*
          re
          (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))))
   (if (<= im -5.8e+174)
     t_0
     (if (<= im -1.2e+71)
       t_2
       (if (<= im -2.7e+21)
         t_1
         (if (<= im 700.0)
           (* (sin re) (+ 1.0 (* im (* 0.5 im))))
           (if (<= im 4.8e+54) t_1 (if (<= im 1.8e+150) t_2 t_0))))))))
double code(double re, double im) {
	double t_0 = 0.5 * (sin(re) * (im * im));
	double t_1 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	double t_2 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	double tmp;
	if (im <= -5.8e+174) {
		tmp = t_0;
	} else if (im <= -1.2e+71) {
		tmp = t_2;
	} else if (im <= -2.7e+21) {
		tmp = t_1;
	} else if (im <= 700.0) {
		tmp = sin(re) * (1.0 + (im * (0.5 * im)));
	} else if (im <= 4.8e+54) {
		tmp = t_1;
	} else if (im <= 1.8e+150) {
		tmp = t_2;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = 0.5d0 * (sin(re) * (im * im))
    t_1 = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
    t_2 = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
    if (im <= (-5.8d+174)) then
        tmp = t_0
    else if (im <= (-1.2d+71)) then
        tmp = t_2
    else if (im <= (-2.7d+21)) then
        tmp = t_1
    else if (im <= 700.0d0) then
        tmp = sin(re) * (1.0d0 + (im * (0.5d0 * im)))
    else if (im <= 4.8d+54) then
        tmp = t_1
    else if (im <= 1.8d+150) then
        tmp = t_2
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = 0.5 * (Math.sin(re) * (im * im));
	double t_1 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	double t_2 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	double tmp;
	if (im <= -5.8e+174) {
		tmp = t_0;
	} else if (im <= -1.2e+71) {
		tmp = t_2;
	} else if (im <= -2.7e+21) {
		tmp = t_1;
	} else if (im <= 700.0) {
		tmp = Math.sin(re) * (1.0 + (im * (0.5 * im)));
	} else if (im <= 4.8e+54) {
		tmp = t_1;
	} else if (im <= 1.8e+150) {
		tmp = t_2;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = 0.5 * (math.sin(re) * (im * im))
	t_1 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666))
	t_2 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))))
	tmp = 0
	if im <= -5.8e+174:
		tmp = t_0
	elif im <= -1.2e+71:
		tmp = t_2
	elif im <= -2.7e+21:
		tmp = t_1
	elif im <= 700.0:
		tmp = math.sin(re) * (1.0 + (im * (0.5 * im)))
	elif im <= 4.8e+54:
		tmp = t_1
	elif im <= 1.8e+150:
		tmp = t_2
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(0.5 * Float64(sin(re) * Float64(im * im)))
	t_1 = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666)))
	t_2 = Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664)))))
	tmp = 0.0
	if (im <= -5.8e+174)
		tmp = t_0;
	elseif (im <= -1.2e+71)
		tmp = t_2;
	elseif (im <= -2.7e+21)
		tmp = t_1;
	elseif (im <= 700.0)
		tmp = Float64(sin(re) * Float64(1.0 + Float64(im * Float64(0.5 * im))));
	elseif (im <= 4.8e+54)
		tmp = t_1;
	elseif (im <= 1.8e+150)
		tmp = t_2;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 0.5 * (sin(re) * (im * im));
	t_1 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	t_2 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	tmp = 0.0;
	if (im <= -5.8e+174)
		tmp = t_0;
	elseif (im <= -1.2e+71)
		tmp = t_2;
	elseif (im <= -2.7e+21)
		tmp = t_1;
	elseif (im <= 700.0)
		tmp = sin(re) * (1.0 + (im * (0.5 * im)));
	elseif (im <= 4.8e+54)
		tmp = t_1;
	elseif (im <= 1.8e+150)
		tmp = t_2;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[Sin[re], $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(re * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5.8e+174], t$95$0, If[LessEqual[im, -1.2e+71], t$95$2, If[LessEqual[im, -2.7e+21], t$95$1, If[LessEqual[im, 700.0], N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.8e+54], t$95$1, If[LessEqual[im, 1.8e+150], t$95$2, t$95$0]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\
t_1 := 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\
t_2 := re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\mathbf{if}\;im \leq -5.8 \cdot 10^{+174}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -1.2 \cdot 10^{+71}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;im \leq -2.7 \cdot 10^{+21}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;im \leq 4.8 \cdot 10^{+54}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq 1.8 \cdot 10^{+150}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < -5.7999999999999999e174 or 1.79999999999999993e150 < 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 + 0.5 \cdot \left(\sin re \cdot {im}^{2}\right)} \]
    5. Step-by-step derivation
      1. *-commutative98.3%

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

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

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

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

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

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

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

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

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

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

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

    if -5.7999999999999999e174 < im < -1.1999999999999999e71 or 4.79999999999999997e54 < im < 1.79999999999999993e150

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.1999999999999999e71 < im < -2.7e21 or 700 < im < 4.79999999999999997e54

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

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

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

        \[\leadsto 0.08333333333333333 + \left(\color{blue}{\frac{0.25 \cdot 1}{{re}^{2}}} + 0.016666666666666666 \cdot {re}^{2}\right) \]
      2. metadata-eval58.0%

        \[\leadsto 0.08333333333333333 + \left(\frac{\color{blue}{0.25}}{{re}^{2}} + 0.016666666666666666 \cdot {re}^{2}\right) \]
      3. unpow258.0%

        \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{\color{blue}{re \cdot re}} + 0.016666666666666666 \cdot {re}^{2}\right) \]
      4. *-commutative58.0%

        \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \color{blue}{{re}^{2} \cdot 0.016666666666666666}\right) \]
      5. unpow258.0%

        \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \color{blue}{\left(re \cdot re\right)} \cdot 0.016666666666666666\right) \]
    7. Simplified58.0%

      \[\leadsto \color{blue}{0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)} \]

    if -2.7e21 < im < 700

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -5.8 \cdot 10^{+174}:\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;im \leq -1.2 \cdot 10^{+71}:\\ \;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{elif}\;im \leq -2.7 \cdot 10^{+21}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \mathbf{elif}\;im \leq 700:\\ \;\;\;\;\sin re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 4.8 \cdot 10^{+54}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \mathbf{elif}\;im \leq 1.8 \cdot 10^{+150}:\\ \;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\ \end{array} \]

Alternative 5: 82.1% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ t_1 := re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{if}\;im \leq -3.8 \cdot 10^{+71}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq -210000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 600:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.65 \cdot 10^{+54}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 2.5 \cdot 10^{+193}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(im \cdot \left(\sin re \cdot im\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0
         (+
          0.08333333333333333
          (+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666))))
        (t_1
         (*
          re
          (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))))
   (if (<= im -3.8e+71)
     t_1
     (if (<= im -210000000000.0)
       t_0
       (if (<= im 600.0)
         (sin re)
         (if (<= im 1.65e+54)
           t_0
           (if (<= im 2.5e+193) t_1 (* 0.5 (* im (* (sin re) im))))))))))
double code(double re, double im) {
	double t_0 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	double t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	double tmp;
	if (im <= -3.8e+71) {
		tmp = t_1;
	} else if (im <= -210000000000.0) {
		tmp = t_0;
	} else if (im <= 600.0) {
		tmp = sin(re);
	} else if (im <= 1.65e+54) {
		tmp = t_0;
	} else if (im <= 2.5e+193) {
		tmp = t_1;
	} 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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
    t_1 = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
    if (im <= (-3.8d+71)) then
        tmp = t_1
    else if (im <= (-210000000000.0d0)) then
        tmp = t_0
    else if (im <= 600.0d0) then
        tmp = sin(re)
    else if (im <= 1.65d+54) then
        tmp = t_0
    else if (im <= 2.5d+193) then
        tmp = t_1
    else
        tmp = 0.5d0 * (im * (sin(re) * im))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	double t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	double tmp;
	if (im <= -3.8e+71) {
		tmp = t_1;
	} else if (im <= -210000000000.0) {
		tmp = t_0;
	} else if (im <= 600.0) {
		tmp = Math.sin(re);
	} else if (im <= 1.65e+54) {
		tmp = t_0;
	} else if (im <= 2.5e+193) {
		tmp = t_1;
	} else {
		tmp = 0.5 * (im * (Math.sin(re) * im));
	}
	return tmp;
}
def code(re, im):
	t_0 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666))
	t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))))
	tmp = 0
	if im <= -3.8e+71:
		tmp = t_1
	elif im <= -210000000000.0:
		tmp = t_0
	elif im <= 600.0:
		tmp = math.sin(re)
	elif im <= 1.65e+54:
		tmp = t_0
	elif im <= 2.5e+193:
		tmp = t_1
	else:
		tmp = 0.5 * (im * (math.sin(re) * im))
	return tmp
function code(re, im)
	t_0 = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666)))
	t_1 = Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664)))))
	tmp = 0.0
	if (im <= -3.8e+71)
		tmp = t_1;
	elseif (im <= -210000000000.0)
		tmp = t_0;
	elseif (im <= 600.0)
		tmp = sin(re);
	elseif (im <= 1.65e+54)
		tmp = t_0;
	elseif (im <= 2.5e+193)
		tmp = t_1;
	else
		tmp = Float64(0.5 * Float64(im * Float64(sin(re) * im)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	tmp = 0.0;
	if (im <= -3.8e+71)
		tmp = t_1;
	elseif (im <= -210000000000.0)
		tmp = t_0;
	elseif (im <= 600.0)
		tmp = sin(re);
	elseif (im <= 1.65e+54)
		tmp = t_0;
	elseif (im <= 2.5e+193)
		tmp = t_1;
	else
		tmp = 0.5 * (im * (sin(re) * im));
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.8e+71], t$95$1, If[LessEqual[im, -210000000000.0], t$95$0, If[LessEqual[im, 600.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.65e+54], t$95$0, If[LessEqual[im, 2.5e+193], t$95$1, N[(0.5 * N[(im * N[(N[Sin[re], $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\
t_1 := re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\mathbf{if}\;im \leq -3.8 \cdot 10^{+71}:\\
\;\;\;\;t_1\\

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

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

\mathbf{elif}\;im \leq 1.65 \cdot 10^{+54}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq 2.5 \cdot 10^{+193}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < -3.8000000000000001e71 or 1.65e54 < im < 2.49999999999999986e193

    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 95.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-identity95.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. *-commutative95.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*95.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. *-commutative95.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*95.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-out95.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-out95.3%

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

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

        \[\leadsto \left(1 + \color{blue}{{im}^{2} \cdot \left(0.5 + 0.041666666666666664 \cdot {im}^{2}\right)}\right) \cdot re \]
      2. unpow269.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. unpow269.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. Simplified69.7%

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

    if -3.8000000000000001e71 < im < -2.1e11 or 600 < im < 1.65e54

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

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

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

        \[\leadsto 0.08333333333333333 + \left(\color{blue}{\frac{0.25 \cdot 1}{{re}^{2}}} + 0.016666666666666666 \cdot {re}^{2}\right) \]
      2. metadata-eval47.4%

        \[\leadsto 0.08333333333333333 + \left(\frac{\color{blue}{0.25}}{{re}^{2}} + 0.016666666666666666 \cdot {re}^{2}\right) \]
      3. unpow247.4%

        \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{\color{blue}{re \cdot re}} + 0.016666666666666666 \cdot {re}^{2}\right) \]
      4. *-commutative47.4%

        \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \color{blue}{{re}^{2} \cdot 0.016666666666666666}\right) \]
      5. unpow247.4%

        \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \color{blue}{\left(re \cdot re\right)} \cdot 0.016666666666666666\right) \]
    7. Simplified47.4%

      \[\leadsto \color{blue}{0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)} \]

    if -2.1e11 < im < 600

    1. Initial program 100.0%

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

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

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

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

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

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

    if 2.49999999999999986e193 < 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*86.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -3.8 \cdot 10^{+71}:\\ \;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{elif}\;im \leq -210000000000:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \mathbf{elif}\;im \leq 600:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.65 \cdot 10^{+54}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \mathbf{elif}\;im \leq 2.5 \cdot 10^{+193}:\\ \;\;\;\;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 6: 88.4% accurate, 2.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 81.4% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ t_1 := re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{if}\;im \leq -5.6 \cdot 10^{+69}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq -210000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 660:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.45 \cdot 10^{+57}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0
         (+
          0.08333333333333333
          (+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666))))
        (t_1
         (*
          re
          (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))))
   (if (<= im -5.6e+69)
     t_1
     (if (<= im -210000000000.0)
       t_0
       (if (<= im 660.0) (sin re) (if (<= im 1.45e+57) t_0 t_1))))))
double code(double re, double im) {
	double t_0 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	double t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	double tmp;
	if (im <= -5.6e+69) {
		tmp = t_1;
	} else if (im <= -210000000000.0) {
		tmp = t_0;
	} else if (im <= 660.0) {
		tmp = sin(re);
	} else if (im <= 1.45e+57) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
    t_1 = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
    if (im <= (-5.6d+69)) then
        tmp = t_1
    else if (im <= (-210000000000.0d0)) then
        tmp = t_0
    else if (im <= 660.0d0) then
        tmp = sin(re)
    else if (im <= 1.45d+57) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	double t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	double tmp;
	if (im <= -5.6e+69) {
		tmp = t_1;
	} else if (im <= -210000000000.0) {
		tmp = t_0;
	} else if (im <= 660.0) {
		tmp = Math.sin(re);
	} else if (im <= 1.45e+57) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(re, im):
	t_0 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666))
	t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))))
	tmp = 0
	if im <= -5.6e+69:
		tmp = t_1
	elif im <= -210000000000.0:
		tmp = t_0
	elif im <= 660.0:
		tmp = math.sin(re)
	elif im <= 1.45e+57:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(re, im)
	t_0 = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666)))
	t_1 = Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664)))))
	tmp = 0.0
	if (im <= -5.6e+69)
		tmp = t_1;
	elseif (im <= -210000000000.0)
		tmp = t_0;
	elseif (im <= 660.0)
		tmp = sin(re);
	elseif (im <= 1.45e+57)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	tmp = 0.0;
	if (im <= -5.6e+69)
		tmp = t_1;
	elseif (im <= -210000000000.0)
		tmp = t_0;
	elseif (im <= 660.0)
		tmp = sin(re);
	elseif (im <= 1.45e+57)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5.6e+69], t$95$1, If[LessEqual[im, -210000000000.0], t$95$0, If[LessEqual[im, 660.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.45e+57], t$95$0, t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\
t_1 := re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\mathbf{if}\;im \leq -5.6 \cdot 10^{+69}:\\
\;\;\;\;t_1\\

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

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

\mathbf{elif}\;im \leq 1.45 \cdot 10^{+57}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -5.59999999999999964e69 or 1.4500000000000001e57 < im

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto \color{blue}{\sin re \cdot \left(0.5 \cdot \left(e^{-im} + e^{im}\right)\right)} \]
    4. Taylor expanded in im around 0 96.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-identity96.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. *-commutative96.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*96.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. *-commutative96.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*96.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-out96.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-out96.3%

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

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

        \[\leadsto \left(1 + \color{blue}{{im}^{2} \cdot \left(0.5 + 0.041666666666666664 \cdot {im}^{2}\right)}\right) \cdot re \]
      2. unpow269.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. unpow269.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. Simplified69.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} \]

    if -5.59999999999999964e69 < im < -2.1e11 or 660 < im < 1.4500000000000001e57

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

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

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

        \[\leadsto 0.08333333333333333 + \left(\color{blue}{\frac{0.25 \cdot 1}{{re}^{2}}} + 0.016666666666666666 \cdot {re}^{2}\right) \]
      2. metadata-eval47.4%

        \[\leadsto 0.08333333333333333 + \left(\frac{\color{blue}{0.25}}{{re}^{2}} + 0.016666666666666666 \cdot {re}^{2}\right) \]
      3. unpow247.4%

        \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{\color{blue}{re \cdot re}} + 0.016666666666666666 \cdot {re}^{2}\right) \]
      4. *-commutative47.4%

        \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \color{blue}{{re}^{2} \cdot 0.016666666666666666}\right) \]
      5. unpow247.4%

        \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \color{blue}{\left(re \cdot re\right)} \cdot 0.016666666666666666\right) \]
    7. Simplified47.4%

      \[\leadsto \color{blue}{0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)} \]

    if -2.1e11 < im < 660

    1. Initial program 100.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -5.6 \cdot 10^{+69}:\\ \;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{elif}\;im \leq -210000000000:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \mathbf{elif}\;im \leq 660:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.45 \cdot 10^{+57}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\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: 50.6% accurate, 14.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -2.8 \cdot 10^{+138}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;im \leq -5 \cdot 10^{+41} \lor \neg \left(im \leq 390\right) \land im \leq 5.2 \cdot 10^{+146}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im -2.8e+138)
   (* 0.5 (* re (* im im)))
   (if (or (<= im -5e+41) (and (not (<= im 390.0)) (<= im 5.2e+146)))
     (+
      0.08333333333333333
      (+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666)))
     (* re (+ 1.0 (* 0.5 (* im im)))))))
double code(double re, double im) {
	double tmp;
	if (im <= -2.8e+138) {
		tmp = 0.5 * (re * (im * im));
	} else if ((im <= -5e+41) || (!(im <= 390.0) && (im <= 5.2e+146))) {
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	} else {
		tmp = re * (1.0 + (0.5 * (im * im)));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (im <= (-2.8d+138)) then
        tmp = 0.5d0 * (re * (im * im))
    else if ((im <= (-5d+41)) .or. (.not. (im <= 390.0d0)) .and. (im <= 5.2d+146)) then
        tmp = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
    else
        tmp = re * (1.0d0 + (0.5d0 * (im * im)))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= -2.8e+138) {
		tmp = 0.5 * (re * (im * im));
	} else if ((im <= -5e+41) || (!(im <= 390.0) && (im <= 5.2e+146))) {
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	} else {
		tmp = re * (1.0 + (0.5 * (im * im)));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= -2.8e+138:
		tmp = 0.5 * (re * (im * im))
	elif (im <= -5e+41) or (not (im <= 390.0) and (im <= 5.2e+146)):
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666))
	else:
		tmp = re * (1.0 + (0.5 * (im * im)))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= -2.8e+138)
		tmp = Float64(0.5 * Float64(re * Float64(im * im)));
	elseif ((im <= -5e+41) || (!(im <= 390.0) && (im <= 5.2e+146)))
		tmp = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666)));
	else
		tmp = Float64(re * Float64(1.0 + Float64(0.5 * Float64(im * im))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= -2.8e+138)
		tmp = 0.5 * (re * (im * im));
	elseif ((im <= -5e+41) || (~((im <= 390.0)) && (im <= 5.2e+146)))
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	else
		tmp = re * (1.0 + (0.5 * (im * im)));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, -2.8e+138], N[(0.5 * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, -5e+41], And[N[Not[LessEqual[im, 390.0]], $MachinePrecision], LessEqual[im, 5.2e+146]]], N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq -5 \cdot 10^{+41} \lor \neg \left(im \leq 390\right) \land im \leq 5.2 \cdot 10^{+146}:\\
\;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.8000000000000001e138 < im < -5.00000000000000022e41 or 390 < im < 5.20000000000000028e146

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

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

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

        \[\leadsto 0.08333333333333333 + \left(\color{blue}{\frac{0.25 \cdot 1}{{re}^{2}}} + 0.016666666666666666 \cdot {re}^{2}\right) \]
      2. metadata-eval35.1%

        \[\leadsto 0.08333333333333333 + \left(\frac{\color{blue}{0.25}}{{re}^{2}} + 0.016666666666666666 \cdot {re}^{2}\right) \]
      3. unpow235.1%

        \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{\color{blue}{re \cdot re}} + 0.016666666666666666 \cdot {re}^{2}\right) \]
      4. *-commutative35.1%

        \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \color{blue}{{re}^{2} \cdot 0.016666666666666666}\right) \]
      5. unpow235.1%

        \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \color{blue}{\left(re \cdot re\right)} \cdot 0.016666666666666666\right) \]
    7. Simplified35.1%

      \[\leadsto \color{blue}{0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)} \]

    if -5.00000000000000022e41 < im < 390 or 5.20000000000000028e146 < 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 91.5%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -2.8 \cdot 10^{+138}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;im \leq -5 \cdot 10^{+41} \lor \neg \left(im \leq 390\right) \land im \leq 5.2 \cdot 10^{+146}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\ \end{array} \]

Alternative 9: 55.8% accurate, 16.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -7.2 \cdot 10^{+276}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;re \leq -4.4 \cdot 10^{+154}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\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 (<= re -7.2e+276)
   (* 0.5 (* re (* im im)))
   (if (<= re -4.4e+154)
     (+
      0.08333333333333333
      (+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666)))
     (* re (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664))))))))
double code(double re, double im) {
	double tmp;
	if (re <= -7.2e+276) {
		tmp = 0.5 * (re * (im * im));
	} else if (re <= -4.4e+154) {
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	} 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 (re <= (-7.2d+276)) then
        tmp = 0.5d0 * (re * (im * im))
    else if (re <= (-4.4d+154)) then
        tmp = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
    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 (re <= -7.2e+276) {
		tmp = 0.5 * (re * (im * im));
	} else if (re <= -4.4e+154) {
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	} else {
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= -7.2e+276:
		tmp = 0.5 * (re * (im * im))
	elif re <= -4.4e+154:
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666))
	else:
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= -7.2e+276)
		tmp = Float64(0.5 * Float64(re * Float64(im * im)));
	elseif (re <= -4.4e+154)
		tmp = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666)));
	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 (re <= -7.2e+276)
		tmp = 0.5 * (re * (im * im));
	elseif (re <= -4.4e+154)
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	else
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, -7.2e+276], N[(0.5 * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, -4.4e+154], N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $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}\;re \leq -7.2 \cdot 10^{+276}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\

\mathbf{elif}\;re \leq -4.4 \cdot 10^{+154}:\\
\;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\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 3 regimes
  2. if re < -7.19999999999999959e276

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.19999999999999959e276 < re < -4.4000000000000002e154

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

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

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

        \[\leadsto 0.08333333333333333 + \left(\color{blue}{\frac{0.25 \cdot 1}{{re}^{2}}} + 0.016666666666666666 \cdot {re}^{2}\right) \]
      2. metadata-eval57.8%

        \[\leadsto 0.08333333333333333 + \left(\frac{\color{blue}{0.25}}{{re}^{2}} + 0.016666666666666666 \cdot {re}^{2}\right) \]
      3. unpow257.8%

        \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{\color{blue}{re \cdot re}} + 0.016666666666666666 \cdot {re}^{2}\right) \]
      4. *-commutative57.8%

        \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \color{blue}{{re}^{2} \cdot 0.016666666666666666}\right) \]
      5. unpow257.8%

        \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \color{blue}{\left(re \cdot re\right)} \cdot 0.016666666666666666\right) \]
    7. Simplified57.8%

      \[\leadsto \color{blue}{0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)} \]

    if -4.4000000000000002e154 < re

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -7.2 \cdot 10^{+276}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;re \leq -4.4 \cdot 10^{+154}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\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 10: 41.3% accurate, 20.2× speedup?

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

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

\mathbf{elif}\;im \leq -2.6 \cdot 10^{+39}:\\
\;\;\;\;\frac{0.25}{re \cdot re}\\

\mathbf{elif}\;im \leq -1.4 \lor \neg \left(im \leq 1.4\right):\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -3.49999999999999978e184 or -2.6e39 < im < -1.3999999999999999 or 1.3999999999999999 < 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 54.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.49999999999999978e184 < im < -2.6e39

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

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

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

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

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

    if -1.3999999999999999 < im < 1.3999999999999999

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

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

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

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

      \[\leadsto \color{blue}{re} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification44.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -3.5 \cdot 10^{+184}:\\ \;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot im\right)\right)\\ \mathbf{elif}\;im \leq -2.6 \cdot 10^{+39}:\\ \;\;\;\;\frac{0.25}{re \cdot re}\\ \mathbf{elif}\;im \leq -1.4 \lor \neg \left(im \leq 1.4\right):\\ \;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;re\\ \end{array} \]

Alternative 11: 48.0% accurate, 27.7× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.3999999999999999 < im < 1.3999999999999999

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

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

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

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

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

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

Alternative 12: 33.1% accurate, 33.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq -460000000000 \lor \neg \left(im \leq 760000000000\right):\\
\;\;\;\;\frac{0.25}{re \cdot re}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < -4.6e11 or 7.6e11 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if -4.6e11 < im < 7.6e11

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

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

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

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

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

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

Alternative 13: 48.2% 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 72.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto -512 \]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto -1 \]

Alternative 16: 4.7% 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 88.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto -0.5 \]

Alternative 17: 4.1% 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 88.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 0.015625 \]

Alternative 18: 4.3% accurate, 309.0× speedup?

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

\\
0.125
\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 88.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{0.125} \]
  8. Final simplification4.4%

    \[\leadsto 0.125 \]

Alternative 19: 4.5% 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 88.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 0.25 \]

Alternative 20: 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 88.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\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.5} \]
  8. Final simplification4.7%

    \[\leadsto 0.5 \]

Alternative 21: 4.8% 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 88.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 1 \]

Alternative 22: 27.6% accurate, 309.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto re \]

Reproduce

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