math.sin on complex, real part

Percentage Accurate: 100.0% → 100.0%
Time: 9.7s
Alternatives: 25
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 25 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: 86.8% accurate, 1.5× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if 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 78.7%

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

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

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

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

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

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

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

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

    if 4.69999999999999972e-5 < im < 2.54999999999999985e77

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if 2.54999999999999985e77 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 89.3% accurate, 2.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{0.25}{re \cdot re} + \frac{{re}^{4} \cdot 0.0002777777777777778 - 0.006944444444444444}{re \cdot \left(re \cdot 0.016666666666666666\right) - 0.08333333333333333}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 2.1e11 or 2.54999999999999985e77 < 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 + \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-identity91.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. *-commutative91.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*91.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. *-commutative91.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*91.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-out91.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-out91.5%

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

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

    if 2.1e11 < im < 2.54999999999999985e77

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

      \[\leadsto \color{blue}{{\left(\sin re \cdot -2\right)}^{-2}} \]
    5. Taylor expanded in re around 0 40.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. +-commutative40.8%

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

        \[\leadsto \color{blue}{0.25 \cdot \frac{1}{{re}^{2}} + \left(0.016666666666666666 \cdot {re}^{2} + 0.08333333333333333\right)} \]
      3. associate-*r/40.8%

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

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

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

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

        \[\leadsto \frac{0.25}{re \cdot re} + \left(\color{blue}{\left(re \cdot re\right)} \cdot 0.016666666666666666 + 0.08333333333333333\right) \]
      8. associate-*l*40.8%

        \[\leadsto \frac{0.25}{re \cdot re} + \left(\color{blue}{re \cdot \left(re \cdot 0.016666666666666666\right)} + 0.08333333333333333\right) \]
      9. fma-def40.8%

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

      \[\leadsto \color{blue}{\frac{0.25}{re \cdot re} + \mathsf{fma}\left(re, re \cdot 0.016666666666666666, 0.08333333333333333\right)} \]
    8. Step-by-step derivation
      1. fma-udef40.8%

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

        \[\leadsto \frac{0.25}{re \cdot re} + \left(\color{blue}{\left(re \cdot re\right) \cdot 0.016666666666666666} + 0.08333333333333333\right) \]
      3. flip-+30.8%

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

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

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

        \[\leadsto \frac{0.25}{re \cdot re} + \frac{{\left(re \cdot re\right)}^{\color{blue}{\left(\sqrt{4}\right)}} \cdot \left(0.016666666666666666 \cdot 0.016666666666666666\right) - 0.08333333333333333 \cdot 0.08333333333333333}{\left(re \cdot re\right) \cdot 0.016666666666666666 - 0.08333333333333333} \]
      7. pow-prod-down30.8%

        \[\leadsto \frac{0.25}{re \cdot re} + \frac{\color{blue}{\left({re}^{\left(\sqrt{4}\right)} \cdot {re}^{\left(\sqrt{4}\right)}\right)} \cdot \left(0.016666666666666666 \cdot 0.016666666666666666\right) - 0.08333333333333333 \cdot 0.08333333333333333}{\left(re \cdot re\right) \cdot 0.016666666666666666 - 0.08333333333333333} \]
      8. pow-prod-up30.8%

        \[\leadsto \frac{0.25}{re \cdot re} + \frac{\color{blue}{{re}^{\left(\sqrt{4} + \sqrt{4}\right)}} \cdot \left(0.016666666666666666 \cdot 0.016666666666666666\right) - 0.08333333333333333 \cdot 0.08333333333333333}{\left(re \cdot re\right) \cdot 0.016666666666666666 - 0.08333333333333333} \]
      9. metadata-eval30.8%

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

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

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

        \[\leadsto \frac{0.25}{re \cdot re} + \frac{{re}^{4} \cdot \color{blue}{0.0002777777777777778} - 0.08333333333333333 \cdot 0.08333333333333333}{\left(re \cdot re\right) \cdot 0.016666666666666666 - 0.08333333333333333} \]
      13. metadata-eval30.8%

        \[\leadsto \frac{0.25}{re \cdot re} + \frac{{re}^{4} \cdot 0.0002777777777777778 - \color{blue}{0.006944444444444444}}{\left(re \cdot re\right) \cdot 0.016666666666666666 - 0.08333333333333333} \]
      14. associate-*l*30.8%

        \[\leadsto \frac{0.25}{re \cdot re} + \frac{{re}^{4} \cdot 0.0002777777777777778 - 0.006944444444444444}{\color{blue}{re \cdot \left(re \cdot 0.016666666666666666\right)} - 0.08333333333333333} \]
    9. Applied egg-rr30.8%

      \[\leadsto \frac{0.25}{re \cdot re} + \color{blue}{\frac{{re}^{4} \cdot 0.0002777777777777778 - 0.006944444444444444}{re \cdot \left(re \cdot 0.016666666666666666\right) - 0.08333333333333333}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification89.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 210000000000 \lor \neg \left(im \leq 2.55 \cdot 10^{+77}\right):\\ \;\;\;\;\sin re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.25}{re \cdot re} + \frac{{re}^{4} \cdot 0.0002777777777777778 - 0.006944444444444444}{re \cdot \left(re \cdot 0.016666666666666666\right) - 0.08333333333333333}\\ \end{array} \]

