math.sin on complex, real part

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

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 17 alternatives:

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

Initial Program: 100.0% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 1.0× speedup?

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

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

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

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

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

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

Alternative 2: 84.4% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 4.2 \cdot 10^{-7}:\\ \;\;\;\;\sin re \cdot \mathsf{fma}\left(0.5, im \cdot im, 1\right)\\ \mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} + e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 4.2e-7)
   (* (sin re) (fma 0.5 (* im im) 1.0))
   (if (<= im 1.9e+154)
     (* (* 0.5 re) (+ (exp (- im)) (exp im)))
     (* (sin re) (* im (* 0.5 im))))))
double code(double re, double im) {
	double tmp;
	if (im <= 4.2e-7) {
		tmp = sin(re) * fma(0.5, (im * im), 1.0);
	} else if (im <= 1.9e+154) {
		tmp = (0.5 * re) * (exp(-im) + exp(im));
	} else {
		tmp = sin(re) * (im * (0.5 * im));
	}
	return tmp;
}
function code(re, im)
	tmp = 0.0
	if (im <= 4.2e-7)
		tmp = Float64(sin(re) * fma(0.5, Float64(im * im), 1.0));
	elseif (im <= 1.9e+154)
		tmp = Float64(Float64(0.5 * re) * Float64(exp(Float64(-im)) + exp(im)));
	else
		tmp = Float64(sin(re) * Float64(im * Float64(0.5 * im)));
	end
	return tmp
end
code[re_, im_] := If[LessEqual[im, 4.2e-7], N[(N[Sin[re], $MachinePrecision] * N[(0.5 * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.9e+154], N[(N[(0.5 * re), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;im \leq 4.2 \cdot 10^{-7}:\\
\;\;\;\;\sin re \cdot \mathsf{fma}\left(0.5, im \cdot im, 1\right)\\

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

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


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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, {im}^{2}, 1\right)} \cdot \sin re \]
      5. unpow277.1%

        \[\leadsto \mathsf{fma}\left(0.5, \color{blue}{im \cdot im}, 1\right) \cdot \sin re \]
    8. Simplified77.1%

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

    if 4.2e-7 < im < 1.8999999999999999e154

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

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

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

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

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

    if 1.8999999999999999e154 < 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. sub0-neg100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(0.5, \color{blue}{im \cdot im}, 1\right) \cdot \sin re \]
    8. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, im \cdot im, 1\right) \cdot \sin re} \]
    9. Taylor expanded in im around inf 100.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 4.2 \cdot 10^{-7}:\\ \;\;\;\;\sin re \cdot \mathsf{fma}\left(0.5, im \cdot im, 1\right)\\ \mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} + e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\\ \end{array} \]

Alternative 3: 84.5% accurate, 1.5× speedup?

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

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

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

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


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

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

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

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

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

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

    if 4.2e-7 < im < 1.8999999999999999e154

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

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

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

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

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

    if 1.8999999999999999e154 < 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. sub0-neg100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(0.5, \color{blue}{im \cdot im}, 1\right) \cdot \sin re \]
    8. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, im \cdot im, 1\right) \cdot \sin re} \]
    9. Taylor expanded in im around inf 100.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 4.2 \cdot 10^{-7}:\\ \;\;\;\;\sin re + \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\ \mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} + e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\\ \end{array} \]

Alternative 4: 68.9% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 550:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 550.0)
   (sin re)
   (if (<= im 1.9e+154)
     (log1p (expm1 (* (* im im) (* 0.5 re))))
     (* (sin re) (* im (* 0.5 im))))))
double code(double re, double im) {
	double tmp;
	if (im <= 550.0) {
		tmp = sin(re);
	} else if (im <= 1.9e+154) {
		tmp = log1p(expm1(((im * im) * (0.5 * re))));
	} else {
		tmp = sin(re) * (im * (0.5 * im));
	}
	return tmp;
}
public static double code(double re, double im) {
	double tmp;
	if (im <= 550.0) {
		tmp = Math.sin(re);
	} else if (im <= 1.9e+154) {
		tmp = Math.log1p(Math.expm1(((im * im) * (0.5 * re))));
	} else {
		tmp = Math.sin(re) * (im * (0.5 * im));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 550.0:
		tmp = math.sin(re)
	elif im <= 1.9e+154:
		tmp = math.log1p(math.expm1(((im * im) * (0.5 * re))))
	else:
		tmp = math.sin(re) * (im * (0.5 * im))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 550.0)
		tmp = sin(re);
	elseif (im <= 1.9e+154)
		tmp = log1p(expm1(Float64(Float64(im * im) * Float64(0.5 * re))));
	else
		tmp = Float64(sin(re) * Float64(im * Float64(0.5 * im)));
	end
	return tmp
end
code[re_, im_] := If[LessEqual[im, 550.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.9e+154], N[Log[1 + N[(Exp[N[(N[(im * im), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\right)\right)\\

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


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

    1. Initial program 100.0%

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

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

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

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

    if 550 < im < 1.8999999999999999e154

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(0.5 \cdot re\right) \cdot \left(im \cdot im\right)} \]
    12. Step-by-step derivation
      1. log1p-expm1-u42.7%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\left(0.5 \cdot re\right) \cdot \left(im \cdot im\right)\right)\right)} \]
      2. *-commutative42.7%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)}\right)\right) \]
    13. Applied egg-rr42.7%

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

    if 1.8999999999999999e154 < 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. sub0-neg100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(0.5, \color{blue}{im \cdot im}, 1\right) \cdot \sin re \]
    8. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, im \cdot im, 1\right) \cdot \sin re} \]
    9. Taylor expanded in im around inf 100.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 550:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\\ \end{array} \]

