math.sin on complex, real part

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

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 17 alternatives:

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

Initial Program: 100.0% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 2: 74.6% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 72.8% accurate, 2.4× speedup?

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

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if 3.2e-13 < im < 1e103

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    if 1e103 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 73.2% accurate, 2.4× speedup?

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

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if 4.79999999999999982 < im < 1e103

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1e103 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 72.0% accurate, 2.5× speedup?

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

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if 3.39999999999999991 < im < 6.9999999999999998e153

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.9999999999999998e153 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 3.4:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 7 \cdot 10^{+153}:\\ \;\;\;\;0.5 \cdot re + e^{im} \cdot \left(0.5 \cdot re\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot \left(1 + 0.5 \cdot im\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 68.8% accurate, 2.7× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if 3.4500000000000002 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 68.8% accurate, 2.8× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if 4.0999999999999996 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 4.1:\\ \;\;\;\;\sin re\\ \mathbf{else}:\\ \;\;\;\;\left(e^{im} + 1\right) \cdot \left(0.5 \cdot re\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 68.8% accurate, 2.8× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if 3.2999999999999998 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(0.5 \cdot re\right) \cdot e^{im} + \color{blue}{\left(\sqrt{re} \cdot \sqrt{re}\right)} \cdot 0.5 \]
      3. sqrt-unprod70.4%

        \[\leadsto \left(0.5 \cdot re\right) \cdot e^{im} + \color{blue}{\sqrt{re \cdot re}} \cdot 0.5 \]
      4. sqr-neg70.4%

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

        \[\leadsto \left(0.5 \cdot re\right) \cdot e^{im} + \color{blue}{\left(\sqrt{-re} \cdot \sqrt{-re}\right)} \cdot 0.5 \]
      6. add-sqr-sqrt73.3%

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

        \[\leadsto \color{blue}{\left(0.5 \cdot re\right) \cdot e^{im} - re \cdot 0.5} \]
      8. *-commutative73.3%

        \[\leadsto \left(0.5 \cdot re\right) \cdot e^{im} - \color{blue}{0.5 \cdot re} \]
      9. associate-*l*73.3%

        \[\leadsto \color{blue}{0.5 \cdot \left(re \cdot e^{im}\right)} - 0.5 \cdot re \]
    10. Applied egg-rr73.3%

      \[\leadsto \color{blue}{0.5 \cdot \left(re \cdot e^{im}\right) - 0.5 \cdot re} \]
    11. Step-by-step derivation
      1. distribute-lft-out--73.3%

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

        \[\leadsto 0.5 \cdot \left(re \cdot e^{im} - \color{blue}{re \cdot 1}\right) \]
      3. distribute-lft-out--73.3%

        \[\leadsto 0.5 \cdot \color{blue}{\left(re \cdot \left(e^{im} - 1\right)\right)} \]
      4. expm1-undefine73.3%

        \[\leadsto 0.5 \cdot \left(re \cdot \color{blue}{\mathsf{expm1}\left(im\right)}\right) \]
      5. associate-*l*73.3%

        \[\leadsto \color{blue}{\left(0.5 \cdot re\right) \cdot \mathsf{expm1}\left(im\right)} \]
    12. Simplified73.3%

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

Alternative 9: 68.8% accurate, 2.9× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if 11.5 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(-2, re, re\right)} \cdot \left(1 + e^{im}\right) \]
    8. Step-by-step derivation
      1. fma-undefine24.7%

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

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

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

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

      \[\leadsto \color{blue}{\left(-re\right)} \cdot \left(1 + e^{im}\right) \]
    10. Step-by-step derivation
      1. distribute-rgt-in24.7%

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

        \[\leadsto \color{blue}{\left(-re\right)} + e^{im} \cdot \left(-re\right) \]
      3. neg-sub024.7%

        \[\leadsto \color{blue}{\left(0 - re\right)} + e^{im} \cdot \left(-re\right) \]
      4. associate-+l-24.7%

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

        \[\leadsto 0 - \left(re - \color{blue}{\left(-re\right) \cdot e^{im}}\right) \]
      6. add-sqr-sqrt10.2%

        \[\leadsto 0 - \left(re - \color{blue}{\left(\sqrt{-re} \cdot \sqrt{-re}\right)} \cdot e^{im}\right) \]
      7. sqrt-unprod30.6%

        \[\leadsto 0 - \left(re - \color{blue}{\sqrt{\left(-re\right) \cdot \left(-re\right)}} \cdot e^{im}\right) \]
      8. sqr-neg30.6%

        \[\leadsto 0 - \left(re - \sqrt{\color{blue}{re \cdot re}} \cdot e^{im}\right) \]
      9. sqrt-unprod35.0%

        \[\leadsto 0 - \left(re - \color{blue}{\left(\sqrt{re} \cdot \sqrt{re}\right)} \cdot e^{im}\right) \]
      10. add-sqr-sqrt72.9%

        \[\leadsto 0 - \left(re - \color{blue}{re} \cdot e^{im}\right) \]
    11. Applied egg-rr72.9%

      \[\leadsto \color{blue}{0 - \left(re - re \cdot e^{im}\right)} \]
    12. Step-by-step derivation
      1. associate--r-72.9%

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

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

        \[\leadsto \color{blue}{re \cdot e^{im} + \left(-re\right)} \]
      4. sub-neg72.9%

        \[\leadsto \color{blue}{re \cdot e^{im} - re} \]
      5. *-rgt-identity72.9%

        \[\leadsto re \cdot e^{im} - \color{blue}{re \cdot 1} \]
      6. distribute-lft-out--72.9%

        \[\leadsto \color{blue}{re \cdot \left(e^{im} - 1\right)} \]
      7. expm1-undefine72.9%

        \[\leadsto re \cdot \color{blue}{\mathsf{expm1}\left(im\right)} \]
    13. Simplified72.9%

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

