math.sin on complex, real part

Percentage Accurate: 100.0% → 100.0%
Time: 13.7s
Alternatives: 20
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 20 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} \\ 0.5 \cdot \left(\sin re \cdot \left(e^{-im} + e^{im}\right)\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(0.5 * Float64(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[(0.5 * N[(N[Sin[re], $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 95.1% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.88 \lor \neg \left(im \leq 6.5 \cdot 10^{+51}\right):\\
\;\;\;\;0.5 \cdot \left(\sin re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.08333333333333333 + im \cdot \left(im \cdot 0.002777777777777778\right)\right)\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 0.880000000000000004 or 6.5e51 < 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. remove-double-neg100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \left(\sin re + {im}^{2} \cdot \left(0.002777777777777778 \cdot \left({im}^{2} \cdot \sin re\right) + 0.08333333333333333 \cdot \sin re\right)\right)\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-in96.3%

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

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

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

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

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + {im}^{2}\right) + \color{blue}{\left(\left(0.002777777777777778 \cdot \left({im}^{2} \cdot \sin re\right) + 0.08333333333333333 \cdot \sin re\right) \cdot {im}^{2}\right)} \cdot {im}^{2}\right) \]
      6. associate-*l*96.7%

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

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + {im}^{2}\right) + \left(\color{blue}{\left(0.002777777777777778 \cdot {im}^{2}\right) \cdot \sin re} + 0.08333333333333333 \cdot \sin re\right) \cdot \left({im}^{2} \cdot {im}^{2}\right)\right) \]
      8. distribute-rgt-out96.7%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + {im}^{2}\right) + \color{blue}{\left(\sin re \cdot \left(0.002777777777777778 \cdot {im}^{2} + 0.08333333333333333\right)\right)} \cdot \left({im}^{2} \cdot {im}^{2}\right)\right) \]
      9. +-commutative96.7%

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

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

    if 0.880000000000000004 < im < 6.5e51

    1. Initial program 99.9%

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

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

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

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

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

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

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

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{-\color{blue}{1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      8. metadata-eval99.9%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{-1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      9. associate-*l/99.9%

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

        \[\leadsto \frac{\color{blue}{0.5 \cdot \left(\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)\right)}}{-1} \]
      11. associate-*r/99.9%

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      12. associate-*l/99.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.88 \lor \neg \left(im \leq 6.5 \cdot 10^{+51}\right):\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.08333333333333333 + im \cdot \left(im \cdot 0.002777777777777778\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(e^{-im} + e^{im}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 84.7% accurate, 2.3× speedup?

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

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

\mathbf{elif}\;im \leq 10^{+98}:\\
\;\;\;\;0.5 \cdot \left(t\_0 \cdot \left(re \cdot \left(2 \cdot \cosh im\right)\right)\right)\\

\mathbf{elif}\;im \leq 4 \cdot 10^{+113}:\\
\;\;\;\;0.5 \cdot \left(0.08333333333333333 \cdot \left(re \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)\right)\\

\mathbf{elif}\;im \leq 3.7 \cdot 10^{+151}:\\
\;\;\;\;0.5 \cdot \left(\left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.08333333333333333 + im \cdot \left(im \cdot 0.002777777777777778\right)\right)\right)\right) \cdot \left(re \cdot t\_0\right)\right)\\

\mathbf{else}:\\
\;\;\;\;-1 + \left(1 + t\_1 \cdot \left(0.5 \cdot \sin re\right)\right)\\


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.4e7 < im < 9.99999999999999998e97

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left(re \cdot \left(\left(1 + \left(re \cdot re\right) \cdot -0.16666666666666666\right) \cdot \color{blue}{\left(e^{im} + e^{-im}\right)}\right)\right) \]
      4. cosh-undef100.0%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(\left(1 + \left(re \cdot re\right) \cdot -0.16666666666666666\right) \cdot \color{blue}{\left(2 \cdot \cosh im\right)}\right)\right) \]
    9. Applied egg-rr100.0%

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left(\left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right) \cdot \color{blue}{\left(re \cdot \left(2 \cdot \cosh im\right)\right)}\right) \]
    11. Simplified100.0%

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

    if 9.99999999999999998e97 < im < 4e113

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 0.5 \cdot \left(\color{blue}{\left(re \cdot \left(1 + {re}^{2} \cdot \left(0.008333333333333333 \cdot {re}^{2} - 0.16666666666666666\right)\right)\right)} \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
    9. Step-by-step derivation
      1. unpow2100.0%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \color{blue}{\left(re \cdot re\right)} \cdot \left(0.008333333333333333 \cdot {re}^{2} - 0.16666666666666666\right)\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
      2. sub-neg100.0%

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

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

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

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \color{blue}{{re}^{2} \cdot 0.008333333333333333}\right)\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
      6. unpow2100.0%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \color{blue}{\left(re \cdot re\right)} \cdot 0.008333333333333333\right)\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
    10. Simplified100.0%

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(0.08333333333333333 \cdot \left({im}^{4} \cdot \left(re \cdot \left(1 + {re}^{2} \cdot \left(0.008333333333333333 \cdot {re}^{2} - 0.16666666666666666\right)\right)\right)\right)\right)} \]
    12. Step-by-step derivation
      1. associate-*r*100.0%

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

        \[\leadsto 0.5 \cdot \left(0.08333333333333333 \cdot \left(\color{blue}{\left(re \cdot {im}^{4}\right)} \cdot \left(1 + {re}^{2} \cdot \left(0.008333333333333333 \cdot {re}^{2} - 0.16666666666666666\right)\right)\right)\right) \]
      3. metadata-eval100.0%

        \[\leadsto 0.5 \cdot \left(0.08333333333333333 \cdot \left(\left(re \cdot {im}^{\color{blue}{\left(2 \cdot 2\right)}}\right) \cdot \left(1 + {re}^{2} \cdot \left(0.008333333333333333 \cdot {re}^{2} - 0.16666666666666666\right)\right)\right)\right) \]
      4. pow-sqr100.0%

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

        \[\leadsto 0.5 \cdot \left(0.08333333333333333 \cdot \left(\left(re \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot {im}^{2}\right)\right) \cdot \left(1 + {re}^{2} \cdot \left(0.008333333333333333 \cdot {re}^{2} - 0.16666666666666666\right)\right)\right)\right) \]
      6. unpow2100.0%

        \[\leadsto 0.5 \cdot \left(0.08333333333333333 \cdot \left(\left(re \cdot \left(\left(im \cdot im\right) \cdot \color{blue}{\left(im \cdot im\right)}\right)\right) \cdot \left(1 + {re}^{2} \cdot \left(0.008333333333333333 \cdot {re}^{2} - 0.16666666666666666\right)\right)\right)\right) \]
      7. sub-neg100.0%

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

        \[\leadsto 0.5 \cdot \left(0.08333333333333333 \cdot \left(\left(re \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right) \cdot \left(1 + {re}^{2} \cdot \left(\color{blue}{{re}^{2} \cdot 0.008333333333333333} + \left(-0.16666666666666666\right)\right)\right)\right)\right) \]
      9. unpow2100.0%

        \[\leadsto 0.5 \cdot \left(0.08333333333333333 \cdot \left(\left(re \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right) \cdot \left(1 + {re}^{2} \cdot \left(\color{blue}{\left(re \cdot re\right)} \cdot 0.008333333333333333 + \left(-0.16666666666666666\right)\right)\right)\right)\right) \]
      10. metadata-eval100.0%

        \[\leadsto 0.5 \cdot \left(0.08333333333333333 \cdot \left(\left(re \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right) \cdot \left(1 + {re}^{2} \cdot \left(\left(re \cdot re\right) \cdot 0.008333333333333333 + \color{blue}{-0.16666666666666666}\right)\right)\right)\right) \]
      11. unpow2100.0%

        \[\leadsto 0.5 \cdot \left(0.08333333333333333 \cdot \left(\left(re \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right) \cdot \left(1 + \color{blue}{\left(re \cdot re\right)} \cdot \left(\left(re \cdot re\right) \cdot 0.008333333333333333 + -0.16666666666666666\right)\right)\right)\right) \]
      12. +-commutative100.0%

        \[\leadsto 0.5 \cdot \left(0.08333333333333333 \cdot \left(\left(re \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right) \cdot \left(1 + \left(re \cdot re\right) \cdot \color{blue}{\left(-0.16666666666666666 + \left(re \cdot re\right) \cdot 0.008333333333333333\right)}\right)\right)\right) \]
      13. associate-*r*100.0%

        \[\leadsto 0.5 \cdot \left(0.08333333333333333 \cdot \left(\left(re \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right) \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \color{blue}{re \cdot \left(re \cdot 0.008333333333333333\right)}\right)\right)\right)\right) \]
    13. Simplified100.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left(0.08333333333333333 \cdot \left(\left(re \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right) \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + re \cdot \left(re \cdot 0.008333333333333333\right)\right)\right)\right)\right)} \]
    14. Taylor expanded in re around 0 100.0%

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

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

        \[\leadsto 0.5 \cdot \left(0.08333333333333333 \cdot \left(re \cdot {im}^{\color{blue}{\left(3 + 1\right)}}\right)\right) \]
      3. pow-plus100.0%

        \[\leadsto 0.5 \cdot \left(0.08333333333333333 \cdot \left(re \cdot \color{blue}{\left({im}^{3} \cdot im\right)}\right)\right) \]
      4. cube-unmult100.0%

        \[\leadsto 0.5 \cdot \left(0.08333333333333333 \cdot \left(re \cdot \left(\color{blue}{\left(im \cdot \left(im \cdot im\right)\right)} \cdot im\right)\right)\right) \]
      5. associate-*r*100.0%

        \[\leadsto 0.5 \cdot \left(0.08333333333333333 \cdot \left(re \cdot \left(\color{blue}{\left(\left(im \cdot im\right) \cdot im\right)} \cdot im\right)\right)\right) \]
      6. associate-*r*100.0%

        \[\leadsto 0.5 \cdot \left(0.08333333333333333 \cdot \left(re \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)}\right)\right) \]
      7. associate-*r*100.0%

        \[\leadsto 0.5 \cdot \left(0.08333333333333333 \cdot \left(re \cdot \color{blue}{\left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)}\right)\right) \]
    16. Simplified100.0%

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

    if 4e113 < im < 3.6999999999999997e151

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(0.5 \cdot \left(\sin re \cdot \left(2 + im \cdot im\right)\right)\right)\right)} \]
      2. expm1-undefine60.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(0.5 \cdot \left(\sin re \cdot \left(2 + im \cdot im\right)\right)\right)} - 1} \]
      3. *-commutative60.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(\sin re \cdot \left(2 + im \cdot im\right)\right) \cdot 0.5}\right)} - 1 \]
    9. Applied egg-rr60.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(\sin re \cdot \left(2 + im \cdot im\right)\right) \cdot 0.5\right)} - 1} \]
    10. Step-by-step derivation
      1. sub-neg60.8%

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

        \[\leadsto e^{\mathsf{log1p}\left(\left(\sin re \cdot \left(2 + im \cdot im\right)\right) \cdot 0.5\right)} + \color{blue}{-1} \]
      3. +-commutative60.8%

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

        \[\leadsto -1 + e^{\color{blue}{\log \left(1 + \left(\sin re \cdot \left(2 + im \cdot im\right)\right) \cdot 0.5\right)}} \]
      5. rem-exp-log97.7%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 64000000:\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot \left(2 + im \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 10^{+98}:\\ \;\;\;\;0.5 \cdot \left(\left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right) \cdot \left(re \cdot \left(2 \cdot \cosh im\right)\right)\right)\\ \mathbf{elif}\;im \leq 4 \cdot 10^{+113}:\\ \;\;\;\;0.5 \cdot \left(0.08333333333333333 \cdot \left(re \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)\right)\\ \mathbf{elif}\;im \leq 3.7 \cdot 10^{+151}:\\ \;\;\;\;0.5 \cdot \left(\left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.08333333333333333 + im \cdot \left(im \cdot 0.002777777777777778\right)\right)\right)\right) \cdot \left(re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + \left(1 + \left(2 + im \cdot im\right) \cdot \left(0.5 \cdot \sin re\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 79.4% accurate, 2.4× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if re < 2.00000000000000016e-5

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left(re \cdot \left(\left(1 + \left(re \cdot re\right) \cdot -0.16666666666666666\right) \cdot \color{blue}{\left(e^{im} + e^{-im}\right)}\right)\right) \]
      4. cosh-undef75.1%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(\left(1 + \left(re \cdot re\right) \cdot -0.16666666666666666\right) \cdot \color{blue}{\left(2 \cdot \cosh im\right)}\right)\right) \]
    9. Applied egg-rr75.1%

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(\left(1 + \left(re \cdot re\right) \cdot -0.16666666666666666\right) \cdot \left(\left(2 \cdot \cosh im\right) \cdot re\right)\right)} \]
      5. associate-*r*75.1%

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

        \[\leadsto 0.5 \cdot \left(\left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right) \cdot \color{blue}{\left(re \cdot \left(2 \cdot \cosh im\right)\right)}\right) \]
    11. Simplified75.1%

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

    if 2.00000000000000016e-5 < re

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \left(\sin re + {im}^{2} \cdot \left(0.002777777777777778 \cdot \left({im}^{2} \cdot \sin re\right) + 0.08333333333333333 \cdot \sin re\right)\right)\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-in95.8%

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

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

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

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

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + {im}^{2}\right) + \color{blue}{\left(\left(0.002777777777777778 \cdot \left({im}^{2} \cdot \sin re\right) + 0.08333333333333333 \cdot \sin re\right) \cdot {im}^{2}\right)} \cdot {im}^{2}\right) \]
      6. associate-*l*95.8%

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

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

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + {im}^{2}\right) + \color{blue}{\left(\sin re \cdot \left(0.002777777777777778 \cdot {im}^{2} + 0.08333333333333333\right)\right)} \cdot \left({im}^{2} \cdot {im}^{2}\right)\right) \]
      9. +-commutative95.8%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + {im}^{2}\right) + \left(\sin re \cdot \color{blue}{\left(0.08333333333333333 + 0.002777777777777778 \cdot {im}^{2}\right)}\right) \cdot \left({im}^{2} \cdot {im}^{2}\right)\right) \]
    7. Simplified95.8%

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