Alternative 5: 81.5% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 580:\\ \;\;\;\;\sin re \cdot \mathsf{fma}\left(0.5, im \cdot im, 1\right)\\ \mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 580.0)
   (* (sin re) (fma 0.5 (* im im) 1.0))
   (if (<= im 1.9e+154)
     (log1p (expm1 (* (* im im) (* 0.5 re))))
     (* (sin re) (* im (* 0.5 im))))))
double code(double re, double im) {
	double tmp;
	if (im <= 580.0) {
		tmp = sin(re) * fma(0.5, (im * im), 1.0);
	} else if (im <= 1.9e+154) {
		tmp = log1p(expm1(((im * im) * (0.5 * re))));
	} else {
		tmp = sin(re) * (im * (0.5 * im));
	}
	return tmp;
}
function code(re, im)
	tmp = 0.0
	if (im <= 580.0)
		tmp = Float64(sin(re) * fma(0.5, Float64(im * im), 1.0));
	elseif (im <= 1.9e+154)
		tmp = log1p(expm1(Float64(Float64(im * im) * Float64(0.5 * re))));
	else
		tmp = Float64(sin(re) * Float64(im * Float64(0.5 * im)));
	end
	return tmp
end
code[re_, im_] := If[LessEqual[im, 580.0], N[(N[Sin[re], $MachinePrecision] * N[(0.5 * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.9e+154], N[Log[1 + N[(Exp[N[(N[(im * im), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;im \leq 580:\\
\;\;\;\;\sin re \cdot \mathsf{fma}\left(0.5, im \cdot im, 1\right)\\

\mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\right)\right)\\

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


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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, {im}^{2}, 1\right)} \cdot \sin re \]
      5. unpow277.2%

        \[\leadsto \mathsf{fma}\left(0.5, \color{blue}{im \cdot im}, 1\right) \cdot \sin re \]
    8. Simplified77.2%

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

    if 580 < im < 1.8999999999999999e154

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(0.5 \cdot re\right) \cdot \left(im \cdot im\right)} \]
    12. Step-by-step derivation
      1. log1p-expm1-u42.7%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\left(0.5 \cdot re\right) \cdot \left(im \cdot im\right)\right)\right)} \]
      2. *-commutative42.7%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)}\right)\right) \]
    13. Applied egg-rr42.7%

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

    if 1.8999999999999999e154 < 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. sub0-neg100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(0.5, \color{blue}{im \cdot im}, 1\right) \cdot \sin re \]
    8. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, im \cdot im, 1\right) \cdot \sin re} \]
    9. Taylor expanded in im around inf 100.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 580:\\ \;\;\;\;\sin re \cdot \mathsf{fma}\left(0.5, im \cdot im, 1\right)\\ \mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\\ \end{array} \]

Alternative 6: 69.0% accurate, 2.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\ t_1 := im \cdot \left(0.5 \cdot im\right)\\ \mathbf{if}\;im \leq 22000000:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.3 \cdot 10^{+56}:\\ \;\;\;\;\sqrt[3]{t_0 \cdot \left(t_0 \cdot t_0\right)}\\ \mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\ \;\;\;\;\frac{re \cdot \left(1 - 0.25 \cdot {im}^{4}\right)}{1 - t_1}\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot t_1\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (* im im) (* 0.5 re))) (t_1 (* im (* 0.5 im))))
   (if (<= im 22000000.0)
     (sin re)
     (if (<= im 2.3e+56)
       (cbrt (* t_0 (* t_0 t_0)))
       (if (<= im 1.9e+154)
         (/ (* re (- 1.0 (* 0.25 (pow im 4.0)))) (- 1.0 t_1))
         (* (sin re) t_1))))))
double code(double re, double im) {
	double t_0 = (im * im) * (0.5 * re);
	double t_1 = im * (0.5 * im);
	double tmp;
	if (im <= 22000000.0) {
		tmp = sin(re);
	} else if (im <= 2.3e+56) {
		tmp = cbrt((t_0 * (t_0 * t_0)));
	} else if (im <= 1.9e+154) {
		tmp = (re * (1.0 - (0.25 * pow(im, 4.0)))) / (1.0 - t_1);
	} else {
		tmp = sin(re) * t_1;
	}
	return tmp;
}
public static double code(double re, double im) {
	double t_0 = (im * im) * (0.5 * re);
	double t_1 = im * (0.5 * im);
	double tmp;
	if (im <= 22000000.0) {
		tmp = Math.sin(re);
	} else if (im <= 2.3e+56) {
		tmp = Math.cbrt((t_0 * (t_0 * t_0)));
	} else if (im <= 1.9e+154) {
		tmp = (re * (1.0 - (0.25 * Math.pow(im, 4.0)))) / (1.0 - t_1);
	} else {
		tmp = Math.sin(re) * t_1;
	}
	return tmp;
}
function code(re, im)
	t_0 = Float64(Float64(im * im) * Float64(0.5 * re))
	t_1 = Float64(im * Float64(0.5 * im))
	tmp = 0.0
	if (im <= 22000000.0)
		tmp = sin(re);
	elseif (im <= 2.3e+56)
		tmp = cbrt(Float64(t_0 * Float64(t_0 * t_0)));
	elseif (im <= 1.9e+154)
		tmp = Float64(Float64(re * Float64(1.0 - Float64(0.25 * (im ^ 4.0)))) / Float64(1.0 - t_1));
	else
		tmp = Float64(sin(re) * t_1);
	end
	return tmp
