math.sin on complex, real part

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

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 17 alternatives:

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

Initial Program: 100.0% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 1.0× speedup?

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

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

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

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

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

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

Alternative 2: 86.0% accurate, 1.4× 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\\ t_2 := e^{-im} + e^{im}\\ \mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq -6.8 \cdot 10^{+121}:\\ \;\;\;\;\left(t_0 + {im}^{4} \cdot 0.08333333333333333\right) \cdot 131072\\ \mathbf{elif}\;im \leq -1.3 \cdot 10^{+81}:\\ \;\;\;\;t_2 \cdot -0.5\\ \mathbf{elif}\;im \leq -450 \lor \neg \left(im \leq 350\right) \land im \leq 5.5 \cdot 10^{+133}:\\ \;\;\;\;t_2 \cdot 131072\\ \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))
        (t_2 (+ (exp (- im)) (exp im))))
   (if (<= im -1.35e+154)
     t_1
     (if (<= im -6.8e+121)
       (* (+ t_0 (* (pow im 4.0) 0.08333333333333333)) 131072.0)
       (if (<= im -1.3e+81)
         (* t_2 -0.5)
         (if (or (<= im -450.0) (and (not (<= im 350.0)) (<= im 5.5e+133)))
           (* t_2 131072.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 t_2 = exp(-im) + exp(im);
	double tmp;
	if (im <= -1.35e+154) {
		tmp = t_1;
	} else if (im <= -6.8e+121) {
		tmp = (t_0 + (pow(im, 4.0) * 0.08333333333333333)) * 131072.0;
	} else if (im <= -1.3e+81) {
		tmp = t_2 * -0.5;
	} else if ((im <= -450.0) || (!(im <= 350.0) && (im <= 5.5e+133))) {
		tmp = t_2 * 131072.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) :: t_2
    real(8) :: tmp
    t_0 = 2.0d0 + (im * im)
    t_1 = (0.5d0 * sin(re)) * t_0
    t_2 = exp(-im) + exp(im)
    if (im <= (-1.35d+154)) then
        tmp = t_1
    else if (im <= (-6.8d+121)) then
        tmp = (t_0 + ((im ** 4.0d0) * 0.08333333333333333d0)) * 131072.0d0
    else if (im <= (-1.3d+81)) then
        tmp = t_2 * (-0.5d0)
    else if ((im <= (-450.0d0)) .or. (.not. (im <= 350.0d0)) .and. (im <= 5.5d+133)) then
        tmp = t_2 * 131072.0d0
    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 t_2 = Math.exp(-im) + Math.exp(im);
	double tmp;
	if (im <= -1.35e+154) {
		tmp = t_1;
	} else if (im <= -6.8e+121) {
		tmp = (t_0 + (Math.pow(im, 4.0) * 0.08333333333333333)) * 131072.0;
	} else if (im <= -1.3e+81) {
		tmp = t_2 * -0.5;
	} else if ((im <= -450.0) || (!(im <= 350.0) && (im <= 5.5e+133))) {
		tmp = t_2 * 131072.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
	t_2 = math.exp(-im) + math.exp(im)
	tmp = 0
	if im <= -1.35e+154:
		tmp = t_1
	elif im <= -6.8e+121:
		tmp = (t_0 + (math.pow(im, 4.0) * 0.08333333333333333)) * 131072.0
	elif im <= -1.3e+81:
		tmp = t_2 * -0.5
	elif (im <= -450.0) or (not (im <= 350.0) and (im <= 5.5e+133)):
		tmp = t_2 * 131072.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)
	t_2 = Float64(exp(Float64(-im)) + exp(im))
	tmp = 0.0
	if (im <= -1.35e+154)
		tmp = t_1;
	elseif (im <= -6.8e+121)
		tmp = Float64(Float64(t_0 + Float64((im ^ 4.0) * 0.08333333333333333)) * 131072.0);
	elseif (im <= -1.3e+81)
		tmp = Float64(t_2 * -0.5);
	elseif ((im <= -450.0) || (!(im <= 350.0) && (im <= 5.5e+133)))
		tmp = Float64(t_2 * 131072.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;
	t_2 = exp(-im) + exp(im);
	tmp = 0.0;
	if (im <= -1.35e+154)
		tmp = t_1;
	elseif (im <= -6.8e+121)
		tmp = (t_0 + ((im ^ 4.0) * 0.08333333333333333)) * 131072.0;
	elseif (im <= -1.3e+81)
		tmp = t_2 * -0.5;
	elseif ((im <= -450.0) || (~((im <= 350.0)) && (im <= 5.5e+133)))
		tmp = t_2 * 131072.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]}, Block[{t$95$2 = N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.35e+154], t$95$1, If[LessEqual[im, -6.8e+121], N[(N[(t$95$0 + N[(N[Power[im, 4.0], $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision] * 131072.0), $MachinePrecision], If[LessEqual[im, -1.3e+81], N[(t$95$2 * -0.5), $MachinePrecision], If[Or[LessEqual[im, -450.0], And[N[Not[LessEqual[im, 350.0]], $MachinePrecision], LessEqual[im, 5.5e+133]]], N[(t$95$2 * 131072.0), $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\\
t_2 := e^{-im} + e^{im}\\
\mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq -6.8 \cdot 10^{+121}:\\
\;\;\;\;\left(t_0 + {im}^{4} \cdot 0.08333333333333333\right) \cdot 131072\\

\mathbf{elif}\;im \leq -1.3 \cdot 10^{+81}:\\
\;\;\;\;t_2 \cdot -0.5\\

\mathbf{elif}\;im \leq -450 \lor \neg \left(im \leq 350\right) \land im \leq 5.5 \cdot 10^{+133}:\\
\;\;\;\;t_2 \cdot 131072\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < -1.35000000000000003e154 or -450 < im < 350 or 5.5e133 < 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 97.7%

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

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

    if -1.35000000000000003e154 < im < -6.80000000000000021e121

    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-rr100.0%

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

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

      \[\leadsto \left(0.5 \cdot 262144\right) \cdot \color{blue}{\left(2 + \left({im}^{2} + 0.08333333333333333 \cdot {im}^{4}\right)\right)} \]
    7. Simplified88.9%

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

    if -6.80000000000000021e121 < im < -1.29999999999999996e81

    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-rr100.0%

      \[\leadsto \left(0.5 \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin re\right)\right)}\right) \cdot \left(e^{-im} + e^{im}\right) \]
    5. Applied egg-rr100.0%

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

    if -1.29999999999999996e81 < im < -450 or 350 < im < 5.5e133

    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-rr100.0%

      \[\leadsto \left(0.5 \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin re\right)\right)}\right) \cdot \left(e^{-im} + e^{im}\right) \]
    5. Applied egg-rr62.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{elif}\;im \leq -6.8 \cdot 10^{+121}:\\ \;\;\;\;\left(\left(2 + im \cdot im\right) + {im}^{4} \cdot 0.08333333333333333\right) \cdot 131072\\ \mathbf{elif}\;im \leq -1.3 \cdot 10^{+81}:\\ \;\;\;\;\left(e^{-im} + e^{im}\right) \cdot -0.5\\ \mathbf{elif}\;im \leq -450 \lor \neg \left(im \leq 350\right) \land im \leq 5.5 \cdot 10^{+133}:\\ \;\;\;\;\left(e^{-im} + e^{im}\right) \cdot 131072\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \end{array} \]

Alternative 3: 93.4% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.075 \lor \neg \left(re \leq 4.2 \cdot 10^{-34}\right):\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left(2 + im \cdot im\right) + {im}^{4} \cdot 0.08333333333333333\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if re < -0.0749999999999999972 or 4.2000000000000002e-34 < re

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
    2. Step-by-step derivation
      1. 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 90.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. Simplified90.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)} \]

    if -0.0749999999999999972 < re < 4.2000000000000002e-34

    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 100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -0.075 \lor \neg \left(re \leq 4.2 \cdot 10^{-34}\right):\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left(2 + im \cdot im\right) + {im}^{4} \cdot 0.08333333333333333\right)\\ \mathbf{else}:\\ \;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\ \end{array} \]

Alternative 4: 86.3% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 + im \cdot im\\ t_1 := \left(t_0 + {im}^{4} \cdot 0.08333333333333333\right) \cdot 131072\\ t_2 := \left(0.5 \cdot \sin re\right) \cdot t_0\\ t_3 := \left(e^{-im} + e^{im}\right) \cdot -0.5\\ \mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;im \leq -9.5 \cdot 10^{+121}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq -17:\\ \;\;\;\;t_3\\ \mathbf{elif}\;im \leq 1650000000000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;im \leq 5 \cdot 10^{+76}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;im \leq 5.5 \cdot 10^{+133}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (+ 2.0 (* im im)))
        (t_1 (* (+ t_0 (* (pow im 4.0) 0.08333333333333333)) 131072.0))
        (t_2 (* (* 0.5 (sin re)) t_0))
        (t_3 (* (+ (exp (- im)) (exp im)) -0.5)))
   (if (<= im -1.35e+154)
     t_2
     (if (<= im -9.5e+121)
       t_1
       (if (<= im -17.0)
         t_3
         (if (<= im 1650000000000.0)
           t_2
           (if (<= im 5e+76) t_3 (if (<= im 5.5e+133) t_1 t_2))))))))