Alternative 4: 81.8% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 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 600:\\ \;\;\;\;\sin re \cdot \left(im \cdot \left(0.5 \cdot im\right) + 1\right)\\ \mathbf{elif}\;im \leq 8.7 \cdot 10^{+61}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \mathbf{elif}\;im \leq 2.15 \cdot 10^{+112}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 2.4 \cdot 10^{+118}:\\ \;\;\;\;0.5 \cdot \left(\left(im \cdot im\right) \cdot \left(re + -0.16666666666666666 \cdot {re}^{3}\right)\right)\\ \mathbf{elif}\;im \leq 1.8 \cdot 10^{+150}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0
         (*
          re
          (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))))
   (if (<= im 600.0)
     (* (sin re) (+ (* im (* 0.5 im)) 1.0))
     (if (<= im 8.7e+61)
       (+
        0.08333333333333333
        (+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666)))
       (if (<= im 2.15e+112)
         t_0
         (if (<= im 2.4e+118)
           (* 0.5 (* (* im im) (+ re (* -0.16666666666666666 (pow re 3.0)))))
           (if (<= im 1.8e+150) t_0 (* 0.5 (* (sin re) (* im im))))))))))
double code(double re, double im) {
	double t_0 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	double tmp;
	if (im <= 600.0) {
		tmp = sin(re) * ((im * (0.5 * im)) + 1.0);
	} else if (im <= 8.7e+61) {
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	} else if (im <= 2.15e+112) {
		tmp = t_0;
	} else if (im <= 2.4e+118) {
		tmp = 0.5 * ((im * im) * (re + (-0.16666666666666666 * pow(re, 3.0))));
	} else if (im <= 1.8e+150) {
		tmp = t_0;
	} else {
		tmp = 0.5 * (sin(re) * (im * 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) :: tmp
    t_0 = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
    if (im <= 600.0d0) then
        tmp = sin(re) * ((im * (0.5d0 * im)) + 1.0d0)
    else if (im <= 8.7d+61) then
        tmp = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
    else if (im <= 2.15d+112) then
        tmp = t_0
    else if (im <= 2.4d+118) then
        tmp = 0.5d0 * ((im * im) * (re + ((-0.16666666666666666d0) * (re ** 3.0d0))))
    else if (im <= 1.8d+150) then
        tmp = t_0
    else
        tmp = 0.5d0 * (sin(re) * (im * im))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	double tmp;
	if (im <= 600.0) {
		tmp = Math.sin(re) * ((im * (0.5 * im)) + 1.0);
	} else if (im <= 8.7e+61) {
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	} else if (im <= 2.15e+112) {
		tmp = t_0;
	} else if (im <= 2.4e+118) {
		tmp = 0.5 * ((im * im) * (re + (-0.16666666666666666 * Math.pow(re, 3.0))));
	} else if (im <= 1.8e+150) {
		tmp = t_0;
	} else {
		tmp = 0.5 * (Math.sin(re) * (im * im));
	}
	return tmp;
}
def code(re, im):
	t_0 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))))
	tmp = 0
	if im <= 600.0:
		tmp = math.sin(re) * ((im * (0.5 * im)) + 1.0)
	elif im <= 8.7e+61:
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666))
	elif im <= 2.15e+112:
		tmp = t_0
	elif im <= 2.4e+118:
		tmp = 0.5 * ((im * im) * (re + (-0.16666666666666666 * math.pow(re, 3.0))))
	elif im <= 1.8e+150:
		tmp = t_0
	else:
		tmp = 0.5 * (math.sin(re) * (im * im))
	return tmp