end
code[re_, im_] := Block[{t$95$0 = N[(N[(im * im), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 22000000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 2.3e+56], N[Power[N[(t$95$0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], If[LessEqual[im, 1.9e+154], N[(N[(re * N[(1.0 - N[(0.25 * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\
t_1 := im \cdot \left(0.5 \cdot im\right)\\
\mathbf{if}\;im \leq 22000000:\\
\;\;\;\;\sin re\\

\mathbf{elif}\;im \leq 2.3 \cdot 10^{+56}:\\
\;\;\;\;\sqrt[3]{t_0 \cdot \left(t_0 \cdot t_0\right)}\\

\mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;\frac{re \cdot \left(1 - 0.25 \cdot {im}^{4}\right)}{1 - t_1}\\

\mathbf{else}:\\
\;\;\;\;\sin re \cdot t_1\\


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

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

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

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

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

    if 2.2e7 < im < 2.30000000000000015e56

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(0.5 \cdot re\right) \cdot \color{blue}{\left(im \cdot im\right)} \]
    11. Simplified10.0%

      \[\leadsto \color{blue}{\left(0.5 \cdot re\right) \cdot \left(im \cdot im\right)} \]
    12. Step-by-step derivation
      1. add-cbrt-cube32.0%

        \[\leadsto \color{blue}{\sqrt[3]{\left(\left(\left(0.5 \cdot re\right) \cdot \left(im \cdot im\right)\right) \cdot \left(\left(0.5 \cdot re\right) \cdot \left(im \cdot im\right)\right)\right) \cdot \left(\left(0.5 \cdot re\right) \cdot \left(im \cdot im\right)\right)}} \]
      2. *-commutative32.0%

        \[\leadsto \sqrt[3]{\left(\color{blue}{\left(\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\right)} \cdot \left(\left(0.5 \cdot re\right) \cdot \left(im \cdot im\right)\right)\right) \cdot \left(\left(0.5 \cdot re\right) \cdot \left(im \cdot im\right)\right)} \]
      3. *-commutative32.0%

        \[\leadsto \sqrt[3]{\left(\left(\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\right) \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\right)}\right) \cdot \left(\left(0.5 \cdot re\right) \cdot \left(im \cdot im\right)\right)} \]
      4. *-commutative32.0%

        \[\leadsto \sqrt[3]{\left(\left(\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\right)\right) \cdot \color{blue}{\left(\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\right)}} \]
    13. Applied egg-rr32.0%

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

    if 2.30000000000000015e56 < im < 1.8999999999999999e154

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot 1 - \left(0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.5 \cdot \left(im \cdot im\right)\right)}{1 - 0.5 \cdot \left(im \cdot im\right)}} \cdot re \]
      3. associate-*l/50.5%

        \[\leadsto \color{blue}{\frac{\left(1 \cdot 1 - \left(0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.5 \cdot \left(im \cdot im\right)\right)\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)}} \]
      4. metadata-eval50.5%

        \[\leadsto \frac{\left(\color{blue}{1} - \left(0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.5 \cdot \left(im \cdot im\right)\right)\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      5. swap-sqr50.5%

        \[\leadsto \frac{\left(1 - \color{blue}{\left(0.5 \cdot 0.5\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)}\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      6. metadata-eval50.5%

        \[\leadsto \frac{\left(1 - \color{blue}{0.25} \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      7. pow250.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot \left(\color{blue}{{im}^{2}} \cdot \left(im \cdot im\right)\right)\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      8. pow250.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right)\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      9. pow-prod-up50.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot \color{blue}{{im}^{\left(2 + 2\right)}}\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      10. metadata-eval50.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot {im}^{\color{blue}{4}}\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      11. associate-*r*50.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot {im}^{4}\right) \cdot re}{1 - \color{blue}{\left(0.5 \cdot im\right) \cdot im}} \]
      12. *-commutative50.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot {im}^{4}\right) \cdot re}{1 - \color{blue}{im \cdot \left(0.5 \cdot im\right)}} \]
    10. Applied egg-rr50.5%

      \[\leadsto \color{blue}{\frac{\left(1 - 0.25 \cdot {im}^{4}\right) \cdot re}{1 - im \cdot \left(0.5 \cdot im\right)}} \]

    if 1.8999999999999999e154 < 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. sub0-neg100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(0.5, \color{blue}{im \cdot im}, 1\right) \cdot \sin re \]
    8. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, im \cdot im, 1\right) \cdot \sin re} \]
    9. Taylor expanded in im around inf 100.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 22000000:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.3 \cdot 10^{+56}:\\ \;\;\;\;\sqrt[3]{\left(\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\right) \cdot \left(\left(\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\right) \cdot \left(\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\right)\right)}\\ \mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\ \;\;\;\;\frac{re \cdot \left(1 - 0.25 \cdot {im}^{4}\right)}{1 - im \cdot \left(0.5 \cdot im\right)}\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\\ \end{array} \]

Alternative 7: 68.9% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.016666666666666666 \cdot \left(re \cdot re\right)\\ t_1 := im \cdot \left(0.5 \cdot im\right)\\ \mathbf{if}\;im \leq 560:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.7 \cdot 10^{+25}:\\ \;\;\;\;0.08333333333333333 + \sqrt[3]{t_0 \cdot \left(t_0 \cdot t_0\right)}\\ \mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\ \;\;\;\;\frac{re \cdot \left(1 - 0.25 \cdot {im}^{4}\right)}{1 - t_1}\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot t_1\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* 0.016666666666666666 (* re re))) (t_1 (* im (* 0.5 im))))
   (if (<= im 560.0)
     (sin re)
     (if (<= im 2.7e+25)
       (+ 0.08333333333333333 (cbrt (* t_0 (* t_0 t_0))))
       (if (<= im 1.9e+154)
         (/ (* re (- 1.0 (* 0.25 (pow im 4.0)))) (- 1.0 t_1))
         (* (sin re) t_1))))))
double code(double re, double im) {
	double t_0 = 0.016666666666666666 * (re * re);
	double t_1 = im * (0.5 * im);
	double tmp;
	if (im <= 560.0) {
		tmp = sin(re);
	} else if (im <= 2.7e+25) {
		tmp = 0.08333333333333333 + cbrt((t_0 * (t_0 * t_0)));
	} else if (im <= 1.9e+154) {
		tmp = (re * (1.0 - (0.25 * pow(im, 4.0)))) / (1.0 - t_1);
	} else {
		tmp = sin(re) * t_1;
	}
	return tmp;
}
public static double code(double re, double im) {
	double t_0 = 0.016666666666666666 * (re * re);
	double t_1 = im * (0.5 * im);
	double tmp;
	if (im <= 560.0) {
		tmp = Math.sin(re);
	} else if (im <= 2.7e+25) {
		tmp = 0.08333333333333333 + Math.cbrt((t_0 * (t_0 * t_0)));
	} else if (im <= 1.9e+154) {
		tmp = (re * (1.0 - (0.25 * Math.pow(im, 4.0)))) / (1.0 - t_1);
	} else {
		tmp = Math.sin(re) * t_1;
	}
	return tmp;
}
function code(re, im)
	t_0 = Float64(0.016666666666666666 * Float64(re * re))
	t_1 = Float64(im * Float64(0.5 * im))
	tmp = 0.0
	if (im <= 560.0)
		tmp = sin(re);
	elseif (im <= 2.7e+25)
		tmp = Float64(0.08333333333333333 + cbrt(Float64(t_0 * Float64(t_0 * t_0))));
	elseif (im <= 1.9e+154)
		tmp = Float64(Float64(re * Float64(1.0 - Float64(0.25 * (im ^ 4.0)))) / Float64(1.0 - t_1));
	else
		tmp = Float64(sin(re) * t_1);
	end
	return tmp
end
code[re_, im_] := Block[{t$95$0 = N[(0.016666666666666666 * N[(re * re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 560.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 2.7e+25], N[(0.08333333333333333 + N[Power[N[(t$95$0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.9e+154], N[(N[(re * N[(1.0 - N[(0.25 * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.016666666666666666 \cdot \left(re \cdot re\right)\\
t_1 := im \cdot \left(0.5 \cdot im\right)\\
\mathbf{if}\;im \leq 560:\\
\;\;\;\;\sin re\\

\mathbf{elif}\;im \leq 2.7 \cdot 10^{+25}:\\
\;\;\;\;0.08333333333333333 + \sqrt[3]{t_0 \cdot \left(t_0 \cdot t_0\right)}\\

\mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;\frac{re \cdot \left(1 - 0.25 \cdot {im}^{4}\right)}{1 - t_1}\\

\mathbf{else}:\\
\;\;\;\;\sin re \cdot t_1\\


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

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

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

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

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

    if 560 < im < 2.7e25

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)} \]
    8. Taylor expanded in re around inf 5.1%

      \[\leadsto \color{blue}{0.08333333333333333 + 0.016666666666666666 \cdot {re}^{2}} \]
    9. Step-by-step derivation
      1. unpow25.1%

        \[\leadsto 0.08333333333333333 + 0.016666666666666666 \cdot \color{blue}{\left(re \cdot re\right)} \]
    10. Simplified5.1%

      \[\leadsto \color{blue}{0.08333333333333333 + 0.016666666666666666 \cdot \left(re \cdot re\right)} \]
    11. Step-by-step derivation
      1. add-cbrt-cube41.9%

        \[\leadsto 0.08333333333333333 + \color{blue}{\sqrt[3]{\left(\left(0.016666666666666666 \cdot \left(re \cdot re\right)\right) \cdot \left(0.016666666666666666 \cdot \left(re \cdot re\right)\right)\right) \cdot \left(0.016666666666666666 \cdot \left(re \cdot re\right)\right)}} \]
    12. Applied egg-rr41.9%

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

    if 2.7e25 < im < 1.8999999999999999e154

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot 1 - \left(0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.5 \cdot \left(im \cdot im\right)\right)}{1 - 0.5 \cdot \left(im \cdot im\right)}} \cdot re \]
      3. associate-*l/39.5%

        \[\leadsto \color{blue}{\frac{\left(1 \cdot 1 - \left(0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.5 \cdot \left(im \cdot im\right)\right)\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)}} \]
      4. metadata-eval39.5%

        \[\leadsto \frac{\left(\color{blue}{1} - \left(0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.5 \cdot \left(im \cdot im\right)\right)\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      5. swap-sqr39.5%

        \[\leadsto \frac{\left(1 - \color{blue}{\left(0.5 \cdot 0.5\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)}\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      6. metadata-eval39.5%

        \[\leadsto \frac{\left(1 - \color{blue}{0.25} \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      7. pow239.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot \left(\color{blue}{{im}^{2}} \cdot \left(im \cdot im\right)\right)\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      8. pow239.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right)\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      9. pow-prod-up39.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot \color{blue}{{im}^{\left(2 + 2\right)}}\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      10. metadata-eval39.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot {im}^{\color{blue}{4}}\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      11. associate-*r*39.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot {im}^{4}\right) \cdot re}{1 - \color{blue}{\left(0.5 \cdot im\right) \cdot im}} \]
      12. *-commutative39.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot {im}^{4}\right) \cdot re}{1 - \color{blue}{im \cdot \left(0.5 \cdot im\right)}} \]
    10. Applied egg-rr39.5%

      \[\leadsto \color{blue}{\frac{\left(1 - 0.25 \cdot {im}^{4}\right) \cdot re}{1 - im \cdot \left(0.5 \cdot im\right)}} \]

    if 1.8999999999999999e154 < 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. sub0-neg100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(0.5, \color{blue}{im \cdot im}, 1\right) \cdot \sin re \]
    8. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, im \cdot im, 1\right) \cdot \sin re} \]
    9. Taylor expanded in im around inf 100.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 560:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.7 \cdot 10^{+25}:\\ \;\;\;\;0.08333333333333333 + \sqrt[3]{\left(0.016666666666666666 \cdot \left(re \cdot re\right)\right) \cdot \left(\left(0.016666666666666666 \cdot \left(re \cdot re\right)\right) \cdot \left(0.016666666666666666 \cdot \left(re \cdot re\right)\right)\right)}\\ \mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\ \;\;\;\;\frac{re \cdot \left(1 - 0.25 \cdot {im}^{4}\right)}{1 - im \cdot \left(0.5 \cdot im\right)}\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\\ \end{array} \]

Alternative 8: 69.3% accurate, 2.5× speedup?

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

\\
\begin{array}{l}
t_0 := im \cdot \left(0.5 \cdot im\right)\\
\mathbf{if}\;im \leq 710:\\
\;\;\;\;\sin re\\

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

\mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;\frac{re \cdot \left(1 - 0.25 \cdot {im}^{4}\right)}{1 - t_0}\\

\mathbf{else}:\\
\;\;\;\;\sin re \cdot t_0\\


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

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

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

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

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

    if 710 < im < 5.3999999999999999e70

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)} \]
    8. Taylor expanded in re around 0 14.8%

      \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \color{blue}{0.016666666666666666 \cdot {re}^{2}}\right) \]
    9. Step-by-step derivation
      1. unpow214.8%

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

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

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

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

    if 5.3999999999999999e70 < im < 1.8999999999999999e154

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot 1 - \left(0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.5 \cdot \left(im \cdot im\right)\right)}{1 - 0.5 \cdot \left(im \cdot im\right)}} \cdot re \]
      3. associate-*l/61.5%

        \[\leadsto \color{blue}{\frac{\left(1 \cdot 1 - \left(0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.5 \cdot \left(im \cdot im\right)\right)\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)}} \]
      4. metadata-eval61.5%

        \[\leadsto \frac{\left(\color{blue}{1} - \left(0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.5 \cdot \left(im \cdot im\right)\right)\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      5. swap-sqr61.5%

        \[\leadsto \frac{\left(1 - \color{blue}{\left(0.5 \cdot 0.5\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)}\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      6. metadata-eval61.5%

        \[\leadsto \frac{\left(1 - \color{blue}{0.25} \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      7. pow261.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot \left(\color{blue}{{im}^{2}} \cdot \left(im \cdot im\right)\right)\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      8. pow261.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right)\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      9. pow-prod-up61.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot \color{blue}{{im}^{\left(2 + 2\right)}}\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      10. metadata-eval61.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot {im}^{\color{blue}{4}}\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      11. associate-*r*61.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot {im}^{4}\right) \cdot re}{1 - \color{blue}{\left(0.5 \cdot im\right) \cdot im}} \]
      12. *-commutative61.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot {im}^{4}\right) \cdot re}{1 - \color{blue}{im \cdot \left(0.5 \cdot im\right)}} \]
    10. Applied egg-rr61.5%

      \[\leadsto \color{blue}{\frac{\left(1 - 0.25 \cdot {im}^{4}\right) \cdot re}{1 - im \cdot \left(0.5 \cdot im\right)}} \]

    if 1.8999999999999999e154 < 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. sub0-neg100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(0.5, \color{blue}{im \cdot im}, 1\right) \cdot \sin re \]
    8. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, im \cdot im, 1\right) \cdot \sin re} \]
    9. Taylor expanded in im around inf 100.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 710:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 5.4 \cdot 10^{+70}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + re \cdot \left(re \cdot 0.016666666666666666\right)\right)\\ \mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\ \;\;\;\;\frac{re \cdot \left(1 - 0.25 \cdot {im}^{4}\right)}{1 - im \cdot \left(0.5 \cdot im\right)}\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\\ \end{array} \]