Alternative 5: 92.3% accurate, 2.4× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 6.4e7 or 1.99999999999999997e77 < 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. remove-double-neg100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.4e7 < im < 1.99999999999999997e77

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left(re \cdot \left(\left(1 + \left(re \cdot re\right) \cdot -0.16666666666666666\right) \cdot \color{blue}{\left(e^{im} + e^{-im}\right)}\right)\right) \]
      4. cosh-undef100.0%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(\left(1 + \left(re \cdot re\right) \cdot -0.16666666666666666\right) \cdot \color{blue}{\left(2 \cdot \cosh im\right)}\right)\right) \]
    9. Applied egg-rr100.0%

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left(\left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right) \cdot \color{blue}{\left(re \cdot \left(2 \cdot \cosh im\right)\right)}\right) \]
    11. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 64000000 \lor \neg \left(im \leq 2 \cdot 10^{+77}\right):\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right) \cdot \left(re \cdot \left(2 \cdot \cosh im\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 82.8% accurate, 2.5× speedup?

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

\\
\begin{array}{l}
t_0 := 2 + im \cdot im\\
\mathbf{if}\;im \leq 1.5 \cdot 10^{+19}:\\
\;\;\;\;0.5 \cdot \left(\sin re \cdot t\_0\right)\\

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

\mathbf{else}:\\
\;\;\;\;-1 + \left(1 + t\_0 \cdot \left(0.5 \cdot \sin re\right)\right)\\


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.5e19 < im < 3.6999999999999997e151

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \left(\sin re + {im}^{2} \cdot \left(0.002777777777777778 \cdot \left({im}^{2} \cdot \sin re\right) + 0.08333333333333333 \cdot \sin re\right)\right)\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-in61.3%

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

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

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

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

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + {im}^{2}\right) + \color{blue}{\left(\left(0.002777777777777778 \cdot \left({im}^{2} \cdot \sin re\right) + 0.08333333333333333 \cdot \sin re\right) \cdot {im}^{2}\right)} \cdot {im}^{2}\right) \]
      6. associate-*l*65.6%

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

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + {im}^{2}\right) + \left(\color{blue}{\left(0.002777777777777778 \cdot {im}^{2}\right) \cdot \sin re} + 0.08333333333333333 \cdot \sin re\right) \cdot \left({im}^{2} \cdot {im}^{2}\right)\right) \]
      8. distribute-rgt-out65.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(0.5 \cdot \left(\sin re \cdot \left(2 + im \cdot im\right)\right)\right)\right)} \]
      2. expm1-undefine60.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(0.5 \cdot \left(\sin re \cdot \left(2 + im \cdot im\right)\right)\right)} - 1} \]
      3. *-commutative60.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(\sin re \cdot \left(2 + im \cdot im\right)\right) \cdot 0.5}\right)} - 1 \]
    9. Applied egg-rr60.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(\sin re \cdot \left(2 + im \cdot im\right)\right) \cdot 0.5\right)} - 1} \]
    10. Step-by-step derivation
      1. sub-neg60.8%

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

        \[\leadsto e^{\mathsf{log1p}\left(\left(\sin re \cdot \left(2 + im \cdot im\right)\right) \cdot 0.5\right)} + \color{blue}{-1} \]
      3. +-commutative60.8%

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

        \[\leadsto -1 + e^{\color{blue}{\log \left(1 + \left(\sin re \cdot \left(2 + im \cdot im\right)\right) \cdot 0.5\right)}} \]
      5. rem-exp-log97.7%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 1.5 \cdot 10^{+19}:\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot \left(2 + im \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 3.7 \cdot 10^{+151}:\\ \;\;\;\;0.5 \cdot \left(\left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.08333333333333333 + im \cdot \left(im \cdot 0.002777777777777778\right)\right)\right)\right) \cdot \left(re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + \left(1 + \left(2 + im \cdot im\right) \cdot \left(0.5 \cdot \sin re\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 82.8% accurate, 2.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.36 \cdot 10^{+20} \lor \neg \left(im \leq 3.7 \cdot 10^{+151}\right):\\
\;\;\;\;0.5 \cdot \left(\sin re \cdot \left(2 + im \cdot im\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.08333333333333333 + im \cdot \left(im \cdot 0.002777777777777778\right)\right)\right)\right) \cdot \left(re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 1.36e20 or 3.6999999999999997e151 < 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. remove-double-neg100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.36e20 < im < 3.6999999999999997e151

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \left(\sin re + {im}^{2} \cdot \left(0.002777777777777778 \cdot \left({im}^{2} \cdot \sin re\right) + 0.08333333333333333 \cdot \sin re\right)\right)\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-in61.3%

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

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

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

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

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + {im}^{2}\right) + \color{blue}{\left(\left(0.002777777777777778 \cdot \left({im}^{2} \cdot \sin re\right) + 0.08333333333333333 \cdot \sin re\right) \cdot {im}^{2}\right)} \cdot {im}^{2}\right) \]
      6. associate-*l*65.6%

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

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + {im}^{2}\right) + \left(\color{blue}{\left(0.002777777777777778 \cdot {im}^{2}\right) \cdot \sin re} + 0.08333333333333333 \cdot \sin re\right) \cdot \left({im}^{2} \cdot {im}^{2}\right)\right) \]
      8. distribute-rgt-out65.6%

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

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

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

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

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

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

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

      \[\leadsto 0.5 \cdot \left(\color{blue}{\left(re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)\right)} \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.08333333333333333 + im \cdot \left(im \cdot 0.002777777777777778\right)\right)\right)\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification85.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 1.36 \cdot 10^{+20} \lor \neg \left(im \leq 3.7 \cdot 10^{+151}\right):\\ \;\;\;\;0.5 \cdot \left(\sin re \cdot \left(2 + im \cdot im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.08333333333333333 + im \cdot \left(im \cdot 0.002777777777777778\right)\right)\right)\right) \cdot \left(re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 67.2% accurate, 2.9× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.08333333333333333 + im \cdot \left(im \cdot 0.002777777777777778\right)\right)\right)\right) \cdot \left(re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)\right)\right)\\


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \left(\sin re + {im}^{2} \cdot \left(0.002777777777777778 \cdot \left({im}^{2} \cdot \sin re\right) + 0.08333333333333333 \cdot \sin re\right)\right)\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-in85.8%

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

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

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

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

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + {im}^{2}\right) + \color{blue}{\left(\left(0.002777777777777778 \cdot \left({im}^{2} \cdot \sin re\right) + 0.08333333333333333 \cdot \sin re\right) \cdot {im}^{2}\right)} \cdot {im}^{2}\right) \]
      6. associate-*l*87.4%

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 57.9% accurate, 10.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq 2.5 \cdot 10^{+69}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + im \cdot \left(im \cdot \left(0.08333333333333333 + im \cdot \left(im \cdot 0.002777777777777778\right)\right)\right)\right)\right)\right)\\ \mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\ \;\;\;\;re \cdot \left(\left(2 + im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot 0.008333333333333333\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re 2.5e+69)
   (*
    0.5
    (*
     re
     (+
      2.0
      (*
       (* im im)
       (+
        1.0
        (*
         im
         (*
          im
          (+ 0.08333333333333333 (* im (* im 0.002777777777777778))))))))))
   (if (or (<= re 1.9e+263) (not (<= re 1.15e+293)))
     (* re (* (+ 2.0 (* im im)) (+ 0.5 (* (* re re) -0.08333333333333333))))
     (*
      re
      (+
       1.0
       (*
        (* re re)
        (+ -0.16666666666666666 (* (* re re) 0.008333333333333333))))))))
double code(double re, double im) {
	double tmp;
	if (re <= 2.5e+69) {
		tmp = 0.5 * (re * (2.0 + ((im * im) * (1.0 + (im * (im * (0.08333333333333333 + (im * (im * 0.002777777777777778)))))))));
	} else if ((re <= 1.9e+263) || !(re <= 1.15e+293)) {
		tmp = re * ((2.0 + (im * im)) * (0.5 + ((re * re) * -0.08333333333333333)));
	} else {
		tmp = re * (1.0 + ((re * re) * (-0.16666666666666666 + ((re * re) * 0.008333333333333333))));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= 2.5d+69) then
        tmp = 0.5d0 * (re * (2.0d0 + ((im * im) * (1.0d0 + (im * (im * (0.08333333333333333d0 + (im * (im * 0.002777777777777778d0)))))))))
    else if ((re <= 1.9d+263) .or. (.not. (re <= 1.15d+293))) then
        tmp = re * ((2.0d0 + (im * im)) * (0.5d0 + ((re * re) * (-0.08333333333333333d0))))
    else
        tmp = re * (1.0d0 + ((re * re) * ((-0.16666666666666666d0) + ((re * re) * 0.008333333333333333d0))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= 2.5e+69) {
		tmp = 0.5 * (re * (2.0 + ((im * im) * (1.0 + (im * (im * (0.08333333333333333 + (im * (im * 0.002777777777777778)))))))));
	} else if ((re <= 1.9e+263) || !(re <= 1.15e+293)) {
		tmp = re * ((2.0 + (im * im)) * (0.5 + ((re * re) * -0.08333333333333333)));
	} else {
		tmp = re * (1.0 + ((re * re) * (-0.16666666666666666 + ((re * re) * 0.008333333333333333))));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= 2.5e+69:
		tmp = 0.5 * (re * (2.0 + ((im * im) * (1.0 + (im * (im * (0.08333333333333333 + (im * (im * 0.002777777777777778)))))))))
	elif (re <= 1.9e+263) or not (re <= 1.15e+293):
		tmp = re * ((2.0 + (im * im)) * (0.5 + ((re * re) * -0.08333333333333333)))
	else:
		tmp = re * (1.0 + ((re * re) * (-0.16666666666666666 + ((re * re) * 0.008333333333333333))))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= 2.5e+69)
		tmp = Float64(0.5 * Float64(re * Float64(2.0 + Float64(Float64(im * im) * Float64(1.0 + Float64(im * Float64(im * Float64(0.08333333333333333 + Float64(im * Float64(im * 0.002777777777777778))))))))));
	elseif ((re <= 1.9e+263) || !(re <= 1.15e+293))
		tmp = Float64(re * Float64(Float64(2.0 + Float64(im * im)) * Float64(0.5 + Float64(Float64(re * re) * -0.08333333333333333))));
	else
		tmp = Float64(re * Float64(1.0 + Float64(Float64(re * re) * Float64(-0.16666666666666666 + Float64(Float64(re * re) * 0.008333333333333333)))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= 2.5e+69)
		tmp = 0.5 * (re * (2.0 + ((im * im) * (1.0 + (im * (im * (0.08333333333333333 + (im * (im * 0.002777777777777778)))))))));
	elseif ((re <= 1.9e+263) || ~((re <= 1.15e+293)))
		tmp = re * ((2.0 + (im * im)) * (0.5 + ((re * re) * -0.08333333333333333)));
	else
		tmp = re * (1.0 + ((re * re) * (-0.16666666666666666 + ((re * re) * 0.008333333333333333))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, 2.5e+69], N[(0.5 * N[(re * N[(2.0 + N[(N[(im * im), $MachinePrecision] * N[(1.0 + N[(im * N[(im * N[(0.08333333333333333 + N[(im * N[(im * 0.002777777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[re, 1.9e+263], N[Not[LessEqual[re, 1.15e+293]], $MachinePrecision]], N[(re * N[(N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(1.0 + N[(N[(re * re), $MachinePrecision] * N[(-0.16666666666666666 + N[(N[(re * re), $MachinePrecision] * 0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.5 \cdot 10^{+69}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + im \cdot \left(im \cdot \left(0.08333333333333333 + im \cdot \left(im \cdot 0.002777777777777778\right)\right)\right)\right)\right)\right)\\

\mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\
\;\;\;\;re \cdot \left(\left(2 + im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\

\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot 0.008333333333333333\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < 2.50000000000000018e69

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(\left(2 \cdot \sin re + {im}^{2} \cdot \sin re\right) + \left({im}^{2} \cdot \left(0.002777777777777778 \cdot \left({im}^{2} \cdot \sin re\right) + 0.08333333333333333 \cdot \sin re\right)\right) \cdot {im}^{2}\right)} \]
      4. distribute-rgt-out90.5%

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

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + {im}^{2}\right) + \color{blue}{\left(\left(0.002777777777777778 \cdot \left({im}^{2} \cdot \sin re\right) + 0.08333333333333333 \cdot \sin re\right) \cdot {im}^{2}\right)} \cdot {im}^{2}\right) \]
      6. associate-*l*91.0%

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

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + {im}^{2}\right) + \left(\color{blue}{\left(0.002777777777777778 \cdot {im}^{2}\right) \cdot \sin re} + 0.08333333333333333 \cdot \sin re\right) \cdot \left({im}^{2} \cdot {im}^{2}\right)\right) \]
      8. distribute-rgt-out91.0%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + {im}^{2}\right) + \color{blue}{\left(\sin re \cdot \left(0.002777777777777778 \cdot {im}^{2} + 0.08333333333333333\right)\right)} \cdot \left({im}^{2} \cdot {im}^{2}\right)\right) \]
      9. +-commutative91.0%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + {im}^{2}\right) + \left(\sin re \cdot \color{blue}{\left(0.08333333333333333 + 0.002777777777777778 \cdot {im}^{2}\right)}\right) \cdot \left({im}^{2} \cdot {im}^{2}\right)\right) \]
    7. Simplified92.8%

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot \left(im \cdot \left(im \cdot 0.002777777777777778\right) + 0.08333333333333333\right)\right)\right)\right) \]
      7. +-commutative64.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot \color{blue}{\left(0.08333333333333333 + im \cdot \left(im \cdot 0.002777777777777778\right)\right)}\right)\right)\right) \]
      8. associate-*r*64.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot \left(0.08333333333333333 + im \cdot \left(im \cdot 0.002777777777777778\right)\right)\right)}\right)\right)\right) \]
    10. Simplified64.9%

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

    if 2.50000000000000018e69 < re < 1.9e263 or 1.14999999999999995e293 < re

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto re \cdot \left(\left(2 + im \cdot im\right) \cdot \left(\color{blue}{\left(re \cdot re\right)} \cdot -0.08333333333333333 + 0.5\right)\right) \]
    10. Simplified45.8%

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

    if 1.9e263 < re < 1.14999999999999995e293

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{re \cdot \left(1 + {re}^{2} \cdot \left(0.008333333333333333 \cdot {re}^{2} - 0.16666666666666666\right)\right)} \]
    10. Step-by-step derivation
      1. unpow250.9%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \color{blue}{\left(re \cdot re\right)} \cdot \left(0.008333333333333333 \cdot {re}^{2} - 0.16666666666666666\right)\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
      2. sub-neg50.9%

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

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(0.008333333333333333 \cdot {re}^{2} + \color{blue}{-0.16666666666666666}\right)\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
      4. +-commutative50.9%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \left(re \cdot re\right) \cdot \color{blue}{\left(-0.16666666666666666 + 0.008333333333333333 \cdot {re}^{2}\right)}\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
      5. *-commutative50.9%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \color{blue}{{re}^{2} \cdot 0.008333333333333333}\right)\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
      6. unpow250.9%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \color{blue}{\left(re \cdot re\right)} \cdot 0.008333333333333333\right)\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
    11. Simplified50.9%

      \[\leadsto \color{blue}{re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot 0.008333333333333333\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification61.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 2.5 \cdot 10^{+69}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + im \cdot \left(im \cdot \left(0.08333333333333333 + im \cdot \left(im \cdot 0.002777777777777778\right)\right)\right)\right)\right)\right)\\ \mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\ \;\;\;\;re \cdot \left(\left(2 + im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot 0.008333333333333333\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 57.8% accurate, 10.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq 2.5 \cdot 10^{+69}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + im \cdot \left(im \cdot \left(\left(im \cdot im\right) \cdot 0.002777777777777778\right)\right)\right)\right)\right)\\ \mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\ \;\;\;\;re \cdot \left(\left(2 + im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot 0.008333333333333333\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re 2.5e+69)
   (*
    0.5
    (*
     re
     (+
      2.0
      (* (* im im) (+ 1.0 (* im (* im (* (* im im) 0.002777777777777778))))))))
   (if (or (<= re 1.9e+263) (not (<= re 1.15e+293)))
     (* re (* (+ 2.0 (* im im)) (+ 0.5 (* (* re re) -0.08333333333333333))))
     (*
      re
      (+
       1.0
       (*
        (* re re)
        (+ -0.16666666666666666 (* (* re re) 0.008333333333333333))))))))
