math.sin on complex, real part

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

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 22 alternatives:

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

Initial Program: 100.0% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \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. remove-double-neg100.0%

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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. Add Preprocessing

Alternative 2: 82.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 0.22:\\ \;\;\;\;\sin re \cdot \left(1 + 0.5 \cdot {im}^{2}\right)\\ \mathbf{elif}\;im \leq 1.1 \cdot 10^{+98}:\\ \;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{elif}\;im \leq 10^{+152}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(-0.16666666666666666 \cdot {re}^{3}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot {im}^{2}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 0.22)
   (* (sin re) (+ 1.0 (* 0.5 (pow im 2.0))))
   (if (<= im 1.1e+98)
     (* (+ (exp (- im)) (exp im)) (* 0.5 re))
     (if (<= im 1e+152)
       (log1p (expm1 (* -0.16666666666666666 (pow re 3.0))))
       (* 0.5 (* (sin re) (pow im 2.0)))))))
double code(double re, double im) {
	double tmp;
	if (im <= 0.22) {
		tmp = sin(re) * (1.0 + (0.5 * pow(im, 2.0)));
	} else if (im <= 1.1e+98) {
		tmp = (exp(-im) + exp(im)) * (0.5 * re);
	} else if (im <= 1e+152) {
		tmp = log1p(expm1((-0.16666666666666666 * pow(re, 3.0))));
	} else {
		tmp = 0.5 * (sin(re) * pow(im, 2.0));
	}
	return tmp;
}
public static double code(double re, double im) {
	double tmp;
	if (im <= 0.22) {
		tmp = Math.sin(re) * (1.0 + (0.5 * Math.pow(im, 2.0)));
	} else if (im <= 1.1e+98) {
		tmp = (Math.exp(-im) + Math.exp(im)) * (0.5 * re);
	} else if (im <= 1e+152) {
		tmp = Math.log1p(Math.expm1((-0.16666666666666666 * Math.pow(re, 3.0))));
	} else {
		tmp = 0.5 * (Math.sin(re) * Math.pow(im, 2.0));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 0.22:
		tmp = math.sin(re) * (1.0 + (0.5 * math.pow(im, 2.0)))
	elif im <= 1.1e+98:
		tmp = (math.exp(-im) + math.exp(im)) * (0.5 * re)
	elif im <= 1e+152:
		tmp = math.log1p(math.expm1((-0.16666666666666666 * math.pow(re, 3.0))))
	else:
		tmp = 0.5 * (math.sin(re) * math.pow(im, 2.0))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 0.22)
		tmp = Float64(sin(re) * Float64(1.0 + Float64(0.5 * (im ^ 2.0))));
	elseif (im <= 1.1e+98)
		tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * re));
	elseif (im <= 1e+152)
		tmp = log1p(expm1(Float64(-0.16666666666666666 * (re ^ 3.0))));
	else
		tmp = Float64(0.5 * Float64(sin(re) * (im ^ 2.0)));
	end
	return tmp
end
code[re_, im_] := If[LessEqual[im, 0.22], N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(0.5 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+98], N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1e+152], N[Log[1 + N[(Exp[N[(-0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(0.5 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;im \leq 10^{+152}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(-0.16666666666666666 \cdot {re}^{3}\right)\right)\\

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


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

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 82.0%

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

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

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

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

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

    if 0.220000000000000001 < im < 1.10000000000000004e98

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 87.5%

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

    if 1.10000000000000004e98 < im < 1e152

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 3.0%

      \[\leadsto \color{blue}{\sin re} \]
    6. Taylor expanded in re around 0 32.7%

      \[\leadsto \color{blue}{re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)} \]
    7. Taylor expanded in re around inf 32.3%

      \[\leadsto \color{blue}{-0.16666666666666666 \cdot {re}^{3}} \]
    8. Step-by-step derivation
      1. log1p-expm1-u54.2%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(-0.16666666666666666 \cdot {re}^{3}\right)\right)} \]
    9. Applied egg-rr54.2%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(-0.16666666666666666 \cdot {re}^{3}\right)\right)} \]

    if 1e152 < 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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 97.3%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.22:\\ \;\;\;\;\sin re \cdot \left(1 + 0.5 \cdot {im}^{2}\right)\\ \mathbf{elif}\;im \leq 1.1 \cdot 10^{+98}:\\ \;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{elif}\;im \leq 10^{+152}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(-0.16666666666666666 \cdot {re}^{3}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot {im}^{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 83.4% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
t_0 := \left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
t_1 := 1 + 0.5 \cdot {im}^{2}\\
\mathbf{if}\;im \leq 0.15:\\
\;\;\;\;\sin re \cdot t\_1\\

\mathbf{elif}\;im \leq 1.1 \cdot 10^{+98}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;im \leq 1.7 \cdot 10^{+142}:\\
\;\;\;\;t\_1 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\\

\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t\_0\\

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


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

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 82.0%

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

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

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

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

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

    if 0.149999999999999994 < im < 1.10000000000000004e98 or 1.6999999999999999e142 < im < 1.35000000000000003e154

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 85.0%

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

    if 1.10000000000000004e98 < im < 1.6999999999999999e142

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 6.1%

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

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

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

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

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

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

    if 1.35000000000000003e154 < 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. remove-double-neg100.0%

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

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

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

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

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

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

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

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

Alternative 4: 83.4% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;im \leq 1.1 \cdot 10^{+98}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;im \leq 2.2 \cdot 10^{+142}:\\
\;\;\;\;0.5 \cdot \left({im}^{2} \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\right)\\

\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t\_0\\

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


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

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 82.0%

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

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

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

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

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

    if 0.0560000000000000012 < im < 1.10000000000000004e98 or 2.19999999999999987e142 < im < 1.35000000000000003e154

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 85.0%

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

    if 1.10000000000000004e98 < im < 2.19999999999999987e142

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 6.1%

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

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

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

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

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

      \[\leadsto \color{blue}{\left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)} \cdot \left(1 + 0.5 \cdot {im}^{2}\right) \]
    9. Taylor expanded in im around inf 43.4%

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

    if 1.35000000000000003e154 < 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. remove-double-neg100.0%

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

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

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

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

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

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

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

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

Alternative 5: 83.4% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;im \leq 1.1 \cdot 10^{+98}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;im \leq 1.7 \cdot 10^{+142}:\\
\;\;\;\;{re}^{3} \cdot \left(-0.16666666666666666 + {im}^{2} \cdot -0.08333333333333333\right)\\

\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t\_0\\

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


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

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 82.0%

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

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

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

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

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

    if 0.0189999999999999995 < im < 1.10000000000000004e98 or 1.6999999999999999e142 < im < 1.35000000000000003e154

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 85.0%

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

    if 1.10000000000000004e98 < im < 1.6999999999999999e142

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 6.1%

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

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

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

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

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

      \[\leadsto \color{blue}{\left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)} \cdot \left(1 + 0.5 \cdot {im}^{2}\right) \]
    9. Taylor expanded in re around inf 42.2%

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

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

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

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

        \[\leadsto \left({re}^{3} \cdot -0.16666666666666666\right) \cdot \color{blue}{\mathsf{fma}\left(0.5, {im}^{2}, 1\right)} \]
      5. associate-*r*42.2%

        \[\leadsto \color{blue}{{re}^{3} \cdot \left(-0.16666666666666666 \cdot \mathsf{fma}\left(0.5, {im}^{2}, 1\right)\right)} \]
      6. fma-undefine42.2%

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

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

        \[\leadsto {re}^{3} \cdot \color{blue}{\left(1 \cdot -0.16666666666666666 + \left(0.5 \cdot {im}^{2}\right) \cdot -0.16666666666666666\right)} \]
      9. metadata-eval42.2%

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

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

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

        \[\leadsto {re}^{3} \cdot \left(-0.16666666666666666 + {im}^{2} \cdot \color{blue}{-0.08333333333333333}\right) \]
    11. Simplified42.2%

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

    if 1.35000000000000003e154 < 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. remove-double-neg100.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.019:\\ \;\;\;\;\sin re \cdot \left(1 + 0.5 \cdot {im}^{2}\right)\\ \mathbf{elif}\;im \leq 1.1 \cdot 10^{+98}:\\ \;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{elif}\;im \leq 1.7 \cdot 10^{+142}:\\ \;\;\;\;{re}^{3} \cdot \left(-0.16666666666666666 + {im}^{2} \cdot -0.08333333333333333\right)\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot {im}^{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 83.3% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{if}\;im \leq 0.45:\\ \;\;\;\;\sin re \cdot \left(1 + 0.5 \cdot {im}^{2}\right)\\ \mathbf{elif}\;im \leq 1.1 \cdot 10^{+98}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;im \leq 5 \cdot 10^{+142}:\\ \;\;\;\;re \cdot \left(1 + \sqrt[3]{{re}^{6} \cdot -0.004629629629629629}\right)\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot {im}^{2}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (+ (exp (- im)) (exp im)) (* 0.5 re))))
   (if (<= im 0.45)
     (* (sin re) (+ 1.0 (* 0.5 (pow im 2.0))))
     (if (<= im 1.1e+98)
       t_0
       (if (<= im 5e+142)
         (* re (+ 1.0 (cbrt (* (pow re 6.0) -0.004629629629629629))))
         (if (<= im 1.35e+154) t_0 (* 0.5 (* (sin re) (pow im 2.0)))))))))