Alternative 9: 69.4% accurate, 2.6× speedup?

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

\\
\begin{array}{l}
t_0 := im \cdot \left(0.5 \cdot im\right)\\
\mathbf{if}\;im \leq 500:\\
\;\;\;\;\sin re\\

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

\mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;\frac{{im}^{4} \cdot \left(re \cdot -0.25\right)}{1 - t_0}\\

\mathbf{else}:\\
\;\;\;\;\sin re \cdot t_0\\


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

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

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

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

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

    if 500 < im < 1.4e72

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)} \]
    8. Taylor expanded in re around 0 14.8%

      \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \color{blue}{0.016666666666666666 \cdot {re}^{2}}\right) \]
    9. Step-by-step derivation
      1. unpow214.8%

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

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

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

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

    if 1.4e72 < im < 1.8999999999999999e154

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot 1 - \left(0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.5 \cdot \left(im \cdot im\right)\right)}{1 - 0.5 \cdot \left(im \cdot im\right)}} \cdot re \]
      3. associate-*l/61.5%

        \[\leadsto \color{blue}{\frac{\left(1 \cdot 1 - \left(0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.5 \cdot \left(im \cdot im\right)\right)\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)}} \]
      4. metadata-eval61.5%

        \[\leadsto \frac{\left(\color{blue}{1} - \left(0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.5 \cdot \left(im \cdot im\right)\right)\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      5. swap-sqr61.5%

        \[\leadsto \frac{\left(1 - \color{blue}{\left(0.5 \cdot 0.5\right) \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)}\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      6. metadata-eval61.5%

        \[\leadsto \frac{\left(1 - \color{blue}{0.25} \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      7. pow261.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot \left(\color{blue}{{im}^{2}} \cdot \left(im \cdot im\right)\right)\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      8. pow261.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot \left({im}^{2} \cdot \color{blue}{{im}^{2}}\right)\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      9. pow-prod-up61.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot \color{blue}{{im}^{\left(2 + 2\right)}}\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      10. metadata-eval61.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot {im}^{\color{blue}{4}}\right) \cdot re}{1 - 0.5 \cdot \left(im \cdot im\right)} \]
      11. associate-*r*61.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot {im}^{4}\right) \cdot re}{1 - \color{blue}{\left(0.5 \cdot im\right) \cdot im}} \]
      12. *-commutative61.5%

        \[\leadsto \frac{\left(1 - 0.25 \cdot {im}^{4}\right) \cdot re}{1 - \color{blue}{im \cdot \left(0.5 \cdot im\right)}} \]
    10. Applied egg-rr61.5%

      \[\leadsto \color{blue}{\frac{\left(1 - 0.25 \cdot {im}^{4}\right) \cdot re}{1 - im \cdot \left(0.5 \cdot im\right)}} \]
    11. Taylor expanded in im around inf 61.5%

      \[\leadsto \frac{\color{blue}{-0.25 \cdot \left(re \cdot {im}^{4}\right)}}{1 - im \cdot \left(0.5 \cdot im\right)} \]
    12. Step-by-step derivation
      1. associate-*r*61.5%

        \[\leadsto \frac{\color{blue}{\left(-0.25 \cdot re\right) \cdot {im}^{4}}}{1 - im \cdot \left(0.5 \cdot im\right)} \]
    13. Simplified61.5%

      \[\leadsto \frac{\color{blue}{\left(-0.25 \cdot re\right) \cdot {im}^{4}}}{1 - im \cdot \left(0.5 \cdot im\right)} \]

    if 1.8999999999999999e154 < 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. sub0-neg100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(0.5, \color{blue}{im \cdot im}, 1\right) \cdot \sin re \]
    8. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, im \cdot im, 1\right) \cdot \sin re} \]
    9. Taylor expanded in im around inf 100.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 500:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.4 \cdot 10^{+72}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + re \cdot \left(re \cdot 0.016666666666666666\right)\right)\\ \mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\ \;\;\;\;\frac{{im}^{4} \cdot \left(re \cdot -0.25\right)}{1 - im \cdot \left(0.5 \cdot im\right)}\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\\ \end{array} \]