double code(double re, double im) {
	double tmp;
	if (re <= 2.5e+69) {
		tmp = 0.5 * (re * (2.0 + ((im * im) * (1.0 + (im * (im * ((im * im) * 0.002777777777777778)))))));
	} else if ((re <= 1.9e+263) || !(re <= 1.15e+293)) {
		tmp = re * ((2.0 + (im * im)) * (0.5 + ((re * re) * -0.08333333333333333)));
	} else {
		tmp = re * (1.0 + ((re * re) * (-0.16666666666666666 + ((re * re) * 0.008333333333333333))));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= 2.5d+69) then
        tmp = 0.5d0 * (re * (2.0d0 + ((im * im) * (1.0d0 + (im * (im * ((im * im) * 0.002777777777777778d0)))))))
    else if ((re <= 1.9d+263) .or. (.not. (re <= 1.15d+293))) then
        tmp = re * ((2.0d0 + (im * im)) * (0.5d0 + ((re * re) * (-0.08333333333333333d0))))
    else
        tmp = re * (1.0d0 + ((re * re) * ((-0.16666666666666666d0) + ((re * re) * 0.008333333333333333d0))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= 2.5e+69) {
		tmp = 0.5 * (re * (2.0 + ((im * im) * (1.0 + (im * (im * ((im * im) * 0.002777777777777778)))))));
	} else if ((re <= 1.9e+263) || !(re <= 1.15e+293)) {
		tmp = re * ((2.0 + (im * im)) * (0.5 + ((re * re) * -0.08333333333333333)));
	} else {
		tmp = re * (1.0 + ((re * re) * (-0.16666666666666666 + ((re * re) * 0.008333333333333333))));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= 2.5e+69:
		tmp = 0.5 * (re * (2.0 + ((im * im) * (1.0 + (im * (im * ((im * im) * 0.002777777777777778)))))))
	elif (re <= 1.9e+263) or not (re <= 1.15e+293):
		tmp = re * ((2.0 + (im * im)) * (0.5 + ((re * re) * -0.08333333333333333)))
	else:
		tmp = re * (1.0 + ((re * re) * (-0.16666666666666666 + ((re * re) * 0.008333333333333333))))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= 2.5e+69)
		tmp = Float64(0.5 * Float64(re * Float64(2.0 + Float64(Float64(im * im) * Float64(1.0 + Float64(im * Float64(im * Float64(Float64(im * im) * 0.002777777777777778))))))));
	elseif ((re <= 1.9e+263) || !(re <= 1.15e+293))
		tmp = Float64(re * Float64(Float64(2.0 + Float64(im * im)) * Float64(0.5 + Float64(Float64(re * re) * -0.08333333333333333))));
	else
		tmp = Float64(re * Float64(1.0 + Float64(Float64(re * re) * Float64(-0.16666666666666666 + Float64(Float64(re * re) * 0.008333333333333333)))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= 2.5e+69)
		tmp = 0.5 * (re * (2.0 + ((im * im) * (1.0 + (im * (im * ((im * im) * 0.002777777777777778)))))));
	elseif ((re <= 1.9e+263) || ~((re <= 1.15e+293)))
		tmp = re * ((2.0 + (im * im)) * (0.5 + ((re * re) * -0.08333333333333333)));
	else
		tmp = re * (1.0 + ((re * re) * (-0.16666666666666666 + ((re * re) * 0.008333333333333333))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, 2.5e+69], N[(0.5 * N[(re * N[(2.0 + N[(N[(im * im), $MachinePrecision] * N[(1.0 + N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * 0.002777777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[re, 1.9e+263], N[Not[LessEqual[re, 1.15e+293]], $MachinePrecision]], N[(re * N[(N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(1.0 + N[(N[(re * re), $MachinePrecision] * N[(-0.16666666666666666 + N[(N[(re * re), $MachinePrecision] * 0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\
\;\;\;\;re \cdot \left(\left(2 + im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\

\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot 0.008333333333333333\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < 2.50000000000000018e69

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(\left(2 \cdot \sin re + {im}^{2} \cdot \sin re\right) + \left({im}^{2} \cdot \left(0.002777777777777778 \cdot \left({im}^{2} \cdot \sin re\right) + 0.08333333333333333 \cdot \sin re\right)\right) \cdot {im}^{2}\right)} \]
      4. distribute-rgt-out90.5%

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

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + {im}^{2}\right) + \color{blue}{\left(\left(0.002777777777777778 \cdot \left({im}^{2} \cdot \sin re\right) + 0.08333333333333333 \cdot \sin re\right) \cdot {im}^{2}\right)} \cdot {im}^{2}\right) \]
      6. associate-*l*91.0%

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

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + {im}^{2}\right) + \left(\color{blue}{\left(0.002777777777777778 \cdot {im}^{2}\right) \cdot \sin re} + 0.08333333333333333 \cdot \sin re\right) \cdot \left({im}^{2} \cdot {im}^{2}\right)\right) \]
      8. distribute-rgt-out91.0%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + {im}^{2}\right) + \color{blue}{\left(\sin re \cdot \left(0.002777777777777778 \cdot {im}^{2} + 0.08333333333333333\right)\right)} \cdot \left({im}^{2} \cdot {im}^{2}\right)\right) \]
      9. +-commutative91.0%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + {im}^{2}\right) + \left(\sin re \cdot \color{blue}{\left(0.08333333333333333 + 0.002777777777777778 \cdot {im}^{2}\right)}\right) \cdot \left({im}^{2} \cdot {im}^{2}\right)\right) \]
    7. Simplified92.8%

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot \left(im \cdot \left(im \cdot 0.002777777777777778\right) + 0.08333333333333333\right)\right)\right)\right) \]
      7. +-commutative64.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot \color{blue}{\left(0.08333333333333333 + im \cdot \left(im \cdot 0.002777777777777778\right)\right)}\right)\right)\right) \]
      8. associate-*r*64.9%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \color{blue}{im \cdot \left(im \cdot \left(0.08333333333333333 + im \cdot \left(im \cdot 0.002777777777777778\right)\right)\right)}\right)\right)\right) \]
    10. Simplified64.9%

      \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + im \cdot \left(im \cdot \left(0.08333333333333333 + im \cdot \left(im \cdot 0.002777777777777778\right)\right)\right)\right)\right)\right)} \]
    11. Taylor expanded in im around inf 64.8%

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + im \cdot \left(im \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot 0.002777777777777778\right)\right)\right)\right)\right) \]
    13. Simplified64.8%

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

    if 2.50000000000000018e69 < re < 1.9e263 or 1.14999999999999995e293 < re

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto re \cdot \left(\left(2 + im \cdot im\right) \cdot \left(\color{blue}{\left(re \cdot re\right)} \cdot -0.08333333333333333 + 0.5\right)\right) \]
    10. Simplified45.8%

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

    if 1.9e263 < re < 1.14999999999999995e293

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{re \cdot \left(1 + {re}^{2} \cdot \left(0.008333333333333333 \cdot {re}^{2} - 0.16666666666666666\right)\right)} \]
    10. Step-by-step derivation
      1. unpow250.9%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \color{blue}{\left(re \cdot re\right)} \cdot \left(0.008333333333333333 \cdot {re}^{2} - 0.16666666666666666\right)\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
      2. sub-neg50.9%

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

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(0.008333333333333333 \cdot {re}^{2} + \color{blue}{-0.16666666666666666}\right)\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
      4. +-commutative50.9%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \left(re \cdot re\right) \cdot \color{blue}{\left(-0.16666666666666666 + 0.008333333333333333 \cdot {re}^{2}\right)}\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
      5. *-commutative50.9%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \color{blue}{{re}^{2} \cdot 0.008333333333333333}\right)\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
      6. unpow250.9%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \color{blue}{\left(re \cdot re\right)} \cdot 0.008333333333333333\right)\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
    11. Simplified50.9%

      \[\leadsto \color{blue}{re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot 0.008333333333333333\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification61.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 2.5 \cdot 10^{+69}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + im \cdot \left(im \cdot \left(\left(im \cdot im\right) \cdot 0.002777777777777778\right)\right)\right)\right)\right)\\ \mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\ \;\;\;\;re \cdot \left(\left(2 + im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot 0.008333333333333333\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 55.5% accurate, 10.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq 2.5 \cdot 10^{+69}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + im \cdot \left(im \cdot 0.08333333333333333\right)\right)\right)\right)\\ \mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\ \;\;\;\;re \cdot \left(\left(2 + im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot 0.008333333333333333\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re 2.5e+69)
   (*
    0.5
    (* re (+ 2.0 (* (* im im) (+ 1.0 (* im (* im 0.08333333333333333)))))))
   (if (or (<= re 1.9e+263) (not (<= re 1.15e+293)))
     (* re (* (+ 2.0 (* im im)) (+ 0.5 (* (* re re) -0.08333333333333333))))
     (*
      re
      (+
       1.0
       (*
        (* re re)
        (+ -0.16666666666666666 (* (* re re) 0.008333333333333333))))))))