double code(double re, double im) {
	double t_0 = 2.0 + (im * im);
	double t_1 = (t_0 + (pow(im, 4.0) * 0.08333333333333333)) * 131072.0;
	double t_2 = (0.5 * sin(re)) * t_0;
	double t_3 = (exp(-im) + exp(im)) * -0.5;
	double tmp;
	if (im <= -1.35e+154) {
		tmp = t_2;
	} else if (im <= -9.5e+121) {
		tmp = t_1;
	} else if (im <= -17.0) {
		tmp = t_3;
	} else if (im <= 1650000000000.0) {
		tmp = t_2;
	} else if (im <= 5e+76) {
		tmp = t_3;
	} else if (im <= 5.5e+133) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	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) :: t_3
    real(8) :: tmp
    t_0 = 2.0d0 + (im * im)
    t_1 = (t_0 + ((im ** 4.0d0) * 0.08333333333333333d0)) * 131072.0d0
    t_2 = (0.5d0 * sin(re)) * t_0
    t_3 = (exp(-im) + exp(im)) * (-0.5d0)
    if (im <= (-1.35d+154)) then
        tmp = t_2
    else if (im <= (-9.5d+121)) then
        tmp = t_1
    else if (im <= (-17.0d0)) then
        tmp = t_3
    else if (im <= 1650000000000.0d0) then
        tmp = t_2
    else if (im <= 5d+76) then
        tmp = t_3
    else if (im <= 5.5d+133) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = 2.0 + (im * im);
	double t_1 = (t_0 + (Math.pow(im, 4.0) * 0.08333333333333333)) * 131072.0;
	double t_2 = (0.5 * Math.sin(re)) * t_0;
	double t_3 = (Math.exp(-im) + Math.exp(im)) * -0.5;
	double tmp;
	if (im <= -1.35e+154) {
		tmp = t_2;
	} else if (im <= -9.5e+121) {
		tmp = t_1;
	} else if (im <= -17.0) {
		tmp = t_3;
	} else if (im <= 1650000000000.0) {
		tmp = t_2;
	} else if (im <= 5e+76) {
		tmp = t_3;
	} else if (im <= 5.5e+133) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(re, im):
	t_0 = 2.0 + (im * im)
	t_1 = (t_0 + (math.pow(im, 4.0) * 0.08333333333333333)) * 131072.0
	t_2 = (0.5 * math.sin(re)) * t_0
	t_3 = (math.exp(-im) + math.exp(im)) * -0.5
	tmp = 0
	if im <= -1.35e+154:
		tmp = t_2
	elif im <= -9.5e+121:
		tmp = t_1
	elif im <= -17.0:
		tmp = t_3
	elif im <= 1650000000000.0:
		tmp = t_2
	elif im <= 5e+76:
		tmp = t_3
	elif im <= 5.5e+133:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(re, im)
	t_0 = Float64(2.0 + Float64(im * im))
	t_1 = Float64(Float64(t_0 + Float64((im ^ 4.0) * 0.08333333333333333)) * 131072.0)
	t_2 = Float64(Float64(0.5 * sin(re)) * t_0)
	t_3 = Float64(Float64(exp(Float64(-im)) + exp(im)) * -0.5)
	tmp = 0.0
	if (im <= -1.35e+154)
		tmp = t_2;
	elseif (im <= -9.5e+121)
		tmp = t_1;
	elseif (im <= -17.0)
		tmp = t_3;
	elseif (im <= 1650000000000.0)
		tmp = t_2;
	elseif (im <= 5e+76)
		tmp = t_3;
	elseif (im <= 5.5e+133)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 2.0 + (im * im);
	t_1 = (t_0 + ((im ^ 4.0) * 0.08333333333333333)) * 131072.0;
	t_2 = (0.5 * sin(re)) * t_0;
	t_3 = (exp(-im) + exp(im)) * -0.5;
	tmp = 0.0;
	if (im <= -1.35e+154)
		tmp = t_2;
	elseif (im <= -9.5e+121)
		tmp = t_1;
	elseif (im <= -17.0)
		tmp = t_3;
	elseif (im <= 1650000000000.0)
		tmp = t_2;
	elseif (im <= 5e+76)
		tmp = t_3;
	elseif (im <= 5.5e+133)
		tmp = t_1;
	else
		tmp = t_2;
	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[(t$95$0 + N[(N[Power[im, 4.0], $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision] * 131072.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]}, If[LessEqual[im, -1.35e+154], t$95$2, If[LessEqual[im, -9.5e+121], t$95$1, If[LessEqual[im, -17.0], t$95$3, If[LessEqual[im, 1650000000000.0], t$95$2, If[LessEqual[im, 5e+76], t$95$3, If[LessEqual[im, 5.5e+133], t$95$1, t$95$2]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 2 + im \cdot im\\
t_1 := \left(t_0 + {im}^{4} \cdot 0.08333333333333333\right) \cdot 131072\\
t_2 := \left(0.5 \cdot \sin re\right) \cdot t_0\\
t_3 := \left(e^{-im} + e^{im}\right) \cdot -0.5\\
\mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;im \leq -9.5 \cdot 10^{+121}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq -17:\\
\;\;\;\;t_3\\

\mathbf{elif}\;im \leq 1650000000000:\\
\;\;\;\;t_2\\

\mathbf{elif}\;im \leq 5 \cdot 10^{+76}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;im \leq 5.5 \cdot 10^{+133}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -1.35000000000000003e154 or -17 < im < 1.65e12 or 5.5e133 < 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 97.7%

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

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

    if -1.35000000000000003e154 < im < -9.49999999999999949e121 or 4.99999999999999991e76 < im < 5.5e133

    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-rr100.0%

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

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

      \[\leadsto \left(0.5 \cdot 262144\right) \cdot \color{blue}{\left(2 + \left({im}^{2} + 0.08333333333333333 \cdot {im}^{4}\right)\right)} \]
    7. Simplified93.8%

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

    if -9.49999999999999949e121 < im < -17 or 1.65e12 < 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. Applied egg-rr100.0%

      \[\leadsto \left(0.5 \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin re\right)\right)}\right) \cdot \left(e^{-im} + e^{im}\right) \]
    5. Applied egg-rr53.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{elif}\;im \leq -9.5 \cdot 10^{+121}:\\ \;\;\;\;\left(\left(2 + im \cdot im\right) + {im}^{4} \cdot 0.08333333333333333\right) \cdot 131072\\ \mathbf{elif}\;im \leq -17:\\ \;\;\;\;\left(e^{-im} + e^{im}\right) \cdot -0.5\\ \mathbf{elif}\;im \leq 1650000000000:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{elif}\;im \leq 5 \cdot 10^{+76}:\\ \;\;\;\;\left(e^{-im} + e^{im}\right) \cdot -0.5\\ \mathbf{elif}\;im \leq 5.5 \cdot 10^{+133}:\\ \;\;\;\;\left(\left(2 + im \cdot im\right) + {im}^{4} \cdot 0.08333333333333333\right) \cdot 131072\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \end{array} \]

Alternative 5: 93.2% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -1.35 \cdot 10^{+154} \lor \neg \left(im \leq -18 \lor \neg \left(im \leq 0.115\right) \land im \leq 1.35 \cdot 10^{+154}\right):\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (if (or (<= im -1.35e+154)
         (not (or (<= im -18.0) (and (not (<= im 0.115)) (<= im 1.35e+154)))))
   (* (* 0.5 (sin re)) (+ 2.0 (* im im)))
   (* (+ (exp (- im)) (exp im)) (* 0.5 re))))
double code(double re, double im) {
	double tmp;
	if ((im <= -1.35e+154) || !((im <= -18.0) || (!(im <= 0.115) && (im <= 1.35e+154)))) {
		tmp = (0.5 * sin(re)) * (2.0 + (im * im));
	} else {
		tmp = (exp(-im) + exp(im)) * (0.5 * re);
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: tmp
    if ((im <= (-1.35d+154)) .or. (.not. (im <= (-18.0d0)) .or. (.not. (im <= 0.115d0)) .and. (im <= 1.35d+154))) then
        tmp = (0.5d0 * sin(re)) * (2.0d0 + (im * im))
    else
        tmp = (exp(-im) + exp(im)) * (0.5d0 * re)
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double tmp;
	if ((im <= -1.35e+154) || !((im <= -18.0) || (!(im <= 0.115) && (im <= 1.35e+154)))) {
		tmp = (0.5 * Math.sin(re)) * (2.0 + (im * im));
	} else {
		tmp = (Math.exp(-im) + Math.exp(im)) * (0.5 * re);
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if (im <= -1.35e+154) or not ((im <= -18.0) or (not (im <= 0.115) and (im <= 1.35e+154))):
		tmp = (0.5 * math.sin(re)) * (2.0 + (im * im))
	else:
		tmp = (math.exp(-im) + math.exp(im)) * (0.5 * re)
	return tmp
function code(re, im)
	tmp = 0.0
	if ((im <= -1.35e+154) || !((im <= -18.0) || (!(im <= 0.115) && (im <= 1.35e+154))))
		tmp = Float64(Float64(0.5 * sin(re)) * Float64(2.0 + Float64(im * im)));
	else
		tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * re));
	end
	return tmp
end
function tmp_2 = code(re, im)
	tmp = 0.0;
	if ((im <= -1.35e+154) || ~(((im <= -18.0) || (~((im <= 0.115)) && (im <= 1.35e+154)))))
		tmp = (0.5 * sin(re)) * (2.0 + (im * im));
	else
		tmp = (exp(-im) + exp(im)) * (0.5 * re);
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[Or[LessEqual[im, -1.35e+154], N[Not[Or[LessEqual[im, -18.0], And[N[Not[LessEqual[im, 0.115]], $MachinePrecision], 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[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < -1.35000000000000003e154 or -18 < im < 0.115000000000000005 or 1.35000000000000003e154 < 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 99.1%

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

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

    if -1.35000000000000003e154 < im < -18 or 0.115000000000000005 < 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 re around 0 75.4%

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

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

Alternative 6: 93.2% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\ t_1 := 0.5 \cdot \sin re\\ t_2 := t_1 \cdot \left(2 + im \cdot im\right)\\ \mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;im \leq -18:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 0.165:\\ \;\;\;\;\sin re + t_1 \cdot \left(im \cdot im\right)\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (+ (exp (- im)) (exp im)) (* 0.5 re)))
        (t_1 (* 0.5 (sin re)))
        (t_2 (* t_1 (+ 2.0 (* im im)))))
   (if (<= im -1.35e+154)
     t_2
     (if (<= im -18.0)
       t_0
       (if (<= im 0.165)
         (+ (sin re) (* t_1 (* im im)))
         (if (<= im 1.35e+154) t_0 t_2))))))
double code(double re, double im) {
	double t_0 = (exp(-im) + exp(im)) * (0.5 * re);
	double t_1 = 0.5 * sin(re);
	double t_2 = t_1 * (2.0 + (im * im));
	double tmp;
	if (im <= -1.35e+154) {
		tmp = t_2;
	} else if (im <= -18.0) {
		tmp = t_0;
	} else if (im <= 0.165) {
		tmp = sin(re) + (t_1 * (im * im));
	} else if (im <= 1.35e+154) {
		tmp = t_0;
	} else {
		tmp = t_2;
	}
	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 = (exp(-im) + exp(im)) * (0.5d0 * re)
    t_1 = 0.5d0 * sin(re)
    t_2 = t_1 * (2.0d0 + (im * im))
    if (im <= (-1.35d+154)) then
        tmp = t_2
    else if (im <= (-18.0d0)) then
        tmp = t_0
    else if (im <= 0.165d0) then
        tmp = sin(re) + (t_1 * (im * im))
    else if (im <= 1.35d+154) then
        tmp = t_0
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = (Math.exp(-im) + Math.exp(im)) * (0.5 * re);
	double t_1 = 0.5 * Math.sin(re);
	double t_2 = t_1 * (2.0 + (im * im));
	double tmp;
	if (im <= -1.35e+154) {
		tmp = t_2;
	} else if (im <= -18.0) {
		tmp = t_0;
	} else if (im <= 0.165) {
		tmp = Math.sin(re) + (t_1 * (im * im));
	} else if (im <= 1.35e+154) {
		tmp = t_0;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(re, im):
	t_0 = (math.exp(-im) + math.exp(im)) * (0.5 * re)
	t_1 = 0.5 * math.sin(re)
	t_2 = t_1 * (2.0 + (im * im))
	tmp = 0
	if im <= -1.35e+154:
		tmp = t_2
	elif im <= -18.0:
		tmp = t_0
	elif im <= 0.165:
		tmp = math.sin(re) + (t_1 * (im * im))
	elif im <= 1.35e+154:
		tmp = t_0
	else:
		tmp = t_2
	return tmp
function code(re, im)
	t_0 = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * re))
	t_1 = Float64(0.5 * sin(re))
	t_2 = Float64(t_1 * Float64(2.0 + Float64(im * im)))
	tmp = 0.0
	if (im <= -1.35e+154)
		tmp = t_2;
	elseif (im <= -18.0)
		tmp = t_0;
	elseif (im <= 0.165)
		tmp = Float64(sin(re) + Float64(t_1 * Float64(im * im)));
	elseif (im <= 1.35e+154)
		tmp = t_0;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = (exp(-im) + exp(im)) * (0.5 * re);
	t_1 = 0.5 * sin(re);
	t_2 = t_1 * (2.0 + (im * im));
	tmp = 0.0;
	if (im <= -1.35e+154)
		tmp = t_2;
	elseif (im <= -18.0)
		tmp = t_0;
	elseif (im <= 0.165)
		tmp = sin(re) + (t_1 * (im * im));
	elseif (im <= 1.35e+154)
		tmp = t_0;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.35e+154], t$95$2, If[LessEqual[im, -18.0], t$95$0, If[LessEqual[im, 0.165], N[(N[Sin[re], $MachinePrecision] + N[(t$95$1 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.35e+154], t$95$0, t$95$2]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq -18:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq 0.165:\\
\;\;\;\;\sin re + t_1 \cdot \left(im \cdot im\right)\\

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

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -1.35000000000000003e154 or 1.35000000000000003e154 < 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)} \]

    if -1.35000000000000003e154 < im < -18 or 0.165000000000000008 < 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 re around 0 75.4%

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

    if -18 < im < 0.165000000000000008

    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 98.6%

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

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

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

Alternative 7: 80.4% accurate, 1.5× 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 -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq -4350000000000:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.25}{re \cdot re}\right)\right)\\ \mathbf{elif}\;im \leq 2.45 \cdot 10^{+76} \lor \neg \left(im \leq 5.5 \cdot 10^{+133}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\left(t_0 + {im}^{4} \cdot 0.08333333333333333\right) \cdot 131072\\ \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 -1.35e+154)
     t_1
     (if (<= im -4350000000000.0)
       (log1p (expm1 (/ 0.25 (* re re))))
       (if (or (<= im 2.45e+76) (not (<= im 5.5e+133)))
         t_1
         (* (+ t_0 (* (pow im 4.0) 0.08333333333333333)) 131072.0))))))
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 <= -1.35e+154) {
		tmp = t_1;
	} else if (im <= -4350000000000.0) {
		tmp = log1p(expm1((0.25 / (re * re))));
	} else if ((im <= 2.45e+76) || !(im <= 5.5e+133)) {
		tmp = t_1;
	} else {
		tmp = (t_0 + (pow(im, 4.0) * 0.08333333333333333)) * 131072.0;
	}
	return tmp;
}
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 <= -1.35e+154) {
		tmp = t_1;
	} else if (im <= -4350000000000.0) {
		tmp = Math.log1p(Math.expm1((0.25 / (re * re))));
	} else if ((im <= 2.45e+76) || !(im <= 5.5e+133)) {
		tmp = t_1;
	} else {
		tmp = (t_0 + (Math.pow(im, 4.0) * 0.08333333333333333)) * 131072.0;
	}
	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 <= -1.35e+154:
		tmp = t_1
	elif im <= -4350000000000.0:
		tmp = math.log1p(math.expm1((0.25 / (re * re))))
	elif (im <= 2.45e+76) or not (im <= 5.5e+133):
		tmp = t_1
	else:
		tmp = (t_0 + (math.pow(im, 4.0) * 0.08333333333333333)) * 131072.0
	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 <= -1.35e+154)
		tmp = t_1;
	elseif (im <= -4350000000000.0)
		tmp = log1p(expm1(Float64(0.25 / Float64(re * re))));
	elseif ((im <= 2.45e+76) || !(im <= 5.5e+133))
		tmp = t_1;
	else
		tmp = Float64(Float64(t_0 + Float64((im ^ 4.0) * 0.08333333333333333)) * 131072.0);
	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, -1.35e+154], t$95$1, If[LessEqual[im, -4350000000000.0], N[Log[1 + N[(Exp[N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[im, 2.45e+76], N[Not[LessEqual[im, 5.5e+133]], $MachinePrecision]], t$95$1, N[(N[(t$95$0 + N[(N[Power[im, 4.0], $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision] * 131072.0), $MachinePrecision]]]]]]
\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 -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq -4350000000000:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.25}{re \cdot re}\right)\right)\\

\mathbf{elif}\;im \leq 2.45 \cdot 10^{+76} \lor \neg \left(im \leq 5.5 \cdot 10^{+133}\right):\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;\left(t_0 + {im}^{4} \cdot 0.08333333333333333\right) \cdot 131072\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -1.35000000000000003e154 or -4.35e12 < im < 2.45000000000000013e76 or 5.5e133 < 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 91.2%

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

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

    if -1.35000000000000003e154 < im < -4.35e12

    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-rr20.7%

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

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

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

      \[\leadsto \color{blue}{\frac{0.25}{re \cdot re}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt20.6%

        \[\leadsto \color{blue}{\sqrt{\frac{0.25}{re \cdot re}} \cdot \sqrt{\frac{0.25}{re \cdot re}}} \]
      2. sqrt-unprod29.1%

        \[\leadsto \color{blue}{\sqrt{\frac{0.25}{re \cdot re} \cdot \frac{0.25}{re \cdot re}}} \]
      3. frac-times29.1%

        \[\leadsto \sqrt{\color{blue}{\frac{0.25 \cdot 0.25}{\left(re \cdot re\right) \cdot \left(re \cdot re\right)}}} \]
      4. metadata-eval29.1%

        \[\leadsto \sqrt{\frac{\color{blue}{0.0625}}{\left(re \cdot re\right) \cdot \left(re \cdot re\right)}} \]
      5. pow229.1%

        \[\leadsto \sqrt{\frac{0.0625}{\color{blue}{{\left(re \cdot re\right)}^{2}}}} \]
      6. metadata-eval29.1%

        \[\leadsto \sqrt{\frac{0.0625}{{\left(re \cdot re\right)}^{\color{blue}{\left(\sqrt{4}\right)}}}} \]
      7. pow-prod-down29.1%

        \[\leadsto \sqrt{\frac{0.0625}{\color{blue}{{re}^{\left(\sqrt{4}\right)} \cdot {re}^{\left(\sqrt{4}\right)}}}} \]
      8. pow-prod-up29.1%

        \[\leadsto \sqrt{\frac{0.0625}{\color{blue}{{re}^{\left(\sqrt{4} + \sqrt{4}\right)}}}} \]
      9. metadata-eval29.1%

        \[\leadsto \sqrt{\frac{0.0625}{{re}^{\left(\color{blue}{2} + \sqrt{4}\right)}}} \]
      10. metadata-eval29.1%

        \[\leadsto \sqrt{\frac{0.0625}{{re}^{\left(2 + \color{blue}{2}\right)}}} \]
      11. metadata-eval29.1%

        \[\leadsto \sqrt{\frac{0.0625}{{re}^{\color{blue}{4}}}} \]
    9. Applied egg-rr29.1%

      \[\leadsto \color{blue}{\sqrt{\frac{0.0625}{{re}^{4}}}} \]
    10. Step-by-step derivation
      1. log1p-expm1-u38.1%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sqrt{\frac{0.0625}{{re}^{4}}}\right)\right)} \]
      2. sqrt-div38.1%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{\frac{\sqrt{0.0625}}{\sqrt{{re}^{4}}}}\right)\right) \]
      3. metadata-eval38.1%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\color{blue}{0.25}}{\sqrt{{re}^{4}}}\right)\right) \]
      4. sqrt-pow138.1%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.25}{\color{blue}{{re}^{\left(\frac{4}{2}\right)}}}\right)\right) \]
      5. metadata-eval38.1%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.25}{{re}^{\color{blue}{2}}}\right)\right) \]
      6. pow238.1%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.25}{\color{blue}{re \cdot re}}\right)\right) \]
    11. Applied egg-rr38.1%

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

    if 2.45000000000000013e76 < im < 5.5e133

    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-rr100.0%

      \[\leadsto \left(0.5 \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin re\right)\right)}\right) \cdot \left(e^{-im} + e^{im}\right) \]
    5. Applied egg-rr100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{elif}\;im \leq -4350000000000:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.25}{re \cdot re}\right)\right)\\ \mathbf{elif}\;im \leq 2.45 \cdot 10^{+76} \lor \neg \left(im \leq 5.5 \cdot 10^{+133}\right):\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(2 + im \cdot im\right) + {im}^{4} \cdot 0.08333333333333333\right) \cdot 131072\\ \end{array} \]

