math.sin on complex, real part

Percentage Accurate: 100.0% → 100.0%
Time: 9.3s
Alternatives: 22
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 22 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: 92.4% accurate, 1.4× speedup?

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

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

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

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


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

    1. Initial program 100.0%

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

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

      \[\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 2.5 < im < 1.1999999999999999e77

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

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

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

    if 1.1999999999999999e77 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

Alternative 3: 86.7% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 100.0%

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

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

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

    if 2.5 < im < 1.1999999999999999e77

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

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

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

    if 1.1999999999999999e77 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

Alternative 4: 86.7% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 100.0%

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

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

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

    if 2.5 < im < 1.1999999999999999e77

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

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

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

    if 1.1999999999999999e77 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

Alternative 5: 84.4% accurate, 1.5× speedup?

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

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

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

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


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

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

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

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

    if 95000 < im < 2.15000000000000012e59

    1. Initial program 100.0%

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

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

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

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

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

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

    if 2.15000000000000012e59 < 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 95.6%

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

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

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

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

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

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

Alternative 6: 81.6% accurate, 1.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;{\left(\sin re \cdot 1.9380669946781485 \cdot 10^{-10}\right)}^{-512}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 95000 or 1.22e150 < 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 82.1%

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

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

    if 95000 < im < 1.22e150

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 95000 \lor \neg \left(im \leq 1.22 \cdot 10^{+150}\right):\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;{\left(\sin re \cdot 1.9380669946781485 \cdot 10^{-10}\right)}^{-512}\\ \end{array} \]

Alternative 7: 78.9% accurate, 1.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;{\sin re}^{-512}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 95000 or 2.0499999999999999e136 < 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 81.8%

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

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

    if 95000 < im < 2.0499999999999999e136

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{{\sin re}^{-512}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification77.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 95000 \lor \neg \left(im \leq 2.05 \cdot 10^{+136}\right):\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;{\sin re}^{-512}\\ \end{array} \]

Alternative 8: 63.4% accurate, 2.7× speedup?

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

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

\mathbf{elif}\;im \leq 3.7 \cdot 10^{+118}:\\
\;\;\;\;{re}^{-512}\\

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

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


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

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

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

    if 95000 < im < 3.69999999999999987e118

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

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

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

      \[\leadsto \color{blue}{{re}^{-512}} \]

    if 3.69999999999999987e118 < im < 3.9000000000000002e218

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

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

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

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

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

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

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

    if 3.9000000000000002e218 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 95000:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 3.7 \cdot 10^{+118}:\\ \;\;\;\;{re}^{-512}\\ \mathbf{elif}\;im \leq 3.9 \cdot 10^{+218}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + im \cdot im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(0.5 \cdot \left(\sin re \cdot im\right)\right)\\ \end{array} \]

Alternative 9: 78.9% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 95000 \lor \neg \left(im \leq 1.22 \cdot 10^{+150}\right):\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \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
 (if (or (<= im 95000.0) (not (<= im 1.22e+150)))
   (* (* 0.5 (sin re)) (+ 2.0 (* im im)))
   (+
    0.08333333333333333
    (+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666)))))
double code(double re, double im) {
	double tmp;
	if ((im <= 95000.0) || !(im <= 1.22e+150)) {
		tmp = (0.5 * sin(re)) * (2.0 + (im * im));
	} 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) :: tmp
    if ((im <= 95000.0d0) .or. (.not. (im <= 1.22d+150))) then
        tmp = (0.5d0 * sin(re)) * (2.0d0 + (im * im))
    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 tmp;
	if ((im <= 95000.0) || !(im <= 1.22e+150)) {
		tmp = (0.5 * Math.sin(re)) * (2.0 + (im * im));
	} else {
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	}
	return tmp;
}
def code(re, im):
	tmp = 0
	if (im <= 95000.0) or not (im <= 1.22e+150):
		tmp = (0.5 * math.sin(re)) * (2.0 + (im * im))
	else:
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666))
	return tmp
