math.sin on complex, real part

Percentage Accurate: 100.0% → 100.0%
Time: 9.9s
Alternatives: 21
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 21 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 99.6%

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

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

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

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

Alternative 2: 92.3% accurate, 1.4× speedup?

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

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

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

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


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

    1. Initial program 99.5%

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

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

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

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

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

    if 0.19 < im < 1.14999999999999997e77

    1. Initial program 100.0%

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

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

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

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

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

    if 1.14999999999999997e77 < im

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto 0.041666666666666664 \cdot \color{blue}{\left({im}^{4} \cdot \sin re\right)} \]
    8. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.19:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left(2 + im \cdot im\right) + {im}^{4} \cdot 0.08333333333333333\right)\\ \mathbf{elif}\;im \leq 1.15 \cdot 10^{+77}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} + e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\\ \end{array} \]

Alternative 3: 86.2% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 99.5%

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

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

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

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

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

    if 0.050000000000000003 < im < 4.99999999999999991e76

    1. Initial program 100.0%

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

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

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

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

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

    if 4.99999999999999991e76 < im

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto 0.041666666666666664 \cdot \color{blue}{\left({im}^{4} \cdot \sin re\right)} \]
    8. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.05:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{elif}\;im \leq 5 \cdot 10^{+76}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} + e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\\ \end{array} \]

Alternative 4: 86.2% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 99.5%

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

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

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

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

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

    if 0.044999999999999998 < im < 1.14999999999999997e77

    1. Initial program 100.0%

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

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

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

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

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

    if 1.14999999999999997e77 < im

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto 0.041666666666666664 \cdot \color{blue}{\left({im}^{4} \cdot \sin re\right)} \]
    8. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.045:\\ \;\;\;\;\sin re + \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\ \mathbf{elif}\;im \leq 1.15 \cdot 10^{+77}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} + e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\\ \end{array} \]

Alternative 5: 84.3% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 115000:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{elif}\;im \leq 3.3 \cdot 10^{+75}:\\ \;\;\;\;{\left(\sin re \cdot 1.9380669946781485 \cdot 10^{-10}\right)}^{-512}\\ \mathbf{else}:\\ \;\;\;\;0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 115000.0)
   (* (* 0.5 (sin re)) (+ 2.0 (* im im)))
   (if (<= im 3.3e+75)
     (pow (* (sin re) 1.9380669946781485e-10) -512.0)
     (* 0.041666666666666664 (* (sin re) (pow im 4.0))))))
