math.sin on complex, real part

Percentage Accurate: 100.0% → 100.0%
Time: 7.2s
Alternatives: 14
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 14 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, 0.8× speedup?

\[\begin{array}{l} \\ \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right) \end{array} \]
(FPCore (re im)
 :precision binary64
 (* (sin re) (fma 0.5 (exp im) (/ 0.5 (exp im)))))
double code(double re, double im) {
	return sin(re) * fma(0.5, exp(im), (0.5 / exp(im)));
}
function code(re, im)
	return Float64(sin(re) * fma(0.5, exp(im), Float64(0.5 / exp(im))))
end
code[re_, im_] := N[(N[Sin[re], $MachinePrecision] * N[(0.5 * N[Exp[im], $MachinePrecision] + N[(0.5 / N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)
\end{array}
Derivation
  1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right) \]

Alternative 2: 100.0% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{-1 \cdot e^{im}}\right)\right) \]
    13. neg-mul-1100.0%

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

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

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

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

Alternative 3: 87.9% accurate, 1.5× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Taylor expanded in im around 0 84.4%

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

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

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

    if 1.3500000000000001 < im

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Applied egg-rr99.1%

      \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{0.001953125}\right) \]
    5. Taylor expanded in re around inf 99.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 1.35:\\ \;\;\;\;\sin re + 0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(0.001953125 + 0.5 \cdot e^{im}\right)\\ \end{array} \]

Alternative 4: 87.8% accurate, 1.5× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{-1 \cdot e^{im}}\right)\right) \]
      13. neg-mul-1100.0%

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

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

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

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

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

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

    if 1.3500000000000001 < im

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Applied egg-rr99.1%

      \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{0.001953125}\right) \]
    5. Taylor expanded in re around inf 99.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 1.35:\\ \;\;\;\;\left(\sin re \cdot 0.5\right) \cdot \left(im \cdot im + 2\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \left(0.001953125 + 0.5 \cdot e^{im}\right)\\ \end{array} \]

Alternative 5: 84.5% accurate, 2.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 6.2 \lor \neg \left(im \leq 6.4 \cdot 10^{+150}\right):\\
\;\;\;\;\left(\sin re \cdot 0.5\right) \cdot \left(im \cdot im + 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 6.20000000000000018 or 6.40000000000000031e150 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{-1 \cdot e^{im}}\right)\right) \]
      13. neg-mul-1100.0%

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

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

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

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

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

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

    if 6.20000000000000018 < im < 6.40000000000000031e150

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Applied egg-rr99.9%

      \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{0.001953125}\right) \]
    5. Taylor expanded in re around 0 88.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 6.2 \lor \neg \left(im \leq 6.4 \cdot 10^{+150}\right):\\ \;\;\;\;\left(\sin re \cdot 0.5\right) \cdot \left(im \cdot im + 2\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.001953125 + 0.5 \cdot e^{im}\right)\\ \end{array} \]

Alternative 6: 69.4% accurate, 2.8× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Taylor expanded in im around 0 64.4%

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

    if 6.20000000000000018 < im

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Applied egg-rr99.9%

      \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{0.001953125}\right) \]
    5. Taylor expanded in re around 0 79.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 6.2:\\ \;\;\;\;\sin re\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(0.001953125 + 0.5 \cdot e^{im}\right)\\ \end{array} \]

Alternative 7: 62.1% accurate, 3.0× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Taylor expanded in im around 0 62.6%

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

    if 2.4e11 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Taylor expanded in im around 0 53.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 28.8% accurate, 34.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 1050:\\
\;\;\;\;0.5 \cdot \left(re \cdot 2\right)\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{-1 \cdot e^{im}}\right)\right) \]
      13. neg-mul-1100.0%

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

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

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

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

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

    if 1050 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Applied egg-rr14.9%

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

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

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

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

        \[\leadsto 0.08333333333333333 + \frac{0.25}{\color{blue}{re \cdot re}} \]
      4. associate-/r*14.9%

        \[\leadsto 0.08333333333333333 + \color{blue}{\frac{\frac{0.25}{re}}{re}} \]
    7. Simplified14.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 1050:\\ \;\;\;\;0.5 \cdot \left(re \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;0.08333333333333333 + \frac{\frac{0.25}{re}}{re}\\ \end{array} \]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
  4. Taylor expanded in im around 0 75.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 28.8% accurate, 43.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 1060:\\
\;\;\;\;0.5 \cdot \left(re \cdot 2\right)\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{-1 \cdot e^{im}}\right)\right) \]
      13. neg-mul-1100.0%

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

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

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

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

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

    if 1060 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Applied egg-rr14.9%

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

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

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

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

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

Alternative 11: 28.8% accurate, 43.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 720:\\
\;\;\;\;0.5 \cdot \left(re \cdot 2\right)\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{-1 \cdot e^{im}}\right)\right) \]
      13. neg-mul-1100.0%

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

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

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

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

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

    if 720 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
    4. Applied egg-rr14.9%

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

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

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

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

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

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

Alternative 12: 26.0% accurate, 61.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + \left(-\color{blue}{-1 \cdot e^{im}}\right)\right) \]
    13. neg-mul-1100.0%

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

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

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

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

    \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{2}\right) \]
  6. Final simplification28.1%

    \[\leadsto 0.5 \cdot \left(re \cdot 2\right) \]

Alternative 13: 4.4% accurate, 309.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
  4. Taylor expanded in im around 0 75.3%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \sin re + \color{blue}{-2} \]
  11. Taylor expanded in re around 0 4.0%

    \[\leadsto \color{blue}{-2} \]
  12. Final simplification4.0%

    \[\leadsto -2 \]

Alternative 14: 4.3% accurate, 309.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
  4. Applied egg-rr11.9%

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

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

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

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

      \[\leadsto 0.08333333333333333 + \frac{0.25}{\color{blue}{re \cdot re}} \]
    4. associate-/r*11.7%

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

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

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

    \[\leadsto 0.08333333333333333 \]

Reproduce

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