double code(double re, double im) {
	double t_0 = (exp(-im) + exp(im)) * (0.5 * re);
	double tmp;
	if (im <= 0.45) {
		tmp = sin(re) * (1.0 + (0.5 * pow(im, 2.0)));
	} else if (im <= 1.1e+98) {
		tmp = t_0;
	} else if (im <= 5e+142) {
		tmp = re * (1.0 + cbrt((pow(re, 6.0) * -0.004629629629629629)));
	} else if (im <= 1.35e+154) {
		tmp = t_0;
	} else {
		tmp = 0.5 * (sin(re) * pow(im, 2.0));
	}
	return tmp;
}
public static double code(double re, double im) {
	double t_0 = (Math.exp(-im) + Math.exp(im)) * (0.5 * re);
	double tmp;
	if (im <= 0.45) {
		tmp = Math.sin(re) * (1.0 + (0.5 * Math.pow(im, 2.0)));
	} else if (im <= 1.1e+98) {
		tmp = t_0;
	} else if (im <= 5e+142) {
		tmp = re * (1.0 + Math.cbrt((Math.pow(re, 6.0) * -0.004629629629629629)));
	} else if (im <= 1.35e+154) {
		tmp = t_0;
	} else {
		tmp = 0.5 * (Math.sin(re) * Math.pow(im, 2.0));
	}
	return tmp;
}
function code(re, im)
	t_0 = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * re))
	tmp = 0.0
	if (im <= 0.45)
		tmp = Float64(sin(re) * Float64(1.0 + Float64(0.5 * (im ^ 2.0))));
	elseif (im <= 1.1e+98)
		tmp = t_0;
	elseif (im <= 5e+142)
		tmp = Float64(re * Float64(1.0 + cbrt(Float64((re ^ 6.0) * -0.004629629629629629))));
	elseif (im <= 1.35e+154)
		tmp = t_0;
	else
		tmp = Float64(0.5 * Float64(sin(re) * (im ^ 2.0)));
	end
	return tmp