double code(double re, double im) {
	double tmp;
	if (re <= 2.5e+69) {
		tmp = 0.5 * (re * (2.0 + ((im * im) * (1.0 + (im * (im * 0.08333333333333333))))));
	} else if ((re <= 1.9e+263) || !(re <= 1.15e+293)) {
		tmp = re * ((2.0 + (im * im)) * (0.5 + ((re * re) * -0.08333333333333333)));
	} else {
		tmp = re * (1.0 + ((re * re) * (-0.16666666666666666 + ((re * re) * 0.008333333333333333))));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= 2.5d+69) then
        tmp = 0.5d0 * (re * (2.0d0 + ((im * im) * (1.0d0 + (im * (im * 0.08333333333333333d0))))))
    else if ((re <= 1.9d+263) .or. (.not. (re <= 1.15d+293))) then
        tmp = re * ((2.0d0 + (im * im)) * (0.5d0 + ((re * re) * (-0.08333333333333333d0))))
    else
        tmp = re * (1.0d0 + ((re * re) * ((-0.16666666666666666d0) + ((re * re) * 0.008333333333333333d0))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= 2.5e+69) {
		tmp = 0.5 * (re * (2.0 + ((im * im) * (1.0 + (im * (im * 0.08333333333333333))))));
	} else if ((re <= 1.9e+263) || !(re <= 1.15e+293)) {
		tmp = re * ((2.0 + (im * im)) * (0.5 + ((re * re) * -0.08333333333333333)));
	} else {
		tmp = re * (1.0 + ((re * re) * (-0.16666666666666666 + ((re * re) * 0.008333333333333333))));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= 2.5e+69:
		tmp = 0.5 * (re * (2.0 + ((im * im) * (1.0 + (im * (im * 0.08333333333333333))))))
	elif (re <= 1.9e+263) or not (re <= 1.15e+293):
		tmp = re * ((2.0 + (im * im)) * (0.5 + ((re * re) * -0.08333333333333333)))
	else:
		tmp = re * (1.0 + ((re * re) * (-0.16666666666666666 + ((re * re) * 0.008333333333333333))))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= 2.5e+69)
		tmp = Float64(0.5 * Float64(re * Float64(2.0 + Float64(Float64(im * im) * Float64(1.0 + Float64(im * Float64(im * 0.08333333333333333)))))));
	elseif ((re <= 1.9e+263) || !(re <= 1.15e+293))
		tmp = Float64(re * Float64(Float64(2.0 + Float64(im * im)) * Float64(0.5 + Float64(Float64(re * re) * -0.08333333333333333))));
	else
		tmp = Float64(re * Float64(1.0 + Float64(Float64(re * re) * Float64(-0.16666666666666666 + Float64(Float64(re * re) * 0.008333333333333333)))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= 2.5e+69)
		tmp = 0.5 * (re * (2.0 + ((im * im) * (1.0 + (im * (im * 0.08333333333333333))))));
	elseif ((re <= 1.9e+263) || ~((re <= 1.15e+293)))
		tmp = re * ((2.0 + (im * im)) * (0.5 + ((re * re) * -0.08333333333333333)));
	else
		tmp = re * (1.0 + ((re * re) * (-0.16666666666666666 + ((re * re) * 0.008333333333333333))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, 2.5e+69], N[(0.5 * N[(re * N[(2.0 + N[(N[(im * im), $MachinePrecision] * N[(1.0 + N[(im * N[(im * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[re, 1.9e+263], N[Not[LessEqual[re, 1.15e+293]], $MachinePrecision]], N[(re * N[(N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(1.0 + N[(N[(re * re), $MachinePrecision] * N[(-0.16666666666666666 + N[(N[(re * re), $MachinePrecision] * 0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\
\;\;\;\;re \cdot \left(\left(2 + im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\

\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot 0.008333333333333333\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < 2.50000000000000018e69

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + \color{blue}{\left(im \cdot im\right)} \cdot \left(im \cdot \left(im \cdot 0.08333333333333333\right) + 1\right)\right)\right) \]
      6. +-commutative62.0%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + \left(im \cdot im\right) \cdot \color{blue}{\left(1 + im \cdot \left(im \cdot 0.08333333333333333\right)\right)}\right)\right) \]
    10. Simplified62.0%

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

    if 2.50000000000000018e69 < re < 1.9e263 or 1.14999999999999995e293 < re

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto re \cdot \left(\left(2 + im \cdot im\right) \cdot \left(\color{blue}{\left(re \cdot re\right)} \cdot -0.08333333333333333 + 0.5\right)\right) \]
    10. Simplified45.8%

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

    if 1.9e263 < re < 1.14999999999999995e293

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{re \cdot \left(1 + {re}^{2} \cdot \left(0.008333333333333333 \cdot {re}^{2} - 0.16666666666666666\right)\right)} \]
    10. Step-by-step derivation
      1. unpow250.9%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \color{blue}{\left(re \cdot re\right)} \cdot \left(0.008333333333333333 \cdot {re}^{2} - 0.16666666666666666\right)\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
      2. sub-neg50.9%

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

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(0.008333333333333333 \cdot {re}^{2} + \color{blue}{-0.16666666666666666}\right)\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
      4. +-commutative50.9%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \left(re \cdot re\right) \cdot \color{blue}{\left(-0.16666666666666666 + 0.008333333333333333 \cdot {re}^{2}\right)}\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
      5. *-commutative50.9%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \color{blue}{{re}^{2} \cdot 0.008333333333333333}\right)\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
      6. unpow250.9%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \color{blue}{\left(re \cdot re\right)} \cdot 0.008333333333333333\right)\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
    11. Simplified50.9%

      \[\leadsto \color{blue}{re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot 0.008333333333333333\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification58.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 2.5 \cdot 10^{+69}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + im \cdot \left(im \cdot 0.08333333333333333\right)\right)\right)\right)\\ \mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\ \;\;\;\;re \cdot \left(\left(2 + im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot 0.008333333333333333\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 55.4% accurate, 10.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq 2.5 \cdot 10^{+69}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + 0.08333333333333333 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\ \;\;\;\;re \cdot \left(\left(2 + im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot 0.008333333333333333\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re 2.5e+69)
   (* 0.5 (* re (+ 2.0 (* 0.08333333333333333 (* (* im im) (* im im))))))
   (if (or (<= re 1.9e+263) (not (<= re 1.15e+293)))
     (* re (* (+ 2.0 (* im im)) (+ 0.5 (* (* re re) -0.08333333333333333))))
     (*
      re
      (+
       1.0
       (*
        (* re re)
        (+ -0.16666666666666666 (* (* re re) 0.008333333333333333))))))))
double code(double re, double im) {
	double tmp;
	if (re <= 2.5e+69) {
		tmp = 0.5 * (re * (2.0 + (0.08333333333333333 * ((im * im) * (im * im)))));
	} else if ((re <= 1.9e+263) || !(re <= 1.15e+293)) {
		tmp = re * ((2.0 + (im * im)) * (0.5 + ((re * re) * -0.08333333333333333)));
	} else {
		tmp = re * (1.0 + ((re * re) * (-0.16666666666666666 + ((re * re) * 0.008333333333333333))));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= 2.5d+69) then
        tmp = 0.5d0 * (re * (2.0d0 + (0.08333333333333333d0 * ((im * im) * (im * im)))))
    else if ((re <= 1.9d+263) .or. (.not. (re <= 1.15d+293))) then
        tmp = re * ((2.0d0 + (im * im)) * (0.5d0 + ((re * re) * (-0.08333333333333333d0))))
    else
        tmp = re * (1.0d0 + ((re * re) * ((-0.16666666666666666d0) + ((re * re) * 0.008333333333333333d0))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= 2.5e+69) {
		tmp = 0.5 * (re * (2.0 + (0.08333333333333333 * ((im * im) * (im * im)))));
	} else if ((re <= 1.9e+263) || !(re <= 1.15e+293)) {
		tmp = re * ((2.0 + (im * im)) * (0.5 + ((re * re) * -0.08333333333333333)));
	} else {
		tmp = re * (1.0 + ((re * re) * (-0.16666666666666666 + ((re * re) * 0.008333333333333333))));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= 2.5e+69:
		tmp = 0.5 * (re * (2.0 + (0.08333333333333333 * ((im * im) * (im * im)))))
	elif (re <= 1.9e+263) or not (re <= 1.15e+293):
		tmp = re * ((2.0 + (im * im)) * (0.5 + ((re * re) * -0.08333333333333333)))
	else:
		tmp = re * (1.0 + ((re * re) * (-0.16666666666666666 + ((re * re) * 0.008333333333333333))))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= 2.5e+69)
		tmp = Float64(0.5 * Float64(re * Float64(2.0 + Float64(0.08333333333333333 * Float64(Float64(im * im) * Float64(im * im))))));
	elseif ((re <= 1.9e+263) || !(re <= 1.15e+293))
		tmp = Float64(re * Float64(Float64(2.0 + Float64(im * im)) * Float64(0.5 + Float64(Float64(re * re) * -0.08333333333333333))));
	else
		tmp = Float64(re * Float64(1.0 + Float64(Float64(re * re) * Float64(-0.16666666666666666 + Float64(Float64(re * re) * 0.008333333333333333)))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= 2.5e+69)
		tmp = 0.5 * (re * (2.0 + (0.08333333333333333 * ((im * im) * (im * im)))));
	elseif ((re <= 1.9e+263) || ~((re <= 1.15e+293)))
		tmp = re * ((2.0 + (im * im)) * (0.5 + ((re * re) * -0.08333333333333333)));
	else
		tmp = re * (1.0 + ((re * re) * (-0.16666666666666666 + ((re * re) * 0.008333333333333333))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, 2.5e+69], N[(0.5 * N[(re * N[(2.0 + N[(0.08333333333333333 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[re, 1.9e+263], N[Not[LessEqual[re, 1.15e+293]], $MachinePrecision]], N[(re * N[(N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(1.0 + N[(N[(re * re), $MachinePrecision] * N[(-0.16666666666666666 + N[(N[(re * re), $MachinePrecision] * 0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.5 \cdot 10^{+69}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(2 + 0.08333333333333333 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)\\

\mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\
\;\;\;\;re \cdot \left(\left(2 + im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\

\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot 0.008333333333333333\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < 2.50000000000000018e69

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + 0.08333333333333333 \cdot \left(\left(im \cdot im\right) \cdot \color{blue}{\left(im \cdot im\right)}\right)\right)\right) \]
    11. Simplified61.8%

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

    if 2.50000000000000018e69 < re < 1.9e263 or 1.14999999999999995e293 < re

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto re \cdot \left(\left(2 + im \cdot im\right) \cdot \left(\color{blue}{\left(re \cdot re\right)} \cdot -0.08333333333333333 + 0.5\right)\right) \]
    10. Simplified45.8%

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

    if 1.9e263 < re < 1.14999999999999995e293

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{re \cdot \left(1 + {re}^{2} \cdot \left(0.008333333333333333 \cdot {re}^{2} - 0.16666666666666666\right)\right)} \]
    10. Step-by-step derivation
      1. unpow250.9%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \color{blue}{\left(re \cdot re\right)} \cdot \left(0.008333333333333333 \cdot {re}^{2} - 0.16666666666666666\right)\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
      2. sub-neg50.9%

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

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(0.008333333333333333 \cdot {re}^{2} + \color{blue}{-0.16666666666666666}\right)\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
      4. +-commutative50.9%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \left(re \cdot re\right) \cdot \color{blue}{\left(-0.16666666666666666 + 0.008333333333333333 \cdot {re}^{2}\right)}\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
      5. *-commutative50.9%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \color{blue}{{re}^{2} \cdot 0.008333333333333333}\right)\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
      6. unpow250.9%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \color{blue}{\left(re \cdot re\right)} \cdot 0.008333333333333333\right)\right)\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
    11. Simplified50.9%

      \[\leadsto \color{blue}{re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot 0.008333333333333333\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification58.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 2.5 \cdot 10^{+69}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + 0.08333333333333333 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\ \;\;\;\;re \cdot \left(\left(2 + im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(1 + \left(re \cdot re\right) \cdot \left(-0.16666666666666666 + \left(re \cdot re\right) \cdot 0.008333333333333333\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 55.4% accurate, 10.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.5 \cdot 10^{+69}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(2 + 0.08333333333333333 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)\\

\mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\
\;\;\;\;re \cdot \left(\left(2 + im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < 2.50000000000000018e69

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + 0.08333333333333333 \cdot \left(\left(im \cdot im\right) \cdot \color{blue}{\left(im \cdot im\right)}\right)\right)\right) \]
    11. Simplified61.8%

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

    if 2.50000000000000018e69 < re < 1.9e263 or 1.14999999999999995e293 < re

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{0.5 \cdot \left(\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)\right)}}{-1} \]
      11. associate-*r/100.0%

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      12. associate-*l/100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\sin \left(-re\right)}{-1} \cdot \left(e^{0 - im} + e^{im}\right)\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} + e^{im}\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 83.1%

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \sin re\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-out83.1%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + {im}^{2}\right)\right)} \]
      2. unpow283.1%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \color{blue}{im \cdot im}\right)\right) \]
    7. Simplified83.1%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + im \cdot im\right)\right)} \]
    8. Taylor expanded in re around 0 11.8%

      \[\leadsto \color{blue}{re \cdot \left(-0.08333333333333333 \cdot \left({re}^{2} \cdot \left(2 + {im}^{2}\right)\right) + 0.5 \cdot \left(2 + {im}^{2}\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*r*11.8%

        \[\leadsto re \cdot \left(\color{blue}{\left(-0.08333333333333333 \cdot {re}^{2}\right) \cdot \left(2 + {im}^{2}\right)} + 0.5 \cdot \left(2 + {im}^{2}\right)\right) \]
      2. distribute-rgt-out45.8%

        \[\leadsto re \cdot \color{blue}{\left(\left(2 + {im}^{2}\right) \cdot \left(-0.08333333333333333 \cdot {re}^{2} + 0.5\right)\right)} \]
      3. unpow245.8%

        \[\leadsto re \cdot \left(\left(2 + \color{blue}{im \cdot im}\right) \cdot \left(-0.08333333333333333 \cdot {re}^{2} + 0.5\right)\right) \]
      4. *-commutative45.8%

        \[\leadsto re \cdot \left(\left(2 + im \cdot im\right) \cdot \left(\color{blue}{{re}^{2} \cdot -0.08333333333333333} + 0.5\right)\right) \]
      5. unpow245.8%

        \[\leadsto re \cdot \left(\left(2 + im \cdot im\right) \cdot \left(\color{blue}{\left(re \cdot re\right)} \cdot -0.08333333333333333 + 0.5\right)\right) \]
    10. Simplified45.8%

      \[\leadsto \color{blue}{re \cdot \left(\left(2 + im \cdot im\right) \cdot \left(\left(re \cdot re\right) \cdot -0.08333333333333333 + 0.5\right)\right)} \]

    if 1.9e263 < re < 1.14999999999999995e293

    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. remove-double-neg100.0%

        \[\leadsto \left(0.5 \cdot \color{blue}{\left(-\left(-\sin re\right)\right)}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      2. sin-neg100.0%

        \[\leadsto \left(0.5 \cdot \left(-\color{blue}{\sin \left(-re\right)}\right)\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      3. distribute-rgt-neg-in100.0%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \sin \left(-re\right)\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
      4. /-rgt-identity100.0%

        \[\leadsto \left(-\color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{1}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      5. exp-0100.0%

        \[\leadsto \left(-\frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{e^{0}}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      6. distribute-neg-frac2100.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{-e^{0}}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      7. exp-0100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{-\color{blue}{1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      8. metadata-eval100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{-1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      9. associate-*l/100.0%

        \[\leadsto \color{blue}{\frac{\left(0.5 \cdot \sin \left(-re\right)\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      10. associate-*l*100.0%

        \[\leadsto \frac{\color{blue}{0.5 \cdot \left(\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)\right)}}{-1} \]
      11. associate-*r/100.0%

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      12. associate-*l/100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\sin \left(-re\right)}{-1} \cdot \left(e^{0 - im} + e^{im}\right)\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} + e^{im}\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 100.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \left(\sin re + 0.08333333333333333 \cdot \left({im}^{2} \cdot \sin re\right)\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*100.0%

        \[\leadsto 0.5 \cdot \left(2 \cdot \sin re + {im}^{2} \cdot \left(\sin re + \color{blue}{\left(0.08333333333333333 \cdot {im}^{2}\right) \cdot \sin re}\right)\right) \]
      2. distribute-rgt1-in100.0%

        \[\leadsto 0.5 \cdot \left(2 \cdot \sin re + {im}^{2} \cdot \color{blue}{\left(\left(0.08333333333333333 \cdot {im}^{2} + 1\right) \cdot \sin re\right)}\right) \]
      3. +-commutative100.0%

        \[\leadsto 0.5 \cdot \left(2 \cdot \sin re + {im}^{2} \cdot \left(\color{blue}{\left(1 + 0.08333333333333333 \cdot {im}^{2}\right)} \cdot \sin re\right)\right) \]
      4. associate-*r*100.0%

        \[\leadsto 0.5 \cdot \left(2 \cdot \sin re + \color{blue}{\left({im}^{2} \cdot \left(1 + 0.08333333333333333 \cdot {im}^{2}\right)\right) \cdot \sin re}\right) \]
      5. distribute-rgt-out100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + {im}^{2} \cdot \left(1 + 0.08333333333333333 \cdot {im}^{2}\right)\right)\right)} \]
      6. unpow2100.0%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \color{blue}{\left(im \cdot im\right)} \cdot \left(1 + 0.08333333333333333 \cdot {im}^{2}\right)\right)\right) \]
      7. *-commutative100.0%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \color{blue}{{im}^{2} \cdot 0.08333333333333333}\right)\right)\right) \]
      8. unpow2100.0%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot 0.08333333333333333\right)\right)\right) \]
    7. Simplified100.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right)} \]
    8. Taylor expanded in re around 0 51.0%

      \[\leadsto 0.5 \cdot \left(\color{blue}{re} \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
    9. Taylor expanded in im around inf 50.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left({im}^{4} \cdot \left(0.08333333333333333 \cdot re + \frac{re}{{im}^{2}}\right)\right)} \]
    10. Step-by-step derivation
      1. metadata-eval50.0%

        \[\leadsto 0.5 \cdot \left({im}^{\color{blue}{\left(2 \cdot 2\right)}} \cdot \left(0.08333333333333333 \cdot re + \frac{re}{{im}^{2}}\right)\right) \]
      2. pow-sqr50.0%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left({im}^{2} \cdot {im}^{2}\right)} \cdot \left(0.08333333333333333 \cdot re + \frac{re}{{im}^{2}}\right)\right) \]
      3. unpow250.0%

        \[\leadsto 0.5 \cdot \left(\left(\color{blue}{\left(im \cdot im\right)} \cdot {im}^{2}\right) \cdot \left(0.08333333333333333 \cdot re + \frac{re}{{im}^{2}}\right)\right) \]
      4. unpow250.0%

        \[\leadsto 0.5 \cdot \left(\left(\left(im \cdot im\right) \cdot \color{blue}{\left(im \cdot im\right)}\right) \cdot \left(0.08333333333333333 \cdot re + \frac{re}{{im}^{2}}\right)\right) \]
      5. *-commutative50.0%

        \[\leadsto 0.5 \cdot \left(\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(\color{blue}{re \cdot 0.08333333333333333} + \frac{re}{{im}^{2}}\right)\right) \]
      6. unpow250.0%

        \[\leadsto 0.5 \cdot \left(\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(re \cdot 0.08333333333333333 + \frac{re}{\color{blue}{im \cdot im}}\right)\right) \]
    11. Simplified50.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(re \cdot 0.08333333333333333 + \frac{re}{im \cdot im}\right)\right)} \]
    12. Taylor expanded in im around 0 52.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left({im}^{2} \cdot \left(re + 0.08333333333333333 \cdot \left({im}^{2} \cdot re\right)\right)\right)} \]
    13. Step-by-step derivation
      1. unpow252.0%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot \left(re + 0.08333333333333333 \cdot \left({im}^{2} \cdot re\right)\right)\right) \]
      2. *-commutative52.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\left(re + 0.08333333333333333 \cdot \left({im}^{2} \cdot re\right)\right) \cdot \left(im \cdot im\right)\right)} \]
      3. *-lft-identity52.0%

        \[\leadsto 0.5 \cdot \left(\left(\color{blue}{1 \cdot re} + 0.08333333333333333 \cdot \left({im}^{2} \cdot re\right)\right) \cdot \left(im \cdot im\right)\right) \]
      4. unpow252.0%

        \[\leadsto 0.5 \cdot \left(\left(1 \cdot re + 0.08333333333333333 \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot re\right)\right) \cdot \left(im \cdot im\right)\right) \]
      5. associate-*r*52.0%

        \[\leadsto 0.5 \cdot \left(\left(1 \cdot re + \color{blue}{\left(0.08333333333333333 \cdot \left(im \cdot im\right)\right) \cdot re}\right) \cdot \left(im \cdot im\right)\right) \]
      6. distribute-rgt-out52.0%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(re \cdot \left(1 + 0.08333333333333333 \cdot \left(im \cdot im\right)\right)\right)} \cdot \left(im \cdot im\right)\right) \]
    14. Simplified52.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(re \cdot \left(1 + 0.08333333333333333 \cdot \left(im \cdot im\right)\right)\right) \cdot \left(im \cdot im\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification58.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 2.5 \cdot 10^{+69}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + 0.08333333333333333 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\ \;\;\;\;re \cdot \left(\left(2 + im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(im \cdot im\right) \cdot \left(re \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 55.2% accurate, 10.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq 2.5 \cdot 10^{+93}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + 0.08333333333333333 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\ \;\;\;\;re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(im \cdot im\right) \cdot \left(re \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re 2.5e+93)
   (* 0.5 (* re (+ 2.0 (* 0.08333333333333333 (* (* im im) (* im im))))))
   (if (or (<= re 1.9e+263) (not (<= re 1.15e+293)))
     (* re (+ 1.0 (* re (* re -0.16666666666666666))))
     (* 0.5 (* (* im im) (* re (+ 1.0 (* (* im im) 0.08333333333333333))))))))
double code(double re, double im) {
	double tmp;
	if (re <= 2.5e+93) {
		tmp = 0.5 * (re * (2.0 + (0.08333333333333333 * ((im * im) * (im * im)))));
	} else if ((re <= 1.9e+263) || !(re <= 1.15e+293)) {
		tmp = re * (1.0 + (re * (re * -0.16666666666666666)));
	} else {
		tmp = 0.5 * ((im * im) * (re * (1.0 + ((im * im) * 0.08333333333333333))));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= 2.5d+93) then
        tmp = 0.5d0 * (re * (2.0d0 + (0.08333333333333333d0 * ((im * im) * (im * im)))))
    else if ((re <= 1.9d+263) .or. (.not. (re <= 1.15d+293))) then
        tmp = re * (1.0d0 + (re * (re * (-0.16666666666666666d0))))
    else
        tmp = 0.5d0 * ((im * im) * (re * (1.0d0 + ((im * im) * 0.08333333333333333d0))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= 2.5e+93) {
		tmp = 0.5 * (re * (2.0 + (0.08333333333333333 * ((im * im) * (im * im)))));
	} else if ((re <= 1.9e+263) || !(re <= 1.15e+293)) {
		tmp = re * (1.0 + (re * (re * -0.16666666666666666)));
	} else {
		tmp = 0.5 * ((im * im) * (re * (1.0 + ((im * im) * 0.08333333333333333))));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= 2.5e+93:
		tmp = 0.5 * (re * (2.0 + (0.08333333333333333 * ((im * im) * (im * im)))))
	elif (re <= 1.9e+263) or not (re <= 1.15e+293):
		tmp = re * (1.0 + (re * (re * -0.16666666666666666)))
	else:
		tmp = 0.5 * ((im * im) * (re * (1.0 + ((im * im) * 0.08333333333333333))))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= 2.5e+93)
		tmp = Float64(0.5 * Float64(re * Float64(2.0 + Float64(0.08333333333333333 * Float64(Float64(im * im) * Float64(im * im))))));
	elseif ((re <= 1.9e+263) || !(re <= 1.15e+293))
		tmp = Float64(re * Float64(1.0 + Float64(re * Float64(re * -0.16666666666666666))));
	else
		tmp = Float64(0.5 * Float64(Float64(im * im) * Float64(re * Float64(1.0 + Float64(Float64(im * im) * 0.08333333333333333)))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= 2.5e+93)
		tmp = 0.5 * (re * (2.0 + (0.08333333333333333 * ((im * im) * (im * im)))));
	elseif ((re <= 1.9e+263) || ~((re <= 1.15e+293)))
		tmp = re * (1.0 + (re * (re * -0.16666666666666666)));
	else
		tmp = 0.5 * ((im * im) * (re * (1.0 + ((im * im) * 0.08333333333333333))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, 2.5e+93], N[(0.5 * N[(re * N[(2.0 + N[(0.08333333333333333 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[re, 1.9e+263], N[Not[LessEqual[re, 1.15e+293]], $MachinePrecision]], N[(re * N[(1.0 + N[(re * N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(im * im), $MachinePrecision] * N[(re * N[(1.0 + N[(N[(im * im), $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.5 \cdot 10^{+93}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(2 + 0.08333333333333333 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)\\

\mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\
\;\;\;\;re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(im \cdot im\right) \cdot \left(re \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < 2.5000000000000001e93

    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. remove-double-neg100.0%

        \[\leadsto \left(0.5 \cdot \color{blue}{\left(-\left(-\sin re\right)\right)}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      2. sin-neg100.0%

        \[\leadsto \left(0.5 \cdot \left(-\color{blue}{\sin \left(-re\right)}\right)\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      3. distribute-rgt-neg-in100.0%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \sin \left(-re\right)\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
      4. /-rgt-identity100.0%

        \[\leadsto \left(-\color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{1}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      5. exp-0100.0%

        \[\leadsto \left(-\frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{e^{0}}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      6. distribute-neg-frac2100.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{-e^{0}}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      7. exp-0100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{-\color{blue}{1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      8. metadata-eval100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{-1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      9. associate-*l/100.0%

        \[\leadsto \color{blue}{\frac{\left(0.5 \cdot \sin \left(-re\right)\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      10. associate-*l*100.0%

        \[\leadsto \frac{\color{blue}{0.5 \cdot \left(\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)\right)}}{-1} \]
      11. associate-*r/100.0%

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      12. associate-*l/100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\sin \left(-re\right)}{-1} \cdot \left(e^{0 - im} + e^{im}\right)\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} + e^{im}\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 86.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \left(\sin re + 0.08333333333333333 \cdot \left({im}^{2} \cdot \sin re\right)\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*86.2%

        \[\leadsto 0.5 \cdot \left(2 \cdot \sin re + {im}^{2} \cdot \left(\sin re + \color{blue}{\left(0.08333333333333333 \cdot {im}^{2}\right) \cdot \sin re}\right)\right) \]
      2. distribute-rgt1-in86.2%

        \[\leadsto 0.5 \cdot \left(2 \cdot \sin re + {im}^{2} \cdot \color{blue}{\left(\left(0.08333333333333333 \cdot {im}^{2} + 1\right) \cdot \sin re\right)}\right) \]
      3. +-commutative86.2%

        \[\leadsto 0.5 \cdot \left(2 \cdot \sin re + {im}^{2} \cdot \left(\color{blue}{\left(1 + 0.08333333333333333 \cdot {im}^{2}\right)} \cdot \sin re\right)\right) \]
      4. associate-*r*89.2%

        \[\leadsto 0.5 \cdot \left(2 \cdot \sin re + \color{blue}{\left({im}^{2} \cdot \left(1 + 0.08333333333333333 \cdot {im}^{2}\right)\right) \cdot \sin re}\right) \]
      5. distribute-rgt-out89.2%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + {im}^{2} \cdot \left(1 + 0.08333333333333333 \cdot {im}^{2}\right)\right)\right)} \]
      6. unpow289.2%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \color{blue}{\left(im \cdot im\right)} \cdot \left(1 + 0.08333333333333333 \cdot {im}^{2}\right)\right)\right) \]
      7. *-commutative89.2%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \color{blue}{{im}^{2} \cdot 0.08333333333333333}\right)\right)\right) \]
      8. unpow289.2%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot 0.08333333333333333\right)\right)\right) \]
    7. Simplified89.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right)} \]
    8. Taylor expanded in re around 0 60.0%

      \[\leadsto 0.5 \cdot \left(\color{blue}{re} \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
    9. Taylor expanded in im around inf 59.8%

      \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + \color{blue}{0.08333333333333333 \cdot {im}^{4}}\right)\right) \]
    10. Step-by-step derivation
      1. metadata-eval59.8%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + 0.08333333333333333 \cdot {im}^{\color{blue}{\left(2 \cdot 2\right)}}\right)\right) \]
      2. pow-sqr59.8%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + 0.08333333333333333 \cdot \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)}\right)\right) \]
      3. unpow259.8%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + 0.08333333333333333 \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot {im}^{2}\right)\right)\right) \]
      4. unpow259.8%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + 0.08333333333333333 \cdot \left(\left(im \cdot im\right) \cdot \color{blue}{\left(im \cdot im\right)}\right)\right)\right) \]
    11. Simplified59.8%

      \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + \color{blue}{0.08333333333333333 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)}\right)\right) \]

    if 2.5000000000000001e93 < re < 1.9e263 or 1.14999999999999995e293 < re

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. remove-double-neg100.0%

        \[\leadsto \left(0.5 \cdot \color{blue}{\left(-\left(-\sin re\right)\right)}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      2. sin-neg100.0%

        \[\leadsto \left(0.5 \cdot \left(-\color{blue}{\sin \left(-re\right)}\right)\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      3. distribute-rgt-neg-in100.0%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \sin \left(-re\right)\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
      4. /-rgt-identity100.0%

        \[\leadsto \left(-\color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{1}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      5. exp-0100.0%

        \[\leadsto \left(-\frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{e^{0}}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      6. distribute-neg-frac2100.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{-e^{0}}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      7. exp-0100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{-\color{blue}{1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      8. metadata-eval100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{-1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      9. associate-*l/100.0%

        \[\leadsto \color{blue}{\frac{\left(0.5 \cdot \sin \left(-re\right)\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      10. associate-*l*100.0%

        \[\leadsto \frac{\color{blue}{0.5 \cdot \left(\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)\right)}}{-1} \]
      11. associate-*r/100.0%

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      12. associate-*l/100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\sin \left(-re\right)}{-1} \cdot \left(e^{0 - im} + e^{im}\right)\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} + e^{im}\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 81.4%

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \sin re\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-out81.4%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + {im}^{2}\right)\right)} \]
      2. unpow281.4%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \color{blue}{im \cdot im}\right)\right) \]
    7. Simplified81.4%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + im \cdot im\right)\right)} \]
    8. Taylor expanded in im around 0 44.3%

      \[\leadsto \color{blue}{\sin re} \]
    9. Taylor expanded in re around 0 48.5%

      \[\leadsto \color{blue}{re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)} \]
    10. Step-by-step derivation
      1. *-commutative48.5%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \color{blue}{{re}^{2} \cdot -0.16666666666666666}\right)\right) \cdot \left(e^{-im} + e^{im}\right)\right) \]
      2. unpow248.5%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \color{blue}{\left(re \cdot re\right)} \cdot -0.16666666666666666\right)\right) \cdot \left(e^{-im} + e^{im}\right)\right) \]
      3. associate-*l*48.5%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \color{blue}{re \cdot \left(re \cdot -0.16666666666666666\right)}\right)\right) \cdot \left(e^{-im} + e^{im}\right)\right) \]
    11. Simplified48.5%

      \[\leadsto \color{blue}{re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)} \]

    if 1.9e263 < re < 1.14999999999999995e293

    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. remove-double-neg100.0%

        \[\leadsto \left(0.5 \cdot \color{blue}{\left(-\left(-\sin re\right)\right)}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      2. sin-neg100.0%

        \[\leadsto \left(0.5 \cdot \left(-\color{blue}{\sin \left(-re\right)}\right)\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      3. distribute-rgt-neg-in100.0%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \sin \left(-re\right)\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
      4. /-rgt-identity100.0%

        \[\leadsto \left(-\color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{1}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      5. exp-0100.0%

        \[\leadsto \left(-\frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{e^{0}}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      6. distribute-neg-frac2100.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{-e^{0}}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      7. exp-0100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{-\color{blue}{1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      8. metadata-eval100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{-1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      9. associate-*l/100.0%

        \[\leadsto \color{blue}{\frac{\left(0.5 \cdot \sin \left(-re\right)\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      10. associate-*l*100.0%

        \[\leadsto \frac{\color{blue}{0.5 \cdot \left(\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)\right)}}{-1} \]
      11. associate-*r/100.0%

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      12. associate-*l/100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\sin \left(-re\right)}{-1} \cdot \left(e^{0 - im} + e^{im}\right)\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} + e^{im}\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 100.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \left(\sin re + 0.08333333333333333 \cdot \left({im}^{2} \cdot \sin re\right)\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*100.0%

        \[\leadsto 0.5 \cdot \left(2 \cdot \sin re + {im}^{2} \cdot \left(\sin re + \color{blue}{\left(0.08333333333333333 \cdot {im}^{2}\right) \cdot \sin re}\right)\right) \]
      2. distribute-rgt1-in100.0%

        \[\leadsto 0.5 \cdot \left(2 \cdot \sin re + {im}^{2} \cdot \color{blue}{\left(\left(0.08333333333333333 \cdot {im}^{2} + 1\right) \cdot \sin re\right)}\right) \]
      3. +-commutative100.0%

        \[\leadsto 0.5 \cdot \left(2 \cdot \sin re + {im}^{2} \cdot \left(\color{blue}{\left(1 + 0.08333333333333333 \cdot {im}^{2}\right)} \cdot \sin re\right)\right) \]
      4. associate-*r*100.0%

        \[\leadsto 0.5 \cdot \left(2 \cdot \sin re + \color{blue}{\left({im}^{2} \cdot \left(1 + 0.08333333333333333 \cdot {im}^{2}\right)\right) \cdot \sin re}\right) \]
      5. distribute-rgt-out100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + {im}^{2} \cdot \left(1 + 0.08333333333333333 \cdot {im}^{2}\right)\right)\right)} \]
      6. unpow2100.0%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \color{blue}{\left(im \cdot im\right)} \cdot \left(1 + 0.08333333333333333 \cdot {im}^{2}\right)\right)\right) \]
      7. *-commutative100.0%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \color{blue}{{im}^{2} \cdot 0.08333333333333333}\right)\right)\right) \]
      8. unpow2100.0%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot 0.08333333333333333\right)\right)\right) \]
    7. Simplified100.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right)} \]
    8. Taylor expanded in re around 0 51.0%

      \[\leadsto 0.5 \cdot \left(\color{blue}{re} \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
    9. Taylor expanded in im around inf 50.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left({im}^{4} \cdot \left(0.08333333333333333 \cdot re + \frac{re}{{im}^{2}}\right)\right)} \]
    10. Step-by-step derivation
      1. metadata-eval50.0%

        \[\leadsto 0.5 \cdot \left({im}^{\color{blue}{\left(2 \cdot 2\right)}} \cdot \left(0.08333333333333333 \cdot re + \frac{re}{{im}^{2}}\right)\right) \]
      2. pow-sqr50.0%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left({im}^{2} \cdot {im}^{2}\right)} \cdot \left(0.08333333333333333 \cdot re + \frac{re}{{im}^{2}}\right)\right) \]
      3. unpow250.0%

        \[\leadsto 0.5 \cdot \left(\left(\color{blue}{\left(im \cdot im\right)} \cdot {im}^{2}\right) \cdot \left(0.08333333333333333 \cdot re + \frac{re}{{im}^{2}}\right)\right) \]
      4. unpow250.0%

        \[\leadsto 0.5 \cdot \left(\left(\left(im \cdot im\right) \cdot \color{blue}{\left(im \cdot im\right)}\right) \cdot \left(0.08333333333333333 \cdot re + \frac{re}{{im}^{2}}\right)\right) \]
      5. *-commutative50.0%

        \[\leadsto 0.5 \cdot \left(\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(\color{blue}{re \cdot 0.08333333333333333} + \frac{re}{{im}^{2}}\right)\right) \]
      6. unpow250.0%

        \[\leadsto 0.5 \cdot \left(\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(re \cdot 0.08333333333333333 + \frac{re}{\color{blue}{im \cdot im}}\right)\right) \]
    11. Simplified50.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(re \cdot 0.08333333333333333 + \frac{re}{im \cdot im}\right)\right)} \]
    12. Taylor expanded in im around 0 52.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left({im}^{2} \cdot \left(re + 0.08333333333333333 \cdot \left({im}^{2} \cdot re\right)\right)\right)} \]
    13. Step-by-step derivation
      1. unpow252.0%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot \left(re + 0.08333333333333333 \cdot \left({im}^{2} \cdot re\right)\right)\right) \]
      2. *-commutative52.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\left(re + 0.08333333333333333 \cdot \left({im}^{2} \cdot re\right)\right) \cdot \left(im \cdot im\right)\right)} \]
      3. *-lft-identity52.0%

        \[\leadsto 0.5 \cdot \left(\left(\color{blue}{1 \cdot re} + 0.08333333333333333 \cdot \left({im}^{2} \cdot re\right)\right) \cdot \left(im \cdot im\right)\right) \]
      4. unpow252.0%

        \[\leadsto 0.5 \cdot \left(\left(1 \cdot re + 0.08333333333333333 \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot re\right)\right) \cdot \left(im \cdot im\right)\right) \]
      5. associate-*r*52.0%

        \[\leadsto 0.5 \cdot \left(\left(1 \cdot re + \color{blue}{\left(0.08333333333333333 \cdot \left(im \cdot im\right)\right) \cdot re}\right) \cdot \left(im \cdot im\right)\right) \]
      6. distribute-rgt-out52.0%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(re \cdot \left(1 + 0.08333333333333333 \cdot \left(im \cdot im\right)\right)\right)} \cdot \left(im \cdot im\right)\right) \]
    14. Simplified52.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(re \cdot \left(1 + 0.08333333333333333 \cdot \left(im \cdot im\right)\right)\right) \cdot \left(im \cdot im\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification57.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 2.5 \cdot 10^{+93}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + 0.08333333333333333 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\ \;\;\;\;re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(im \cdot im\right) \cdot \left(re \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 55.2% accurate, 12.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq 2.5 \cdot 10^{+93}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + 0.08333333333333333 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\ \;\;\;\;re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re 2.5e+93)
   (* 0.5 (* re (+ 2.0 (* 0.08333333333333333 (* (* im im) (* im im))))))
   (if (or (<= re 1.9e+263) (not (<= re 1.15e+293)))
     (* re (+ 1.0 (* re (* re -0.16666666666666666))))
     (* 0.5 (* re (* im im))))))