Alternative 8: 81.5% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 + im \cdot im\\ t_1 := \left(t_0 + {im}^{4} \cdot 0.08333333333333333\right) \cdot 131072\\ t_2 := \left(0.5 \cdot \sin re\right) \cdot t_0\\ \mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;im \leq -2.25 \cdot 10^{+64}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq -8 \cdot 10^{+24}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \mathbf{elif}\;im \leq 2.45 \cdot 10^{+76} \lor \neg \left(im \leq 5.5 \cdot 10^{+133}\right):\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (+ 2.0 (* im im)))
        (t_1 (* (+ t_0 (* (pow im 4.0) 0.08333333333333333)) 131072.0))
        (t_2 (* (* 0.5 (sin re)) t_0)))
   (if (<= im -1.35e+154)
     t_2
     (if (<= im -2.25e+64)
       t_1
       (if (<= im -8e+24)
         (+
          0.08333333333333333
          (+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666)))
         (if (or (<= im 2.45e+76) (not (<= im 5.5e+133))) t_2 t_1))))))
double code(double re, double im) {
	double t_0 = 2.0 + (im * im);
	double t_1 = (t_0 + (pow(im, 4.0) * 0.08333333333333333)) * 131072.0;
	double t_2 = (0.5 * sin(re)) * t_0;
	double tmp;
	if (im <= -1.35e+154) {
		tmp = t_2;
	} else if (im <= -2.25e+64) {
		tmp = t_1;
	} else if (im <= -8e+24) {
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	} else if ((im <= 2.45e+76) || !(im <= 5.5e+133)) {
		tmp = 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 = 2.0d0 + (im * im)
    t_1 = (t_0 + ((im ** 4.0d0) * 0.08333333333333333d0)) * 131072.0d0
    t_2 = (0.5d0 * sin(re)) * t_0
    if (im <= (-1.35d+154)) then
        tmp = t_2
    else if (im <= (-2.25d+64)) then
        tmp = t_1
    else if (im <= (-8d+24)) then
        tmp = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
    else if ((im <= 2.45d+76) .or. (.not. (im <= 5.5d+133))) then
        tmp = t_2
    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 = (t_0 + (Math.pow(im, 4.0) * 0.08333333333333333)) * 131072.0;
	double t_2 = (0.5 * Math.sin(re)) * t_0;
	double tmp;
	if (im <= -1.35e+154) {
		tmp = t_2;
	} else if (im <= -2.25e+64) {
		tmp = t_1;
	} else if (im <= -8e+24) {
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	} else if ((im <= 2.45e+76) || !(im <= 5.5e+133)) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(re, im):
	t_0 = 2.0 + (im * im)
	t_1 = (t_0 + (math.pow(im, 4.0) * 0.08333333333333333)) * 131072.0
	t_2 = (0.5 * math.sin(re)) * t_0
	tmp = 0
	if im <= -1.35e+154:
		tmp = t_2
	elif im <= -2.25e+64:
		tmp = t_1
	elif im <= -8e+24:
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666))
	elif (im <= 2.45e+76) or not (im <= 5.5e+133):
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(re, im)
	t_0 = Float64(2.0 + Float64(im * im))
	t_1 = Float64(Float64(t_0 + Float64((im ^ 4.0) * 0.08333333333333333)) * 131072.0)
	t_2 = Float64(Float64(0.5 * sin(re)) * t_0)
	tmp = 0.0
	if (im <= -1.35e+154)
		tmp = t_2;
	elseif (im <= -2.25e+64)
		tmp = t_1;
	elseif (im <= -8e+24)
		tmp = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666)));
	elseif ((im <= 2.45e+76) || !(im <= 5.5e+133))
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 2.0 + (im * im);
	t_1 = (t_0 + ((im ^ 4.0) * 0.08333333333333333)) * 131072.0;
	t_2 = (0.5 * sin(re)) * t_0;
	tmp = 0.0;
	if (im <= -1.35e+154)
		tmp = t_2;
	elseif (im <= -2.25e+64)
		tmp = t_1;
	elseif (im <= -8e+24)
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	elseif ((im <= 2.45e+76) || ~((im <= 5.5e+133)))
		tmp = t_2;
	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[(t$95$0 + N[(N[Power[im, 4.0], $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision] * 131072.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[im, -1.35e+154], t$95$2, If[LessEqual[im, -2.25e+64], t$95$1, If[LessEqual[im, -8e+24], N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, 2.45e+76], N[Not[LessEqual[im, 5.5e+133]], $MachinePrecision]], t$95$2, t$95$1]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq -2.25 \cdot 10^{+64}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;im \leq 2.45 \cdot 10^{+76} \lor \neg \left(im \leq 5.5 \cdot 10^{+133}\right):\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -1.35000000000000003e154 or -7.9999999999999999e24 < im < 2.45000000000000013e76 or 5.5e133 < 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 89.6%

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

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

    if -1.35000000000000003e154 < im < -2.24999999999999987e64 or 2.45000000000000013e76 < im < 5.5e133

    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-rr100.0%

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

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

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

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

    if -2.24999999999999987e64 < im < -7.9999999999999999e24

    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-rr26.6%

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

      \[\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/43.1%

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

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

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

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

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

      \[\leadsto \color{blue}{0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification85.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{elif}\;im \leq -2.25 \cdot 10^{+64}:\\ \;\;\;\;\left(\left(2 + im \cdot im\right) + {im}^{4} \cdot 0.08333333333333333\right) \cdot 131072\\ \mathbf{elif}\;im \leq -8 \cdot 10^{+24}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \mathbf{elif}\;im \leq 2.45 \cdot 10^{+76} \lor \neg \left(im \leq 5.5 \cdot 10^{+133}\right):\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(2 + im \cdot im\right) + {im}^{4} \cdot 0.08333333333333333\right) \cdot 131072\\ \end{array} \]

Alternative 9: 79.5% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{0.25}{re \cdot re}\\ t_1 := \left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;im \leq -9.5 \cdot 10^{+30}:\\ \;\;\;\;\sqrt{t_0 \cdot t_0}\\ \mathbf{elif}\;im \leq 1650000000000 \lor \neg \left(im \leq 9.5 \cdot 10^{+144}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;re + im \cdot \left(\left(re \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (/ 0.25 (* re re))) (t_1 (* (* 0.5 (sin re)) (+ 2.0 (* im im)))))
   (if (<= im -1.35e+154)
     t_1
     (if (<= im -9.5e+30)
       (sqrt (* t_0 t_0))
       (if (or (<= im 1650000000000.0) (not (<= im 9.5e+144)))
         t_1
         (+
          re
          (* im (* (* re im) (+ 0.5 (* (* re re) -0.08333333333333333))))))))))
double code(double re, double im) {
	double t_0 = 0.25 / (re * re);
	double t_1 = (0.5 * sin(re)) * (2.0 + (im * im));
	double tmp;
	if (im <= -1.35e+154) {
		tmp = t_1;
	} else if (im <= -9.5e+30) {
		tmp = sqrt((t_0 * t_0));
	} else if ((im <= 1650000000000.0) || !(im <= 9.5e+144)) {
		tmp = t_1;
	} else {
		tmp = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333))));
	}
	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 = 0.25d0 / (re * re)
    t_1 = (0.5d0 * sin(re)) * (2.0d0 + (im * im))
    if (im <= (-1.35d+154)) then
        tmp = t_1
    else if (im <= (-9.5d+30)) then
        tmp = sqrt((t_0 * t_0))
    else if ((im <= 1650000000000.0d0) .or. (.not. (im <= 9.5d+144))) then
        tmp = t_1
    else
        tmp = re + (im * ((re * im) * (0.5d0 + ((re * re) * (-0.08333333333333333d0)))))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = 0.25 / (re * re);
	double t_1 = (0.5 * Math.sin(re)) * (2.0 + (im * im));
	double tmp;
	if (im <= -1.35e+154) {
		tmp = t_1;
	} else if (im <= -9.5e+30) {
		tmp = Math.sqrt((t_0 * t_0));
	} else if ((im <= 1650000000000.0) || !(im <= 9.5e+144)) {
		tmp = t_1;
	} else {
		tmp = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333))));
	}
	return tmp;
}
def code(re, im):
	t_0 = 0.25 / (re * re)
	t_1 = (0.5 * math.sin(re)) * (2.0 + (im * im))
	tmp = 0
	if im <= -1.35e+154:
		tmp = t_1
	elif im <= -9.5e+30:
		tmp = math.sqrt((t_0 * t_0))
	elif (im <= 1650000000000.0) or not (im <= 9.5e+144):
		tmp = t_1
	else:
		tmp = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333))))
	return tmp