Alternative 10: 66.1% accurate, 2.7× speedup?

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

\\
\begin{array}{l}
t_0 := im \cdot \left(0.5 \cdot im\right)\\
t_1 := re \cdot t_0\\
\mathbf{if}\;im \leq 680:\\
\;\;\;\;\sin re\\

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

\mathbf{elif}\;im \leq 1.85 \cdot 10^{+140}:\\
\;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;\sin re \cdot t_0\\


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

    1. Initial program 100.0%

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

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

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

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

    if 680 < im < 1.5499999999999999e96

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)} \]
    8. Taylor expanded in re around 0 17.5%

      \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \color{blue}{0.016666666666666666 \cdot {re}^{2}}\right) \]
    9. Step-by-step derivation
      1. unpow217.5%

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

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

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

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

    if 1.5499999999999999e96 < im < 1.85000000000000001e140

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

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

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

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

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

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

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

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

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

    if 1.85000000000000001e140 < im < 1.8999999999999999e154

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)} \]
    9. Step-by-step derivation
      1. distribute-rgt-in5.1%

        \[\leadsto \color{blue}{1 \cdot re + \left(0.5 \cdot \left(im \cdot im\right)\right) \cdot re} \]
      2. *-un-lft-identity5.1%

        \[\leadsto \color{blue}{re} + \left(0.5 \cdot \left(im \cdot im\right)\right) \cdot re \]
      3. flip-+100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{re \cdot re - \left(re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\right) \cdot \left(re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\right)}{re - re \cdot \color{blue}{\left(im \cdot \left(0.5 \cdot im\right)\right)}} \]
    10. Applied egg-rr100.0%

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

        \[\leadsto \frac{re \cdot re - \color{blue}{re \cdot \left(\left(im \cdot \left(0.5 \cdot im\right)\right) \cdot \left(re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\right)\right)}}{re - re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)} \]
      2. distribute-lft-out--100.0%

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

        \[\leadsto \frac{re \cdot \left(re - \color{blue}{\left(\left(0.5 \cdot im\right) \cdot im\right)} \cdot \left(re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\right)\right)}{re - re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)} \]
      4. associate-*l*100.0%

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

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

    if 1.8999999999999999e154 < 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. sub0-neg100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(0.5, \color{blue}{im \cdot im}, 1\right) \cdot \sin re \]
    8. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, im \cdot im, 1\right) \cdot \sin re} \]
    9. Taylor expanded in im around inf 100.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 680:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.55 \cdot 10^{+96}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + re \cdot \left(re \cdot 0.016666666666666666\right)\right)\\ \mathbf{elif}\;im \leq 1.85 \cdot 10^{+140}:\\ \;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\ \mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\ \;\;\;\;\frac{re \cdot \left(re - \left(0.5 \cdot im\right) \cdot \left(im \cdot \left(re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\right)\right)\right)}{re - re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\\ \end{array} \]