double code(double re, double im) {
	double tmp;
	if (im <= 115000.0) {
		tmp = (0.5 * sin(re)) * (2.0 + (im * im));
	} else if (im <= 3.3e+75) {
		tmp = pow((sin(re) * 1.9380669946781485e-10), -512.0);
	} else {
		tmp = 0.041666666666666664 * (sin(re) * pow(im, 4.0));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (im <= 115000.0d0) then
        tmp = (0.5d0 * sin(re)) * (2.0d0 + (im * im))
    else if (im <= 3.3d+75) then
        tmp = (sin(re) * 1.9380669946781485d-10) ** (-512.0d0)
    else
        tmp = 0.041666666666666664d0 * (sin(re) * (im ** 4.0d0))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 115000.0) {
		tmp = (0.5 * Math.sin(re)) * (2.0 + (im * im));
	} else if (im <= 3.3e+75) {
		tmp = Math.pow((Math.sin(re) * 1.9380669946781485e-10), -512.0);
	} else {
		tmp = 0.041666666666666664 * (Math.sin(re) * Math.pow(im, 4.0));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 115000.0:
		tmp = (0.5 * math.sin(re)) * (2.0 + (im * im))
	elif im <= 3.3e+75:
		tmp = math.pow((math.sin(re) * 1.9380669946781485e-10), -512.0)
	else:
		tmp = 0.041666666666666664 * (math.sin(re) * math.pow(im, 4.0))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 115000.0)
		tmp = Float64(Float64(0.5 * sin(re)) * Float64(2.0 + Float64(im * im)));
	elseif (im <= 3.3e+75)
		tmp = Float64(sin(re) * 1.9380669946781485e-10) ^ -512.0;
	else
		tmp = Float64(0.041666666666666664 * Float64(sin(re) * (im ^ 4.0)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 115000.0)
		tmp = (0.5 * sin(re)) * (2.0 + (im * im));
	elseif (im <= 3.3e+75)
		tmp = (sin(re) * 1.9380669946781485e-10) ^ -512.0;
	else
		tmp = 0.041666666666666664 * (sin(re) * (im ^ 4.0));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 115000.0], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.3e+75], N[Power[N[(N[Sin[re], $MachinePrecision] * 1.9380669946781485e-10), $MachinePrecision], -512.0], $MachinePrecision], N[(0.041666666666666664 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 3.3 \cdot 10^{+75}:\\
\;\;\;\;{\left(\sin re \cdot 1.9380669946781485 \cdot 10^{-10}\right)}^{-512}\\

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


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

    1. Initial program 99.5%

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

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

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

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

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

    if 115000 < im < 3.29999999999999998e75

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\sin re \cdot 1.9380669946781485 \cdot 10^{-10}\right)}^{-512}} \]

    if 3.29999999999999998e75 < im

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto 0.041666666666666664 \cdot \color{blue}{\left({im}^{4} \cdot \sin re\right)} \]
    8. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 115000:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{elif}\;im \leq 3.3 \cdot 10^{+75}:\\ \;\;\;\;{\left(\sin re \cdot 1.9380669946781485 \cdot 10^{-10}\right)}^{-512}\\ \mathbf{else}:\\ \;\;\;\;0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\\ \end{array} \]

Alternative 6: 82.5% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;im \leq 1.12 \cdot 10^{+70}:\\
\;\;\;\;{\left(\sin re \cdot 1.9380669946781485 \cdot 10^{-10}\right)}^{-512}\\

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < 115000 or 1.35000000000000003e154 < im

    1. Initial program 99.6%

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

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

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

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

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

    if 115000 < im < 1.11999999999999993e70

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\sin re \cdot 1.9380669946781485 \cdot 10^{-10}\right)}^{-512}} \]

    if 1.11999999999999993e70 < im < 1.35000000000000003e154

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\left(4 - \color{blue}{{im}^{2}} \cdot \left(im \cdot im\right)\right) \cdot re}{2 - im \cdot im} \]
      6. pow289.5%

        \[\leadsto 0.5 \cdot \frac{\left(4 - {im}^{2} \cdot \color{blue}{{im}^{2}}\right) \cdot re}{2 - im \cdot im} \]
      7. pow-prod-up89.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 115000:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{elif}\;im \leq 1.12 \cdot 10^{+70}:\\ \;\;\;\;{\left(\sin re \cdot 1.9380669946781485 \cdot 10^{-10}\right)}^{-512}\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;0.5 \cdot \frac{re \cdot \left(4 - {im}^{4}\right)}{2 - im \cdot im}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \end{array} \]

Alternative 7: 81.1% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{if}\;im \leq 115000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 8 \cdot 10^{+41}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re\right)\right)\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;0.5 \cdot \frac{re \cdot \left(4 - {im}^{4}\right)}{2 - im \cdot im}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (* 0.5 (sin re)) (+ 2.0 (* im im)))))
   (if (<= im 115000.0)
     t_0
     (if (<= im 8e+41)
       (log1p (expm1 re))
       (if (<= im 1.35e+154)
         (* 0.5 (/ (* re (- 4.0 (pow im 4.0))) (- 2.0 (* im im))))
         t_0)))))