Alternative 10: 64.1% accurate, 2.9× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if 13.5 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 44.5% accurate, 14.0× speedup?

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

\\
\begin{array}{l}
t_0 := im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\\
\mathbf{if}\;re \leq 4 \cdot 10^{+273}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(2 + im \cdot \left(1 + t\_0\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;re \cdot \left(im \cdot \left(-1 - t\_0\right) - 2\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if re < 3.99999999999999978e273

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999999999999978e273 < re

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(-2, re, re\right)} \cdot \left(1 + e^{im}\right) \]
    8. Step-by-step derivation
      1. fma-undefine51.0%

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

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

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

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

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

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

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

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

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

Alternative 12: 47.3% accurate, 15.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;re \leq 4 \cdot 10^{+273}:\\
\;\;\;\;re \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.25\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if re < 3.99999999999999978e273

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999999999999978e273 < re

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(-2, re, re\right)} \cdot \left(1 + e^{im}\right) \]
    8. Step-by-step derivation
      1. fma-undefine51.0%

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

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

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

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

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

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

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

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

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

Alternative 13: 47.3% accurate, 19.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;re \leq 4 \cdot 10^{+273}:\\
\;\;\;\;re \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.25\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if re < 3.99999999999999978e273

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999999999999978e273 < re

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(-2, re, re\right)} \cdot \left(1 + e^{im}\right) \]
    8. Step-by-step derivation
      1. fma-undefine51.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 4 \cdot 10^{+273}:\\ \;\;\;\;re \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.25\right)\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(\left(-im\right) - 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 32.5% accurate, 25.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;re \leq 4 \cdot 10^{+273}:\\
\;\;\;\;re + 0.5 \cdot \left(re \cdot im\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if re < 3.99999999999999978e273

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999999999999978e273 < re

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(-2, re, re\right)} \cdot \left(1 + e^{im}\right) \]
    8. Step-by-step derivation
      1. fma-undefine51.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 4 \cdot 10^{+273}:\\ \;\;\;\;re + 0.5 \cdot \left(re \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(\left(-im\right) - 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 30.1% accurate, 28.1× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

    if 2.1e5 < re

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(-2, re, re\right)} \cdot \left(1 + e^{im}\right) \]
    8. Step-by-step derivation
      1. fma-undefine17.7%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 210000:\\ \;\;\;\;re\\ \mathbf{else}:\\ \;\;\;\;re \cdot \left(\left(-im\right) - 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 27.9% accurate, 51.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq 0.235:\\ \;\;\;\;re\\ \mathbf{else}:\\ \;\;\;\;0.75\\ \end{array} \end{array} \]