function code(re, im)
	t_0 = Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664)))))
	tmp = 0.0
	if (im <= 600.0)
		tmp = Float64(sin(re) * Float64(Float64(im * Float64(0.5 * im)) + 1.0));
	elseif (im <= 8.7e+61)
		tmp = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666)));
	elseif (im <= 2.15e+112)
		tmp = t_0;
	elseif (im <= 2.4e+118)
		tmp = Float64(0.5 * Float64(Float64(im * im) * Float64(re + Float64(-0.16666666666666666 * (re ^ 3.0)))));
	elseif (im <= 1.8e+150)
		tmp = t_0;
	else
		tmp = Float64(0.5 * Float64(sin(re) * Float64(im * im)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	tmp = 0.0;
	if (im <= 600.0)
		tmp = sin(re) * ((im * (0.5 * im)) + 1.0);
	elseif (im <= 8.7e+61)
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	elseif (im <= 2.15e+112)
		tmp = t_0;
	elseif (im <= 2.4e+118)
		tmp = 0.5 * ((im * im) * (re + (-0.16666666666666666 * (re ^ 3.0))));
	elseif (im <= 1.8e+150)
		tmp = t_0;
	else
		tmp = 0.5 * (sin(re) * (im * im));
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = 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, 600.0], N[(N[Sin[re], $MachinePrecision] * N[(N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 8.7e+61], N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.15e+112], t$95$0, If[LessEqual[im, 2.4e+118], N[(0.5 * N[(N[(im * im), $MachinePrecision] * N[(re + N[(-0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.8e+150], t$95$0, N[(0.5 * N[(N[Sin[re], $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 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 600:\\
\;\;\;\;\sin re \cdot \left(im \cdot \left(0.5 \cdot im\right) + 1\right)\\

\mathbf{elif}\;im \leq 8.7 \cdot 10^{+61}:\\
\;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\

\mathbf{elif}\;im \leq 2.15 \cdot 10^{+112}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq 2.4 \cdot 10^{+118}:\\
\;\;\;\;0.5 \cdot \left(\left(im \cdot im\right) \cdot \left(re + -0.16666666666666666 \cdot {re}^{3}\right)\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if 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 78.6%

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

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

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

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

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

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

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

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

    if 600 < im < 8.7000000000000002e61

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

      \[\leadsto \color{blue}{{\left(\sin re \cdot -2\right)}^{-2}} \]
    5. Taylor expanded in re around 0 56.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/56.4%

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

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

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

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

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

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

    if 8.7000000000000002e61 < im < 2.14999999999999991e112 or 2.4e118 < 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 86.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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.14999999999999991e112 < im < 2.4e118

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot \left(re + -0.16666666666666666 \cdot {re}^{3}\right)\right) \]
    12. Simplified67.8%

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

    if 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 97.0%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 600:\\ \;\;\;\;\sin re \cdot \left(im \cdot \left(0.5 \cdot im\right) + 1\right)\\ \mathbf{elif}\;im \leq 8.7 \cdot 10^{+61}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \mathbf{elif}\;im \leq 2.15 \cdot 10^{+112}:\\ \;\;\;\;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.4 \cdot 10^{+118}:\\ \;\;\;\;0.5 \cdot \left(\left(im \cdot im\right) \cdot \left(re + -0.16666666666666666 \cdot {re}^{3}\right)\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: 89.6% accurate, 2.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 580 \lor \neg \left(im \leq 2.8 \cdot 10^{+70}\right):\\
\;\;\;\;\sin re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 580 or 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 91.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-identity91.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. *-commutative91.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*91.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. *-commutative91.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*91.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-out91.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-out91.5%

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

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

    if 580 < 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. Applied egg-rr31.5%

      \[\leadsto \color{blue}{{\left(\sin re \cdot -2\right)}^{-2}} \]
    5. Taylor expanded in re around 0 50.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/50.8%

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

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

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

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

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

      \[\leadsto \color{blue}{0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification89.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 580 \lor \neg \left(im \leq 2.8 \cdot 10^{+70}\right):\\ \;\;\;\;\sin re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \end{array} \]

Alternative 6: 67.5% accurate, 2.7× speedup?

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

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

\mathbf{elif}\;im \leq 1.02 \cdot 10^{+62}:\\
\;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\

\mathbf{elif}\;im \leq 3.55 \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}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if 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 65.5%

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

    if 660 < im < 1.02000000000000002e62

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

      \[\leadsto \color{blue}{{\left(\sin re \cdot -2\right)}^{-2}} \]
    5. Taylor expanded in re around 0 56.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/56.4%

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

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

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

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

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

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

    if 1.02000000000000002e62 < im < 3.5499999999999999e193

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sin re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right)\right)} \]
    7. Taylor expanded in re around 0 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 3.5499999999999999e193 < 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 simplification67.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 660:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.02 \cdot 10^{+62}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \mathbf{elif}\;im \leq 3.55 \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 7: 69.6% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 520:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.7 \cdot 10^{+61}:\\ \;\;\;\;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} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 520.0)
   (sin re)
   (if (<= im 2.7e+61)
     (+
      0.08333333333333333
      (+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666)))
     (if (<= im 1.8e+150)
       (* re (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))
       (* 0.5 (* (sin re) (* im im)))))))
double code(double re, double im) {
	double tmp;
	if (im <= 520.0) {
		tmp = sin(re);
	} else if (im <= 2.7e+61) {
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	} else if (im <= 1.8e+150) {
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	} else {
		tmp = 0.5 * (sin(re) * (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 <= 520.0d0) then
        tmp = sin(re)
    else if (im <= 2.7d+61) then
        tmp = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
    else if (im <= 1.8d+150) then
        tmp = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
    else
        tmp = 0.5d0 * (sin(re) * (im * im))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 520.0) {
		tmp = Math.sin(re);
	} else if (im <= 2.7e+61) {
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	} else if (im <= 1.8e+150) {
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	} else {
		tmp = 0.5 * (Math.sin(re) * (im * im));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 520.0:
		tmp = math.sin(re)
	elif im <= 2.7e+61:
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666))
	elif im <= 1.8e+150:
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))))
	else:
		tmp = 0.5 * (math.sin(re) * (im * im))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 520.0)
		tmp = sin(re);
	elseif (im <= 2.7e+61)
		tmp = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666)));
	elseif (im <= 1.8e+150)
		tmp = Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664)))));
	else
		tmp = Float64(0.5 * Float64(sin(re) * Float64(im * im)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 520.0)
		tmp = sin(re);
	elseif (im <= 2.7e+61)
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	elseif (im <= 1.8e+150)
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	else
		tmp = 0.5 * (sin(re) * (im * im));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 520.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 2.7e+61], N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.8e+150], N[(re * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Sin[re], $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 2.7 \cdot 10^{+61}:\\
\;\;\;\;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}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < 520

    1. Initial program 100.0%

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

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

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

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

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

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

    if 520 < im < 2.7000000000000002e61

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

      \[\leadsto \color{blue}{{\left(\sin re \cdot -2\right)}^{-2}} \]
    5. Taylor expanded in re around 0 56.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/56.4%

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

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

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

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

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

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

    if 2.7000000000000002e61 < 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 90.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 520:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.7 \cdot 10^{+61}:\\ \;\;\;\;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 8: 82.0% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 550:\\ \;\;\;\;\sin re \cdot \left(im \cdot \left(0.5 \cdot im\right) + 1\right)\\ \mathbf{elif}\;im \leq 2.7 \cdot 10^{+60}:\\ \;\;\;\;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} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 550.0)
   (* (sin re) (+ (* im (* 0.5 im)) 1.0))
   (if (<= im 2.7e+60)
     (+
      0.08333333333333333
      (+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666)))
     (if (<= im 1.8e+150)
       (* re (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))
       (* 0.5 (* (sin re) (* im im)))))))
