math.sin on complex, real part

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

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 17 alternatives:

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

Initial Program: 100.0% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 71.7% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.1 \cdot 10^{-11}:\\
\;\;\;\;\sin re\\

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if 1.1000000000000001e-11 < im < 1.31999999999999998e154

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    if 1.31999999999999998e154 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 1.1 \cdot 10^{-11}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.32 \cdot 10^{+154}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} + e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(0.5 \cdot {im}^{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 65.1% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 680:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.32 \cdot 10^{+154}:\\ \;\;\;\;\sqrt[3]{{\left(\frac{0.5}{re}\right)}^{6}}\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(0.5 \cdot {im}^{2}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 680.0)
   (sin re)
   (if (<= im 1.32e+154)
     (cbrt (pow (/ 0.5 re) 6.0))
     (* (sin re) (* 0.5 (pow im 2.0))))))
double code(double re, double im) {
	double tmp;
	if (im <= 680.0) {
		tmp = sin(re);
	} else if (im <= 1.32e+154) {
		tmp = cbrt(pow((0.5 / re), 6.0));
	} else {
		tmp = sin(re) * (0.5 * pow(im, 2.0));
	}
	return tmp;
}
public static double code(double re, double im) {
	double tmp;
	if (im <= 680.0) {
		tmp = Math.sin(re);
	} else if (im <= 1.32e+154) {
		tmp = Math.cbrt(Math.pow((0.5 / re), 6.0));
	} else {
		tmp = Math.sin(re) * (0.5 * Math.pow(im, 2.0));
	}
	return tmp;
}
function code(re, im)
	tmp = 0.0
	if (im <= 680.0)
		tmp = sin(re);
	elseif (im <= 1.32e+154)
		tmp = cbrt((Float64(0.5 / re) ^ 6.0));
	else
		tmp = Float64(sin(re) * Float64(0.5 * (im ^ 2.0)));
	end
	return tmp