function code(re, im)
	tmp = 0.0
	if ((im <= 95000.0) || !(im <= 1.22e+150))
		tmp = Float64(Float64(0.5 * sin(re)) * Float64(2.0 + Float64(im * im)));
	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)
	tmp = 0.0;
	if ((im <= 95000.0) || ~((im <= 1.22e+150)))
		tmp = (0.5 * sin(re)) * (2.0 + (im * im));
	else
		tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
	end
	tmp_2 = tmp;
end
code[re_, im_] := If[Or[LessEqual[im, 95000.0], N[Not[LessEqual[im, 1.22e+150]], $MachinePrecision]], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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}
\mathbf{if}\;im \leq 95000 \lor \neg \left(im \leq 1.22 \cdot 10^{+150}\right):\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\

\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 2 regimes
  2. if im < 95000 or 1.22e150 < 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 82.1%

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

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

    if 95000 < im < 1.22e150

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 95000 \lor \neg \left(im \leq 1.22 \cdot 10^{+150}\right):\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\ \end{array} \]

Alternative 10: 62.8% accurate, 2.9× speedup?

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

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

\mathbf{elif}\;im \leq 6.2 \cdot 10^{+118}:\\
\;\;\;\;{re}^{-512}\\

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


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

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

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

    if 95000 < im < 6.19999999999999973e118

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

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

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

      \[\leadsto \color{blue}{{re}^{-512}} \]

    if 6.19999999999999973e118 < 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 78.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 95000:\\ \;\;\;\;\sin re\\ \mathbf{elif}\;im \leq 6.2 \cdot 10^{+118}:\\ \;\;\;\;{re}^{-512}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + im \cdot im\right)\right)\\ \end{array} \]

Alternative 11: 62.9% accurate, 3.0× speedup?

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

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

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

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


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

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

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

    if 1.3e6 < im < 4.49999999999999977e120

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

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

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

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

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

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

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

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

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

    if 4.49999999999999977e120 < 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 78.9%

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

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

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

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

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

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

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

Alternative 12: 48.9% accurate, 18.0× speedup?

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

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

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

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


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

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

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

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

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

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

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

        \[\leadsto re \cdot \left(0.5 \cdot \color{blue}{\left({im}^{2} + 2\right)}\right) \]
      4. distribute-rgt-in51.5%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(re, \color{blue}{\left(im \cdot im\right)} \cdot 0.5, re\right) \]
      10. associate-*l*51.5%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(re, im \cdot \left(im \cdot 0.5\right), re\right)} \]
    9. Step-by-step derivation
      1. fma-udef51.5%

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

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

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

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

    if 95000 < im < 7.79999999999999967e121

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

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

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

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

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

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

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

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

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

    if 7.79999999999999967e121 < 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 78.9%

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

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

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

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

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

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

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

Alternative 13: 48.0% accurate, 23.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.032 \lor \neg \left(im \leq 1.9 \cdot 10^{+100}\right):\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(2 + im \cdot im\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 0.032000000000000001 or 1.89999999999999982e100 < 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 80.9%

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

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

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

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

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

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

    if 0.032000000000000001 < im < 1.89999999999999982e100

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.032 \lor \neg \left(im \leq 1.9 \cdot 10^{+100}\right):\\ \;\;\;\;0.5 \cdot \left(re \cdot \left(2 + im \cdot im\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.08333333333333333 + \frac{\frac{0.25}{re}}{re}\\ \end{array} \]

Alternative 14: 47.9% accurate, 23.5× speedup?

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

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

\mathbf{elif}\;im \leq 1.4 \cdot 10^{+103}:\\
\;\;\;\;0.08333333333333333 + \frac{\frac{0.25}{re}}{re}\\

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


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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(re, {im}^{2} \cdot 0.5, re\right)} \]
      9. unpow252.7%

        \[\leadsto \mathsf{fma}\left(re, \color{blue}{\left(im \cdot im\right)} \cdot 0.5, re\right) \]
      10. associate-*l*52.7%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(re, im \cdot \left(im \cdot 0.5\right), re\right)} \]
    9. Step-by-step derivation
      1. fma-udef52.7%

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

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

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

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

    if 0.032000000000000001 < im < 1.40000000000000004e103

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

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

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

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

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

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

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

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

    if 1.40000000000000004e103 < 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 70.5%

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

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

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

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

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

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

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