double code(double re, double im) {
	double tmp;
	if (im <= 550.0) {
		tmp = sin(re) * ((im * (0.5 * im)) + 1.0);
	} else if (im <= 2.7e+60) {
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	} else if (im <= 1.8e+150) {
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	} else {
		tmp = 0.5 * (sin(re) * (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 <= 550.0d0) then
        tmp = sin(re) * ((im * (0.5d0 * im)) + 1.0d0)
    else if (im <= 2.7d+60) then
        tmp = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
    else if (im <= 1.8d+150) then
        tmp = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
    else
        tmp = 0.5d0 * (sin(re) * (im * im))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 550.0) {
		tmp = Math.sin(re) * ((im * (0.5 * im)) + 1.0);
	} else if (im <= 2.7e+60) {
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	} else if (im <= 1.8e+150) {
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	} else {
		tmp = 0.5 * (Math.sin(re) * (im * im));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 550.0:
		tmp = math.sin(re) * ((im * (0.5 * im)) + 1.0)
	elif im <= 2.7e+60:
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666))
	elif im <= 1.8e+150:
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))))
	else:
		tmp = 0.5 * (math.sin(re) * (im * im))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 550.0)
		tmp = Float64(sin(re) * Float64(Float64(im * Float64(0.5 * im)) + 1.0));
	elseif (im <= 2.7e+60)
		tmp = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666)));
	elseif (im <= 1.8e+150)
		tmp = Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664)))));
	else
		tmp = Float64(0.5 * Float64(sin(re) * Float64(im * im)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 550.0)
		tmp = sin(re) * ((im * (0.5 * im)) + 1.0);
	elseif (im <= 2.7e+60)
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	elseif (im <= 1.8e+150)
		tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
	else
		tmp = 0.5 * (sin(re) * (im * im));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 550.0], N[(N[Sin[re], $MachinePrecision] * N[(N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.7e+60], N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.8e+150], N[(re * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Sin[re], $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 2.7 \cdot 10^{+60}:\\
\;\;\;\;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}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < 550

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

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

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

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

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

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

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

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

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

    if 550 < im < 2.6999999999999999e60

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

      \[\leadsto \color{blue}{{\left(\sin re \cdot -2\right)}^{-2}} \]
    5. Taylor expanded in re around 0 56.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/56.4%

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

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

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

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

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

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

    if 2.6999999999999999e60 < 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 90.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 550:\\ \;\;\;\;\sin re \cdot \left(im \cdot \left(0.5 \cdot im\right) + 1\right)\\ \mathbf{elif}\;im \leq 2.7 \cdot 10^{+60}:\\ \;\;\;\;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 9: 66.7% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 820:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 3.5 \cdot 10^{+61}:\\ \;\;\;\;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 (<= im 820.0)
   (sin re)
   (if (<= im 3.5e+61)
     (+
      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 (im <= 820.0) {
		tmp = sin(re);
	} else if (im <= 3.5e+61) {
		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 (im <= 820.0d0) then
        tmp = sin(re)
    else if (im <= 3.5d+61) 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 (im <= 820.0) {
		tmp = Math.sin(re);
	} else if (im <= 3.5e+61) {
		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 im <= 820.0:
		tmp = math.sin(re)
	elif im <= 3.5e+61:
		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 (im <= 820.0)
		tmp = sin(re);
	elseif (im <= 3.5e+61)
		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 (im <= 820.0)
		tmp = sin(re);
	elseif (im <= 3.5e+61)
		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[im, 820.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 3.5e+61], 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}\;im \leq 820:\\
\;\;\;\;\sin re\\

\mathbf{elif}\;im \leq 3.5 \cdot 10^{+61}:\\
\;\;\;\;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 im < 820

    1. Initial program 100.0%

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

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

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

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

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

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

    if 820 < im < 3.50000000000000018e61

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

      \[\leadsto \color{blue}{{\left(\sin re \cdot -2\right)}^{-2}} \]
    5. Taylor expanded in re around 0 56.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/56.4%

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

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

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

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

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

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

    if 3.50000000000000018e61 < 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 68.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. *-commutative68.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 820:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 3.5 \cdot 10^{+61}:\\ \;\;\;\;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: 56.3% accurate, 16.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 340 \lor \neg \left(im \leq 1.85 \cdot 10^{+61}\right):\\
\;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 340 < im < 1.85000000000000001e61

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

      \[\leadsto \color{blue}{{\left(\sin re \cdot -2\right)}^{-2}} \]
    5. Taylor expanded in re around 0 56.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/56.4%

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

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

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

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

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

      \[\leadsto \color{blue}{0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification59.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 340 \lor \neg \left(im \leq 1.85 \cdot 10^{+61}\right):\\ \;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \end{array} \]

Alternative 11: 49.8% accurate, 18.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 650 \lor \neg \left(im \leq 1.92 \cdot 10^{+146}\right):\\
\;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\


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

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

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

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

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

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

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

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

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

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

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

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

    if 650 < im < 1.91999999999999993e146

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

      \[\leadsto \color{blue}{{\left(\sin re \cdot -2\right)}^{-2}} \]
    5. Taylor expanded in re around 0 38.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/38.1%

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

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

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

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

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

      \[\leadsto \color{blue}{0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification51.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 650 \lor \neg \left(im \leq 1.92 \cdot 10^{+146}\right):\\ \;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \end{array} \]

Alternative 12: 45.8% accurate, 23.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.75 \cdot 10^{-286} \lor \neg \left(re \leq 1.4 \cdot 10^{-193}\right):\\
\;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if re < 1.74999999999999994e-286 or 1.4000000000000001e-193 < 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 74.1%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.74999999999999994e-286 < re < 1.4000000000000001e-193

    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-rr81.3%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 1.75 \cdot 10^{-286} \lor \neg \left(re \leq 1.4 \cdot 10^{-193}\right):\\ \;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.25}{re \cdot re}\\ \end{array} \]

Alternative 13: 34.9% accurate, 27.8× speedup?

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

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

\mathbf{elif}\;im \leq 1.16 \cdot 10^{+73}:\\
\;\;\;\;\frac{0.25}{re \cdot re}\\

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


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

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

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

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

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

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

    if 7.8e11 < im < 1.16000000000000007e73

    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-rr34.4%

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

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

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

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

    if 1.16000000000000007e73 < 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 62.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 780000000000:\\ \;\;\;\;re\\ \mathbf{elif}\;im \leq 1.16 \cdot 10^{+73}:\\ \;\;\;\;\frac{0.25}{re \cdot re}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot im\right)\right)\\ \end{array} \]

Alternative 14: 37.9% accurate, 27.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 780000000000:\\ \;\;\;\;re\\ \mathbf{elif}\;im \leq 5.4 \cdot 10^{+71}:\\ \;\;\;\;\frac{0.25}{re \cdot re}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 780000000000.0)
   re
   (if (<= im 5.4e+71) (/ 0.25 (* re re)) (* 0.5 (* re (* im im))))))