end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 0.45], N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(0.5 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+98], t$95$0, If[LessEqual[im, 5e+142], N[(re * N[(1.0 + N[Power[N[(N[Power[re, 6.0], $MachinePrecision] * -0.004629629629629629), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.35e+154], t$95$0, N[(0.5 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 1.1 \cdot 10^{+98}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;im \leq 5 \cdot 10^{+142}:\\
\;\;\;\;re \cdot \left(1 + \sqrt[3]{{re}^{6} \cdot -0.004629629629629629}\right)\\

\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t\_0\\

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


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

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 82.0%

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

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

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

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

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

    if 0.450000000000000011 < im < 1.10000000000000004e98 or 5.0000000000000001e142 < im < 1.35000000000000003e154

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 85.0%

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

    if 1.10000000000000004e98 < im < 5.0000000000000001e142

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 2.9%

      \[\leadsto \color{blue}{\sin re} \]
    6. Taylor expanded in re around 0 32.2%

      \[\leadsto \color{blue}{re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)} \]
    7. Step-by-step derivation
      1. add-cbrt-cube41.4%

        \[\leadsto re \cdot \left(1 + \color{blue}{\sqrt[3]{\left(\left(-0.16666666666666666 \cdot {re}^{2}\right) \cdot \left(-0.16666666666666666 \cdot {re}^{2}\right)\right) \cdot \left(-0.16666666666666666 \cdot {re}^{2}\right)}}\right) \]
      2. pow1/310.2%

        \[\leadsto re \cdot \left(1 + \color{blue}{{\left(\left(\left(-0.16666666666666666 \cdot {re}^{2}\right) \cdot \left(-0.16666666666666666 \cdot {re}^{2}\right)\right) \cdot \left(-0.16666666666666666 \cdot {re}^{2}\right)\right)}^{0.3333333333333333}}\right) \]
      3. pow310.2%

        \[\leadsto re \cdot \left(1 + {\color{blue}{\left({\left(-0.16666666666666666 \cdot {re}^{2}\right)}^{3}\right)}}^{0.3333333333333333}\right) \]
      4. *-commutative10.2%

        \[\leadsto re \cdot \left(1 + {\left({\color{blue}{\left({re}^{2} \cdot -0.16666666666666666\right)}}^{3}\right)}^{0.3333333333333333}\right) \]
      5. unpow-prod-down10.2%

        \[\leadsto re \cdot \left(1 + {\color{blue}{\left({\left({re}^{2}\right)}^{3} \cdot {-0.16666666666666666}^{3}\right)}}^{0.3333333333333333}\right) \]
      6. unpow210.2%

        \[\leadsto re \cdot \left(1 + {\left({\color{blue}{\left(re \cdot re\right)}}^{3} \cdot {-0.16666666666666666}^{3}\right)}^{0.3333333333333333}\right) \]
      7. pow-prod-down10.2%

        \[\leadsto re \cdot \left(1 + {\left(\color{blue}{\left({re}^{3} \cdot {re}^{3}\right)} \cdot {-0.16666666666666666}^{3}\right)}^{0.3333333333333333}\right) \]
      8. pow-prod-up10.2%

        \[\leadsto re \cdot \left(1 + {\left(\color{blue}{{re}^{\left(3 + 3\right)}} \cdot {-0.16666666666666666}^{3}\right)}^{0.3333333333333333}\right) \]
      9. metadata-eval10.2%

        \[\leadsto re \cdot \left(1 + {\left({re}^{\color{blue}{6}} \cdot {-0.16666666666666666}^{3}\right)}^{0.3333333333333333}\right) \]
      10. metadata-eval10.2%

        \[\leadsto re \cdot \left(1 + {\left({re}^{6} \cdot \color{blue}{-0.004629629629629629}\right)}^{0.3333333333333333}\right) \]
    8. Applied egg-rr10.2%

      \[\leadsto re \cdot \left(1 + \color{blue}{{\left({re}^{6} \cdot -0.004629629629629629\right)}^{0.3333333333333333}}\right) \]
    9. Step-by-step derivation
      1. unpow1/341.4%

        \[\leadsto re \cdot \left(1 + \color{blue}{\sqrt[3]{{re}^{6} \cdot -0.004629629629629629}}\right) \]
    10. Simplified41.4%

      \[\leadsto re \cdot \left(1 + \color{blue}{\sqrt[3]{{re}^{6} \cdot -0.004629629629629629}}\right) \]

    if 1.35000000000000003e154 < 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. remove-double-neg100.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.45:\\ \;\;\;\;\sin re \cdot \left(1 + 0.5 \cdot {im}^{2}\right)\\ \mathbf{elif}\;im \leq 1.1 \cdot 10^{+98}:\\ \;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{elif}\;im \leq 5 \cdot 10^{+142}:\\ \;\;\;\;re \cdot \left(1 + \sqrt[3]{{re}^{6} \cdot -0.004629629629629629}\right)\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot {im}^{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 77.9% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;im \leq 4.3 \cdot 10^{+97}:\\
\;\;\;\;2 \cdot {\sin re}^{-2}\\

\mathbf{elif}\;im \leq 10^{+152}:\\
\;\;\;\;re \cdot \left(1 + \sqrt[3]{{re}^{6} \cdot -0.004629629629629629}\right)\\

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


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

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 82.0%

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

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

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

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

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

    if 2.1e15 < im < 4.2999999999999998e97

    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. remove-double-neg100.0%

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

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

      \[\leadsto \color{blue}{\sin re + \sin re} \]
    6. Step-by-step derivation
      1. count-22.4%

        \[\leadsto \color{blue}{2 \cdot \sin re} \]
    7. Simplified2.4%

      \[\leadsto \color{blue}{2 \cdot \sin re} \]
    8. Applied egg-rr8.2%

      \[\leadsto 2 \cdot \color{blue}{{\sin re}^{-2}} \]

    if 4.2999999999999998e97 < im < 1e152

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 3.0%

      \[\leadsto \color{blue}{\sin re} \]
    6. Taylor expanded in re around 0 32.7%

      \[\leadsto \color{blue}{re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)} \]
    7. Step-by-step derivation
      1. add-cbrt-cube39.8%

        \[\leadsto re \cdot \left(1 + \color{blue}{\sqrt[3]{\left(\left(-0.16666666666666666 \cdot {re}^{2}\right) \cdot \left(-0.16666666666666666 \cdot {re}^{2}\right)\right) \cdot \left(-0.16666666666666666 \cdot {re}^{2}\right)}}\right) \]
      2. pow1/37.8%

        \[\leadsto re \cdot \left(1 + \color{blue}{{\left(\left(\left(-0.16666666666666666 \cdot {re}^{2}\right) \cdot \left(-0.16666666666666666 \cdot {re}^{2}\right)\right) \cdot \left(-0.16666666666666666 \cdot {re}^{2}\right)\right)}^{0.3333333333333333}}\right) \]
      3. pow37.8%

        \[\leadsto re \cdot \left(1 + {\color{blue}{\left({\left(-0.16666666666666666 \cdot {re}^{2}\right)}^{3}\right)}}^{0.3333333333333333}\right) \]
      4. *-commutative7.8%

        \[\leadsto re \cdot \left(1 + {\left({\color{blue}{\left({re}^{2} \cdot -0.16666666666666666\right)}}^{3}\right)}^{0.3333333333333333}\right) \]
      5. unpow-prod-down7.8%

        \[\leadsto re \cdot \left(1 + {\color{blue}{\left({\left({re}^{2}\right)}^{3} \cdot {-0.16666666666666666}^{3}\right)}}^{0.3333333333333333}\right) \]
      6. unpow27.8%

        \[\leadsto re \cdot \left(1 + {\left({\color{blue}{\left(re \cdot re\right)}}^{3} \cdot {-0.16666666666666666}^{3}\right)}^{0.3333333333333333}\right) \]
      7. pow-prod-down7.8%

        \[\leadsto re \cdot \left(1 + {\left(\color{blue}{\left({re}^{3} \cdot {re}^{3}\right)} \cdot {-0.16666666666666666}^{3}\right)}^{0.3333333333333333}\right) \]
      8. pow-prod-up7.8%

        \[\leadsto re \cdot \left(1 + {\left(\color{blue}{{re}^{\left(3 + 3\right)}} \cdot {-0.16666666666666666}^{3}\right)}^{0.3333333333333333}\right) \]
      9. metadata-eval7.8%

        \[\leadsto re \cdot \left(1 + {\left({re}^{\color{blue}{6}} \cdot {-0.16666666666666666}^{3}\right)}^{0.3333333333333333}\right) \]
      10. metadata-eval7.8%

        \[\leadsto re \cdot \left(1 + {\left({re}^{6} \cdot \color{blue}{-0.004629629629629629}\right)}^{0.3333333333333333}\right) \]
    8. Applied egg-rr7.8%

      \[\leadsto re \cdot \left(1 + \color{blue}{{\left({re}^{6} \cdot -0.004629629629629629\right)}^{0.3333333333333333}}\right) \]
    9. Step-by-step derivation
      1. unpow1/339.8%

        \[\leadsto re \cdot \left(1 + \color{blue}{\sqrt[3]{{re}^{6} \cdot -0.004629629629629629}}\right) \]
    10. Simplified39.8%

      \[\leadsto re \cdot \left(1 + \color{blue}{\sqrt[3]{{re}^{6} \cdot -0.004629629629629629}}\right) \]

    if 1e152 < 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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 97.3%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 2.1 \cdot 10^{+15}:\\ \;\;\;\;\sin re \cdot \left(1 + 0.5 \cdot {im}^{2}\right)\\ \mathbf{elif}\;im \leq 4.3 \cdot 10^{+97}:\\ \;\;\;\;2 \cdot {\sin re}^{-2}\\ \mathbf{elif}\;im \leq 10^{+152}:\\ \;\;\;\;re \cdot \left(1 + \sqrt[3]{{re}^{6} \cdot -0.004629629629629629}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot {im}^{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 65.2% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;im \leq 4.6 \cdot 10^{+97}:\\
\;\;\;\;2 \cdot {\sin re}^{-2}\\

\mathbf{elif}\;im \leq 10^{+152}:\\
\;\;\;\;re \cdot \left(1 + \sqrt[3]{{re}^{6} \cdot -0.004629629629629629}\right)\\

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


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

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 64.1%

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

    if 6e10 < im < 4.60000000000000011e97

    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. remove-double-neg100.0%

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

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

      \[\leadsto \color{blue}{\sin re + \sin re} \]
    6. Step-by-step derivation
      1. count-22.4%

        \[\leadsto \color{blue}{2 \cdot \sin re} \]
    7. Simplified2.4%

      \[\leadsto \color{blue}{2 \cdot \sin re} \]
    8. Applied egg-rr8.2%

      \[\leadsto 2 \cdot \color{blue}{{\sin re}^{-2}} \]

    if 4.60000000000000011e97 < im < 1e152

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 3.0%

      \[\leadsto \color{blue}{\sin re} \]
    6. Taylor expanded in re around 0 32.7%

      \[\leadsto \color{blue}{re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)} \]
    7. Step-by-step derivation
      1. add-cbrt-cube39.8%

        \[\leadsto re \cdot \left(1 + \color{blue}{\sqrt[3]{\left(\left(-0.16666666666666666 \cdot {re}^{2}\right) \cdot \left(-0.16666666666666666 \cdot {re}^{2}\right)\right) \cdot \left(-0.16666666666666666 \cdot {re}^{2}\right)}}\right) \]
      2. pow1/37.8%

        \[\leadsto re \cdot \left(1 + \color{blue}{{\left(\left(\left(-0.16666666666666666 \cdot {re}^{2}\right) \cdot \left(-0.16666666666666666 \cdot {re}^{2}\right)\right) \cdot \left(-0.16666666666666666 \cdot {re}^{2}\right)\right)}^{0.3333333333333333}}\right) \]
      3. pow37.8%

        \[\leadsto re \cdot \left(1 + {\color{blue}{\left({\left(-0.16666666666666666 \cdot {re}^{2}\right)}^{3}\right)}}^{0.3333333333333333}\right) \]
      4. *-commutative7.8%

        \[\leadsto re \cdot \left(1 + {\left({\color{blue}{\left({re}^{2} \cdot -0.16666666666666666\right)}}^{3}\right)}^{0.3333333333333333}\right) \]
      5. unpow-prod-down7.8%

        \[\leadsto re \cdot \left(1 + {\color{blue}{\left({\left({re}^{2}\right)}^{3} \cdot {-0.16666666666666666}^{3}\right)}}^{0.3333333333333333}\right) \]
      6. unpow27.8%

        \[\leadsto re \cdot \left(1 + {\left({\color{blue}{\left(re \cdot re\right)}}^{3} \cdot {-0.16666666666666666}^{3}\right)}^{0.3333333333333333}\right) \]
      7. pow-prod-down7.8%

        \[\leadsto re \cdot \left(1 + {\left(\color{blue}{\left({re}^{3} \cdot {re}^{3}\right)} \cdot {-0.16666666666666666}^{3}\right)}^{0.3333333333333333}\right) \]
      8. pow-prod-up7.8%

        \[\leadsto re \cdot \left(1 + {\left(\color{blue}{{re}^{\left(3 + 3\right)}} \cdot {-0.16666666666666666}^{3}\right)}^{0.3333333333333333}\right) \]
      9. metadata-eval7.8%

        \[\leadsto re \cdot \left(1 + {\left({re}^{\color{blue}{6}} \cdot {-0.16666666666666666}^{3}\right)}^{0.3333333333333333}\right) \]
      10. metadata-eval7.8%

        \[\leadsto re \cdot \left(1 + {\left({re}^{6} \cdot \color{blue}{-0.004629629629629629}\right)}^{0.3333333333333333}\right) \]
    8. Applied egg-rr7.8%

      \[\leadsto re \cdot \left(1 + \color{blue}{{\left({re}^{6} \cdot -0.004629629629629629\right)}^{0.3333333333333333}}\right) \]
    9. Step-by-step derivation
      1. unpow1/339.8%

        \[\leadsto re \cdot \left(1 + \color{blue}{\sqrt[3]{{re}^{6} \cdot -0.004629629629629629}}\right) \]
    10. Simplified39.8%

      \[\leadsto re \cdot \left(1 + \color{blue}{\sqrt[3]{{re}^{6} \cdot -0.004629629629629629}}\right) \]

    if 1e152 < 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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 97.3%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 60000000000:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 4.6 \cdot 10^{+97}:\\ \;\;\;\;2 \cdot {\sin re}^{-2}\\ \mathbf{elif}\;im \leq 10^{+152}:\\ \;\;\;\;re \cdot \left(1 + \sqrt[3]{{re}^{6} \cdot -0.004629629629629629}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot {im}^{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 65.0% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 60000000000:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.55 \cdot 10^{+101}:\\ \;\;\;\;2 \cdot {\sin re}^{-2}\\ \mathbf{elif}\;im \leq 10^{+152}:\\ \;\;\;\;2 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot {im}^{2}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 60000000000.0)
   (sin re)
   (if (<= im 1.55e+101)
     (* 2.0 (pow (sin re) -2.0))
     (if (<= im 1e+152)
       (* 2.0 (* re (+ 1.0 (* -0.16666666666666666 (pow re 2.0)))))
       (* 0.5 (* (sin re) (pow im 2.0)))))))
double code(double re, double im) {
	double tmp;
	if (im <= 60000000000.0) {
		tmp = sin(re);
	} else if (im <= 1.55e+101) {
		tmp = 2.0 * pow(sin(re), -2.0);
	} else if (im <= 1e+152) {
		tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * pow(re, 2.0))));
	} else {
		tmp = 0.5 * (sin(re) * 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 <= 60000000000.0d0) then
        tmp = sin(re)
    else if (im <= 1.55d+101) then
        tmp = 2.0d0 * (sin(re) ** (-2.0d0))
    else if (im <= 1d+152) then
        tmp = 2.0d0 * (re * (1.0d0 + ((-0.16666666666666666d0) * (re ** 2.0d0))))
    else
        tmp = 0.5d0 * (sin(re) * (im ** 2.0d0))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 60000000000.0) {
		tmp = Math.sin(re);
	} else if (im <= 1.55e+101) {
		tmp = 2.0 * Math.pow(Math.sin(re), -2.0);
	} else if (im <= 1e+152) {
		tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * Math.pow(re, 2.0))));
	} else {
		tmp = 0.5 * (Math.sin(re) * Math.pow(im, 2.0));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 60000000000.0:
		tmp = math.sin(re)
	elif im <= 1.55e+101:
		tmp = 2.0 * math.pow(math.sin(re), -2.0)
	elif im <= 1e+152:
		tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * math.pow(re, 2.0))))
	else:
		tmp = 0.5 * (math.sin(re) * math.pow(im, 2.0))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 60000000000.0)
		tmp = sin(re);
	elseif (im <= 1.55e+101)
		tmp = Float64(2.0 * (sin(re) ^ -2.0));
	elseif (im <= 1e+152)
		tmp = Float64(2.0 * Float64(re * Float64(1.0 + Float64(-0.16666666666666666 * (re ^ 2.0)))));
	else
		tmp = Float64(0.5 * Float64(sin(re) * (im ^ 2.0)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 60000000000.0)
		tmp = sin(re);
	elseif (im <= 1.55e+101)
		tmp = 2.0 * (sin(re) ^ -2.0);
	elseif (im <= 1e+152)
		tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * (re ^ 2.0))));
	else
		tmp = 0.5 * (sin(re) * (im ^ 2.0));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 60000000000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.55e+101], N[(2.0 * N[Power[N[Sin[re], $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1e+152], N[(2.0 * N[(re * N[(1.0 + N[(-0.16666666666666666 * N[Power[re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 1.55 \cdot 10^{+101}:\\
\;\;\;\;2 \cdot {\sin re}^{-2}\\

\mathbf{elif}\;im \leq 10^{+152}:\\
\;\;\;\;2 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\\

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


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

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 64.1%

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

    if 6e10 < im < 1.55e101

    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. remove-double-neg100.0%

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

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

      \[\leadsto \color{blue}{\sin re + \sin re} \]
    6. Step-by-step derivation
      1. count-22.5%

        \[\leadsto \color{blue}{2 \cdot \sin re} \]
    7. Simplified2.5%

      \[\leadsto \color{blue}{2 \cdot \sin re} \]
    8. Applied egg-rr12.2%

      \[\leadsto 2 \cdot \color{blue}{{\sin re}^{-2}} \]

    if 1.55e101 < im < 1e152

    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. remove-double-neg100.0%

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

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

      \[\leadsto \color{blue}{\sin re + \sin re} \]
    6. Step-by-step derivation
      1. count-23.1%

        \[\leadsto \color{blue}{2 \cdot \sin re} \]
    7. Simplified3.1%

      \[\leadsto \color{blue}{2 \cdot \sin re} \]
    8. Taylor expanded in re around 0 41.3%

      \[\leadsto 2 \cdot \color{blue}{\left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)} \]

    if 1e152 < 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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 97.3%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 60000000000:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.55 \cdot 10^{+101}:\\ \;\;\;\;2 \cdot {\sin re}^{-2}\\ \mathbf{elif}\;im \leq 10^{+152}:\\ \;\;\;\;2 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot {im}^{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 62.1% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 60000000000:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.9 \cdot 10^{+101}:\\ \;\;\;\;2 \cdot {\sin re}^{-2}\\ \mathbf{elif}\;im \leq 10^{+152}:\\ \;\;\;\;2 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(1 + 0.5 \cdot {im}^{2}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 60000000000.0)
   (sin re)
   (if (<= im 1.9e+101)
     (* 2.0 (pow (sin re) -2.0))
     (if (<= im 1e+152)
       (* 2.0 (* re (+ 1.0 (* -0.16666666666666666 (pow re 2.0)))))
       (* re (+ 1.0 (* 0.5 (pow im 2.0))))))))
double code(double re, double im) {
	double tmp;
	if (im <= 60000000000.0) {
		tmp = sin(re);
	} else if (im <= 1.9e+101) {
		tmp = 2.0 * pow(sin(re), -2.0);
	} else if (im <= 1e+152) {
		tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * pow(re, 2.0))));
	} else {
		tmp = re * (1.0 + (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 <= 60000000000.0d0) then
        tmp = sin(re)
    else if (im <= 1.9d+101) then
        tmp = 2.0d0 * (sin(re) ** (-2.0d0))
    else if (im <= 1d+152) then
        tmp = 2.0d0 * (re * (1.0d0 + ((-0.16666666666666666d0) * (re ** 2.0d0))))
    else
        tmp = re * (1.0d0 + (0.5d0 * (im ** 2.0d0)))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 60000000000.0) {
		tmp = Math.sin(re);
	} else if (im <= 1.9e+101) {
		tmp = 2.0 * Math.pow(Math.sin(re), -2.0);
	} else if (im <= 1e+152) {
		tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * Math.pow(re, 2.0))));
	} else {
		tmp = re * (1.0 + (0.5 * Math.pow(im, 2.0)));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 60000000000.0:
		tmp = math.sin(re)
	elif im <= 1.9e+101:
		tmp = 2.0 * math.pow(math.sin(re), -2.0)
	elif im <= 1e+152:
		tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * math.pow(re, 2.0))))
	else:
		tmp = re * (1.0 + (0.5 * math.pow(im, 2.0)))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 60000000000.0)
		tmp = sin(re);
	elseif (im <= 1.9e+101)
		tmp = Float64(2.0 * (sin(re) ^ -2.0));
	elseif (im <= 1e+152)
		tmp = Float64(2.0 * Float64(re * Float64(1.0 + Float64(-0.16666666666666666 * (re ^ 2.0)))));
	else
		tmp = Float64(re * Float64(1.0 + Float64(0.5 * (im ^ 2.0))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 60000000000.0)
		tmp = sin(re);
	elseif (im <= 1.9e+101)
		tmp = 2.0 * (sin(re) ^ -2.0);
	elseif (im <= 1e+152)
		tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * (re ^ 2.0))));
	else
		tmp = re * (1.0 + (0.5 * (im ^ 2.0)));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 60000000000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.9e+101], N[(2.0 * N[Power[N[Sin[re], $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1e+152], N[(2.0 * N[(re * N[(1.0 + N[(-0.16666666666666666 * N[Power[re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(1.0 + N[(0.5 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 1.9 \cdot 10^{+101}:\\
\;\;\;\;2 \cdot {\sin re}^{-2}\\

\mathbf{elif}\;im \leq 10^{+152}:\\
\;\;\;\;2 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\\

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


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

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 64.1%

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

    if 6e10 < im < 1.8999999999999999e101

    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. remove-double-neg100.0%

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

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

      \[\leadsto \color{blue}{\sin re + \sin re} \]
    6. Step-by-step derivation
      1. count-22.5%

        \[\leadsto \color{blue}{2 \cdot \sin re} \]
    7. Simplified2.5%

      \[\leadsto \color{blue}{2 \cdot \sin re} \]
    8. Applied egg-rr12.2%

      \[\leadsto 2 \cdot \color{blue}{{\sin re}^{-2}} \]

    if 1.8999999999999999e101 < im < 1e152

    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. remove-double-neg100.0%

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

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

      \[\leadsto \color{blue}{\sin re + \sin re} \]
    6. Step-by-step derivation
      1. count-23.1%

        \[\leadsto \color{blue}{2 \cdot \sin re} \]
    7. Simplified3.1%

      \[\leadsto \color{blue}{2 \cdot \sin re} \]
    8. Taylor expanded in re around 0 41.3%

      \[\leadsto 2 \cdot \color{blue}{\left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)} \]

    if 1e152 < 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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 97.3%

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

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

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

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

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

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

Alternative 11: 62.1% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 11500000000000:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.05 \cdot 10^{+101}:\\ \;\;\;\;{\sin re}^{-2}\\ \mathbf{elif}\;im \leq 9.2 \cdot 10^{+151}:\\ \;\;\;\;2 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(1 + 0.5 \cdot {im}^{2}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 11500000000000.0)
   (sin re)
   (if (<= im 2.05e+101)
     (pow (sin re) -2.0)
     (if (<= im 9.2e+151)
       (* 2.0 (* re (+ 1.0 (* -0.16666666666666666 (pow re 2.0)))))
       (* re (+ 1.0 (* 0.5 (pow im 2.0))))))))
double code(double re, double im) {
	double tmp;
	if (im <= 11500000000000.0) {
		tmp = sin(re);
	} else if (im <= 2.05e+101) {
		tmp = pow(sin(re), -2.0);
	} else if (im <= 9.2e+151) {
		tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * pow(re, 2.0))));
	} else {
		tmp = re * (1.0 + (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 <= 11500000000000.0d0) then
        tmp = sin(re)
    else if (im <= 2.05d+101) then
        tmp = sin(re) ** (-2.0d0)
    else if (im <= 9.2d+151) then
        tmp = 2.0d0 * (re * (1.0d0 + ((-0.16666666666666666d0) * (re ** 2.0d0))))
    else
        tmp = re * (1.0d0 + (0.5d0 * (im ** 2.0d0)))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 11500000000000.0) {
		tmp = Math.sin(re);
	} else if (im <= 2.05e+101) {
		tmp = Math.pow(Math.sin(re), -2.0);
	} else if (im <= 9.2e+151) {
		tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * Math.pow(re, 2.0))));
	} else {
		tmp = re * (1.0 + (0.5 * Math.pow(im, 2.0)));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 11500000000000.0:
		tmp = math.sin(re)
	elif im <= 2.05e+101:
		tmp = math.pow(math.sin(re), -2.0)
	elif im <= 9.2e+151:
		tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * math.pow(re, 2.0))))
	else:
		tmp = re * (1.0 + (0.5 * math.pow(im, 2.0)))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 11500000000000.0)
		tmp = sin(re);
	elseif (im <= 2.05e+101)
		tmp = sin(re) ^ -2.0;
	elseif (im <= 9.2e+151)
		tmp = Float64(2.0 * Float64(re * Float64(1.0 + Float64(-0.16666666666666666 * (re ^ 2.0)))));
	else
		tmp = Float64(re * Float64(1.0 + Float64(0.5 * (im ^ 2.0))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 11500000000000.0)
		tmp = sin(re);
	elseif (im <= 2.05e+101)
		tmp = sin(re) ^ -2.0;
	elseif (im <= 9.2e+151)
		tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * (re ^ 2.0))));
	else
		tmp = re * (1.0 + (0.5 * (im ^ 2.0)));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 11500000000000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 2.05e+101], N[Power[N[Sin[re], $MachinePrecision], -2.0], $MachinePrecision], If[LessEqual[im, 9.2e+151], N[(2.0 * N[(re * N[(1.0 + N[(-0.16666666666666666 * N[Power[re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(1.0 + N[(0.5 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 2.05 \cdot 10^{+101}:\\
\;\;\;\;{\sin re}^{-2}\\

\mathbf{elif}\;im \leq 9.2 \cdot 10^{+151}:\\
\;\;\;\;2 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\\

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


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

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 64.1%

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

    if 1.15e13 < im < 2.05e101

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 2.5%

      \[\leadsto \color{blue}{\sin re} \]
    6. Applied egg-rr12.2%

      \[\leadsto \color{blue}{{\sin re}^{-2}} \]

    if 2.05e101 < im < 9.2000000000000003e151

    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. remove-double-neg100.0%

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

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

      \[\leadsto \color{blue}{\sin re + \sin re} \]
    6. Step-by-step derivation
      1. count-23.1%

        \[\leadsto \color{blue}{2 \cdot \sin re} \]
    7. Simplified3.1%

      \[\leadsto \color{blue}{2 \cdot \sin re} \]
    8. Taylor expanded in re around 0 41.3%

      \[\leadsto 2 \cdot \color{blue}{\left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)} \]

    if 9.2000000000000003e151 < 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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 97.3%

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

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

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

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

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

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

Alternative 12: 62.1% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 2.1 \cdot 10^{+15}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.4 \cdot 10^{+101}:\\ \;\;\;\;2 \cdot {re}^{-2}\\ \mathbf{elif}\;im \leq 10^{+152}:\\ \;\;\;\;2 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(1 + 0.5 \cdot {im}^{2}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 2.1e+15)
   (sin re)
   (if (<= im 1.4e+101)
     (* 2.0 (pow re -2.0))
     (if (<= im 1e+152)
       (* 2.0 (* re (+ 1.0 (* -0.16666666666666666 (pow re 2.0)))))
       (* re (+ 1.0 (* 0.5 (pow im 2.0))))))))
double code(double re, double im) {
	double tmp;
	if (im <= 2.1e+15) {
		tmp = sin(re);
	} else if (im <= 1.4e+101) {
		tmp = 2.0 * pow(re, -2.0);
	} else if (im <= 1e+152) {
		tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * pow(re, 2.0))));
	} else {
		tmp = re * (1.0 + (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 <= 2.1d+15) then
        tmp = sin(re)
    else if (im <= 1.4d+101) then
        tmp = 2.0d0 * (re ** (-2.0d0))
    else if (im <= 1d+152) then
        tmp = 2.0d0 * (re * (1.0d0 + ((-0.16666666666666666d0) * (re ** 2.0d0))))
    else
        tmp = re * (1.0d0 + (0.5d0 * (im ** 2.0d0)))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 2.1e+15) {
		tmp = Math.sin(re);
	} else if (im <= 1.4e+101) {
		tmp = 2.0 * Math.pow(re, -2.0);
	} else if (im <= 1e+152) {
		tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * Math.pow(re, 2.0))));
	} else {
		tmp = re * (1.0 + (0.5 * Math.pow(im, 2.0)));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 2.1e+15:
		tmp = math.sin(re)
	elif im <= 1.4e+101:
		tmp = 2.0 * math.pow(re, -2.0)
	elif im <= 1e+152:
		tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * math.pow(re, 2.0))))
	else:
		tmp = re * (1.0 + (0.5 * math.pow(im, 2.0)))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 2.1e+15)
		tmp = sin(re);
	elseif (im <= 1.4e+101)
		tmp = Float64(2.0 * (re ^ -2.0));
	elseif (im <= 1e+152)
		tmp = Float64(2.0 * Float64(re * Float64(1.0 + Float64(-0.16666666666666666 * (re ^ 2.0)))));
	else
		tmp = Float64(re * Float64(1.0 + Float64(0.5 * (im ^ 2.0))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 2.1e+15)
		tmp = sin(re);
	elseif (im <= 1.4e+101)
		tmp = 2.0 * (re ^ -2.0);
	elseif (im <= 1e+152)
		tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * (re ^ 2.0))));
	else
		tmp = re * (1.0 + (0.5 * (im ^ 2.0)));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 2.1e+15], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.4e+101], N[(2.0 * N[Power[re, -2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1e+152], N[(2.0 * N[(re * N[(1.0 + N[(-0.16666666666666666 * N[Power[re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(1.0 + N[(0.5 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 1.4 \cdot 10^{+101}:\\
\;\;\;\;2 \cdot {re}^{-2}\\

\mathbf{elif}\;im \leq 10^{+152}:\\
\;\;\;\;2 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\\

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


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

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 64.1%

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

    if 2.1e15 < im < 1.39999999999999991e101

    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. remove-double-neg100.0%

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

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

      \[\leadsto \color{blue}{\sin re + \sin re} \]
    6. Step-by-step derivation
      1. count-22.5%

        \[\leadsto \color{blue}{2 \cdot \sin re} \]
    7. Simplified2.5%

      \[\leadsto \color{blue}{2 \cdot \sin re} \]
    8. Applied egg-rr12.2%

      \[\leadsto 2 \cdot \color{blue}{{\sin re}^{-2}} \]
    9. Taylor expanded in re around 0 12.1%

      \[\leadsto 2 \cdot {\color{blue}{re}}^{-2} \]

    if 1.39999999999999991e101 < im < 1e152

    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. remove-double-neg100.0%

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

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

      \[\leadsto \color{blue}{\sin re + \sin re} \]
    6. Step-by-step derivation
      1. count-23.1%

        \[\leadsto \color{blue}{2 \cdot \sin re} \]
    7. Simplified3.1%

      \[\leadsto \color{blue}{2 \cdot \sin re} \]
    8. Taylor expanded in re around 0 41.3%

      \[\leadsto 2 \cdot \color{blue}{\left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)} \]

    if 1e152 < 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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 97.3%

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

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

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

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

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

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

Alternative 13: 62.1% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 2.1 \cdot 10^{+15}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.05 \cdot 10^{+101}:\\ \;\;\;\;2 \cdot {re}^{-2}\\ \mathbf{elif}\;im \leq 9.2 \cdot 10^{+151}:\\ \;\;\;\;re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(1 + 0.5 \cdot {im}^{2}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 2.1e+15)
   (sin re)
   (if (<= im 2.05e+101)
     (* 2.0 (pow re -2.0))
     (if (<= im 9.2e+151)
       (* re (+ 1.0 (* -0.16666666666666666 (pow re 2.0))))
       (* re (+ 1.0 (* 0.5 (pow im 2.0))))))))
double code(double re, double im) {
	double tmp;
	if (im <= 2.1e+15) {
		tmp = sin(re);
	} else if (im <= 2.05e+101) {
		tmp = 2.0 * pow(re, -2.0);
	} else if (im <= 9.2e+151) {
		tmp = re * (1.0 + (-0.16666666666666666 * pow(re, 2.0)));
	} else {
		tmp = re * (1.0 + (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 <= 2.1d+15) then
        tmp = sin(re)
    else if (im <= 2.05d+101) then
        tmp = 2.0d0 * (re ** (-2.0d0))
    else if (im <= 9.2d+151) then
        tmp = re * (1.0d0 + ((-0.16666666666666666d0) * (re ** 2.0d0)))
    else
        tmp = re * (1.0d0 + (0.5d0 * (im ** 2.0d0)))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 2.1e+15) {
		tmp = Math.sin(re);
	} else if (im <= 2.05e+101) {
		tmp = 2.0 * Math.pow(re, -2.0);
	} else if (im <= 9.2e+151) {
		tmp = re * (1.0 + (-0.16666666666666666 * Math.pow(re, 2.0)));
	} else {
		tmp = re * (1.0 + (0.5 * Math.pow(im, 2.0)));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 2.1e+15:
		tmp = math.sin(re)
	elif im <= 2.05e+101:
		tmp = 2.0 * math.pow(re, -2.0)
	elif im <= 9.2e+151:
		tmp = re * (1.0 + (-0.16666666666666666 * math.pow(re, 2.0)))
	else:
		tmp = re * (1.0 + (0.5 * math.pow(im, 2.0)))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 2.1e+15)
		tmp = sin(re);
	elseif (im <= 2.05e+101)
		tmp = Float64(2.0 * (re ^ -2.0));
	elseif (im <= 9.2e+151)
		tmp = Float64(re * Float64(1.0 + Float64(-0.16666666666666666 * (re ^ 2.0))));
	else
		tmp = Float64(re * Float64(1.0 + Float64(0.5 * (im ^ 2.0))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 2.1e+15)
		tmp = sin(re);
	elseif (im <= 2.05e+101)
		tmp = 2.0 * (re ^ -2.0);
	elseif (im <= 9.2e+151)
		tmp = re * (1.0 + (-0.16666666666666666 * (re ^ 2.0)));
	else
		tmp = re * (1.0 + (0.5 * (im ^ 2.0)));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 2.1e+15], N[Sin[re], $MachinePrecision], If[LessEqual[im, 2.05e+101], N[(2.0 * N[Power[re, -2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 9.2e+151], N[(re * N[(1.0 + N[(-0.16666666666666666 * N[Power[re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(1.0 + N[(0.5 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 2.05 \cdot 10^{+101}:\\
\;\;\;\;2 \cdot {re}^{-2}\\

\mathbf{elif}\;im \leq 9.2 \cdot 10^{+151}:\\
\;\;\;\;re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\\

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


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

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 64.1%

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

    if 2.1e15 < im < 2.05e101

    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. remove-double-neg100.0%

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

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

      \[\leadsto \color{blue}{\sin re + \sin re} \]
    6. Step-by-step derivation
      1. count-22.5%

        \[\leadsto \color{blue}{2 \cdot \sin re} \]
    7. Simplified2.5%

      \[\leadsto \color{blue}{2 \cdot \sin re} \]
    8. Applied egg-rr12.2%

      \[\leadsto 2 \cdot \color{blue}{{\sin re}^{-2}} \]
    9. Taylor expanded in re around 0 12.1%

      \[\leadsto 2 \cdot {\color{blue}{re}}^{-2} \]

    if 2.05e101 < im < 9.2000000000000003e151

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 3.1%

      \[\leadsto \color{blue}{\sin re} \]
    6. Taylor expanded in re around 0 41.3%

      \[\leadsto \color{blue}{re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)} \]

    if 9.2000000000000003e151 < 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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 97.3%

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

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

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

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

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

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

Alternative 14: 62.1% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 2.1 \cdot 10^{+15}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.3 \cdot 10^{+101}:\\ \;\;\;\;2 \cdot {re}^{-2}\\ \mathbf{elif}\;im \leq 9.2 \cdot 10^{+151}:\\ \;\;\;\;re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.5 \cdot {im}^{2}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 2.1e+15)
   (sin re)
   (if (<= im 1.3e+101)
     (* 2.0 (pow re -2.0))
     (if (<= im 9.2e+151)
       (* re (+ 1.0 (* -0.16666666666666666 (pow re 2.0))))
       (* re (* 0.5 (pow im 2.0)))))))
double code(double re, double im) {
	double tmp;
	if (im <= 2.1e+15) {
		tmp = sin(re);
	} else if (im <= 1.3e+101) {
		tmp = 2.0 * pow(re, -2.0);
	} else if (im <= 9.2e+151) {
		tmp = re * (1.0 + (-0.16666666666666666 * pow(re, 2.0)));
	} 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 <= 2.1d+15) then
        tmp = sin(re)
    else if (im <= 1.3d+101) then
        tmp = 2.0d0 * (re ** (-2.0d0))
    else if (im <= 9.2d+151) then
        tmp = re * (1.0d0 + ((-0.16666666666666666d0) * (re ** 2.0d0)))
    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 <= 2.1e+15) {
		tmp = Math.sin(re);
	} else if (im <= 1.3e+101) {
		tmp = 2.0 * Math.pow(re, -2.0);
	} else if (im <= 9.2e+151) {
		tmp = re * (1.0 + (-0.16666666666666666 * Math.pow(re, 2.0)));
	} else {
		tmp = re * (0.5 * Math.pow(im, 2.0));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 2.1e+15:
		tmp = math.sin(re)
	elif im <= 1.3e+101:
		tmp = 2.0 * math.pow(re, -2.0)
	elif im <= 9.2e+151:
		tmp = re * (1.0 + (-0.16666666666666666 * math.pow(re, 2.0)))
	else:
		tmp = re * (0.5 * math.pow(im, 2.0))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 2.1e+15)
		tmp = sin(re);
	elseif (im <= 1.3e+101)
		tmp = Float64(2.0 * (re ^ -2.0));
	elseif (im <= 9.2e+151)
		tmp = Float64(re * Float64(1.0 + Float64(-0.16666666666666666 * (re ^ 2.0))));
	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 <= 2.1e+15)
		tmp = sin(re);
	elseif (im <= 1.3e+101)
		tmp = 2.0 * (re ^ -2.0);
	elseif (im <= 9.2e+151)
		tmp = re * (1.0 + (-0.16666666666666666 * (re ^ 2.0)));
	else
		tmp = re * (0.5 * (im ^ 2.0));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 2.1e+15], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.3e+101], N[(2.0 * N[Power[re, -2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 9.2e+151], N[(re * N[(1.0 + N[(-0.16666666666666666 * N[Power[re, 2.0], $MachinePrecision]), $MachinePrecision]), $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 2.1 \cdot 10^{+15}:\\
\;\;\;\;\sin re\\

\mathbf{elif}\;im \leq 1.3 \cdot 10^{+101}:\\
\;\;\;\;2 \cdot {re}^{-2}\\

\mathbf{elif}\;im \leq 9.2 \cdot 10^{+151}:\\
\;\;\;\;re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\\

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


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

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 64.1%

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

    if 2.1e15 < im < 1.3e101

    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. remove-double-neg100.0%

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

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

      \[\leadsto \color{blue}{\sin re + \sin re} \]
    6. Step-by-step derivation
      1. count-22.5%

        \[\leadsto \color{blue}{2 \cdot \sin re} \]
    7. Simplified2.5%

      \[\leadsto \color{blue}{2 \cdot \sin re} \]
    8. Applied egg-rr12.2%

      \[\leadsto 2 \cdot \color{blue}{{\sin re}^{-2}} \]
    9. Taylor expanded in re around 0 12.1%

      \[\leadsto 2 \cdot {\color{blue}{re}}^{-2} \]

    if 1.3e101 < im < 9.2000000000000003e151

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 3.1%

      \[\leadsto \color{blue}{\sin re} \]
    6. Taylor expanded in re around 0 41.3%

      \[\leadsto \color{blue}{re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)} \]

    if 9.2000000000000003e151 < 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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 97.3%

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

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

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

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

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

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

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

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

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

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

Alternative 15: 62.1% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 2.1 \cdot 10^{+15}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.5 \cdot 10^{+101}:\\ \;\;\;\;2 \cdot {re}^{-2}\\ \mathbf{elif}\;im \leq 9.2 \cdot 10^{+151}:\\ \;\;\;\;-0.16666666666666666 \cdot {re}^{3}\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.5 \cdot {im}^{2}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 2.1e+15)
   (sin re)
   (if (<= im 2.5e+101)
     (* 2.0 (pow re -2.0))
     (if (<= im 9.2e+151)
       (* -0.16666666666666666 (pow re 3.0))
       (* re (* 0.5 (pow im 2.0)))))))
double code(double re, double im) {
	double tmp;
	if (im <= 2.1e+15) {
		tmp = sin(re);
	} else if (im <= 2.5e+101) {
		tmp = 2.0 * pow(re, -2.0);
	} else if (im <= 9.2e+151) {
		tmp = -0.16666666666666666 * pow(re, 3.0);
	} 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 <= 2.1d+15) then
        tmp = sin(re)
    else if (im <= 2.5d+101) then
        tmp = 2.0d0 * (re ** (-2.0d0))
    else if (im <= 9.2d+151) then
        tmp = (-0.16666666666666666d0) * (re ** 3.0d0)
    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 <= 2.1e+15) {
		tmp = Math.sin(re);
	} else if (im <= 2.5e+101) {
		tmp = 2.0 * Math.pow(re, -2.0);
	} else if (im <= 9.2e+151) {
		tmp = -0.16666666666666666 * Math.pow(re, 3.0);
	} else {
		tmp = re * (0.5 * Math.pow(im, 2.0));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 2.1e+15:
		tmp = math.sin(re)
	elif im <= 2.5e+101:
		tmp = 2.0 * math.pow(re, -2.0)
	elif im <= 9.2e+151:
		tmp = -0.16666666666666666 * math.pow(re, 3.0)
	else:
		tmp = re * (0.5 * math.pow(im, 2.0))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 2.1e+15)
		tmp = sin(re);
	elseif (im <= 2.5e+101)
		tmp = Float64(2.0 * (re ^ -2.0));
	elseif (im <= 9.2e+151)
		tmp = Float64(-0.16666666666666666 * (re ^ 3.0));
	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 <= 2.1e+15)
		tmp = sin(re);
	elseif (im <= 2.5e+101)
		tmp = 2.0 * (re ^ -2.0);
	elseif (im <= 9.2e+151)
		tmp = -0.16666666666666666 * (re ^ 3.0);
	else
		tmp = re * (0.5 * (im ^ 2.0));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 2.1e+15], N[Sin[re], $MachinePrecision], If[LessEqual[im, 2.5e+101], N[(2.0 * N[Power[re, -2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 9.2e+151], N[(-0.16666666666666666 * N[Power[re, 3.0], $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 2.1 \cdot 10^{+15}:\\
\;\;\;\;\sin re\\

\mathbf{elif}\;im \leq 2.5 \cdot 10^{+101}:\\
\;\;\;\;2 \cdot {re}^{-2}\\

\mathbf{elif}\;im \leq 9.2 \cdot 10^{+151}:\\
\;\;\;\;-0.16666666666666666 \cdot {re}^{3}\\

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


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

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 64.1%

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

    if 2.1e15 < im < 2.49999999999999994e101

    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. remove-double-neg100.0%

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

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

      \[\leadsto \color{blue}{\sin re + \sin re} \]
    6. Step-by-step derivation
      1. count-22.5%

        \[\leadsto \color{blue}{2 \cdot \sin re} \]
    7. Simplified2.5%

      \[\leadsto \color{blue}{2 \cdot \sin re} \]
    8. Applied egg-rr12.2%

      \[\leadsto 2 \cdot \color{blue}{{\sin re}^{-2}} \]
    9. Taylor expanded in re around 0 12.1%

      \[\leadsto 2 \cdot {\color{blue}{re}}^{-2} \]

    if 2.49999999999999994e101 < im < 9.2000000000000003e151

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 3.1%

      \[\leadsto \color{blue}{\sin re} \]
    6. Taylor expanded in re around 0 41.3%

      \[\leadsto \color{blue}{re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)} \]
    7. Taylor expanded in re around inf 40.7%

      \[\leadsto \color{blue}{-0.16666666666666666 \cdot {re}^{3}} \]

    if 9.2000000000000003e151 < 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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 97.3%

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

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

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

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

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

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

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

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

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

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

Alternative 16: 55.2% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 2.1 \cdot 10^{+15}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.05 \cdot 10^{+101} \lor \neg \left(im \leq 7.5 \cdot 10^{+259}\right):\\ \;\;\;\;2 \cdot {re}^{-2}\\ \mathbf{else}:\\ \;\;\;\;-0.16666666666666666 \cdot {re}^{3}\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 2.1e+15)
   (sin re)
   (if (or (<= im 1.05e+101) (not (<= im 7.5e+259)))
     (* 2.0 (pow re -2.0))
     (* -0.16666666666666666 (pow re 3.0)))))
double code(double re, double im) {
	double tmp;
	if (im <= 2.1e+15) {
		tmp = sin(re);
	} else if ((im <= 1.05e+101) || !(im <= 7.5e+259)) {
		tmp = 2.0 * pow(re, -2.0);
	} else {
		tmp = -0.16666666666666666 * pow(re, 3.0);
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (im <= 2.1d+15) then
        tmp = sin(re)
    else if ((im <= 1.05d+101) .or. (.not. (im <= 7.5d+259))) then
        tmp = 2.0d0 * (re ** (-2.0d0))
    else
        tmp = (-0.16666666666666666d0) * (re ** 3.0d0)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 2.1e+15) {
		tmp = Math.sin(re);
	} else if ((im <= 1.05e+101) || !(im <= 7.5e+259)) {
		tmp = 2.0 * Math.pow(re, -2.0);
	} else {
		tmp = -0.16666666666666666 * Math.pow(re, 3.0);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 2.1e+15:
		tmp = math.sin(re)
	elif (im <= 1.05e+101) or not (im <= 7.5e+259):
		tmp = 2.0 * math.pow(re, -2.0)
	else:
		tmp = -0.16666666666666666 * math.pow(re, 3.0)
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 2.1e+15)
		tmp = sin(re);
	elseif ((im <= 1.05e+101) || !(im <= 7.5e+259))
		tmp = Float64(2.0 * (re ^ -2.0));
	else
		tmp = Float64(-0.16666666666666666 * (re ^ 3.0));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 2.1e+15)
		tmp = sin(re);
	elseif ((im <= 1.05e+101) || ~((im <= 7.5e+259)))
		tmp = 2.0 * (re ^ -2.0);
	else
		tmp = -0.16666666666666666 * (re ^ 3.0);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 2.1e+15], N[Sin[re], $MachinePrecision], If[Or[LessEqual[im, 1.05e+101], N[Not[LessEqual[im, 7.5e+259]], $MachinePrecision]], N[(2.0 * N[Power[re, -2.0], $MachinePrecision]), $MachinePrecision], N[(-0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 1.05 \cdot 10^{+101} \lor \neg \left(im \leq 7.5 \cdot 10^{+259}\right):\\
\;\;\;\;2 \cdot {re}^{-2}\\

\mathbf{else}:\\
\;\;\;\;-0.16666666666666666 \cdot {re}^{3}\\


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

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 64.1%

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

    if 2.1e15 < im < 1.05e101 or 7.4999999999999995e259 < 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. remove-double-neg100.0%

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

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

      \[\leadsto \color{blue}{\sin re + \sin re} \]
    6. Step-by-step derivation
      1. count-22.5%

        \[\leadsto \color{blue}{2 \cdot \sin re} \]
    7. Simplified2.5%

      \[\leadsto \color{blue}{2 \cdot \sin re} \]
    8. Applied egg-rr8.2%

      \[\leadsto 2 \cdot \color{blue}{{\sin re}^{-2}} \]
    9. Taylor expanded in re around 0 8.0%

      \[\leadsto 2 \cdot {\color{blue}{re}}^{-2} \]

    if 1.05e101 < im < 7.4999999999999995e259

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 2.8%

      \[\leadsto \color{blue}{\sin re} \]
    6. Taylor expanded in re around 0 27.8%

      \[\leadsto \color{blue}{re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)} \]
    7. Taylor expanded in re around inf 27.3%

      \[\leadsto \color{blue}{-0.16666666666666666 \cdot {re}^{3}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification52.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 2.1 \cdot 10^{+15}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.05 \cdot 10^{+101} \lor \neg \left(im \leq 7.5 \cdot 10^{+259}\right):\\ \;\;\;\;2 \cdot {re}^{-2}\\ \mathbf{else}:\\ \;\;\;\;-0.16666666666666666 \cdot {re}^{3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 55.2% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 2.1 \cdot 10^{+15}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+101} \lor \neg \left(im \leq 3.4 \cdot 10^{+260}\right):\\ \;\;\;\;{re}^{-2}\\ \mathbf{else}:\\ \;\;\;\;-0.16666666666666666 \cdot {re}^{3}\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 2.1e+15)
   (sin re)
   (if (or (<= im 1.35e+101) (not (<= im 3.4e+260)))
     (pow re -2.0)
     (* -0.16666666666666666 (pow re 3.0)))))
double code(double re, double im) {
	double tmp;
	if (im <= 2.1e+15) {
		tmp = sin(re);
	} else if ((im <= 1.35e+101) || !(im <= 3.4e+260)) {
		tmp = pow(re, -2.0);
	} else {
		tmp = -0.16666666666666666 * pow(re, 3.0);
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (im <= 2.1d+15) then
        tmp = sin(re)
    else if ((im <= 1.35d+101) .or. (.not. (im <= 3.4d+260))) then
        tmp = re ** (-2.0d0)
    else
        tmp = (-0.16666666666666666d0) * (re ** 3.0d0)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 2.1e+15) {
		tmp = Math.sin(re);
	} else if ((im <= 1.35e+101) || !(im <= 3.4e+260)) {
		tmp = Math.pow(re, -2.0);
	} else {
		tmp = -0.16666666666666666 * Math.pow(re, 3.0);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 2.1e+15:
		tmp = math.sin(re)
	elif (im <= 1.35e+101) or not (im <= 3.4e+260):
		tmp = math.pow(re, -2.0)
	else:
		tmp = -0.16666666666666666 * math.pow(re, 3.0)
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 2.1e+15)
		tmp = sin(re);
	elseif ((im <= 1.35e+101) || !(im <= 3.4e+260))
		tmp = re ^ -2.0;
	else
		tmp = Float64(-0.16666666666666666 * (re ^ 3.0));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 2.1e+15)
		tmp = sin(re);
	elseif ((im <= 1.35e+101) || ~((im <= 3.4e+260)))
		tmp = re ^ -2.0;
	else
		tmp = -0.16666666666666666 * (re ^ 3.0);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 2.1e+15], N[Sin[re], $MachinePrecision], If[Or[LessEqual[im, 1.35e+101], N[Not[LessEqual[im, 3.4e+260]], $MachinePrecision]], N[Power[re, -2.0], $MachinePrecision], N[(-0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 1.35 \cdot 10^{+101} \lor \neg \left(im \leq 3.4 \cdot 10^{+260}\right):\\
\;\;\;\;{re}^{-2}\\

\mathbf{else}:\\
\;\;\;\;-0.16666666666666666 \cdot {re}^{3}\\


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

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 64.1%

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

    if 2.1e15 < im < 1.35000000000000003e101 or 3.3999999999999998e260 < 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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 2.5%

      \[\leadsto \color{blue}{\sin re} \]
    6. Applied egg-rr8.2%

      \[\leadsto \color{blue}{{\sin re}^{-2}} \]
    7. Taylor expanded in re around 0 8.0%

      \[\leadsto {\color{blue}{re}}^{-2} \]

    if 1.35000000000000003e101 < im < 3.3999999999999998e260

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 2.8%

      \[\leadsto \color{blue}{\sin re} \]
    6. Taylor expanded in re around 0 27.8%

      \[\leadsto \color{blue}{re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)} \]
    7. Taylor expanded in re around inf 27.3%

      \[\leadsto \color{blue}{-0.16666666666666666 \cdot {re}^{3}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification52.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 2.1 \cdot 10^{+15}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+101} \lor \neg \left(im \leq 3.4 \cdot 10^{+260}\right):\\ \;\;\;\;{re}^{-2}\\ \mathbf{else}:\\ \;\;\;\;-0.16666666666666666 \cdot {re}^{3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 54.6% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 2.1 \cdot 10^{+15}:\\ \;\;\;\;\sin re\\ \mathbf{else}:\\ \;\;\;\;{re}^{-2}\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 2.1e+15) (sin re) (pow re -2.0)))
double code(double re, double im) {
	double tmp;
	if (im <= 2.1e+15) {
		tmp = sin(re);
	} else {
		tmp = pow(re, -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 <= 2.1d+15) then
        tmp = sin(re)
    else
        tmp = re ** (-2.0d0)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 2.1e+15) {
		tmp = Math.sin(re);
	} else {
		tmp = Math.pow(re, -2.0);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 2.1e+15:
		tmp = math.sin(re)
	else:
		tmp = math.pow(re, -2.0)
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 2.1e+15)
		tmp = sin(re);
	else
		tmp = re ^ -2.0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 2.1e+15)
		tmp = sin(re);
	else
		tmp = re ^ -2.0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 2.1e+15], N[Sin[re], $MachinePrecision], N[Power[re, -2.0], $MachinePrecision]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;{re}^{-2}\\


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

    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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 64.1%

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

    if 2.1e15 < 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. remove-double-neg100.0%

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 2.7%

      \[\leadsto \color{blue}{\sin re} \]
    6. Applied egg-rr9.7%

      \[\leadsto \color{blue}{{\sin re}^{-2}} \]
    7. Taylor expanded in re around 0 9.5%

      \[\leadsto {\color{blue}{re}}^{-2} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 19: 52.0% accurate, 3.1× speedup?

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

\\
\sin 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. remove-double-neg100.0%

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 48.5%

    \[\leadsto \color{blue}{\sin re} \]
  6. Add Preprocessing

Alternative 20: 27.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. remove-double-neg100.0%

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{\color{blue}{-im}} + 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 48.5%

    \[\leadsto \color{blue}{\sin re} \]
  6. Taylor expanded in re around 0 25.0%

    \[\leadsto \color{blue}{re} \]
  7. Add Preprocessing

Alternative 21: 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. remove-double-neg100.0%

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

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

    \[\leadsto \color{blue}{\frac{\sin re \cdot -2}{\sin re \cdot -2 + \left(\sin re \cdot -2 - \sin re \cdot -2\right)}} \]
  6. Step-by-step derivation
    1. +-inverses4.8%

      \[\leadsto \frac{\sin re \cdot -2}{\sin re \cdot -2 + \color{blue}{0}} \]
    2. +-rgt-identity4.8%

      \[\leadsto \frac{\sin re \cdot -2}{\color{blue}{\sin re \cdot -2}} \]
    3. *-inverses4.8%

      \[\leadsto \color{blue}{1} \]
  7. Simplified4.8%

    \[\leadsto \color{blue}{1} \]
  8. Add Preprocessing

Alternative 22: 2.9% accurate, 309.0× speedup?

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

\\
0
\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. remove-double-neg100.0%

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

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

    \[\leadsto \color{blue}{\log \left({1}^{\sin re}\right)} \]
  6. Step-by-step derivation
    1. pow-base-12.8%

      \[\leadsto \log \color{blue}{1} \]
    2. metadata-eval2.8%

      \[\leadsto \color{blue}{0} \]
  7. Simplified2.8%

    \[\leadsto \color{blue}{0} \]
  8. Add Preprocessing

Reproduce

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