(FPCore (re im) :precision binary64 (if (<= re 0.235) re 0.75))
double code(double re, double im) {
	double tmp;
	if (re <= 0.235) {
		tmp = re;
	} else {
		tmp = 0.75;
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (re <= 0.235d0) then
        tmp = re
    else
        tmp = 0.75d0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (re <= 0.235) {
		tmp = re;
	} else {
		tmp = 0.75;
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if re <= 0.235:
		tmp = re
	else:
		tmp = 0.75
	return tmp
function code(re, im)
	tmp = 0.0
	if (re <= 0.235)
		tmp = re;
	else
		tmp = 0.75;
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (re <= 0.235)
		tmp = re;
	else
		tmp = 0.75;
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[re, 0.235], re, 0.75]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;0.75\\


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

    if 0.23499999999999999 < re

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(0.5 \cdot re\right) \cdot \color{blue}{0.25} \]
    7. Applied egg-rr2.8%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(re\right)} - -2\right)} \cdot 0.25 \]
    8. Step-by-step derivation
      1. log1p-undefine2.8%

        \[\leadsto \left(e^{\color{blue}{\log \left(1 + re\right)}} - -2\right) \cdot 0.25 \]
      2. rem-exp-log2.8%

        \[\leadsto \left(\color{blue}{\left(1 + re\right)} - -2\right) \cdot 0.25 \]
      3. +-commutative2.8%

        \[\leadsto \left(\color{blue}{\left(re + 1\right)} - -2\right) \cdot 0.25 \]
      4. associate--l+2.8%

        \[\leadsto \color{blue}{\left(re + \left(1 - -2\right)\right)} \cdot 0.25 \]
      5. metadata-eval2.8%

        \[\leadsto \left(re + \color{blue}{3}\right) \cdot 0.25 \]
    9. Simplified2.8%

      \[\leadsto \color{blue}{\left(re + 3\right)} \cdot 0.25 \]
    10. Taylor expanded in re around 0 5.6%

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

Alternative 17: 4.7% accurate, 309.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \left(0.5 \cdot re\right) \cdot \color{blue}{0.25} \]
  7. Applied egg-rr2.2%

    \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(re\right)} - -2\right)} \cdot 0.25 \]
  8. Step-by-step derivation
    1. log1p-undefine2.2%

      \[\leadsto \left(e^{\color{blue}{\log \left(1 + re\right)}} - -2\right) \cdot 0.25 \]
    2. rem-exp-log2.9%

      \[\leadsto \left(\color{blue}{\left(1 + re\right)} - -2\right) \cdot 0.25 \]
    3. +-commutative2.9%

      \[\leadsto \left(\color{blue}{\left(re + 1\right)} - -2\right) \cdot 0.25 \]
    4. associate--l+2.9%

      \[\leadsto \color{blue}{\left(re + \left(1 - -2\right)\right)} \cdot 0.25 \]
    5. metadata-eval2.9%

      \[\leadsto \left(re + \color{blue}{3}\right) \cdot 0.25 \]
  9. Simplified2.9%

    \[\leadsto \color{blue}{\left(re + 3\right)} \cdot 0.25 \]
  10. Taylor expanded in re around 0 4.0%

    \[\leadsto \color{blue}{0.75} \]
  11. Add Preprocessing

Reproduce

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