double code(double re, double im) {
	double tmp;
	if (im <= 780000000000.0) {
		tmp = re;
	} else if (im <= 5.4e+71) {
		tmp = 0.25 / (re * re);
	} else {
		tmp = 0.5 * (re * (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 <= 780000000000.0d0) then
        tmp = re
    else if (im <= 5.4d+71) then
        tmp = 0.25d0 / (re * re)
    else
        tmp = 0.5d0 * (re * (im * im))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 780000000000.0) {
		tmp = re;
	} else if (im <= 5.4e+71) {
		tmp = 0.25 / (re * re);
	} else {
		tmp = 0.5 * (re * (im * im));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 780000000000.0:
		tmp = re
	elif im <= 5.4e+71:
		tmp = 0.25 / (re * re)
	else:
		tmp = 0.5 * (re * (im * im))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 780000000000.0)
		tmp = re;
	elseif (im <= 5.4e+71)
		tmp = Float64(0.25 / Float64(re * re));
	else
		tmp = Float64(0.5 * Float64(re * Float64(im * im)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 780000000000.0)
		tmp = re;
	elseif (im <= 5.4e+71)
		tmp = 0.25 / (re * re);
	else
		tmp = 0.5 * (re * (im * im));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 780000000000.0], re, If[LessEqual[im, 5.4e+71], N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 5.4 \cdot 10^{+71}:\\
\;\;\;\;\frac{0.25}{re \cdot re}\\

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


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

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

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

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

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

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

    if 7.8e11 < im < 5.39999999999999993e71

    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-rr34.4%

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

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

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

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

    if 5.39999999999999993e71 < 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 62.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 780000000000:\\ \;\;\;\;re\\ \mathbf{elif}\;im \leq 5.4 \cdot 10^{+71}:\\ \;\;\;\;\frac{0.25}{re \cdot re}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\ \end{array} \]

Alternative 15: 37.9% accurate, 27.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 700000000000:\\ \;\;\;\;re\\ \mathbf{elif}\;im \leq 1.8 \cdot 10^{+71}:\\ \;\;\;\;\frac{0.5}{re} \cdot \frac{0.5}{re}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 700000000000.0)
   re
   (if (<= im 1.8e+71) (* (/ 0.5 re) (/ 0.5 re)) (* 0.5 (* re (* im im))))))