function code(re, im)
	t_0 = Float64(0.25 / Float64(re * re))
	t_1 = Float64(Float64(0.5 * sin(re)) * Float64(2.0 + Float64(im * im)))
	tmp = 0.0
	if (im <= -1.35e+154)
		tmp = t_1;
	elseif (im <= -9.5e+30)
		tmp = sqrt(Float64(t_0 * t_0));
	elseif ((im <= 1650000000000.0) || !(im <= 9.5e+144))
		tmp = t_1;
	else
		tmp = Float64(re + Float64(im * Float64(Float64(re * im) * Float64(0.5 + Float64(Float64(re * re) * -0.08333333333333333)))));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 0.25 / (re * re);
	t_1 = (0.5 * sin(re)) * (2.0 + (im * im));
	tmp = 0.0;
	if (im <= -1.35e+154)
		tmp = t_1;
	elseif (im <= -9.5e+30)
		tmp = sqrt((t_0 * t_0));
	elseif ((im <= 1650000000000.0) || ~((im <= 9.5e+144)))
		tmp = t_1;
	else
		tmp = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333))));
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.35e+154], t$95$1, If[LessEqual[im, -9.5e+30], N[Sqrt[N[(t$95$0 * t$95$0), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[im, 1650000000000.0], N[Not[LessEqual[im, 9.5e+144]], $MachinePrecision]], t$95$1, N[(re + N[(im * N[(N[(re * im), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{0.25}{re \cdot re}\\
t_1 := \left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;im \leq -9.5 \cdot 10^{+30}:\\
\;\;\;\;\sqrt{t_0 \cdot t_0}\\

\mathbf{elif}\;im \leq 1650000000000 \lor \neg \left(im \leq 9.5 \cdot 10^{+144}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -1.35000000000000003e154 or -9.5000000000000003e30 < im < 1.65e12 or 9.50000000000000031e144 < 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 94.5%

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

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

    if -1.35000000000000003e154 < im < -9.5000000000000003e30

    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-rr25.2%

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

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

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

      \[\leadsto \color{blue}{\frac{0.25}{re \cdot re}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt25.0%

        \[\leadsto \color{blue}{\sqrt{\frac{0.25}{re \cdot re}} \cdot \sqrt{\frac{0.25}{re \cdot re}}} \]
      2. sqrt-unprod35.5%

        \[\leadsto \color{blue}{\sqrt{\frac{0.25}{re \cdot re} \cdot \frac{0.25}{re \cdot re}}} \]
      3. frac-times35.5%

        \[\leadsto \sqrt{\color{blue}{\frac{0.25 \cdot 0.25}{\left(re \cdot re\right) \cdot \left(re \cdot re\right)}}} \]
      4. metadata-eval35.5%

        \[\leadsto \sqrt{\frac{\color{blue}{0.0625}}{\left(re \cdot re\right) \cdot \left(re \cdot re\right)}} \]
      5. pow235.5%

        \[\leadsto \sqrt{\frac{0.0625}{\color{blue}{{\left(re \cdot re\right)}^{2}}}} \]
      6. metadata-eval35.5%

        \[\leadsto \sqrt{\frac{0.0625}{{\left(re \cdot re\right)}^{\color{blue}{\left(\sqrt{4}\right)}}}} \]
      7. pow-prod-down35.5%

        \[\leadsto \sqrt{\frac{0.0625}{\color{blue}{{re}^{\left(\sqrt{4}\right)} \cdot {re}^{\left(\sqrt{4}\right)}}}} \]
      8. pow-prod-up35.5%

        \[\leadsto \sqrt{\frac{0.0625}{\color{blue}{{re}^{\left(\sqrt{4} + \sqrt{4}\right)}}}} \]
      9. metadata-eval35.5%

        \[\leadsto \sqrt{\frac{0.0625}{{re}^{\left(\color{blue}{2} + \sqrt{4}\right)}}} \]
      10. metadata-eval35.5%

        \[\leadsto \sqrt{\frac{0.0625}{{re}^{\left(2 + \color{blue}{2}\right)}}} \]
      11. metadata-eval35.5%

        \[\leadsto \sqrt{\frac{0.0625}{{re}^{\color{blue}{4}}}} \]
    9. Applied egg-rr35.5%

      \[\leadsto \color{blue}{\sqrt{\frac{0.0625}{{re}^{4}}}} \]
    10. Step-by-step derivation
      1. add-sqr-sqrt35.5%

        \[\leadsto \sqrt{\color{blue}{\sqrt{\frac{0.0625}{{re}^{4}}} \cdot \sqrt{\frac{0.0625}{{re}^{4}}}}} \]
      2. sqrt-div35.5%

        \[\leadsto \sqrt{\color{blue}{\frac{\sqrt{0.0625}}{\sqrt{{re}^{4}}}} \cdot \sqrt{\frac{0.0625}{{re}^{4}}}} \]
      3. metadata-eval35.5%

        \[\leadsto \sqrt{\frac{\color{blue}{0.25}}{\sqrt{{re}^{4}}} \cdot \sqrt{\frac{0.0625}{{re}^{4}}}} \]
      4. sqrt-pow135.5%

        \[\leadsto \sqrt{\frac{0.25}{\color{blue}{{re}^{\left(\frac{4}{2}\right)}}} \cdot \sqrt{\frac{0.0625}{{re}^{4}}}} \]
      5. metadata-eval35.5%

        \[\leadsto \sqrt{\frac{0.25}{{re}^{\color{blue}{2}}} \cdot \sqrt{\frac{0.0625}{{re}^{4}}}} \]
      6. pow235.5%

        \[\leadsto \sqrt{\frac{0.25}{\color{blue}{re \cdot re}} \cdot \sqrt{\frac{0.0625}{{re}^{4}}}} \]
      7. sqrt-div35.5%

        \[\leadsto \sqrt{\frac{0.25}{re \cdot re} \cdot \color{blue}{\frac{\sqrt{0.0625}}{\sqrt{{re}^{4}}}}} \]
      8. metadata-eval35.5%

        \[\leadsto \sqrt{\frac{0.25}{re \cdot re} \cdot \frac{\color{blue}{0.25}}{\sqrt{{re}^{4}}}} \]
      9. sqrt-pow135.5%

        \[\leadsto \sqrt{\frac{0.25}{re \cdot re} \cdot \frac{0.25}{\color{blue}{{re}^{\left(\frac{4}{2}\right)}}}} \]
      10. metadata-eval35.5%

        \[\leadsto \sqrt{\frac{0.25}{re \cdot re} \cdot \frac{0.25}{{re}^{\color{blue}{2}}}} \]
      11. pow235.5%

        \[\leadsto \sqrt{\frac{0.25}{re \cdot re} \cdot \frac{0.25}{\color{blue}{re \cdot re}}} \]
    11. Applied egg-rr35.5%

      \[\leadsto \sqrt{\color{blue}{\frac{0.25}{re \cdot re} \cdot \frac{0.25}{re \cdot re}}} \]

    if 1.65e12 < im < 9.50000000000000031e144

    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 \color{blue}{\sin re + 0.5 \cdot \left(\sin re \cdot {im}^{2}\right)} \]
    5. Simplified4.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re + im \cdot \left(\left(re \cdot im\right) \cdot \left(\color{blue}{\left(re \cdot re\right)} \cdot -0.08333333333333333 + 0.5\right)\right) \]
    8. Simplified35.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{elif}\;im \leq -9.5 \cdot 10^{+30}:\\ \;\;\;\;\sqrt{\frac{0.25}{re \cdot re} \cdot \frac{0.25}{re \cdot re}}\\ \mathbf{elif}\;im \leq 1650000000000 \lor \neg \left(im \leq 9.5 \cdot 10^{+144}\right):\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;re + im \cdot \left(\left(re \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\ \end{array} \]

Alternative 10: 75.9% accurate, 2.8× speedup?

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

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

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

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

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

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

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

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

Alternative 11: 73.2% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := re + \left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{if}\;im \leq -1.5 \cdot 10^{+137}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -8 \cdot 10^{+24}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \mathbf{elif}\;im \leq 6.9 \cdot 10^{-18}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.05 \cdot 10^{+132}:\\ \;\;\;\;re + im \cdot \left(\left(re \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (+ re (* (* im im) (* 0.5 re)))))
   (if (<= im -1.5e+137)
     t_0
     (if (<= im -8e+24)
       (+
        0.08333333333333333
        (+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666)))
       (if (<= im 6.9e-18)
         (sin re)
         (if (<= im 1.05e+132)
           (+
            re
            (* im (* (* re im) (+ 0.5 (* (* re re) -0.08333333333333333)))))
           t_0))))))
double code(double re, double im) {
	double t_0 = re + ((im * im) * (0.5 * re));
	double tmp;
	if (im <= -1.5e+137) {
		tmp = t_0;
	} else if (im <= -8e+24) {
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	} else if (im <= 6.9e-18) {
		tmp = sin(re);
	} else if (im <= 1.05e+132) {
		tmp = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333))));
	} 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 = re + ((im * im) * (0.5d0 * re))
    if (im <= (-1.5d+137)) then
        tmp = t_0
    else if (im <= (-8d+24)) then
        tmp = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
    else if (im <= 6.9d-18) then
        tmp = sin(re)
    else if (im <= 1.05d+132) then
        tmp = re + (im * ((re * im) * (0.5d0 + ((re * re) * (-0.08333333333333333d0)))))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = re + ((im * im) * (0.5 * re));
	double tmp;
	if (im <= -1.5e+137) {
		tmp = t_0;
	} else if (im <= -8e+24) {
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	} else if (im <= 6.9e-18) {
		tmp = Math.sin(re);
	} else if (im <= 1.05e+132) {
		tmp = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333))));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = re + ((im * im) * (0.5 * re))
	tmp = 0
	if im <= -1.5e+137:
		tmp = t_0
	elif im <= -8e+24:
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666))
	elif im <= 6.9e-18:
		tmp = math.sin(re)
	elif im <= 1.05e+132:
		tmp = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333))))
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(re + Float64(Float64(im * im) * Float64(0.5 * re)))
	tmp = 0.0
	if (im <= -1.5e+137)
		tmp = t_0;
	elseif (im <= -8e+24)
		tmp = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666)));
	elseif (im <= 6.9e-18)
		tmp = sin(re);
	elseif (im <= 1.05e+132)
		tmp = Float64(re + Float64(im * Float64(Float64(re * im) * Float64(0.5 + Float64(Float64(re * re) * -0.08333333333333333)))));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = re + ((im * im) * (0.5 * re));
	tmp = 0.0;
	if (im <= -1.5e+137)
		tmp = t_0;
	elseif (im <= -8e+24)
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	elseif (im <= 6.9e-18)
		tmp = sin(re);
	elseif (im <= 1.05e+132)
		tmp = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333))));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(re + N[(N[(im * im), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.5e+137], t$95$0, If[LessEqual[im, -8e+24], 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, 6.9e-18], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.05e+132], N[(re + N[(im * N[(N[(re * im), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := re + \left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\
\mathbf{if}\;im \leq -1.5 \cdot 10^{+137}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;im \leq 6.9 \cdot 10^{-18}:\\
\;\;\;\;\sin re\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if im < -1.5e137 or 1.04999999999999997e132 < 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 88.8%

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

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

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

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

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

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

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

    if -1.5e137 < im < -7.9999999999999999e24

    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-rr24.5%

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

      \[\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/33.4%

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

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

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

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

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

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

    if -7.9999999999999999e24 < im < 6.9000000000000003e-18

    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 94.4%

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

    if 6.9000000000000003e-18 < im < 1.04999999999999997e132

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin re + \left(\left(\left(-0.08333333333333333 \cdot {re}^{3}\right) \cdot im\right) \cdot im + \color{blue}{\left(\left(0.5 \cdot re\right) \cdot im\right) \cdot im}\right) \]
      7. distribute-rgt-out38.9%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1.5 \cdot 10^{+137}:\\ \;\;\;\;re + \left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{elif}\;im \leq -8 \cdot 10^{+24}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \mathbf{elif}\;im \leq 6.9 \cdot 10^{-18}:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 1.05 \cdot 10^{+132}:\\ \;\;\;\;re + im \cdot \left(\left(re \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\ \mathbf{else}:\\ \;\;\;\;re + \left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\ \end{array} \]

Alternative 12: 49.3% accurate, 14.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := re + im \cdot \left(\left(re \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\ \mathbf{if}\;re \leq -1.05 \cdot 10^{+32}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;re \leq 8.4 \cdot 10^{+94}:\\ \;\;\;\;re + \left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{elif}\;re \leq 6.5 \cdot 10^{+253}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0
         (+
          re
          (* im (* (* re im) (+ 0.5 (* (* re re) -0.08333333333333333)))))))
   (if (<= re -1.05e+32)
     t_0
     (if (<= re 8.4e+94)
       (+ re (* (* im im) (* 0.5 re)))
       (if (<= re 6.5e+253)
         t_0
         (+
          0.08333333333333333
          (+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666))))))))
double code(double re, double im) {
	double t_0 = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333))));
	double tmp;
	if (re <= -1.05e+32) {
		tmp = t_0;
	} else if (re <= 8.4e+94) {
		tmp = re + ((im * im) * (0.5 * re));
	} else if (re <= 6.5e+253) {
		tmp = t_0;
	} else {
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	}
	return tmp;
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = re + (im * ((re * im) * (0.5d0 + ((re * re) * (-0.08333333333333333d0)))))
    if (re <= (-1.05d+32)) then
        tmp = t_0
    else if (re <= 8.4d+94) then
        tmp = re + ((im * im) * (0.5d0 * re))
    else if (re <= 6.5d+253) then
        tmp = t_0
    else
        tmp = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333))));
	double tmp;
	if (re <= -1.05e+32) {
		tmp = t_0;
	} else if (re <= 8.4e+94) {
		tmp = re + ((im * im) * (0.5 * re));
	} else if (re <= 6.5e+253) {
		tmp = t_0;
	} else {
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	}
	return tmp;
}
def code(re, im):
	t_0 = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333))))
	tmp = 0
	if re <= -1.05e+32:
		tmp = t_0
	elif re <= 8.4e+94:
		tmp = re + ((im * im) * (0.5 * re))
	elif re <= 6.5e+253:
		tmp = t_0
	else:
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666))
	return tmp