double code(double re, double im) {
	double t_0 = (0.5 * sin(re)) * (2.0 + (im * im));
	double tmp;
	if (im <= 115000.0) {
		tmp = t_0;
	} else if (im <= 8e+41) {
		tmp = log1p(expm1(re));
	} else if (im <= 1.35e+154) {
		tmp = 0.5 * ((re * (4.0 - pow(im, 4.0))) / (2.0 - (im * im)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
public static double code(double re, double im) {
	double t_0 = (0.5 * Math.sin(re)) * (2.0 + (im * im));
	double tmp;
	if (im <= 115000.0) {
		tmp = t_0;
	} else if (im <= 8e+41) {
		tmp = Math.log1p(Math.expm1(re));
	} else if (im <= 1.35e+154) {
		tmp = 0.5 * ((re * (4.0 - Math.pow(im, 4.0))) / (2.0 - (im * im)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = (0.5 * math.sin(re)) * (2.0 + (im * im))
	tmp = 0
	if im <= 115000.0:
		tmp = t_0
	elif im <= 8e+41:
		tmp = math.log1p(math.expm1(re))
	elif im <= 1.35e+154:
		tmp = 0.5 * ((re * (4.0 - math.pow(im, 4.0))) / (2.0 - (im * im)))
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(Float64(0.5 * sin(re)) * Float64(2.0 + Float64(im * im)))
	tmp = 0.0
	if (im <= 115000.0)
		tmp = t_0;
	elseif (im <= 8e+41)
		tmp = log1p(expm1(re));
	elseif (im <= 1.35e+154)
		tmp = Float64(0.5 * Float64(Float64(re * Float64(4.0 - (im ^ 4.0))) / Float64(2.0 - Float64(im * im))));
	else
		tmp = t_0;
	end
	return tmp
end
code[re_, im_] := Block[{t$95$0 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 115000.0], t$95$0, If[LessEqual[im, 8e+41], N[Log[1 + N[(Exp[re] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 1.35e+154], N[(0.5 * N[(N[(re * N[(4.0 - N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 - N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

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

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

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < 115000 or 1.35000000000000003e154 < im

    1. Initial program 99.6%

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

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

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

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

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

    if 115000 < im < 8.00000000000000005e41

    1. Initial program 100.0%

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

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

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

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

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

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

    if 8.00000000000000005e41 < im < 1.35000000000000003e154

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{\left(2 \cdot 2 - \left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot re}{2 - im \cdot im}} \]
      4. metadata-eval71.9%

        \[\leadsto 0.5 \cdot \frac{\left(\color{blue}{4} - \left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot re}{2 - im \cdot im} \]
      5. pow271.9%

        \[\leadsto 0.5 \cdot \frac{\left(4 - \color{blue}{{im}^{2}} \cdot \left(im \cdot im\right)\right) \cdot re}{2 - im \cdot im} \]
      6. pow271.9%

        \[\leadsto 0.5 \cdot \frac{\left(4 - {im}^{2} \cdot \color{blue}{{im}^{2}}\right) \cdot re}{2 - im \cdot im} \]
      7. pow-prod-up71.9%

        \[\leadsto 0.5 \cdot \frac{\left(4 - \color{blue}{{im}^{\left(2 + 2\right)}}\right) \cdot re}{2 - im \cdot im} \]
      8. metadata-eval71.9%

        \[\leadsto 0.5 \cdot \frac{\left(4 - {im}^{\color{blue}{4}}\right) \cdot re}{2 - im \cdot im} \]
    10. Applied egg-rr71.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 115000:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{elif}\;im \leq 8 \cdot 10^{+41}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re\right)\right)\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;0.5 \cdot \frac{re \cdot \left(4 - {im}^{4}\right)}{2 - im \cdot im}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \end{array} \]

Alternative 8: 80.7% accurate, 2.5× speedup?

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

\\
\begin{array}{l}
t_0 := 4 - {im}^{4}\\
t_1 := \left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\
t_2 := 2 - im \cdot im\\
\mathbf{if}\;im \leq 115000:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq 6 \cdot 10^{+39}:\\
\;\;\;\;0.5 \cdot \frac{t_0 \cdot \left(re \cdot re\right)}{re \cdot t_2}\\

\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;0.5 \cdot \frac{re \cdot t_0}{t_2}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < 115000 or 1.35000000000000003e154 < im

    1. Initial program 99.6%

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

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

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

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

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

    if 115000 < im < 5.9999999999999999e39

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\left(re \cdot re\right) \cdot \left(2 \cdot 2\right)} - \left(re \cdot \left(im \cdot im\right)\right) \cdot \left(re \cdot \left(im \cdot im\right)\right)}{re \cdot 2 - re \cdot \left(im \cdot im\right)} \]
      2. metadata-eval40.8%

        \[\leadsto 0.5 \cdot \frac{\left(re \cdot re\right) \cdot \color{blue}{4} - \left(re \cdot \left(im \cdot im\right)\right) \cdot \left(re \cdot \left(im \cdot im\right)\right)}{re \cdot 2 - re \cdot \left(im \cdot im\right)} \]
      3. swap-sqr40.8%

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

        \[\leadsto 0.5 \cdot \frac{\left(re \cdot re\right) \cdot 4 - \left(re \cdot re\right) \cdot \color{blue}{\left(\left(\left(im \cdot im\right) \cdot im\right) \cdot im\right)}}{re \cdot 2 - re \cdot \left(im \cdot im\right)} \]
      5. unpow340.8%

        \[\leadsto 0.5 \cdot \frac{\left(re \cdot re\right) \cdot 4 - \left(re \cdot re\right) \cdot \left(\color{blue}{{im}^{3}} \cdot im\right)}{re \cdot 2 - re \cdot \left(im \cdot im\right)} \]
      6. pow-plus40.8%

        \[\leadsto 0.5 \cdot \frac{\left(re \cdot re\right) \cdot 4 - \left(re \cdot re\right) \cdot \color{blue}{{im}^{\left(3 + 1\right)}}}{re \cdot 2 - re \cdot \left(im \cdot im\right)} \]
      7. metadata-eval40.8%

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

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

        \[\leadsto 0.5 \cdot \frac{\left(re \cdot re\right) \cdot \left(4 - {im}^{4}\right)}{\color{blue}{re \cdot \left(2 - im \cdot im\right)}} \]
    12. Simplified40.8%

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

    if 5.9999999999999999e39 < im < 1.35000000000000003e154

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{\left(2 \cdot 2 - \left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot re}{2 - im \cdot im}} \]
      4. metadata-eval71.9%

        \[\leadsto 0.5 \cdot \frac{\left(\color{blue}{4} - \left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot re}{2 - im \cdot im} \]
      5. pow271.9%

        \[\leadsto 0.5 \cdot \frac{\left(4 - \color{blue}{{im}^{2}} \cdot \left(im \cdot im\right)\right) \cdot re}{2 - im \cdot im} \]
      6. pow271.9%

        \[\leadsto 0.5 \cdot \frac{\left(4 - {im}^{2} \cdot \color{blue}{{im}^{2}}\right) \cdot re}{2 - im \cdot im} \]
      7. pow-prod-up71.9%

        \[\leadsto 0.5 \cdot \frac{\left(4 - \color{blue}{{im}^{\left(2 + 2\right)}}\right) \cdot re}{2 - im \cdot im} \]
      8. metadata-eval71.9%

        \[\leadsto 0.5 \cdot \frac{\left(4 - {im}^{\color{blue}{4}}\right) \cdot re}{2 - im \cdot im} \]
    10. Applied egg-rr71.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 115000:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{elif}\;im \leq 6 \cdot 10^{+39}:\\ \;\;\;\;0.5 \cdot \frac{\left(4 - {im}^{4}\right) \cdot \left(re \cdot re\right)}{re \cdot \left(2 - im \cdot im\right)}\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;0.5 \cdot \frac{re \cdot \left(4 - {im}^{4}\right)}{2 - im \cdot im}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \end{array} \]

Alternative 9: 81.3% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{if}\;im \leq 115000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 1.5 \cdot 10^{+80}:\\ \;\;\;\;\frac{0.25}{re \cdot re} + \mathsf{fma}\left(re, re \cdot 0.016666666666666666, 0.08333333333333333\right)\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;0.5 \cdot \frac{re}{\frac{2 - im \cdot im}{4 - {im}^{4}}}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (* 0.5 (sin re)) (+ 2.0 (* im im)))))
   (if (<= im 115000.0)
     t_0
     (if (<= im 1.5e+80)
       (+
        (/ 0.25 (* re re))
        (fma re (* re 0.016666666666666666) 0.08333333333333333))
       (if (<= im 1.35e+154)
         (* 0.5 (/ re (/ (- 2.0 (* im im)) (- 4.0 (pow im 4.0)))))
         t_0)))))
double code(double re, double im) {
	double t_0 = (0.5 * sin(re)) * (2.0 + (im * im));
	double tmp;
	if (im <= 115000.0) {
		tmp = t_0;
	} else if (im <= 1.5e+80) {
		tmp = (0.25 / (re * re)) + fma(re, (re * 0.016666666666666666), 0.08333333333333333);
	} else if (im <= 1.35e+154) {
		tmp = 0.5 * (re / ((2.0 - (im * im)) / (4.0 - pow(im, 4.0))));
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(re, im)
	t_0 = Float64(Float64(0.5 * sin(re)) * Float64(2.0 + Float64(im * im)))
	tmp = 0.0
	if (im <= 115000.0)
		tmp = t_0;
	elseif (im <= 1.5e+80)
		tmp = Float64(Float64(0.25 / Float64(re * re)) + fma(re, Float64(re * 0.016666666666666666), 0.08333333333333333));
	elseif (im <= 1.35e+154)
		tmp = Float64(0.5 * Float64(re / Float64(Float64(2.0 - Float64(im * im)) / Float64(4.0 - (im ^ 4.0)))));
	else
		tmp = t_0;
	end
	return tmp
end
code[re_, im_] := Block[{t$95$0 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 115000.0], t$95$0, If[LessEqual[im, 1.5e+80], N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(re * N[(re * 0.016666666666666666), $MachinePrecision] + 0.08333333333333333), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.35e+154], N[(0.5 * N[(re / N[(N[(2.0 - N[(im * im), $MachinePrecision]), $MachinePrecision] / N[(4.0 - N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 1.5 \cdot 10^{+80}:\\
\;\;\;\;\frac{0.25}{re \cdot re} + \mathsf{fma}\left(re, re \cdot 0.016666666666666666, 0.08333333333333333\right)\\

\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;0.5 \cdot \frac{re}{\frac{2 - im \cdot im}{4 - {im}^{4}}}\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < 115000 or 1.35000000000000003e154 < im

    1. Initial program 99.6%

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

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

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

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

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

    if 115000 < im < 1.49999999999999993e80

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{0.25}{re \cdot re} + \left(\color{blue}{re \cdot \left(re \cdot 0.016666666666666666\right)} + 0.08333333333333333\right) \]
      9. fma-def20.2%

        \[\leadsto \frac{0.25}{re \cdot re} + \color{blue}{\mathsf{fma}\left(re, re \cdot 0.016666666666666666, 0.08333333333333333\right)} \]
    7. Simplified20.2%

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

    if 1.49999999999999993e80 < im < 1.35000000000000003e154

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{re \cdot \left(2 \cdot 2 - \left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)}{2 - im \cdot im}} \]
      3. metadata-eval94.1%

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

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

        \[\leadsto 0.5 \cdot \frac{re \cdot \left(4 - {im}^{2} \cdot \color{blue}{{im}^{2}}\right)}{2 - im \cdot im} \]
      6. pow-prod-up94.1%

        \[\leadsto 0.5 \cdot \frac{re \cdot \left(4 - \color{blue}{{im}^{\left(2 + 2\right)}}\right)}{2 - im \cdot im} \]
      7. metadata-eval94.1%

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{re}{\frac{2 - im \cdot im}{4 - {im}^{4}}}} \]
    12. Simplified94.1%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{re}{\frac{2 - im \cdot im}{4 - {im}^{4}}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification79.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 115000:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{elif}\;im \leq 1.5 \cdot 10^{+80}:\\ \;\;\;\;\frac{0.25}{re \cdot re} + \mathsf{fma}\left(re, re \cdot 0.016666666666666666, 0.08333333333333333\right)\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;0.5 \cdot \frac{re}{\frac{2 - im \cdot im}{4 - {im}^{4}}}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \end{array} \]

Alternative 10: 80.6% accurate, 2.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 3.25e6 or 1.35000000000000003e154 < im

    1. Initial program 99.6%

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

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

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

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

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

    if 3.25e6 < im < 1.35000000000000003e154

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 3250000 \lor \neg \left(im \leq 1.35 \cdot 10^{+154}\right):\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{re \cdot \left(4 - {im}^{4}\right)}{2 - im \cdot im}\\ \end{array} \]

Alternative 11: 78.1% accurate, 2.7× speedup?

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

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

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

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < 115000 or 1.35000000000000003e154 < im

    1. Initial program 99.6%

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

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

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

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

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

    if 115000 < im < 2.89999999999999986e80

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if 2.89999999999999986e80 < im < 1.35000000000000003e154

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 115000:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{elif}\;im \leq 2.9 \cdot 10^{+80}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + im \cdot im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \end{array} \]

Alternative 12: 78.1% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 + im \cdot im\\ t_1 := \left(0.5 \cdot \sin re\right) \cdot t_0\\ \mathbf{if}\;im \leq 115000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq 1.9 \cdot 10^{+80}:\\ \;\;\;\;\frac{0.25}{re \cdot re} + \mathsf{fma}\left(re, re \cdot 0.016666666666666666, 0.08333333333333333\right)\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;0.5 \cdot \left(re \cdot t_0\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (+ 2.0 (* im im))) (t_1 (* (* 0.5 (sin re)) t_0)))
   (if (<= im 115000.0)
     t_1
     (if (<= im 1.9e+80)
       (+
        (/ 0.25 (* re re))
        (fma re (* re 0.016666666666666666) 0.08333333333333333))
       (if (<= im 1.35e+154) (* 0.5 (* re t_0)) t_1)))))
double code(double re, double im) {
	double t_0 = 2.0 + (im * im);
	double t_1 = (0.5 * sin(re)) * t_0;
	double tmp;
	if (im <= 115000.0) {
		tmp = t_1;
	} else if (im <= 1.9e+80) {
		tmp = (0.25 / (re * re)) + fma(re, (re * 0.016666666666666666), 0.08333333333333333);
	} else if (im <= 1.35e+154) {
		tmp = 0.5 * (re * t_0);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(re, im)
	t_0 = Float64(2.0 + Float64(im * im))
	t_1 = Float64(Float64(0.5 * sin(re)) * t_0)
	tmp = 0.0
	if (im <= 115000.0)
		tmp = t_1;
	elseif (im <= 1.9e+80)
		tmp = Float64(Float64(0.25 / Float64(re * re)) + fma(re, Float64(re * 0.016666666666666666), 0.08333333333333333));
	elseif (im <= 1.35e+154)
		tmp = Float64(0.5 * Float64(re * t_0));
	else
		tmp = t_1;
	end
	return tmp
end
code[re_, im_] := Block[{t$95$0 = N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[im, 115000.0], t$95$1, If[LessEqual[im, 1.9e+80], N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(re * N[(re * 0.016666666666666666), $MachinePrecision] + 0.08333333333333333), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.35e+154], N[(0.5 * N[(re * t$95$0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 1.9 \cdot 10^{+80}:\\
\;\;\;\;\frac{0.25}{re \cdot re} + \mathsf{fma}\left(re, re \cdot 0.016666666666666666, 0.08333333333333333\right)\\

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < 115000 or 1.35000000000000003e154 < im

    1. Initial program 99.6%

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

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

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

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

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

    if 115000 < im < 1.89999999999999999e80

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{0.25}{re \cdot re} + \left(\color{blue}{re \cdot \left(re \cdot 0.016666666666666666\right)} + 0.08333333333333333\right) \]
      9. fma-def20.2%

        \[\leadsto \frac{0.25}{re \cdot re} + \color{blue}{\mathsf{fma}\left(re, re \cdot 0.016666666666666666, 0.08333333333333333\right)} \]
    7. Simplified20.2%

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

    if 1.89999999999999999e80 < im < 1.35000000000000003e154

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 115000:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{elif}\;im \leq 1.9 \cdot 10^{+80}:\\ \;\;\;\;\frac{0.25}{re \cdot re} + \mathsf{fma}\left(re, re \cdot 0.016666666666666666, 0.08333333333333333\right)\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + im \cdot im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \end{array} \]

Alternative 13: 63.5% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 120000:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.9 \cdot 10^{+80}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \mathbf{elif}\;im \leq 3.8 \cdot 10^{+215}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + im \cdot im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(0.5 \cdot \left(\sin re \cdot im\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (<= im 120000.0)
   (sin re)
   (if (<= im 2.9e+80)
     (+
      0.08333333333333333
      (+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666)))
     (if (<= im 3.8e+215)
       (* 0.5 (* re (+ 2.0 (* im im))))
       (* im (* 0.5 (* (sin re) im)))))))
double code(double re, double im) {
	double tmp;
	if (im <= 120000.0) {
		tmp = sin(re);
	} else if (im <= 2.9e+80) {
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	} else if (im <= 3.8e+215) {
		tmp = 0.5 * (re * (2.0 + (im * im)));
	} else {
		tmp = im * (0.5 * (sin(re) * im));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if (im <= 120000.0d0) then
        tmp = sin(re)
    else if (im <= 2.9d+80) then
        tmp = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
    else if (im <= 3.8d+215) then
        tmp = 0.5d0 * (re * (2.0d0 + (im * im)))
    else
        tmp = im * (0.5d0 * (sin(re) * im))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if (im <= 120000.0) {
		tmp = Math.sin(re);
	} else if (im <= 2.9e+80) {
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	} else if (im <= 3.8e+215) {
		tmp = 0.5 * (re * (2.0 + (im * im)));
	} else {
		tmp = im * (0.5 * (Math.sin(re) * im));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if im <= 120000.0:
		tmp = math.sin(re)
	elif im <= 2.9e+80:
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666))
	elif im <= 3.8e+215:
		tmp = 0.5 * (re * (2.0 + (im * im)))
	else:
		tmp = im * (0.5 * (math.sin(re) * im))
	return tmp
function code(re, im)
	tmp = 0.0
	if (im <= 120000.0)
		tmp = sin(re);
	elseif (im <= 2.9e+80)
		tmp = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666)));
	elseif (im <= 3.8e+215)
		tmp = Float64(0.5 * Float64(re * Float64(2.0 + Float64(im * im))));
	else
		tmp = Float64(im * Float64(0.5 * Float64(sin(re) * im)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if (im <= 120000.0)
		tmp = sin(re);
	elseif (im <= 2.9e+80)
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	elseif (im <= 3.8e+215)
		tmp = 0.5 * (re * (2.0 + (im * im)));
	else
		tmp = im * (0.5 * (sin(re) * im));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[LessEqual[im, 120000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 2.9e+80], N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.8e+215], N[(0.5 * N[(re * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im * N[(0.5 * N[(N[Sin[re], $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;im \leq 3.8 \cdot 10^{+215}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(2 + im \cdot im\right)\right)\\

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


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

    1. Initial program 99.5%

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

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

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

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

    if 1.2e5 < im < 2.89999999999999986e80

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if 2.89999999999999986e80 < im < 3.79999999999999968e215

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if 3.79999999999999968e215 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 120000:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.9 \cdot 10^{+80}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \mathbf{elif}\;im \leq 3.8 \cdot 10^{+215}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + im \cdot im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(0.5 \cdot \left(\sin re \cdot im\right)\right)\\ \end{array} \]

Alternative 14: 62.3% accurate, 3.0× speedup?

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

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

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

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


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

    1. Initial program 99.5%

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

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

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

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

    if 115000 < im < 2.89999999999999986e80

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if 2.89999999999999986e80 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 115000:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 2.9 \cdot 10^{+80}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + im \cdot im\right)\right)\\ \end{array} \]

Alternative 15: 34.0% accurate, 34.1× speedup?

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

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

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


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

    1. Initial program 99.5%

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

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

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

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

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

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

    if 1.4199999999999999 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 36.8% accurate, 34.1× speedup?

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

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

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


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

    1. Initial program 99.5%

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

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

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

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

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

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

    if 1.4199999999999999 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 17: 47.1% accurate, 34.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 18: 29.0% accurate, 43.8× speedup?

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

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

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


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

    1. Initial program 99.5%

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

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

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

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

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

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

    if 3.7e6 < im

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto \frac{0.25}{\color{blue}{re \cdot re}} \]
    7. Simplified8.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 3700000:\\ \;\;\;\;re\\ \mathbf{else}:\\ \;\;\;\;\frac{0.25}{re \cdot re}\\ \end{array} \]

Alternative 19: 3.5% accurate, 309.0× speedup?

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

\\
1.9380669946781485 \cdot 10^{-10}
\end{array}
Derivation
  1. Initial program 99.6%

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\sin re \cdot 1.9380669946781485 \cdot 10^{-10}}{\sin re + \left(\sin re \cdot 1.9380669946781485 \cdot 10^{-10} - \sin re \cdot 1.9380669946781485 \cdot 10^{-10}\right)}} \]
  7. Step-by-step derivation
    1. +-inverses3.4%

      \[\leadsto \frac{\sin re \cdot 1.9380669946781485 \cdot 10^{-10}}{\sin re + \color{blue}{0}} \]
    2. +-rgt-identity3.4%

      \[\leadsto \frac{\sin re \cdot 1.9380669946781485 \cdot 10^{-10}}{\color{blue}{\sin re}} \]
    3. associate-*l/3.4%

      \[\leadsto \color{blue}{\frac{\sin re}{\sin re} \cdot 1.9380669946781485 \cdot 10^{-10}} \]
    4. *-inverses3.4%

      \[\leadsto \color{blue}{1} \cdot 1.9380669946781485 \cdot 10^{-10} \]
    5. metadata-eval3.4%

      \[\leadsto \color{blue}{1.9380669946781485 \cdot 10^{-10}} \]
  8. Simplified3.4%

    \[\leadsto \color{blue}{1.9380669946781485 \cdot 10^{-10}} \]
  9. Final simplification3.4%

    \[\leadsto 1.9380669946781485 \cdot 10^{-10} \]

Alternative 20: 4.8% accurate, 309.0× speedup?

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

\\
1
\end{array}
Derivation
  1. Initial program 99.6%

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\sin re - \sin re \cdot 1.9380669946781485 \cdot 10^{-10}}{\sin re - \sin re \cdot 1.9380669946781485 \cdot 10^{-10}}} \]
  7. Step-by-step derivation
    1. *-inverses4.3%

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

    \[\leadsto \color{blue}{1} \]
  9. Final simplification4.3%

    \[\leadsto 1 \]

Alternative 21: 26.2% accurate, 309.0× speedup?

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{re} \]
  7. Final simplification29.0%

    \[\leadsto re \]

Reproduce

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