double code(double re, double im) {
	double tmp;
	if (re <= 2.5e+93) {
		tmp = 0.5 * (re * (2.0 + (0.08333333333333333 * ((im * im) * (im * im)))));
	} else if ((re <= 1.9e+263) || !(re <= 1.15e+293)) {
		tmp = re * (1.0 + (re * (re * -0.16666666666666666)));
	} else {
		tmp = 0.5 * (re * (im * im));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= 2.5d+93) then
        tmp = 0.5d0 * (re * (2.0d0 + (0.08333333333333333d0 * ((im * im) * (im * im)))))
    else if ((re <= 1.9d+263) .or. (.not. (re <= 1.15d+293))) then
        tmp = re * (1.0d0 + (re * (re * (-0.16666666666666666d0))))
    else
        tmp = 0.5d0 * (re * (im * im))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= 2.5e+93) {
		tmp = 0.5 * (re * (2.0 + (0.08333333333333333 * ((im * im) * (im * im)))));
	} else if ((re <= 1.9e+263) || !(re <= 1.15e+293)) {
		tmp = re * (1.0 + (re * (re * -0.16666666666666666)));
	} else {
		tmp = 0.5 * (re * (im * im));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= 2.5e+93:
		tmp = 0.5 * (re * (2.0 + (0.08333333333333333 * ((im * im) * (im * im)))))
	elif (re <= 1.9e+263) or not (re <= 1.15e+293):
		tmp = re * (1.0 + (re * (re * -0.16666666666666666)))
	else:
		tmp = 0.5 * (re * (im * im))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= 2.5e+93)
		tmp = Float64(0.5 * Float64(re * Float64(2.0 + Float64(0.08333333333333333 * Float64(Float64(im * im) * Float64(im * im))))));
	elseif ((re <= 1.9e+263) || !(re <= 1.15e+293))
		tmp = Float64(re * Float64(1.0 + Float64(re * Float64(re * -0.16666666666666666))));
	else
		tmp = Float64(0.5 * Float64(re * Float64(im * im)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= 2.5e+93)
		tmp = 0.5 * (re * (2.0 + (0.08333333333333333 * ((im * im) * (im * im)))));
	elseif ((re <= 1.9e+263) || ~((re <= 1.15e+293)))
		tmp = re * (1.0 + (re * (re * -0.16666666666666666)));
	else
		tmp = 0.5 * (re * (im * im));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, 2.5e+93], N[(0.5 * N[(re * N[(2.0 + N[(0.08333333333333333 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[re, 1.9e+263], N[Not[LessEqual[re, 1.15e+293]], $MachinePrecision]], N[(re * N[(1.0 + N[(re * N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.5 \cdot 10^{+93}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(2 + 0.08333333333333333 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)\\

\mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\
\;\;\;\;re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < 2.5000000000000001e93

    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. remove-double-neg100.0%

        \[\leadsto \left(0.5 \cdot \color{blue}{\left(-\left(-\sin re\right)\right)}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      2. sin-neg100.0%

        \[\leadsto \left(0.5 \cdot \left(-\color{blue}{\sin \left(-re\right)}\right)\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      3. distribute-rgt-neg-in100.0%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \sin \left(-re\right)\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
      4. /-rgt-identity100.0%

        \[\leadsto \left(-\color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{1}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      5. exp-0100.0%

        \[\leadsto \left(-\frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{e^{0}}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      6. distribute-neg-frac2100.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{-e^{0}}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      7. exp-0100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{-\color{blue}{1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      8. metadata-eval100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{-1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      9. associate-*l/100.0%

        \[\leadsto \color{blue}{\frac{\left(0.5 \cdot \sin \left(-re\right)\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      10. associate-*l*100.0%

        \[\leadsto \frac{\color{blue}{0.5 \cdot \left(\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)\right)}}{-1} \]
      11. associate-*r/100.0%

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      12. associate-*l/100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\sin \left(-re\right)}{-1} \cdot \left(e^{0 - im} + e^{im}\right)\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} + e^{im}\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 86.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \left(\sin re + 0.08333333333333333 \cdot \left({im}^{2} \cdot \sin re\right)\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*86.2%

        \[\leadsto 0.5 \cdot \left(2 \cdot \sin re + {im}^{2} \cdot \left(\sin re + \color{blue}{\left(0.08333333333333333 \cdot {im}^{2}\right) \cdot \sin re}\right)\right) \]
      2. distribute-rgt1-in86.2%

        \[\leadsto 0.5 \cdot \left(2 \cdot \sin re + {im}^{2} \cdot \color{blue}{\left(\left(0.08333333333333333 \cdot {im}^{2} + 1\right) \cdot \sin re\right)}\right) \]
      3. +-commutative86.2%

        \[\leadsto 0.5 \cdot \left(2 \cdot \sin re + {im}^{2} \cdot \left(\color{blue}{\left(1 + 0.08333333333333333 \cdot {im}^{2}\right)} \cdot \sin re\right)\right) \]
      4. associate-*r*89.2%

        \[\leadsto 0.5 \cdot \left(2 \cdot \sin re + \color{blue}{\left({im}^{2} \cdot \left(1 + 0.08333333333333333 \cdot {im}^{2}\right)\right) \cdot \sin re}\right) \]
      5. distribute-rgt-out89.2%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + {im}^{2} \cdot \left(1 + 0.08333333333333333 \cdot {im}^{2}\right)\right)\right)} \]
      6. unpow289.2%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \color{blue}{\left(im \cdot im\right)} \cdot \left(1 + 0.08333333333333333 \cdot {im}^{2}\right)\right)\right) \]
      7. *-commutative89.2%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \color{blue}{{im}^{2} \cdot 0.08333333333333333}\right)\right)\right) \]
      8. unpow289.2%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \color{blue}{\left(im \cdot im\right)} \cdot 0.08333333333333333\right)\right)\right) \]
    7. Simplified89.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right)} \]
    8. Taylor expanded in re around 0 60.0%

      \[\leadsto 0.5 \cdot \left(\color{blue}{re} \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \]
    9. Taylor expanded in im around inf 59.8%

      \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + \color{blue}{0.08333333333333333 \cdot {im}^{4}}\right)\right) \]
    10. Step-by-step derivation
      1. metadata-eval59.8%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + 0.08333333333333333 \cdot {im}^{\color{blue}{\left(2 \cdot 2\right)}}\right)\right) \]
      2. pow-sqr59.8%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + 0.08333333333333333 \cdot \color{blue}{\left({im}^{2} \cdot {im}^{2}\right)}\right)\right) \]
      3. unpow259.8%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + 0.08333333333333333 \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot {im}^{2}\right)\right)\right) \]
      4. unpow259.8%

        \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + 0.08333333333333333 \cdot \left(\left(im \cdot im\right) \cdot \color{blue}{\left(im \cdot im\right)}\right)\right)\right) \]
    11. Simplified59.8%

      \[\leadsto 0.5 \cdot \left(re \cdot \left(2 + \color{blue}{0.08333333333333333 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)}\right)\right) \]

    if 2.5000000000000001e93 < re < 1.9e263 or 1.14999999999999995e293 < re

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. remove-double-neg100.0%

        \[\leadsto \left(0.5 \cdot \color{blue}{\left(-\left(-\sin re\right)\right)}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      2. sin-neg100.0%

        \[\leadsto \left(0.5 \cdot \left(-\color{blue}{\sin \left(-re\right)}\right)\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      3. distribute-rgt-neg-in100.0%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \sin \left(-re\right)\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
      4. /-rgt-identity100.0%

        \[\leadsto \left(-\color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{1}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      5. exp-0100.0%

        \[\leadsto \left(-\frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{e^{0}}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      6. distribute-neg-frac2100.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{-e^{0}}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      7. exp-0100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{-\color{blue}{1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      8. metadata-eval100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{-1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      9. associate-*l/100.0%

        \[\leadsto \color{blue}{\frac{\left(0.5 \cdot \sin \left(-re\right)\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      10. associate-*l*100.0%

        \[\leadsto \frac{\color{blue}{0.5 \cdot \left(\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)\right)}}{-1} \]
      11. associate-*r/100.0%

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      12. associate-*l/100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\sin \left(-re\right)}{-1} \cdot \left(e^{0 - im} + e^{im}\right)\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} + e^{im}\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 81.4%

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \sin re\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-out81.4%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + {im}^{2}\right)\right)} \]
      2. unpow281.4%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \color{blue}{im \cdot im}\right)\right) \]
    7. Simplified81.4%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + im \cdot im\right)\right)} \]
    8. Taylor expanded in im around 0 44.3%

      \[\leadsto \color{blue}{\sin re} \]
    9. Taylor expanded in re around 0 48.5%

      \[\leadsto \color{blue}{re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)} \]
    10. Step-by-step derivation
      1. *-commutative48.5%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \color{blue}{{re}^{2} \cdot -0.16666666666666666}\right)\right) \cdot \left(e^{-im} + e^{im}\right)\right) \]
      2. unpow248.5%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \color{blue}{\left(re \cdot re\right)} \cdot -0.16666666666666666\right)\right) \cdot \left(e^{-im} + e^{im}\right)\right) \]
      3. associate-*l*48.5%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \color{blue}{re \cdot \left(re \cdot -0.16666666666666666\right)}\right)\right) \cdot \left(e^{-im} + e^{im}\right)\right) \]
    11. Simplified48.5%

      \[\leadsto \color{blue}{re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)} \]

    if 1.9e263 < re < 1.14999999999999995e293

    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. remove-double-neg100.0%

        \[\leadsto \left(0.5 \cdot \color{blue}{\left(-\left(-\sin re\right)\right)}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      2. sin-neg100.0%

        \[\leadsto \left(0.5 \cdot \left(-\color{blue}{\sin \left(-re\right)}\right)\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      3. distribute-rgt-neg-in100.0%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \sin \left(-re\right)\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
      4. /-rgt-identity100.0%

        \[\leadsto \left(-\color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{1}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      5. exp-0100.0%

        \[\leadsto \left(-\frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{e^{0}}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      6. distribute-neg-frac2100.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{-e^{0}}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      7. exp-0100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{-\color{blue}{1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      8. metadata-eval100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{-1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      9. associate-*l/100.0%

        \[\leadsto \color{blue}{\frac{\left(0.5 \cdot \sin \left(-re\right)\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      10. associate-*l*100.0%

        \[\leadsto \frac{\color{blue}{0.5 \cdot \left(\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)\right)}}{-1} \]
      11. associate-*r/100.0%

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      12. associate-*l/100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\sin \left(-re\right)}{-1} \cdot \left(e^{0 - im} + e^{im}\right)\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} + e^{im}\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 76.3%

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \sin re\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-out76.3%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + {im}^{2}\right)\right)} \]
      2. unpow276.3%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \color{blue}{im \cdot im}\right)\right) \]
    7. Simplified76.3%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + im \cdot im\right)\right)} \]
    8. Taylor expanded in re around 0 51.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(re \cdot \left(2 + {im}^{2}\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*r*51.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot re\right) \cdot \left(2 + {im}^{2}\right)} \]
      2. *-commutative51.0%

        \[\leadsto \color{blue}{\left(2 + {im}^{2}\right) \cdot \left(0.5 \cdot re\right)} \]
      3. unpow251.0%

        \[\leadsto \left(2 + \color{blue}{im \cdot im}\right) \cdot \left(0.5 \cdot re\right) \]
      4. *-commutative51.0%

        \[\leadsto \left(2 + im \cdot im\right) \cdot \color{blue}{\left(re \cdot 0.5\right)} \]
    10. Simplified51.0%

      \[\leadsto \color{blue}{\left(2 + im \cdot im\right) \cdot \left(re \cdot 0.5\right)} \]
    11. Taylor expanded in im around inf 52.0%

      \[\leadsto \color{blue}{0.5 \cdot \left({im}^{2} \cdot re\right)} \]
    12. Step-by-step derivation
      1. unpow252.0%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot re\right) \]
      2. *-commutative52.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot im\right)\right)} \]
    13. Simplified52.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification57.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 2.5 \cdot 10^{+93}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + 0.08333333333333333 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right)\right)\\ \mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\ \;\;\;\;re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 48.1% accurate, 12.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq 2.5 \cdot 10^{+93}:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right) + 2 \cdot \left(0.5 \cdot re\right)\\ \mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\ \;\;\;\;re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re 2.5e+93)
   (+ (* (* im im) (* 0.5 re)) (* 2.0 (* 0.5 re)))
   (if (or (<= re 1.9e+263) (not (<= re 1.15e+293)))
     (* re (+ 1.0 (* re (* re -0.16666666666666666))))
     (* 0.5 (* re (* im im))))))