double code(double re, double im) {
	double tmp;
	if (im <= 700000000000.0) {
		tmp = re;
	} else if (im <= 1.8e+71) {
		tmp = (0.5 / re) * (0.5 / re);
	} else {
		tmp = 0.5 * (re * (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 <= 700000000000.0d0) then
        tmp = re
    else if (im <= 1.8d+71) then
        tmp = (0.5d0 / re) * (0.5d0 / re)
    else
        tmp = 0.5d0 * (re * (im * im))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 700000000000.0) {
		tmp = re;
	} else if (im <= 1.8e+71) {
		tmp = (0.5 / re) * (0.5 / re);
	} else {
		tmp = 0.5 * (re * (im * im));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 700000000000.0:
		tmp = re
	elif im <= 1.8e+71:
		tmp = (0.5 / re) * (0.5 / re)
	else:
		tmp = 0.5 * (re * (im * im))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 700000000000.0)
		tmp = re;
	elseif (im <= 1.8e+71)
		tmp = Float64(Float64(0.5 / re) * Float64(0.5 / re));
	else
		tmp = Float64(0.5 * Float64(re * Float64(im * im)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 700000000000.0)
		tmp = re;
	elseif (im <= 1.8e+71)
		tmp = (0.5 / re) * (0.5 / re);
	else
		tmp = 0.5 * (re * (im * im));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 700000000000.0], re, If[LessEqual[im, 1.8e+71], N[(N[(0.5 / re), $MachinePrecision] * N[(0.5 / re), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 1.8 \cdot 10^{+71}:\\
\;\;\;\;\frac{0.5}{re} \cdot \frac{0.5}{re}\\

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


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

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

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

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

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

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

    if 7e11 < im < 1.8e71

    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-rr34.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.8e71 < 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 62.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 700000000000:\\ \;\;\;\;re\\ \mathbf{elif}\;im \leq 1.8 \cdot 10^{+71}:\\ \;\;\;\;\frac{0.5}{re} \cdot \frac{0.5}{re}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\ \end{array} \]

Alternative 16: 30.4% accurate, 43.8× speedup?

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

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

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


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

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

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

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

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

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

    if 7e11 < 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-rr16.0%

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

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

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

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

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

Alternative 17: 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 18: 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 19: 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 20: 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 21: 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 22: 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 23: 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 24: 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 25: 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))))