Alternative 11: 63.1% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\\ \mathbf{if}\;im \leq 550:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.65 \cdot 10^{+97}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + re \cdot \left(re \cdot 0.016666666666666666\right)\right)\\ \mathbf{elif}\;im \leq 5.8 \cdot 10^{+141} \lor \neg \left(im \leq 4.4 \cdot 10^{+153}\right):\\ \;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{re \cdot \left(re - \left(0.5 \cdot im\right) \cdot \left(im \cdot t_0\right)\right)}{re - t_0}\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* re (* im (* 0.5 im)))))
   (if (<= im 550.0)
     (sin re)
     (if (<= im 1.65e+97)
       (+
        0.08333333333333333
        (+ (/ 0.25 (* re re)) (* re (* re 0.016666666666666666))))
       (if (or (<= im 5.8e+141) (not (<= im 4.4e+153)))
         (* re (+ 1.0 (* 0.5 (* im im))))
         (/ (* re (- re (* (* 0.5 im) (* im t_0)))) (- re t_0)))))))
double code(double re, double im) {
	double t_0 = re * (im * (0.5 * im));
	double tmp;
	if (im <= 550.0) {
		tmp = sin(re);
	} else if (im <= 1.65e+97) {
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + (re * (re * 0.016666666666666666)));
	} else if ((im <= 5.8e+141) || !(im <= 4.4e+153)) {
		tmp = re * (1.0 + (0.5 * (im * im)));
	} else {
		tmp = (re * (re - ((0.5 * im) * (im * t_0)))) / (re - t_0);
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = re * (im * (0.5d0 * im))
    if (im <= 550.0d0) then
        tmp = sin(re)
    else if (im <= 1.65d+97) then
        tmp = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + (re * (re * 0.016666666666666666d0)))
    else if ((im <= 5.8d+141) .or. (.not. (im <= 4.4d+153))) then
        tmp = re * (1.0d0 + (0.5d0 * (im * im)))
    else
        tmp = (re * (re - ((0.5d0 * im) * (im * t_0)))) / (re - t_0)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = re * (im * (0.5 * im));
	double tmp;
	if (im <= 550.0) {
		tmp = Math.sin(re);
	} else if (im <= 1.65e+97) {
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + (re * (re * 0.016666666666666666)));
	} else if ((im <= 5.8e+141) || !(im <= 4.4e+153)) {
		tmp = re * (1.0 + (0.5 * (im * im)));
	} else {
		tmp = (re * (re - ((0.5 * im) * (im * t_0)))) / (re - t_0);
	}
	return tmp;
}
def code(re, im):
	t_0 = re * (im * (0.5 * im))
	tmp = 0
	if im <= 550.0:
		tmp = math.sin(re)
	elif im <= 1.65e+97:
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + (re * (re * 0.016666666666666666)))
	elif (im <= 5.8e+141) or not (im <= 4.4e+153):
		tmp = re * (1.0 + (0.5 * (im * im)))
	else:
		tmp = (re * (re - ((0.5 * im) * (im * t_0)))) / (re - t_0)
	return tmp