double code(double re, double im) {
	double tmp;
	if (re <= 2.5e+93) {
		tmp = ((im * im) * (0.5 * re)) + (2.0 * (0.5 * re));
	} else if ((re <= 1.9e+263) || !(re <= 1.15e+293)) {
		tmp = re * (1.0 + (re * (re * -0.16666666666666666)));
	} else {
		tmp = 0.5 * (re * (im * im));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= 2.5d+93) then
        tmp = ((im * im) * (0.5d0 * re)) + (2.0d0 * (0.5d0 * re))
    else if ((re <= 1.9d+263) .or. (.not. (re <= 1.15d+293))) then
        tmp = re * (1.0d0 + (re * (re * (-0.16666666666666666d0))))
    else
        tmp = 0.5d0 * (re * (im * im))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= 2.5e+93) {
		tmp = ((im * im) * (0.5 * re)) + (2.0 * (0.5 * re));
	} else if ((re <= 1.9e+263) || !(re <= 1.15e+293)) {
		tmp = re * (1.0 + (re * (re * -0.16666666666666666)));
	} else {
		tmp = 0.5 * (re * (im * im));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= 2.5e+93:
		tmp = ((im * im) * (0.5 * re)) + (2.0 * (0.5 * re))
	elif (re <= 1.9e+263) or not (re <= 1.15e+293):
		tmp = re * (1.0 + (re * (re * -0.16666666666666666)))
	else:
		tmp = 0.5 * (re * (im * im))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= 2.5e+93)
		tmp = Float64(Float64(Float64(im * im) * Float64(0.5 * re)) + Float64(2.0 * Float64(0.5 * re)));
	elseif ((re <= 1.9e+263) || !(re <= 1.15e+293))
		tmp = Float64(re * Float64(1.0 + Float64(re * Float64(re * -0.16666666666666666))));
	else
		tmp = Float64(0.5 * Float64(re * Float64(im * im)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= 2.5e+93)
		tmp = ((im * im) * (0.5 * re)) + (2.0 * (0.5 * re));
	elseif ((re <= 1.9e+263) || ~((re <= 1.15e+293)))
		tmp = re * (1.0 + (re * (re * -0.16666666666666666)));
	else
		tmp = 0.5 * (re * (im * im));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, 2.5e+93], N[(N[(N[(im * im), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[re, 1.9e+263], N[Not[LessEqual[re, 1.15e+293]], $MachinePrecision]], N[(re * N[(1.0 + N[(re * N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.5 \cdot 10^{+93}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right) + 2 \cdot \left(0.5 \cdot re\right)\\

\mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\
\;\;\;\;re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < 2.5000000000000001e93

    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. remove-double-neg100.0%

        \[\leadsto \left(0.5 \cdot \color{blue}{\left(-\left(-\sin re\right)\right)}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      2. sin-neg100.0%

        \[\leadsto \left(0.5 \cdot \left(-\color{blue}{\sin \left(-re\right)}\right)\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      3. distribute-rgt-neg-in100.0%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \sin \left(-re\right)\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
      4. /-rgt-identity100.0%

        \[\leadsto \left(-\color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{1}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      5. exp-0100.0%

        \[\leadsto \left(-\frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{e^{0}}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      6. distribute-neg-frac2100.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{-e^{0}}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      7. exp-0100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{-\color{blue}{1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      8. metadata-eval100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{-1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      9. associate-*l/100.0%

        \[\leadsto \color{blue}{\frac{\left(0.5 \cdot \sin \left(-re\right)\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      10. associate-*l*100.0%

        \[\leadsto \frac{\color{blue}{0.5 \cdot \left(\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)\right)}}{-1} \]
      11. associate-*r/100.0%

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      12. associate-*l/100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\sin \left(-re\right)}{-1} \cdot \left(e^{0 - im} + e^{im}\right)\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} + e^{im}\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 78.6%

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \sin re\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-out78.6%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + {im}^{2}\right)\right)} \]
      2. unpow278.6%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \color{blue}{im \cdot im}\right)\right) \]
    7. Simplified78.6%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + im \cdot im\right)\right)} \]
    8. Taylor expanded in re around 0 53.1%

      \[\leadsto \color{blue}{0.5 \cdot \left(re \cdot \left(2 + {im}^{2}\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*r*53.1%

        \[\leadsto \color{blue}{\left(0.5 \cdot re\right) \cdot \left(2 + {im}^{2}\right)} \]
      2. *-commutative53.1%

        \[\leadsto \color{blue}{\left(2 + {im}^{2}\right) \cdot \left(0.5 \cdot re\right)} \]
      3. unpow253.1%

        \[\leadsto \left(2 + \color{blue}{im \cdot im}\right) \cdot \left(0.5 \cdot re\right) \]
      4. *-commutative53.1%

        \[\leadsto \left(2 + im \cdot im\right) \cdot \color{blue}{\left(re \cdot 0.5\right)} \]
    10. Simplified53.1%

      \[\leadsto \color{blue}{\left(2 + im \cdot im\right) \cdot \left(re \cdot 0.5\right)} \]
    11. Step-by-step derivation
      1. *-commutative53.1%

        \[\leadsto \color{blue}{\left(re \cdot 0.5\right) \cdot \left(2 + im \cdot im\right)} \]
      2. +-commutative53.1%

        \[\leadsto \left(re \cdot 0.5\right) \cdot \color{blue}{\left(im \cdot im + 2\right)} \]
      3. distribute-lft-in53.1%

        \[\leadsto \color{blue}{\left(re \cdot 0.5\right) \cdot \left(im \cdot im\right) + \left(re \cdot 0.5\right) \cdot 2} \]
    12. Applied egg-rr53.1%

      \[\leadsto \color{blue}{\left(re \cdot 0.5\right) \cdot \left(im \cdot im\right) + \left(re \cdot 0.5\right) \cdot 2} \]

    if 2.5000000000000001e93 < re < 1.9e263 or 1.14999999999999995e293 < re

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. remove-double-neg100.0%

        \[\leadsto \left(0.5 \cdot \color{blue}{\left(-\left(-\sin re\right)\right)}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      2. sin-neg100.0%

        \[\leadsto \left(0.5 \cdot \left(-\color{blue}{\sin \left(-re\right)}\right)\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      3. distribute-rgt-neg-in100.0%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \sin \left(-re\right)\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
      4. /-rgt-identity100.0%

        \[\leadsto \left(-\color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{1}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      5. exp-0100.0%

        \[\leadsto \left(-\frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{e^{0}}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      6. distribute-neg-frac2100.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{-e^{0}}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      7. exp-0100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{-\color{blue}{1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      8. metadata-eval100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{-1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      9. associate-*l/100.0%

        \[\leadsto \color{blue}{\frac{\left(0.5 \cdot \sin \left(-re\right)\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      10. associate-*l*100.0%

        \[\leadsto \frac{\color{blue}{0.5 \cdot \left(\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)\right)}}{-1} \]
      11. associate-*r/100.0%

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      12. associate-*l/100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\sin \left(-re\right)}{-1} \cdot \left(e^{0 - im} + e^{im}\right)\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} + e^{im}\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 81.4%

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \sin re\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-out81.4%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + {im}^{2}\right)\right)} \]
      2. unpow281.4%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \color{blue}{im \cdot im}\right)\right) \]
    7. Simplified81.4%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + im \cdot im\right)\right)} \]
    8. Taylor expanded in im around 0 44.3%

      \[\leadsto \color{blue}{\sin re} \]
    9. Taylor expanded in re around 0 48.5%

      \[\leadsto \color{blue}{re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)} \]
    10. Step-by-step derivation
      1. *-commutative48.5%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \color{blue}{{re}^{2} \cdot -0.16666666666666666}\right)\right) \cdot \left(e^{-im} + e^{im}\right)\right) \]
      2. unpow248.5%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \color{blue}{\left(re \cdot re\right)} \cdot -0.16666666666666666\right)\right) \cdot \left(e^{-im} + e^{im}\right)\right) \]
      3. associate-*l*48.5%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \color{blue}{re \cdot \left(re \cdot -0.16666666666666666\right)}\right)\right) \cdot \left(e^{-im} + e^{im}\right)\right) \]
    11. Simplified48.5%

      \[\leadsto \color{blue}{re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)} \]

    if 1.9e263 < re < 1.14999999999999995e293

    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. remove-double-neg100.0%

        \[\leadsto \left(0.5 \cdot \color{blue}{\left(-\left(-\sin re\right)\right)}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      2. sin-neg100.0%

        \[\leadsto \left(0.5 \cdot \left(-\color{blue}{\sin \left(-re\right)}\right)\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      3. distribute-rgt-neg-in100.0%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \sin \left(-re\right)\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
      4. /-rgt-identity100.0%

        \[\leadsto \left(-\color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{1}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      5. exp-0100.0%

        \[\leadsto \left(-\frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{e^{0}}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      6. distribute-neg-frac2100.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{-e^{0}}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      7. exp-0100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{-\color{blue}{1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      8. metadata-eval100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{-1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      9. associate-*l/100.0%

        \[\leadsto \color{blue}{\frac{\left(0.5 \cdot \sin \left(-re\right)\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      10. associate-*l*100.0%

        \[\leadsto \frac{\color{blue}{0.5 \cdot \left(\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)\right)}}{-1} \]
      11. associate-*r/100.0%

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      12. associate-*l/100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\sin \left(-re\right)}{-1} \cdot \left(e^{0 - im} + e^{im}\right)\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} + e^{im}\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 76.3%

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \sin re\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-out76.3%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + {im}^{2}\right)\right)} \]
      2. unpow276.3%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \color{blue}{im \cdot im}\right)\right) \]
    7. Simplified76.3%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + im \cdot im\right)\right)} \]
    8. Taylor expanded in re around 0 51.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(re \cdot \left(2 + {im}^{2}\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*r*51.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot re\right) \cdot \left(2 + {im}^{2}\right)} \]
      2. *-commutative51.0%

        \[\leadsto \color{blue}{\left(2 + {im}^{2}\right) \cdot \left(0.5 \cdot re\right)} \]
      3. unpow251.0%

        \[\leadsto \left(2 + \color{blue}{im \cdot im}\right) \cdot \left(0.5 \cdot re\right) \]
      4. *-commutative51.0%

        \[\leadsto \left(2 + im \cdot im\right) \cdot \color{blue}{\left(re \cdot 0.5\right)} \]
    10. Simplified51.0%

      \[\leadsto \color{blue}{\left(2 + im \cdot im\right) \cdot \left(re \cdot 0.5\right)} \]
    11. Taylor expanded in im around inf 52.0%

      \[\leadsto \color{blue}{0.5 \cdot \left({im}^{2} \cdot re\right)} \]
    12. Step-by-step derivation
      1. unpow252.0%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot re\right) \]
      2. *-commutative52.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot im\right)\right)} \]
    13. Simplified52.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification52.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 2.5 \cdot 10^{+93}:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right) + 2 \cdot \left(0.5 \cdot re\right)\\ \mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\ \;\;\;\;re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 48.1% accurate, 12.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq 2.5 \cdot 10^{+93}:\\ \;\;\;\;\left(2 + im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\ \;\;\;\;re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= re 2.5e+93)
   (* (+ 2.0 (* im im)) (* 0.5 re))
   (if (or (<= re 1.9e+263) (not (<= re 1.15e+293)))
     (* re (+ 1.0 (* re (* re -0.16666666666666666))))
     (* 0.5 (* re (* im im))))))