Alternative 15: 34.1% accurate, 27.8× speedup?

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

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

\mathbf{elif}\;im \leq 1.06 \cdot 10^{+102}:\\
\;\;\;\;\frac{0.25}{re \cdot re}\\

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


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

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

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

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

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

    if 6e4 < im < 1.06000000000000001e102

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

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

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

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

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

    if 1.06000000000000001e102 < 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 70.5%

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

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

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

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

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

        \[\leadsto re \cdot \left(0.5 \cdot \color{blue}{\left({im}^{2} + 2\right)}\right) \]
      4. distribute-rgt-in57.6%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(re, \color{blue}{\left(im \cdot im\right)} \cdot 0.5, re\right) \]
      10. associate-*l*57.6%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 60000:\\ \;\;\;\;re\\ \mathbf{elif}\;im \leq 1.06 \cdot 10^{+102}:\\ \;\;\;\;\frac{0.25}{re \cdot re}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot im\right)\right)\\ \end{array} \]

Alternative 16: 37.0% accurate, 27.8× speedup?

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

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

\mathbf{elif}\;im \leq 1.25 \cdot 10^{+104}:\\
\;\;\;\;\frac{0.25}{re \cdot re}\\

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


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

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

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

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

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

    if 6e4 < im < 1.2499999999999999e104

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

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

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

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

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

    if 1.2499999999999999e104 < 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 70.5%

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

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

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

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

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

        \[\leadsto re \cdot \left(0.5 \cdot \color{blue}{\left({im}^{2} + 2\right)}\right) \]
      4. distribute-rgt-in57.6%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(re, \color{blue}{\left(im \cdot im\right)} \cdot 0.5, re\right) \]
      10. associate-*l*57.6%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 60000:\\ \;\;\;\;re\\ \mathbf{elif}\;im \leq 1.25 \cdot 10^{+104}:\\ \;\;\;\;\frac{0.25}{re \cdot re}\\ \mathbf{else}:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\ \end{array} \]

Alternative 17: 37.0% accurate, 27.8× speedup?

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

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

\mathbf{elif}\;im \leq 1.95 \cdot 10^{+100}:\\
\;\;\;\;0.08333333333333333 + \frac{\frac{0.25}{re}}{re}\\

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


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

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

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

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

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

    if 0.032000000000000001 < im < 1.95e100

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

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

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

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

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

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

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

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

    if 1.95e100 < 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 70.5%

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

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

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

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

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

        \[\leadsto re \cdot \left(0.5 \cdot \color{blue}{\left({im}^{2} + 2\right)}\right) \]
      4. distribute-rgt-in57.6%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(re, \color{blue}{\left(im \cdot im\right)} \cdot 0.5, re\right) \]
      10. associate-*l*57.6%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 0.032:\\ \;\;\;\;re\\ \mathbf{elif}\;im \leq 1.95 \cdot 10^{+100}:\\ \;\;\;\;0.08333333333333333 + \frac{\frac{0.25}{re}}{re}\\ \mathbf{else}:\\ \;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\ \end{array} \]

Alternative 18: 28.7% accurate, 43.8× speedup?

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

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

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


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

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

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

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

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

    if 75000 < im

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

Alternative 19: 3.6% accurate, 309.0× speedup?

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

\\
1.9380669946781485 \cdot 10^{-10}
\end{array}
Derivation
  1. Initial program 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 85.4%

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

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

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

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

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

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

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

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

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

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

Alternative 20: 4.3% accurate, 309.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 0.08333333333333333 \]

Alternative 21: 4.8% accurate, 309.0× speedup?

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

\\
1
\end{array}
Derivation
  1. Initial program 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 85.4%

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

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

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

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

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

    \[\leadsto 1 \]

Alternative 22: 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 re around 0 66.8%

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

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

    \[\leadsto \color{blue}{re} \]
  7. Final simplification33.5%

    \[\leadsto re \]

Reproduce

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