function code(re, im)
	t_0 = Float64(re * Float64(im * Float64(0.5 * im)))
	tmp = 0.0
	if (im <= 550.0)
		tmp = sin(re);
	elseif (im <= 1.65e+97)
		tmp = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(re * Float64(re * 0.016666666666666666))));
	elseif ((im <= 5.8e+141) || !(im <= 4.4e+153))
		tmp = Float64(re * Float64(1.0 + Float64(0.5 * Float64(im * im))));
	else
		tmp = Float64(Float64(re * Float64(re - Float64(Float64(0.5 * im) * Float64(im * t_0)))) / Float64(re - t_0));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = re * (im * (0.5 * im));
	tmp = 0.0;
	if (im <= 550.0)
		tmp = sin(re);
	elseif (im <= 1.65e+97)
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + (re * (re * 0.016666666666666666)));
	elseif ((im <= 5.8e+141) || ~((im <= 4.4e+153)))
		tmp = re * (1.0 + (0.5 * (im * im)));
	else
		tmp = (re * (re - ((0.5 * im) * (im * t_0)))) / (re - t_0);
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 550.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.65e+97], N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(re * N[(re * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, 5.8e+141], N[Not[LessEqual[im, 4.4e+153]], $MachinePrecision]], N[(re * N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(re * N[(re - N[(N[(0.5 * im), $MachinePrecision] * N[(im * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(re - t$95$0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;im \leq 5.8 \cdot 10^{+141} \lor \neg \left(im \leq 4.4 \cdot 10^{+153}\right):\\
\;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\

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


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

    1. Initial program 100.0%

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

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

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

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

    if 550 < im < 1.6500000000000001e97

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)} \]
    8. Taylor expanded in re around 0 17.5%

      \[\leadsto 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \color{blue}{0.016666666666666666 \cdot {re}^{2}}\right) \]
    9. Step-by-step derivation
      1. unpow217.5%

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

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

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

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

    if 1.6500000000000001e97 < im < 5.80000000000000013e141 or 4.3999999999999999e153 < 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. sub0-neg100.0%

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

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

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

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

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

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

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

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

    if 5.80000000000000013e141 < im < 4.3999999999999999e153

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)} \]
    9. Step-by-step derivation
      1. distribute-rgt-in5.1%

        \[\leadsto \color{blue}{1 \cdot re + \left(0.5 \cdot \left(im \cdot im\right)\right) \cdot re} \]
      2. *-un-lft-identity5.1%

        \[\leadsto \color{blue}{re} + \left(0.5 \cdot \left(im \cdot im\right)\right) \cdot re \]
      3. flip-+100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{re \cdot re - \left(re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\right) \cdot \left(re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\right)}{re - re \cdot \color{blue}{\left(im \cdot \left(0.5 \cdot im\right)\right)}} \]
    10. Applied egg-rr100.0%

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

        \[\leadsto \frac{re \cdot re - \color{blue}{re \cdot \left(\left(im \cdot \left(0.5 \cdot im\right)\right) \cdot \left(re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\right)\right)}}{re - re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)} \]
      2. distribute-lft-out--100.0%

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

        \[\leadsto \frac{re \cdot \left(re - \color{blue}{\left(\left(0.5 \cdot im\right) \cdot im\right)} \cdot \left(re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\right)\right)}{re - re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)} \]
      4. associate-*l*100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 550:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.65 \cdot 10^{+97}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + re \cdot \left(re \cdot 0.016666666666666666\right)\right)\\ \mathbf{elif}\;im \leq 5.8 \cdot 10^{+141} \lor \neg \left(im \leq 4.4 \cdot 10^{+153}\right):\\ \;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{re \cdot \left(re - \left(0.5 \cdot im\right) \cdot \left(im \cdot \left(re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)\right)\right)\right)}{re - re \cdot \left(im \cdot \left(0.5 \cdot im\right)\right)}\\ \end{array} \]