double code(double re, double im) {
	double tmp;
	if (re <= 2.5e+93) {
		tmp = (2.0 + (im * im)) * (0.5 * re);
	} else if ((re <= 1.9e+263) || !(re <= 1.15e+293)) {
		tmp = re * (1.0 + (re * (re * -0.16666666666666666)));
	} else {
		tmp = 0.5 * (re * (im * im));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= 2.5d+93) then
        tmp = (2.0d0 + (im * im)) * (0.5d0 * re)
    else if ((re <= 1.9d+263) .or. (.not. (re <= 1.15d+293))) then
        tmp = re * (1.0d0 + (re * (re * (-0.16666666666666666d0))))
    else
        tmp = 0.5d0 * (re * (im * im))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= 2.5e+93) {
		tmp = (2.0 + (im * im)) * (0.5 * re);
	} else if ((re <= 1.9e+263) || !(re <= 1.15e+293)) {
		tmp = re * (1.0 + (re * (re * -0.16666666666666666)));
	} else {
		tmp = 0.5 * (re * (im * im));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= 2.5e+93:
		tmp = (2.0 + (im * im)) * (0.5 * re)
	elif (re <= 1.9e+263) or not (re <= 1.15e+293):
		tmp = re * (1.0 + (re * (re * -0.16666666666666666)))
	else:
		tmp = 0.5 * (re * (im * im))
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= 2.5e+93)
		tmp = Float64(Float64(2.0 + Float64(im * im)) * Float64(0.5 * re));
	elseif ((re <= 1.9e+263) || !(re <= 1.15e+293))
		tmp = Float64(re * Float64(1.0 + Float64(re * Float64(re * -0.16666666666666666))));
	else
		tmp = Float64(0.5 * Float64(re * Float64(im * im)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= 2.5e+93)
		tmp = (2.0 + (im * im)) * (0.5 * re);
	elseif ((re <= 1.9e+263) || ~((re <= 1.15e+293)))
		tmp = re * (1.0 + (re * (re * -0.16666666666666666)));
	else
		tmp = 0.5 * (re * (im * im));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, 2.5e+93], N[(N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[re, 1.9e+263], N[Not[LessEqual[re, 1.15e+293]], $MachinePrecision]], N[(re * N[(1.0 + N[(re * N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.5 \cdot 10^{+93}:\\
\;\;\;\;\left(2 + im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\

\mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\
\;\;\;\;re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < 2.5000000000000001e93

    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. remove-double-neg100.0%

        \[\leadsto \left(0.5 \cdot \color{blue}{\left(-\left(-\sin re\right)\right)}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      2. sin-neg100.0%

        \[\leadsto \left(0.5 \cdot \left(-\color{blue}{\sin \left(-re\right)}\right)\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      3. distribute-rgt-neg-in100.0%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \sin \left(-re\right)\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
      4. /-rgt-identity100.0%

        \[\leadsto \left(-\color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{1}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      5. exp-0100.0%

        \[\leadsto \left(-\frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{e^{0}}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      6. distribute-neg-frac2100.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{-e^{0}}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      7. exp-0100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{-\color{blue}{1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      8. metadata-eval100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{-1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      9. associate-*l/100.0%

        \[\leadsto \color{blue}{\frac{\left(0.5 \cdot \sin \left(-re\right)\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      10. associate-*l*100.0%

        \[\leadsto \frac{\color{blue}{0.5 \cdot \left(\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)\right)}}{-1} \]
      11. associate-*r/100.0%

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      12. associate-*l/100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\sin \left(-re\right)}{-1} \cdot \left(e^{0 - im} + e^{im}\right)\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} + e^{im}\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 78.6%

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \sin re\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-out78.6%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + {im}^{2}\right)\right)} \]
      2. unpow278.6%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \color{blue}{im \cdot im}\right)\right) \]
    7. Simplified78.6%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + im \cdot im\right)\right)} \]
    8. Taylor expanded in re around 0 53.1%

      \[\leadsto \color{blue}{0.5 \cdot \left(re \cdot \left(2 + {im}^{2}\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*r*53.1%

        \[\leadsto \color{blue}{\left(0.5 \cdot re\right) \cdot \left(2 + {im}^{2}\right)} \]
      2. *-commutative53.1%

        \[\leadsto \color{blue}{\left(2 + {im}^{2}\right) \cdot \left(0.5 \cdot re\right)} \]
      3. unpow253.1%

        \[\leadsto \left(2 + \color{blue}{im \cdot im}\right) \cdot \left(0.5 \cdot re\right) \]
      4. *-commutative53.1%

        \[\leadsto \left(2 + im \cdot im\right) \cdot \color{blue}{\left(re \cdot 0.5\right)} \]
    10. Simplified53.1%

      \[\leadsto \color{blue}{\left(2 + im \cdot im\right) \cdot \left(re \cdot 0.5\right)} \]

    if 2.5000000000000001e93 < re < 1.9e263 or 1.14999999999999995e293 < re

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. remove-double-neg100.0%

        \[\leadsto \left(0.5 \cdot \color{blue}{\left(-\left(-\sin re\right)\right)}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      2. sin-neg100.0%

        \[\leadsto \left(0.5 \cdot \left(-\color{blue}{\sin \left(-re\right)}\right)\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      3. distribute-rgt-neg-in100.0%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \sin \left(-re\right)\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
      4. /-rgt-identity100.0%

        \[\leadsto \left(-\color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{1}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      5. exp-0100.0%

        \[\leadsto \left(-\frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{e^{0}}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      6. distribute-neg-frac2100.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{-e^{0}}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      7. exp-0100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{-\color{blue}{1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      8. metadata-eval100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{-1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      9. associate-*l/100.0%

        \[\leadsto \color{blue}{\frac{\left(0.5 \cdot \sin \left(-re\right)\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      10. associate-*l*100.0%

        \[\leadsto \frac{\color{blue}{0.5 \cdot \left(\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)\right)}}{-1} \]
      11. associate-*r/100.0%

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      12. associate-*l/100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\sin \left(-re\right)}{-1} \cdot \left(e^{0 - im} + e^{im}\right)\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} + e^{im}\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 81.4%

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \sin re\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-out81.4%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + {im}^{2}\right)\right)} \]
      2. unpow281.4%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \color{blue}{im \cdot im}\right)\right) \]
    7. Simplified81.4%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + im \cdot im\right)\right)} \]
    8. Taylor expanded in im around 0 44.3%

      \[\leadsto \color{blue}{\sin re} \]
    9. Taylor expanded in re around 0 48.5%

      \[\leadsto \color{blue}{re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)} \]
    10. Step-by-step derivation
      1. *-commutative48.5%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \color{blue}{{re}^{2} \cdot -0.16666666666666666}\right)\right) \cdot \left(e^{-im} + e^{im}\right)\right) \]
      2. unpow248.5%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \color{blue}{\left(re \cdot re\right)} \cdot -0.16666666666666666\right)\right) \cdot \left(e^{-im} + e^{im}\right)\right) \]
      3. associate-*l*48.5%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \color{blue}{re \cdot \left(re \cdot -0.16666666666666666\right)}\right)\right) \cdot \left(e^{-im} + e^{im}\right)\right) \]
    11. Simplified48.5%

      \[\leadsto \color{blue}{re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)} \]

    if 1.9e263 < re < 1.14999999999999995e293

    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. remove-double-neg100.0%

        \[\leadsto \left(0.5 \cdot \color{blue}{\left(-\left(-\sin re\right)\right)}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      2. sin-neg100.0%

        \[\leadsto \left(0.5 \cdot \left(-\color{blue}{\sin \left(-re\right)}\right)\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      3. distribute-rgt-neg-in100.0%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \sin \left(-re\right)\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
      4. /-rgt-identity100.0%

        \[\leadsto \left(-\color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{1}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      5. exp-0100.0%

        \[\leadsto \left(-\frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{e^{0}}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      6. distribute-neg-frac2100.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{-e^{0}}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      7. exp-0100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{-\color{blue}{1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      8. metadata-eval100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{-1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      9. associate-*l/100.0%

        \[\leadsto \color{blue}{\frac{\left(0.5 \cdot \sin \left(-re\right)\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      10. associate-*l*100.0%

        \[\leadsto \frac{\color{blue}{0.5 \cdot \left(\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)\right)}}{-1} \]
      11. associate-*r/100.0%

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      12. associate-*l/100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\sin \left(-re\right)}{-1} \cdot \left(e^{0 - im} + e^{im}\right)\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} + e^{im}\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 76.3%

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \sin re\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-out76.3%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + {im}^{2}\right)\right)} \]
      2. unpow276.3%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \color{blue}{im \cdot im}\right)\right) \]
    7. Simplified76.3%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + im \cdot im\right)\right)} \]
    8. Taylor expanded in re around 0 51.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(re \cdot \left(2 + {im}^{2}\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*r*51.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot re\right) \cdot \left(2 + {im}^{2}\right)} \]
      2. *-commutative51.0%

        \[\leadsto \color{blue}{\left(2 + {im}^{2}\right) \cdot \left(0.5 \cdot re\right)} \]
      3. unpow251.0%

        \[\leadsto \left(2 + \color{blue}{im \cdot im}\right) \cdot \left(0.5 \cdot re\right) \]
      4. *-commutative51.0%

        \[\leadsto \left(2 + im \cdot im\right) \cdot \color{blue}{\left(re \cdot 0.5\right)} \]
    10. Simplified51.0%

      \[\leadsto \color{blue}{\left(2 + im \cdot im\right) \cdot \left(re \cdot 0.5\right)} \]
    11. Taylor expanded in im around inf 52.0%

      \[\leadsto \color{blue}{0.5 \cdot \left({im}^{2} \cdot re\right)} \]
    12. Step-by-step derivation
      1. unpow252.0%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot re\right) \]
      2. *-commutative52.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot im\right)\right)} \]
    13. Simplified52.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification52.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 2.5 \cdot 10^{+93}:\\ \;\;\;\;\left(2 + im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{elif}\;re \leq 1.9 \cdot 10^{+263} \lor \neg \left(re \leq 1.15 \cdot 10^{+293}\right):\\ \;\;\;\;re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 40.4% accurate, 12.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 5 \cdot 10^{+61} \lor \neg \left(im \leq 2.7 \cdot 10^{+208}\right) \land im \leq 1.58 \cdot 10^{+227}:\\ \;\;\;\;re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (or (<= im 5e+61) (and (not (<= im 2.7e+208)) (<= im 1.58e+227)))
   (* re (+ 1.0 (* re (* re -0.16666666666666666))))
   (* 0.5 (* re (* im im)))))