end
code[re_, im_] := If[LessEqual[im, 680.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.32e+154], N[Power[N[Power[N[(0.5 / re), $MachinePrecision], 6.0], $MachinePrecision], 1/3], $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(0.5 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 1.32 \cdot 10^{+154}:\\
\;\;\;\;\sqrt[3]{{\left(\frac{0.5}{re}\right)}^{6}}\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if 680 < im < 1.31999999999999998e154

    1. Initial program 100.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right)} \]
    4. Add Preprocessing
    5. Applied egg-rr27.3%

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

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

        \[\leadsto \color{blue}{\sqrt{\frac{0.25}{{re}^{2}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}}} \]
      2. sqrt-div27.1%

        \[\leadsto \color{blue}{\frac{\sqrt{0.25}}{\sqrt{{re}^{2}}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      3. metadata-eval27.1%

        \[\leadsto \frac{\color{blue}{0.5}}{\sqrt{{re}^{2}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      4. unpow227.1%

        \[\leadsto \frac{0.5}{\sqrt{\color{blue}{re \cdot re}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      5. sqrt-prod26.8%

        \[\leadsto \frac{0.5}{\color{blue}{\sqrt{re} \cdot \sqrt{re}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      6. add-sqr-sqrt42.4%

        \[\leadsto \frac{0.5}{\color{blue}{re}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      7. sqrt-div42.4%

        \[\leadsto \frac{0.5}{re} \cdot \color{blue}{\frac{\sqrt{0.25}}{\sqrt{{re}^{2}}}} \]
      8. metadata-eval42.4%

        \[\leadsto \frac{0.5}{re} \cdot \frac{\color{blue}{0.5}}{\sqrt{{re}^{2}}} \]
      9. unpow242.4%

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

        \[\leadsto \frac{0.5}{re} \cdot \frac{0.5}{\color{blue}{\sqrt{re} \cdot \sqrt{re}}} \]
      11. add-sqr-sqrt27.1%

        \[\leadsto \frac{0.5}{re} \cdot \frac{0.5}{\color{blue}{re}} \]
    8. Applied egg-rr27.1%

      \[\leadsto \color{blue}{\frac{0.5}{re} \cdot \frac{0.5}{re}} \]
    9. Step-by-step derivation
      1. add-cbrt-cube34.0%

        \[\leadsto \color{blue}{\sqrt[3]{\left(\left(\frac{0.5}{re} \cdot \frac{0.5}{re}\right) \cdot \left(\frac{0.5}{re} \cdot \frac{0.5}{re}\right)\right) \cdot \left(\frac{0.5}{re} \cdot \frac{0.5}{re}\right)}} \]
      2. pow1/334.0%

        \[\leadsto \color{blue}{{\left(\left(\left(\frac{0.5}{re} \cdot \frac{0.5}{re}\right) \cdot \left(\frac{0.5}{re} \cdot \frac{0.5}{re}\right)\right) \cdot \left(\frac{0.5}{re} \cdot \frac{0.5}{re}\right)\right)}^{0.3333333333333333}} \]
      3. pow334.0%

        \[\leadsto {\color{blue}{\left({\left(\frac{0.5}{re} \cdot \frac{0.5}{re}\right)}^{3}\right)}}^{0.3333333333333333} \]
      4. pow234.0%

        \[\leadsto {\left({\color{blue}{\left({\left(\frac{0.5}{re}\right)}^{2}\right)}}^{3}\right)}^{0.3333333333333333} \]
      5. pow-pow34.0%

        \[\leadsto {\color{blue}{\left({\left(\frac{0.5}{re}\right)}^{\left(2 \cdot 3\right)}\right)}}^{0.3333333333333333} \]
      6. metadata-eval34.0%

        \[\leadsto {\left({\left(\frac{0.5}{re}\right)}^{\color{blue}{6}}\right)}^{0.3333333333333333} \]
    10. Applied egg-rr34.0%

      \[\leadsto \color{blue}{{\left({\left(\frac{0.5}{re}\right)}^{6}\right)}^{0.3333333333333333}} \]
    11. Step-by-step derivation
      1. unpow1/334.0%

        \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{0.5}{re}\right)}^{6}}} \]
    12. Simplified34.0%

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{0.5}{re}\right)}^{6}}} \]

    if 1.31999999999999998e154 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 680:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.32 \cdot 10^{+154}:\\ \;\;\;\;\sqrt[3]{{\left(\frac{0.5}{re}\right)}^{6}}\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(0.5 \cdot {im}^{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 61.7% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 750:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.5 \cdot 10^{+142}:\\ \;\;\;\;\sqrt[3]{{\left(\frac{0.5}{re}\right)}^{6}}\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.5 \cdot {im}^{2} + 1\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 750.0)
   (sin re)
   (if (<= im 2.5e+142)
     (cbrt (pow (/ 0.5 re) 6.0))
     (* re (+ (* 0.5 (pow im 2.0)) 1.0)))))
double code(double re, double im) {
	double tmp;
	if (im <= 750.0) {
		tmp = sin(re);
	} else if (im <= 2.5e+142) {
		tmp = cbrt(pow((0.5 / re), 6.0));
	} else {
		tmp = re * ((0.5 * pow(im, 2.0)) + 1.0);
	}
	return tmp;
}
public static double code(double re, double im) {
	double tmp;
	if (im <= 750.0) {
		tmp = Math.sin(re);
	} else if (im <= 2.5e+142) {
		tmp = Math.cbrt(Math.pow((0.5 / re), 6.0));
	} else {
		tmp = re * ((0.5 * Math.pow(im, 2.0)) + 1.0);
	}
	return tmp;
}
function code(re, im)
	tmp = 0.0
	if (im <= 750.0)
		tmp = sin(re);
	elseif (im <= 2.5e+142)
		tmp = cbrt((Float64(0.5 / re) ^ 6.0));
	else
		tmp = Float64(re * Float64(Float64(0.5 * (im ^ 2.0)) + 1.0));
	end
	return tmp
end
code[re_, im_] := If[LessEqual[im, 750.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 2.5e+142], N[Power[N[Power[N[(0.5 / re), $MachinePrecision], 6.0], $MachinePrecision], 1/3], $MachinePrecision], N[(re * N[(N[(0.5 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 2.5 \cdot 10^{+142}:\\
\;\;\;\;\sqrt[3]{{\left(\frac{0.5}{re}\right)}^{6}}\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if 750 < im < 2.5000000000000001e142

    1. Initial program 100.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right)} \]
    4. Add Preprocessing
    5. Applied egg-rr27.3%

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

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

        \[\leadsto \color{blue}{\sqrt{\frac{0.25}{{re}^{2}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}}} \]
      2. sqrt-div27.1%

        \[\leadsto \color{blue}{\frac{\sqrt{0.25}}{\sqrt{{re}^{2}}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      3. metadata-eval27.1%

        \[\leadsto \frac{\color{blue}{0.5}}{\sqrt{{re}^{2}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      4. unpow227.1%

        \[\leadsto \frac{0.5}{\sqrt{\color{blue}{re \cdot re}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      5. sqrt-prod26.8%

        \[\leadsto \frac{0.5}{\color{blue}{\sqrt{re} \cdot \sqrt{re}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      6. add-sqr-sqrt40.8%

        \[\leadsto \frac{0.5}{\color{blue}{re}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      7. sqrt-div40.8%

        \[\leadsto \frac{0.5}{re} \cdot \color{blue}{\frac{\sqrt{0.25}}{\sqrt{{re}^{2}}}} \]
      8. metadata-eval40.8%

        \[\leadsto \frac{0.5}{re} \cdot \frac{\color{blue}{0.5}}{\sqrt{{re}^{2}}} \]
      9. unpow240.8%

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

        \[\leadsto \frac{0.5}{re} \cdot \frac{0.5}{\color{blue}{\sqrt{re} \cdot \sqrt{re}}} \]
      11. add-sqr-sqrt27.1%

        \[\leadsto \frac{0.5}{re} \cdot \frac{0.5}{\color{blue}{re}} \]
    8. Applied egg-rr27.1%

      \[\leadsto \color{blue}{\frac{0.5}{re} \cdot \frac{0.5}{re}} \]
    9. Step-by-step derivation
      1. add-cbrt-cube31.1%

        \[\leadsto \color{blue}{\sqrt[3]{\left(\left(\frac{0.5}{re} \cdot \frac{0.5}{re}\right) \cdot \left(\frac{0.5}{re} \cdot \frac{0.5}{re}\right)\right) \cdot \left(\frac{0.5}{re} \cdot \frac{0.5}{re}\right)}} \]
      2. pow1/331.1%

        \[\leadsto \color{blue}{{\left(\left(\left(\frac{0.5}{re} \cdot \frac{0.5}{re}\right) \cdot \left(\frac{0.5}{re} \cdot \frac{0.5}{re}\right)\right) \cdot \left(\frac{0.5}{re} \cdot \frac{0.5}{re}\right)\right)}^{0.3333333333333333}} \]
      3. pow331.1%

        \[\leadsto {\color{blue}{\left({\left(\frac{0.5}{re} \cdot \frac{0.5}{re}\right)}^{3}\right)}}^{0.3333333333333333} \]
      4. pow231.1%

        \[\leadsto {\left({\color{blue}{\left({\left(\frac{0.5}{re}\right)}^{2}\right)}}^{3}\right)}^{0.3333333333333333} \]
      5. pow-pow31.1%

        \[\leadsto {\color{blue}{\left({\left(\frac{0.5}{re}\right)}^{\left(2 \cdot 3\right)}\right)}}^{0.3333333333333333} \]
      6. metadata-eval31.1%

        \[\leadsto {\left({\left(\frac{0.5}{re}\right)}^{\color{blue}{6}}\right)}^{0.3333333333333333} \]
    10. Applied egg-rr31.1%

      \[\leadsto \color{blue}{{\left({\left(\frac{0.5}{re}\right)}^{6}\right)}^{0.3333333333333333}} \]
    11. Step-by-step derivation
      1. unpow1/331.1%

        \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{0.5}{re}\right)}^{6}}} \]
    12. Simplified31.1%

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{0.5}{re}\right)}^{6}}} \]

    if 2.5000000000000001e142 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 750:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.5 \cdot 10^{+142}:\\ \;\;\;\;\sqrt[3]{{\left(\frac{0.5}{re}\right)}^{6}}\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.5 \cdot {im}^{2} + 1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 61.2% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 490:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+121}:\\ \;\;\;\;0.08333333333333333 + \frac{\frac{0.25}{re}}{re}\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.5 \cdot {im}^{2} + 1\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 490.0)
   (sin re)
   (if (<= im 1.35e+121)
     (+ 0.08333333333333333 (/ (/ 0.25 re) re))
     (* re (+ (* 0.5 (pow im 2.0)) 1.0)))))
double code(double re, double im) {
	double tmp;
	if (im <= 490.0) {
		tmp = sin(re);
	} else if (im <= 1.35e+121) {
		tmp = 0.08333333333333333 + ((0.25 / re) / re);
	} else {
		tmp = re * ((0.5 * pow(im, 2.0)) + 1.0);
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (im <= 490.0d0) then
        tmp = sin(re)
    else if (im <= 1.35d+121) then
        tmp = 0.08333333333333333d0 + ((0.25d0 / re) / re)
    else
        tmp = re * ((0.5d0 * (im ** 2.0d0)) + 1.0d0)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 490.0) {
		tmp = Math.sin(re);
	} else if (im <= 1.35e+121) {
		tmp = 0.08333333333333333 + ((0.25 / re) / re);
	} else {
		tmp = re * ((0.5 * Math.pow(im, 2.0)) + 1.0);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 490.0:
		tmp = math.sin(re)
	elif im <= 1.35e+121:
		tmp = 0.08333333333333333 + ((0.25 / re) / re)
	else:
		tmp = re * ((0.5 * math.pow(im, 2.0)) + 1.0)
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 490.0)
		tmp = sin(re);
	elseif (im <= 1.35e+121)
		tmp = Float64(0.08333333333333333 + Float64(Float64(0.25 / re) / re));
	else
		tmp = Float64(re * Float64(Float64(0.5 * (im ^ 2.0)) + 1.0));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 490.0)
		tmp = sin(re);
	elseif (im <= 1.35e+121)
		tmp = 0.08333333333333333 + ((0.25 / re) / re);
	else
		tmp = re * ((0.5 * (im ^ 2.0)) + 1.0);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 490.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.35e+121], N[(0.08333333333333333 + N[(N[(0.25 / re), $MachinePrecision] / re), $MachinePrecision]), $MachinePrecision], N[(re * N[(N[(0.5 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if 490 < im < 1.3500000000000001e121

    1. Initial program 100.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right)} \]
    4. Add Preprocessing
    5. Applied egg-rr28.7%

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

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

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

        \[\leadsto 0.08333333333333333 + \frac{\color{blue}{0.25}}{{re}^{2}} \]
    8. Simplified28.7%

      \[\leadsto \color{blue}{0.08333333333333333 + \frac{0.25}{{re}^{2}}} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt28.5%

        \[\leadsto \color{blue}{\sqrt{\frac{0.25}{{re}^{2}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}}} \]
      2. sqrt-div28.5%

        \[\leadsto \color{blue}{\frac{\sqrt{0.25}}{\sqrt{{re}^{2}}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      3. metadata-eval28.5%

        \[\leadsto \frac{\color{blue}{0.5}}{\sqrt{{re}^{2}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      4. unpow228.5%

        \[\leadsto \frac{0.5}{\sqrt{\color{blue}{re \cdot re}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      5. sqrt-prod28.2%

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

        \[\leadsto \frac{0.5}{\color{blue}{re}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      7. sqrt-div45.8%

        \[\leadsto \frac{0.5}{re} \cdot \color{blue}{\frac{\sqrt{0.25}}{\sqrt{{re}^{2}}}} \]
      8. metadata-eval45.8%

        \[\leadsto \frac{0.5}{re} \cdot \frac{\color{blue}{0.5}}{\sqrt{{re}^{2}}} \]
      9. unpow245.8%

        \[\leadsto \frac{0.5}{re} \cdot \frac{0.5}{\sqrt{\color{blue}{re \cdot re}}} \]
      10. sqrt-prod28.2%

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

        \[\leadsto \frac{0.5}{re} \cdot \frac{0.5}{\color{blue}{re}} \]
    10. Applied egg-rr28.7%

      \[\leadsto 0.08333333333333333 + \color{blue}{\frac{0.5}{re} \cdot \frac{0.5}{re}} \]
    11. Step-by-step derivation
      1. associate-*l/28.5%

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

        \[\leadsto \frac{\color{blue}{\frac{0.5 \cdot 0.5}{re}}}{re} \]
      3. metadata-eval28.5%

        \[\leadsto \frac{\frac{\color{blue}{0.25}}{re}}{re} \]
    12. Applied egg-rr28.7%

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

    if 1.3500000000000001e121 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 490:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+121}:\\ \;\;\;\;0.08333333333333333 + \frac{\frac{0.25}{re}}{re}\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.5 \cdot {im}^{2} + 1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 61.2% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 490:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+121}:\\ \;\;\;\;0.08333333333333333 + \frac{\frac{0.25}{re}}{re}\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.5 \cdot {im}^{2}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 490.0)
   (sin re)
   (if (<= im 1.35e+121)
     (+ 0.08333333333333333 (/ (/ 0.25 re) re))
     (* re (* 0.5 (pow im 2.0))))))
double code(double re, double im) {
	double tmp;
	if (im <= 490.0) {
		tmp = sin(re);
	} else if (im <= 1.35e+121) {
		tmp = 0.08333333333333333 + ((0.25 / re) / re);
	} else {
		tmp = re * (0.5 * pow(im, 2.0));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (im <= 490.0d0) then
        tmp = sin(re)
    else if (im <= 1.35d+121) then
        tmp = 0.08333333333333333d0 + ((0.25d0 / re) / re)
    else
        tmp = re * (0.5d0 * (im ** 2.0d0))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 490.0) {
		tmp = Math.sin(re);
	} else if (im <= 1.35e+121) {
		tmp = 0.08333333333333333 + ((0.25 / re) / re);
	} else {
		tmp = re * (0.5 * Math.pow(im, 2.0));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 490.0:
		tmp = math.sin(re)
	elif im <= 1.35e+121:
		tmp = 0.08333333333333333 + ((0.25 / re) / re)
	else:
		tmp = re * (0.5 * math.pow(im, 2.0))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 490.0)
		tmp = sin(re);
	elseif (im <= 1.35e+121)
		tmp = Float64(0.08333333333333333 + Float64(Float64(0.25 / re) / re));
	else
		tmp = Float64(re * Float64(0.5 * (im ^ 2.0)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 490.0)
		tmp = sin(re);
	elseif (im <= 1.35e+121)
		tmp = 0.08333333333333333 + ((0.25 / re) / re);
	else
		tmp = re * (0.5 * (im ^ 2.0));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 490.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.35e+121], N[(0.08333333333333333 + N[(N[(0.25 / re), $MachinePrecision] / re), $MachinePrecision]), $MachinePrecision], N[(re * N[(0.5 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if 490 < im < 1.3500000000000001e121

    1. Initial program 100.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right)} \]
    4. Add Preprocessing
    5. Applied egg-rr28.7%

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

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

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

        \[\leadsto 0.08333333333333333 + \frac{\color{blue}{0.25}}{{re}^{2}} \]
    8. Simplified28.7%

      \[\leadsto \color{blue}{0.08333333333333333 + \frac{0.25}{{re}^{2}}} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt28.5%

        \[\leadsto \color{blue}{\sqrt{\frac{0.25}{{re}^{2}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}}} \]
      2. sqrt-div28.5%

        \[\leadsto \color{blue}{\frac{\sqrt{0.25}}{\sqrt{{re}^{2}}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      3. metadata-eval28.5%

        \[\leadsto \frac{\color{blue}{0.5}}{\sqrt{{re}^{2}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      4. unpow228.5%

        \[\leadsto \frac{0.5}{\sqrt{\color{blue}{re \cdot re}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      5. sqrt-prod28.2%

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

        \[\leadsto \frac{0.5}{\color{blue}{re}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      7. sqrt-div45.8%

        \[\leadsto \frac{0.5}{re} \cdot \color{blue}{\frac{\sqrt{0.25}}{\sqrt{{re}^{2}}}} \]
      8. metadata-eval45.8%

        \[\leadsto \frac{0.5}{re} \cdot \frac{\color{blue}{0.5}}{\sqrt{{re}^{2}}} \]
      9. unpow245.8%

        \[\leadsto \frac{0.5}{re} \cdot \frac{0.5}{\sqrt{\color{blue}{re \cdot re}}} \]
      10. sqrt-prod28.2%

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

        \[\leadsto \frac{0.5}{re} \cdot \frac{0.5}{\color{blue}{re}} \]
    10. Applied egg-rr28.7%

      \[\leadsto 0.08333333333333333 + \color{blue}{\frac{0.5}{re} \cdot \frac{0.5}{re}} \]
    11. Step-by-step derivation
      1. associate-*l/28.5%

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

        \[\leadsto \frac{\color{blue}{\frac{0.5 \cdot 0.5}{re}}}{re} \]
      3. metadata-eval28.5%

        \[\leadsto \frac{\frac{\color{blue}{0.25}}{re}}{re} \]
    12. Applied egg-rr28.7%

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

    if 1.3500000000000001e121 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 490:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+121}:\\ \;\;\;\;0.08333333333333333 + \frac{\frac{0.25}{re}}{re}\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.5 \cdot {im}^{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 52.9% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 770:\\ \;\;\;\;\sin re\\ \mathbf{else}:\\ \;\;\;\;0.08333333333333333 + \frac{\frac{0.25}{re}}{re}\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 770.0) (sin re) (+ 0.08333333333333333 (/ (/ 0.25 re) re))))
double code(double re, double im) {
	double tmp;
	if (im <= 770.0) {
		tmp = sin(re);
	} else {
		tmp = 0.08333333333333333 + ((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 <= 770.0d0) then
        tmp = sin(re)
    else
        tmp = 0.08333333333333333d0 + ((0.25d0 / re) / re)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 770.0) {
		tmp = Math.sin(re);
	} else {
		tmp = 0.08333333333333333 + ((0.25 / re) / re);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 770.0:
		tmp = math.sin(re)
	else:
		tmp = 0.08333333333333333 + ((0.25 / re) / re)
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 770.0)
		tmp = sin(re);
	else
		tmp = Float64(0.08333333333333333 + Float64(Float64(0.25 / re) / re));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 770.0)
		tmp = sin(re);
	else
		tmp = 0.08333333333333333 + ((0.25 / re) / re);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 770.0], N[Sin[re], $MachinePrecision], N[(0.08333333333333333 + N[(N[(0.25 / re), $MachinePrecision] / re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if 770 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right)} \]
    4. Add Preprocessing
    5. Applied egg-rr22.7%

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

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

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

        \[\leadsto 0.08333333333333333 + \frac{\color{blue}{0.25}}{{re}^{2}} \]
    8. Simplified22.7%

      \[\leadsto \color{blue}{0.08333333333333333 + \frac{0.25}{{re}^{2}}} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt22.5%

        \[\leadsto \color{blue}{\sqrt{\frac{0.25}{{re}^{2}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}}} \]
      2. sqrt-div22.5%

        \[\leadsto \color{blue}{\frac{\sqrt{0.25}}{\sqrt{{re}^{2}}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      3. metadata-eval22.5%

        \[\leadsto \frac{\color{blue}{0.5}}{\sqrt{{re}^{2}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      4. unpow222.5%

        \[\leadsto \frac{0.5}{\sqrt{\color{blue}{re \cdot re}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      5. sqrt-prod22.2%

        \[\leadsto \frac{0.5}{\color{blue}{\sqrt{re} \cdot \sqrt{re}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      6. add-sqr-sqrt38.8%

        \[\leadsto \frac{0.5}{\color{blue}{re}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      7. sqrt-div38.8%

        \[\leadsto \frac{0.5}{re} \cdot \color{blue}{\frac{\sqrt{0.25}}{\sqrt{{re}^{2}}}} \]
      8. metadata-eval38.8%

        \[\leadsto \frac{0.5}{re} \cdot \frac{\color{blue}{0.5}}{\sqrt{{re}^{2}}} \]
      9. unpow238.8%

        \[\leadsto \frac{0.5}{re} \cdot \frac{0.5}{\sqrt{\color{blue}{re \cdot re}}} \]
      10. sqrt-prod22.2%

        \[\leadsto \frac{0.5}{re} \cdot \frac{0.5}{\color{blue}{\sqrt{re} \cdot \sqrt{re}}} \]
      11. add-sqr-sqrt22.5%

        \[\leadsto \frac{0.5}{re} \cdot \frac{0.5}{\color{blue}{re}} \]
    10. Applied egg-rr22.7%

      \[\leadsto 0.08333333333333333 + \color{blue}{\frac{0.5}{re} \cdot \frac{0.5}{re}} \]
    11. Step-by-step derivation
      1. associate-*l/22.5%

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

        \[\leadsto \frac{\color{blue}{\frac{0.5 \cdot 0.5}{re}}}{re} \]
      3. metadata-eval22.5%

        \[\leadsto \frac{\frac{\color{blue}{0.25}}{re}}{re} \]
    12. Applied egg-rr22.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 770:\\ \;\;\;\;\sin re\\ \mathbf{else}:\\ \;\;\;\;0.08333333333333333 + \frac{\frac{0.25}{re}}{re}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 29.0% accurate, 25.7× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

    if 0.28999999999999998 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right)} \]
    4. Add Preprocessing
    5. Applied egg-rr21.9%

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

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

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

        \[\leadsto 0.08333333333333333 + \frac{\color{blue}{0.25}}{{re}^{2}} \]
    8. Simplified21.9%

      \[\leadsto \color{blue}{0.08333333333333333 + \frac{0.25}{{re}^{2}}} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt21.8%

        \[\leadsto \color{blue}{\sqrt{\frac{0.25}{{re}^{2}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}}} \]
      2. sqrt-div21.8%

        \[\leadsto \color{blue}{\frac{\sqrt{0.25}}{\sqrt{{re}^{2}}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      3. metadata-eval21.8%

        \[\leadsto \frac{\color{blue}{0.5}}{\sqrt{{re}^{2}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      4. unpow221.8%

        \[\leadsto \frac{0.5}{\sqrt{\color{blue}{re \cdot re}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      5. sqrt-prod21.5%

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

        \[\leadsto \frac{0.5}{\color{blue}{re}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      7. sqrt-div37.6%

        \[\leadsto \frac{0.5}{re} \cdot \color{blue}{\frac{\sqrt{0.25}}{\sqrt{{re}^{2}}}} \]
      8. metadata-eval37.6%

        \[\leadsto \frac{0.5}{re} \cdot \frac{\color{blue}{0.5}}{\sqrt{{re}^{2}}} \]
      9. unpow237.6%

        \[\leadsto \frac{0.5}{re} \cdot \frac{0.5}{\sqrt{\color{blue}{re \cdot re}}} \]
      10. sqrt-prod21.5%

        \[\leadsto \frac{0.5}{re} \cdot \frac{0.5}{\color{blue}{\sqrt{re} \cdot \sqrt{re}}} \]
      11. add-sqr-sqrt21.8%

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

      \[\leadsto 0.08333333333333333 + \color{blue}{\frac{0.5}{re} \cdot \frac{0.5}{re}} \]
    11. Step-by-step derivation
      1. associate-*l/21.8%

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

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

        \[\leadsto \frac{\frac{\color{blue}{0.25}}{re}}{re} \]
    12. Applied egg-rr21.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.29:\\ \;\;\;\;re\\ \mathbf{else}:\\ \;\;\;\;0.08333333333333333 + \frac{\frac{0.25}{re}}{re}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 29.0% accurate, 30.9× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if 1080 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right)} \]
    4. Add Preprocessing
    5. Applied egg-rr22.7%

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

      \[\leadsto \color{blue}{\frac{0.25}{{re}^{2}}} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt22.5%

        \[\leadsto \color{blue}{\sqrt{\frac{0.25}{{re}^{2}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}}} \]
      2. sqrt-div22.5%

        \[\leadsto \color{blue}{\frac{\sqrt{0.25}}{\sqrt{{re}^{2}}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      3. metadata-eval22.5%

        \[\leadsto \frac{\color{blue}{0.5}}{\sqrt{{re}^{2}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      4. unpow222.5%

        \[\leadsto \frac{0.5}{\sqrt{\color{blue}{re \cdot re}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      5. sqrt-prod22.2%

        \[\leadsto \frac{0.5}{\color{blue}{\sqrt{re} \cdot \sqrt{re}}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      6. add-sqr-sqrt38.8%

        \[\leadsto \frac{0.5}{\color{blue}{re}} \cdot \sqrt{\frac{0.25}{{re}^{2}}} \]
      7. sqrt-div38.8%

        \[\leadsto \frac{0.5}{re} \cdot \color{blue}{\frac{\sqrt{0.25}}{\sqrt{{re}^{2}}}} \]
      8. metadata-eval38.8%

        \[\leadsto \frac{0.5}{re} \cdot \frac{\color{blue}{0.5}}{\sqrt{{re}^{2}}} \]
      9. unpow238.8%

        \[\leadsto \frac{0.5}{re} \cdot \frac{0.5}{\sqrt{\color{blue}{re \cdot re}}} \]
      10. sqrt-prod22.2%

        \[\leadsto \frac{0.5}{re} \cdot \frac{0.5}{\color{blue}{\sqrt{re} \cdot \sqrt{re}}} \]
      11. add-sqr-sqrt22.5%

        \[\leadsto \frac{0.5}{re} \cdot \frac{0.5}{\color{blue}{re}} \]
    8. Applied egg-rr22.5%

      \[\leadsto \color{blue}{\frac{0.5}{re} \cdot \frac{0.5}{re}} \]
    9. Step-by-step derivation
      1. associate-*l/22.5%

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

        \[\leadsto \frac{\color{blue}{\frac{0.5 \cdot 0.5}{re}}}{re} \]
      3. metadata-eval22.5%

        \[\leadsto \frac{\frac{\color{blue}{0.25}}{re}}{re} \]
    10. Applied egg-rr22.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 1080:\\ \;\;\;\;re\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{0.25}{re}}{re}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 4.1% accurate, 309.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto -4 \]
  9. Add Preprocessing

Alternative 11: 4.7% accurate, 309.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto -1 \]
  9. Add Preprocessing

Alternative 12: 4.2% accurate, 309.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 0.0625 \]
  9. Add Preprocessing

Alternative 13: 4.2% accurate, 309.0× speedup?

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right)} \]
  4. Add Preprocessing
  5. Applied egg-rr12.1%

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

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

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

      \[\leadsto 0.08333333333333333 + \frac{\color{blue}{0.25}}{{re}^{2}} \]
  8. Simplified12.1%

    \[\leadsto \color{blue}{0.08333333333333333 + \frac{0.25}{{re}^{2}}} \]
  9. Taylor expanded in re around inf 4.2%

    \[\leadsto \color{blue}{0.08333333333333333} \]
  10. Final simplification4.2%

    \[\leadsto 0.08333333333333333 \]
  11. Add Preprocessing

Alternative 14: 4.4% accurate, 309.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 0.25 \]
  9. Add Preprocessing

Alternative 15: 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. distribute-rgt-in100.0%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 0.5 \]
  9. Add Preprocessing

Alternative 16: 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. distribute-rgt-in100.0%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 1 \]
  9. Add Preprocessing

Alternative 17: 26.3% accurate, 309.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto re \]
  9. Add Preprocessing

Reproduce

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