Alternative 12: 37.1% accurate, 27.8× speedup?

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

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

\mathbf{elif}\;im \leq 3.1 \cdot 10^{+25}:\\
\;\;\;\;0.08333333333333333 + 0.016666666666666666 \cdot \left(re \cdot re\right)\\

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


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

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

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

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

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

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

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

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

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

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

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

    if 390 < im < 3.0999999999999998e25

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)} \]
    8. Taylor expanded in re around inf 5.1%

      \[\leadsto \color{blue}{0.08333333333333333 + 0.016666666666666666 \cdot {re}^{2}} \]
    9. Step-by-step derivation
      1. unpow25.1%

        \[\leadsto 0.08333333333333333 + 0.016666666666666666 \cdot \color{blue}{\left(re \cdot re\right)} \]
    10. Simplified5.1%

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

    if 3.0999999999999998e25 < 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. sub0-neg100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 390:\\ \;\;\;\;re\\ \mathbf{elif}\;im \leq 3.1 \cdot 10^{+25}:\\ \;\;\;\;0.08333333333333333 + 0.016666666666666666 \cdot \left(re \cdot re\right)\\ \mathbf{else}:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\ \end{array} \]

Alternative 13: 37.0% accurate, 34.1× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

    if 1.3999999999999999 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(0.5 \cdot re\right) \cdot \color{blue}{\left(im \cdot im\right)} \]
    11. Simplified51.6%

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

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

Alternative 14: 47.9% accurate, 34.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 28.9% accurate, 43.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 5.4 \cdot 10^{+35}:\\
\;\;\;\;re\\

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


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

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

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

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

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

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

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

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

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

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

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

    if 5.40000000000000005e35 < 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. sub0-neg100.0%

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

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

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

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

        \[\leadsto \frac{0.25}{\color{blue}{re \cdot re}} \]
    7. Simplified11.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 5.4 \cdot 10^{+35}:\\ \;\;\;\;re\\ \mathbf{else}:\\ \;\;\;\;\frac{0.25}{re \cdot re}\\ \end{array} \]

Alternative 16: 4.2% accurate, 309.0× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto 0.08333333333333333 + \frac{\color{blue}{0.25}}{{re}^{2}} \]
    3. unpow29.2%

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

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

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

    \[\leadsto 0.08333333333333333 \]

Alternative 17: 26.6% accurate, 309.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{re} \]
  10. Final simplification27.5%

    \[\leadsto re \]

Reproduce

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