double code(double re, double im) {
	double tmp;
	if ((im <= 5e+61) || (!(im <= 2.7e+208) && (im <= 1.58e+227))) {
		tmp = re * (1.0 + (re * (re * -0.16666666666666666)));
	} else {
		tmp = 0.5 * (re * (im * im));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if ((im <= 5d+61) .or. (.not. (im <= 2.7d+208)) .and. (im <= 1.58d+227)) then
        tmp = re * (1.0d0 + (re * (re * (-0.16666666666666666d0))))
    else
        tmp = 0.5d0 * (re * (im * im))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if ((im <= 5e+61) || (!(im <= 2.7e+208) && (im <= 1.58e+227))) {
		tmp = re * (1.0 + (re * (re * -0.16666666666666666)));
	} else {
		tmp = 0.5 * (re * (im * im));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if (im <= 5e+61) or (not (im <= 2.7e+208) and (im <= 1.58e+227)):
		tmp = re * (1.0 + (re * (re * -0.16666666666666666)))
	else:
		tmp = 0.5 * (re * (im * im))
	return tmp
function code(re, im)
	tmp = 0.0
	if ((im <= 5e+61) || (!(im <= 2.7e+208) && (im <= 1.58e+227)))
		tmp = Float64(re * Float64(1.0 + Float64(re * Float64(re * -0.16666666666666666))));
	else
		tmp = Float64(0.5 * Float64(re * Float64(im * im)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if ((im <= 5e+61) || (~((im <= 2.7e+208)) && (im <= 1.58e+227)))
		tmp = re * (1.0 + (re * (re * -0.16666666666666666)));
	else
		tmp = 0.5 * (re * (im * im));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[Or[LessEqual[im, 5e+61], And[N[Not[LessEqual[im, 2.7e+208]], $MachinePrecision], LessEqual[im, 1.58e+227]]], N[(re * N[(1.0 + N[(re * N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;im \leq 5 \cdot 10^{+61} \lor \neg \left(im \leq 2.7 \cdot 10^{+208}\right) \land im \leq 1.58 \cdot 10^{+227}:\\
\;\;\;\;re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 5.00000000000000018e61 or 2.7e208 < im < 1.57999999999999994e227

    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. remove-double-neg100.0%

        \[\leadsto \left(0.5 \cdot \color{blue}{\left(-\left(-\sin re\right)\right)}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      2. sin-neg100.0%

        \[\leadsto \left(0.5 \cdot \left(-\color{blue}{\sin \left(-re\right)}\right)\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      3. distribute-rgt-neg-in100.0%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \sin \left(-re\right)\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
      4. /-rgt-identity100.0%

        \[\leadsto \left(-\color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{1}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      5. exp-0100.0%

        \[\leadsto \left(-\frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{e^{0}}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      6. distribute-neg-frac2100.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{-e^{0}}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      7. exp-0100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{-\color{blue}{1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      8. metadata-eval100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{-1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      9. associate-*l/100.0%

        \[\leadsto \color{blue}{\frac{\left(0.5 \cdot \sin \left(-re\right)\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      10. associate-*l*100.0%

        \[\leadsto \frac{\color{blue}{0.5 \cdot \left(\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)\right)}}{-1} \]
      11. associate-*r/100.0%

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      12. associate-*l/100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\sin \left(-re\right)}{-1} \cdot \left(e^{0 - im} + e^{im}\right)\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} + e^{im}\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 80.3%

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \sin re\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-out80.3%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + {im}^{2}\right)\right)} \]
      2. unpow280.3%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \color{blue}{im \cdot im}\right)\right) \]
    7. Simplified80.3%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + im \cdot im\right)\right)} \]
    8. Taylor expanded in im around 0 55.3%

      \[\leadsto \color{blue}{\sin re} \]
    9. Taylor expanded in re around 0 38.1%

      \[\leadsto \color{blue}{re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)} \]
    10. Step-by-step derivation
      1. *-commutative60.4%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \color{blue}{{re}^{2} \cdot -0.16666666666666666}\right)\right) \cdot \left(e^{-im} + e^{im}\right)\right) \]
      2. unpow260.4%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \color{blue}{\left(re \cdot re\right)} \cdot -0.16666666666666666\right)\right) \cdot \left(e^{-im} + e^{im}\right)\right) \]
      3. associate-*l*60.4%

        \[\leadsto 0.5 \cdot \left(\left(re \cdot \left(1 + \color{blue}{re \cdot \left(re \cdot -0.16666666666666666\right)}\right)\right) \cdot \left(e^{-im} + e^{im}\right)\right) \]
    11. Simplified38.1%

      \[\leadsto \color{blue}{re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)} \]

    if 5.00000000000000018e61 < im < 2.7e208 or 1.57999999999999994e227 < 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. remove-double-neg100.0%

        \[\leadsto \left(0.5 \cdot \color{blue}{\left(-\left(-\sin re\right)\right)}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      2. sin-neg100.0%

        \[\leadsto \left(0.5 \cdot \left(-\color{blue}{\sin \left(-re\right)}\right)\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      3. distribute-rgt-neg-in100.0%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \sin \left(-re\right)\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
      4. /-rgt-identity100.0%

        \[\leadsto \left(-\color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{1}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      5. exp-0100.0%

        \[\leadsto \left(-\frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{e^{0}}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      6. distribute-neg-frac2100.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{-e^{0}}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      7. exp-0100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{-\color{blue}{1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      8. metadata-eval100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{-1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      9. associate-*l/100.0%

        \[\leadsto \color{blue}{\frac{\left(0.5 \cdot \sin \left(-re\right)\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      10. associate-*l*100.0%

        \[\leadsto \frac{\color{blue}{0.5 \cdot \left(\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)\right)}}{-1} \]
      11. associate-*r/100.0%

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      12. associate-*l/100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\sin \left(-re\right)}{-1} \cdot \left(e^{0 - im} + e^{im}\right)\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} + e^{im}\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 72.8%

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \sin re\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-out72.8%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + {im}^{2}\right)\right)} \]
      2. unpow272.8%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \color{blue}{im \cdot im}\right)\right) \]
    7. Simplified72.8%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + im \cdot im\right)\right)} \]
    8. Taylor expanded in re around 0 53.9%

      \[\leadsto \color{blue}{0.5 \cdot \left(re \cdot \left(2 + {im}^{2}\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*r*53.9%

        \[\leadsto \color{blue}{\left(0.5 \cdot re\right) \cdot \left(2 + {im}^{2}\right)} \]
      2. *-commutative53.9%

        \[\leadsto \color{blue}{\left(2 + {im}^{2}\right) \cdot \left(0.5 \cdot re\right)} \]
      3. unpow253.9%

        \[\leadsto \left(2 + \color{blue}{im \cdot im}\right) \cdot \left(0.5 \cdot re\right) \]
      4. *-commutative53.9%

        \[\leadsto \left(2 + im \cdot im\right) \cdot \color{blue}{\left(re \cdot 0.5\right)} \]
    10. Simplified53.9%

      \[\leadsto \color{blue}{\left(2 + im \cdot im\right) \cdot \left(re \cdot 0.5\right)} \]
    11. Taylor expanded in im around inf 53.9%

      \[\leadsto \color{blue}{0.5 \cdot \left({im}^{2} \cdot re\right)} \]
    12. Step-by-step derivation
      1. unpow253.9%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot re\right) \]
      2. *-commutative53.9%

        \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot im\right)\right)} \]
    13. Simplified53.9%

      \[\leadsto \color{blue}{0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification40.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 5 \cdot 10^{+61} \lor \neg \left(im \leq 2.7 \cdot 10^{+208}\right) \land im \leq 1.58 \cdot 10^{+227}:\\ \;\;\;\;re \cdot \left(1 + re \cdot \left(re \cdot -0.16666666666666666\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 37.0% accurate, 25.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 0.056:\\ \;\;\;\;re\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 0.056) re (* 0.5 (* re (* im im)))))
double code(double re, double im) {
	double tmp;
	if (im <= 0.056) {
		tmp = re;
	} else {
		tmp = 0.5 * (re * (im * im));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (im <= 0.056d0) then
        tmp = re
    else
        tmp = 0.5d0 * (re * (im * im))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 0.056) {
		tmp = re;
	} else {
		tmp = 0.5 * (re * (im * im));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 0.056:
		tmp = re
	else:
		tmp = 0.5 * (re * (im * im))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 0.056)
		tmp = re;
	else
		tmp = Float64(0.5 * Float64(re * Float64(im * im)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 0.056)
		tmp = re;
	else
		tmp = 0.5 * (re * (im * im));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 0.056], re, N[(0.5 * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.056:\\
\;\;\;\;re\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 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. remove-double-neg100.0%

        \[\leadsto \left(0.5 \cdot \color{blue}{\left(-\left(-\sin re\right)\right)}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      2. sin-neg100.0%

        \[\leadsto \left(0.5 \cdot \left(-\color{blue}{\sin \left(-re\right)}\right)\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      3. distribute-rgt-neg-in100.0%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \sin \left(-re\right)\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
      4. /-rgt-identity100.0%

        \[\leadsto \left(-\color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{1}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      5. exp-0100.0%

        \[\leadsto \left(-\frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{e^{0}}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      6. distribute-neg-frac2100.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{-e^{0}}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      7. exp-0100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{-\color{blue}{1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      8. metadata-eval100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{-1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      9. associate-*l/100.0%

        \[\leadsto \color{blue}{\frac{\left(0.5 \cdot \sin \left(-re\right)\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      10. associate-*l*100.0%

        \[\leadsto \frac{\color{blue}{0.5 \cdot \left(\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)\right)}}{-1} \]
      11. associate-*r/100.0%

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      12. associate-*l/100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\sin \left(-re\right)}{-1} \cdot \left(e^{0 - im} + e^{im}\right)\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} + e^{im}\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 86.1%

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \sin re\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-out86.1%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + {im}^{2}\right)\right)} \]
      2. unpow286.1%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \color{blue}{im \cdot im}\right)\right) \]
    7. Simplified86.1%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + im \cdot im\right)\right)} \]
    8. Taylor expanded in re around 0 48.6%

      \[\leadsto \color{blue}{0.5 \cdot \left(re \cdot \left(2 + {im}^{2}\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*r*48.6%

        \[\leadsto \color{blue}{\left(0.5 \cdot re\right) \cdot \left(2 + {im}^{2}\right)} \]
      2. *-commutative48.6%

        \[\leadsto \color{blue}{\left(2 + {im}^{2}\right) \cdot \left(0.5 \cdot re\right)} \]
      3. unpow248.6%

        \[\leadsto \left(2 + \color{blue}{im \cdot im}\right) \cdot \left(0.5 \cdot re\right) \]
      4. *-commutative48.6%

        \[\leadsto \left(2 + im \cdot im\right) \cdot \color{blue}{\left(re \cdot 0.5\right)} \]
    10. Simplified48.6%

      \[\leadsto \color{blue}{\left(2 + im \cdot im\right) \cdot \left(re \cdot 0.5\right)} \]
    11. Taylor expanded in im around 0 30.6%

      \[\leadsto \color{blue}{re} \]

    if 0.0560000000000000012 < 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. remove-double-neg100.0%

        \[\leadsto \left(0.5 \cdot \color{blue}{\left(-\left(-\sin re\right)\right)}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      2. sin-neg100.0%

        \[\leadsto \left(0.5 \cdot \left(-\color{blue}{\sin \left(-re\right)}\right)\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      3. distribute-rgt-neg-in100.0%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \sin \left(-re\right)\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
      4. /-rgt-identity100.0%

        \[\leadsto \left(-\color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{1}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      5. exp-0100.0%

        \[\leadsto \left(-\frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{e^{0}}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
      6. distribute-neg-frac2100.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{-e^{0}}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      7. exp-0100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{-\color{blue}{1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      8. metadata-eval100.0%

        \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{-1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
      9. associate-*l/100.0%

        \[\leadsto \color{blue}{\frac{\left(0.5 \cdot \sin \left(-re\right)\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      10. associate-*l*100.0%

        \[\leadsto \frac{\color{blue}{0.5 \cdot \left(\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)\right)}}{-1} \]
      11. associate-*r/100.0%

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
      12. associate-*l/100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\sin \left(-re\right)}{-1} \cdot \left(e^{0 - im} + e^{im}\right)\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} + e^{im}\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in im around 0 58.8%

      \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \sin re\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-out58.8%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + {im}^{2}\right)\right)} \]
      2. unpow258.8%

        \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \color{blue}{im \cdot im}\right)\right) \]
    7. Simplified58.8%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + im \cdot im\right)\right)} \]
    8. Taylor expanded in re around 0 40.4%

      \[\leadsto \color{blue}{0.5 \cdot \left(re \cdot \left(2 + {im}^{2}\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*r*40.4%

        \[\leadsto \color{blue}{\left(0.5 \cdot re\right) \cdot \left(2 + {im}^{2}\right)} \]
      2. *-commutative40.4%

        \[\leadsto \color{blue}{\left(2 + {im}^{2}\right) \cdot \left(0.5 \cdot re\right)} \]
      3. unpow240.4%

        \[\leadsto \left(2 + \color{blue}{im \cdot im}\right) \cdot \left(0.5 \cdot re\right) \]
      4. *-commutative40.4%

        \[\leadsto \left(2 + im \cdot im\right) \cdot \color{blue}{\left(re \cdot 0.5\right)} \]
    10. Simplified40.4%

      \[\leadsto \color{blue}{\left(2 + im \cdot im\right) \cdot \left(re \cdot 0.5\right)} \]
    11. Taylor expanded in im around inf 40.4%

      \[\leadsto \color{blue}{0.5 \cdot \left({im}^{2} \cdot re\right)} \]
    12. Step-by-step derivation
      1. unpow240.4%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(im \cdot im\right)} \cdot re\right) \]
      2. *-commutative40.4%

        \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(im \cdot im\right)\right)} \]
    13. Simplified40.4%

      \[\leadsto \color{blue}{0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 20: 26.5% accurate, 309.0× speedup?

\[\begin{array}{l} \\ re \end{array} \]
(FPCore (re im) :precision binary64 re)
double code(double re, double im) {
	return re;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    code = re
end function
public static double code(double re, double im) {
	return re;
}
def code(re, im):
	return re
function code(re, im)
	return re
end
function tmp = code(re, im)
	tmp = re;
end
code[re_, im_] := re
\begin{array}{l}

\\
re
\end{array}
Derivation
  1. Initial program 100.0%

    \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
  2. Step-by-step derivation
    1. remove-double-neg100.0%

      \[\leadsto \left(0.5 \cdot \color{blue}{\left(-\left(-\sin re\right)\right)}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. sin-neg100.0%

      \[\leadsto \left(0.5 \cdot \left(-\color{blue}{\sin \left(-re\right)}\right)\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    3. distribute-rgt-neg-in100.0%

      \[\leadsto \color{blue}{\left(-0.5 \cdot \sin \left(-re\right)\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
    4. /-rgt-identity100.0%

      \[\leadsto \left(-\color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{1}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    5. exp-0100.0%

      \[\leadsto \left(-\frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{e^{0}}}\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    6. distribute-neg-frac2100.0%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \sin \left(-re\right)}{-e^{0}}} \cdot \left(e^{0 - im} + e^{im}\right) \]
    7. exp-0100.0%

      \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{-\color{blue}{1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
    8. metadata-eval100.0%

      \[\leadsto \frac{0.5 \cdot \sin \left(-re\right)}{\color{blue}{-1}} \cdot \left(e^{0 - im} + e^{im}\right) \]
    9. associate-*l/100.0%

      \[\leadsto \color{blue}{\frac{\left(0.5 \cdot \sin \left(-re\right)\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
    10. associate-*l*100.0%

      \[\leadsto \frac{\color{blue}{0.5 \cdot \left(\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)\right)}}{-1} \]
    11. associate-*r/100.0%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\sin \left(-re\right) \cdot \left(e^{0 - im} + e^{im}\right)}{-1}} \]
    12. associate-*l/100.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\sin \left(-re\right)}{-1} \cdot \left(e^{0 - im} + e^{im}\right)\right)} \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{0.5 \cdot \left(\sin re \cdot \left(e^{-im} + e^{im}\right)\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in im around 0 79.0%

    \[\leadsto 0.5 \cdot \color{blue}{\left(2 \cdot \sin re + {im}^{2} \cdot \sin re\right)} \]
  6. Step-by-step derivation
    1. distribute-rgt-out79.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + {im}^{2}\right)\right)} \]
    2. unpow279.0%

      \[\leadsto 0.5 \cdot \left(\sin re \cdot \left(2 + \color{blue}{im \cdot im}\right)\right) \]
  7. Simplified79.0%

    \[\leadsto 0.5 \cdot \color{blue}{\left(\sin re \cdot \left(2 + im \cdot im\right)\right)} \]
  8. Taylor expanded in re around 0 46.5%

    \[\leadsto \color{blue}{0.5 \cdot \left(re \cdot \left(2 + {im}^{2}\right)\right)} \]
  9. Step-by-step derivation
    1. associate-*r*46.5%

      \[\leadsto \color{blue}{\left(0.5 \cdot re\right) \cdot \left(2 + {im}^{2}\right)} \]
    2. *-commutative46.5%

      \[\leadsto \color{blue}{\left(2 + {im}^{2}\right) \cdot \left(0.5 \cdot re\right)} \]
    3. unpow246.5%

      \[\leadsto \left(2 + \color{blue}{im \cdot im}\right) \cdot \left(0.5 \cdot re\right) \]
    4. *-commutative46.5%

      \[\leadsto \left(2 + im \cdot im\right) \cdot \color{blue}{\left(re \cdot 0.5\right)} \]
  10. Simplified46.5%

    \[\leadsto \color{blue}{\left(2 + im \cdot im\right) \cdot \left(re \cdot 0.5\right)} \]
  11. Taylor expanded in im around 0 23.3%

    \[\leadsto \color{blue}{re} \]
  12. Add Preprocessing

Reproduce

?
herbie shell --seed 2024107 
(FPCore (re im)
  :name "math.sin on complex, real part"
  :precision binary64
  (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))