function code(re, im)
	t_0 = Float64(re + Float64(im * Float64(Float64(re * im) * Float64(0.5 + Float64(Float64(re * re) * -0.08333333333333333)))))
	tmp = 0.0
	if (re <= -1.05e+32)
		tmp = t_0;
	elseif (re <= 8.4e+94)
		tmp = Float64(re + Float64(Float64(im * im) * Float64(0.5 * re)));
	elseif (re <= 6.5e+253)
		tmp = t_0;
	else
		tmp = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333))));
	tmp = 0.0;
	if (re <= -1.05e+32)
		tmp = t_0;
	elseif (re <= 8.4e+94)
		tmp = re + ((im * im) * (0.5 * re));
	elseif (re <= 6.5e+253)
		tmp = t_0;
	else
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(re + N[(im * N[(N[(re * im), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -1.05e+32], t$95$0, If[LessEqual[re, 8.4e+94], N[(re + N[(N[(im * im), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 6.5e+253], t$95$0, N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := re + im \cdot \left(\left(re \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\
\mathbf{if}\;re \leq -1.05 \cdot 10^{+32}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;re \leq 6.5 \cdot 10^{+253}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if re < -1.05e32 or 8.39999999999999958e94 < re < 6.5000000000000002e253

    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 79.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.05e32 < re < 8.39999999999999958e94

    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 76.8%

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

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

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

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

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

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

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

    if 6.5000000000000002e253 < re

    1. Initial program 99.9%

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

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

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

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

      \[\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/28.4%

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

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

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

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

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

      \[\leadsto \color{blue}{0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification50.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -1.05 \cdot 10^{+32}:\\ \;\;\;\;re + im \cdot \left(\left(re \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\ \mathbf{elif}\;re \leq 8.4 \cdot 10^{+94}:\\ \;\;\;\;re + \left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{elif}\;re \leq 6.5 \cdot 10^{+253}:\\ \;\;\;\;re + im \cdot \left(\left(re \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \end{array} \]

Alternative 13: 38.9% accurate, 23.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(2 + im \cdot im\right) \cdot 131072\\ \mathbf{if}\;im \leq -4 \cdot 10^{+176}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq -9.5 \cdot 10^{+30}:\\ \;\;\;\;0.08333333333333333 + \frac{0.25}{re \cdot re}\\ \mathbf{elif}\;im \leq 7.2 \cdot 10^{+76}:\\ \;\;\;\;re\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (+ 2.0 (* im im)) 131072.0)))
   (if (<= im -4e+176)
     t_0
     (if (<= im -9.5e+30)
       (+ 0.08333333333333333 (/ 0.25 (* re re)))
       (if (<= im 7.2e+76) re t_0)))))
double code(double re, double im) {
	double t_0 = (2.0 + (im * im)) * 131072.0;
	double tmp;
	if (im <= -4e+176) {
		tmp = t_0;
	} else if (im <= -9.5e+30) {
		tmp = 0.08333333333333333 + (0.25 / (re * re));
	} else if (im <= 7.2e+76) {
		tmp = re;
	} 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 = (2.0d0 + (im * im)) * 131072.0d0
    if (im <= (-4d+176)) then
        tmp = t_0
    else if (im <= (-9.5d+30)) then
        tmp = 0.08333333333333333d0 + (0.25d0 / (re * re))
    else if (im <= 7.2d+76) then
        tmp = re
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = (2.0 + (im * im)) * 131072.0;
	double tmp;
	if (im <= -4e+176) {
		tmp = t_0;
	} else if (im <= -9.5e+30) {
		tmp = 0.08333333333333333 + (0.25 / (re * re));
	} else if (im <= 7.2e+76) {
		tmp = re;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(re, im):
	t_0 = (2.0 + (im * im)) * 131072.0
	tmp = 0
	if im <= -4e+176:
		tmp = t_0
	elif im <= -9.5e+30:
		tmp = 0.08333333333333333 + (0.25 / (re * re))
	elif im <= 7.2e+76:
		tmp = re
	else:
		tmp = t_0
	return tmp
function code(re, im)
	t_0 = Float64(Float64(2.0 + Float64(im * im)) * 131072.0)
	tmp = 0.0
	if (im <= -4e+176)
		tmp = t_0;
	elseif (im <= -9.5e+30)
		tmp = Float64(0.08333333333333333 + Float64(0.25 / Float64(re * re)));
	elseif (im <= 7.2e+76)
		tmp = re;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = (2.0 + (im * im)) * 131072.0;
	tmp = 0.0;
	if (im <= -4e+176)
		tmp = t_0;
	elseif (im <= -9.5e+30)
		tmp = 0.08333333333333333 + (0.25 / (re * re));
	elseif (im <= 7.2e+76)
		tmp = re;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision] * 131072.0), $MachinePrecision]}, If[LessEqual[im, -4e+176], t$95$0, If[LessEqual[im, -9.5e+30], N[(0.08333333333333333 + N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 7.2e+76], re, t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(2 + im \cdot im\right) \cdot 131072\\
\mathbf{if}\;im \leq -4 \cdot 10^{+176}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;im \leq -9.5 \cdot 10^{+30}:\\
\;\;\;\;0.08333333333333333 + \frac{0.25}{re \cdot re}\\

\mathbf{elif}\;im \leq 7.2 \cdot 10^{+76}:\\
\;\;\;\;re\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -4e176 or 7.2000000000000006e76 < 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-rr100.0%

      \[\leadsto \left(0.5 \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin re\right)\right)}\right) \cdot \left(e^{-im} + e^{im}\right) \]
    5. Applied egg-rr49.3%

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

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

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

    if -4e176 < im < -9.5000000000000003e30

    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-rr21.9%

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

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

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

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

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

      \[\leadsto \color{blue}{0.08333333333333333 + \frac{0.25}{re \cdot re}} \]

    if -9.5000000000000003e30 < im < 7.2000000000000006e76

    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 84.8%

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

      \[\leadsto \color{blue}{re} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification37.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -4 \cdot 10^{+176}:\\ \;\;\;\;\left(2 + im \cdot im\right) \cdot 131072\\ \mathbf{elif}\;im \leq -9.5 \cdot 10^{+30}:\\ \;\;\;\;0.08333333333333333 + \frac{0.25}{re \cdot re}\\ \mathbf{elif}\;im \leq 7.2 \cdot 10^{+76}:\\ \;\;\;\;re\\ \mathbf{else}:\\ \;\;\;\;\left(2 + im \cdot im\right) \cdot 131072\\ \end{array} \]

Alternative 14: 28.6% accurate, 34.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq -2.6 \cdot 10^{+31}:\\
\;\;\;\;0.08333333333333333 + \frac{0.25}{re \cdot re}\\

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


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

    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-rr19.0%

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

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

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

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

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

      \[\leadsto \color{blue}{0.08333333333333333 + \frac{0.25}{re \cdot re}} \]

    if -2.6e31 < 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 68.7%

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

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

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

Alternative 15: 47.2% accurate, 34.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 28.5% accurate, 43.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq -6.5 \cdot 10^{+43}:\\
\;\;\;\;\frac{0.25}{re \cdot re}\\

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


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

    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-rr19.8%

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

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

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

      \[\leadsto \color{blue}{\frac{0.25}{re \cdot re}} \]

    if -6.4999999999999998e43 < 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 67.7%

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

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

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

Alternative 17: 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 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 52.4%

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

    \[\leadsto \color{blue}{re} \]
  6. Final simplification25.2%

    \[\leadsto re \]

Reproduce

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