Linear.Quaternion:$csin from linear-1.19.1.3

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

Specification

?
\[\begin{array}{l} \\ \cos x \cdot \frac{\sinh y}{y} \end{array} \]
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
	return cos(x) * (sinh(y) / y);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = cos(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
	return Math.cos(x) * (Math.sinh(y) / y);
}
def code(x, y):
	return math.cos(x) * (math.sinh(y) / y)
function code(x, y)
	return Float64(cos(x) * Float64(sinh(y) / y))
end
function tmp = code(x, y)
	tmp = cos(x) * (sinh(y) / y);
end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\cos x \cdot \frac{\sinh y}{y}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \cos x \cdot \frac{\sinh y}{y} \end{array} \]
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
	return cos(x) * (sinh(y) / y);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = cos(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
	return Math.cos(x) * (Math.sinh(y) / y);
}
def code(x, y):
	return math.cos(x) * (math.sinh(y) / y)
function code(x, y)
	return Float64(cos(x) * Float64(sinh(y) / y))
end
function tmp = code(x, y)
	tmp = cos(x) * (sinh(y) / y);
end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\cos x \cdot \frac{\sinh y}{y}
\end{array}

Alternative 1: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \cos x \cdot \frac{\sinh y}{y} \end{array} \]
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
	return cos(x) * (sinh(y) / y);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = cos(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
	return Math.cos(x) * (Math.sinh(y) / y);
}
def code(x, y):
	return math.cos(x) * (math.sinh(y) / y)
function code(x, y)
	return Float64(cos(x) * Float64(sinh(y) / y))
end
function tmp = code(x, y)
	tmp = cos(x) * (sinh(y) / y);
end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\cos x \cdot \frac{\sinh y}{y}
\end{array}
Derivation
  1. Initial program 100.0%

    \[\cos x \cdot \frac{\sinh y}{y} \]
  2. Final simplification100.0%

    \[\leadsto \cos x \cdot \frac{\sinh y}{y} \]

Alternative 2: 82.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{if}\;y \leq 2600000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{+51}:\\ \;\;\;\;\left(y \cdot y\right) \cdot \left|0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right|\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{+153}:\\ \;\;\;\;\sqrt[3]{{y}^{6} \cdot 0.004629629629629629}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y))))))
   (if (<= y 2600000000000.0)
     t_0
     (if (<= y 2.4e+51)
       (*
        (* y y)
        (fabs (+ 0.16666666666666666 (* -0.08333333333333333 (* x x)))))
       (if (<= y 2.65e+153)
         (cbrt (* (pow y 6.0) 0.004629629629629629))
         t_0)))))
double code(double x, double y) {
	double t_0 = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	double tmp;
	if (y <= 2600000000000.0) {
		tmp = t_0;
	} else if (y <= 2.4e+51) {
		tmp = (y * y) * fabs((0.16666666666666666 + (-0.08333333333333333 * (x * x))));
	} else if (y <= 2.65e+153) {
		tmp = cbrt((pow(y, 6.0) * 0.004629629629629629));
	} else {
		tmp = t_0;
	}
	return tmp;
}
public static double code(double x, double y) {
	double t_0 = Math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	double tmp;
	if (y <= 2600000000000.0) {
		tmp = t_0;
	} else if (y <= 2.4e+51) {
		tmp = (y * y) * Math.abs((0.16666666666666666 + (-0.08333333333333333 * (x * x))));
	} else if (y <= 2.65e+153) {
		tmp = Math.cbrt((Math.pow(y, 6.0) * 0.004629629629629629));
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(x, y)
	t_0 = Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))))
	tmp = 0.0
	if (y <= 2600000000000.0)
		tmp = t_0;
	elseif (y <= 2.4e+51)
		tmp = Float64(Float64(y * y) * abs(Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x)))));
	elseif (y <= 2.65e+153)
		tmp = cbrt(Float64((y ^ 6.0) * 0.004629629629629629));
	else
		tmp = t_0;
	end
	return tmp
end
code[x_, y_] := Block[{t$95$0 = N[(N[Cos[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 2600000000000.0], t$95$0, If[LessEqual[y, 2.4e+51], N[(N[(y * y), $MachinePrecision] * N[Abs[N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.65e+153], N[Power[N[(N[Power[y, 6.0], $MachinePrecision] * 0.004629629629629629), $MachinePrecision], 1/3], $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{if}\;y \leq 2600000000000:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 2.4 \cdot 10^{+51}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left|0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right|\\

\mathbf{elif}\;y \leq 2.65 \cdot 10^{+153}:\\
\;\;\;\;\sqrt[3]{{y}^{6} \cdot 0.004629629629629629}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 2.6e12 or 2.65e153 < y

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 88.9%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow288.9%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified88.9%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]

    if 2.6e12 < y < 2.3999999999999999e51

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 3.7%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow23.7%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified3.7%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in y around inf 3.7%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot {y}^{2}\right)} \]
    6. Step-by-step derivation
      1. unpow23.7%

        \[\leadsto 0.16666666666666666 \cdot \left(\cos x \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    7. Simplified3.7%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)} \]
    8. Taylor expanded in x around 0 44.0%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(-0.5 \cdot \left({y}^{2} \cdot {x}^{2}\right) + {y}^{2}\right)} \]
    9. Step-by-step derivation
      1. fma-def44.0%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\mathsf{fma}\left(-0.5, {y}^{2} \cdot {x}^{2}, {y}^{2}\right)} \]
      2. unpow244.0%

        \[\leadsto 0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \color{blue}{\left(y \cdot y\right)} \cdot {x}^{2}, {y}^{2}\right) \]
      3. *-commutative44.0%

        \[\leadsto 0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \color{blue}{{x}^{2} \cdot \left(y \cdot y\right)}, {y}^{2}\right) \]
      4. unpow244.0%

        \[\leadsto 0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \color{blue}{\left(x \cdot x\right)} \cdot \left(y \cdot y\right), {y}^{2}\right) \]
      5. unpow244.0%

        \[\leadsto 0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), \color{blue}{y \cdot y}\right) \]
    10. Simplified44.0%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt1.0%

        \[\leadsto \color{blue}{\sqrt{0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)} \cdot \sqrt{0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)}} \]
      2. sqrt-unprod15.8%

        \[\leadsto \color{blue}{\sqrt{\left(0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)\right)}} \]
      3. swap-sqr15.8%

        \[\leadsto \sqrt{\color{blue}{\left(0.16666666666666666 \cdot 0.16666666666666666\right) \cdot \left(\mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right) \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)\right)}} \]
      4. metadata-eval15.8%

        \[\leadsto \sqrt{\color{blue}{0.027777777777777776} \cdot \left(\mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right) \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)\right)} \]
      5. pow215.8%

        \[\leadsto \sqrt{0.027777777777777776 \cdot \color{blue}{{\left(\mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)\right)}^{2}}} \]
      6. fma-udef15.8%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\color{blue}{\left(-0.5 \cdot \left(\left(x \cdot x\right) \cdot \left(y \cdot y\right)\right) + y \cdot y\right)}}^{2}} \]
      7. +-commutative15.8%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\color{blue}{\left(y \cdot y + -0.5 \cdot \left(\left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)\right)}}^{2}} \]
      8. fma-def15.8%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\color{blue}{\left(\mathsf{fma}\left(y, y, -0.5 \cdot \left(\left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)\right)\right)}}^{2}} \]
      9. *-commutative15.8%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\left(\mathsf{fma}\left(y, y, \color{blue}{\left(\left(x \cdot x\right) \cdot \left(y \cdot y\right)\right) \cdot -0.5}\right)\right)}^{2}} \]
      10. *-commutative15.8%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\left(\mathsf{fma}\left(y, y, \color{blue}{\left(\left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)} \cdot -0.5\right)\right)}^{2}} \]
      11. pow215.8%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\left(\mathsf{fma}\left(y, y, \left(\color{blue}{{y}^{2}} \cdot \left(x \cdot x\right)\right) \cdot -0.5\right)\right)}^{2}} \]
      12. pow215.8%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\left(\mathsf{fma}\left(y, y, \left({y}^{2} \cdot \color{blue}{{x}^{2}}\right) \cdot -0.5\right)\right)}^{2}} \]
      13. pow-prod-down15.8%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\left(\mathsf{fma}\left(y, y, \color{blue}{{\left(y \cdot x\right)}^{2}} \cdot -0.5\right)\right)}^{2}} \]
    12. Applied egg-rr15.8%

      \[\leadsto \color{blue}{\sqrt{0.027777777777777776 \cdot {\left(\mathsf{fma}\left(y, y, {\left(y \cdot x\right)}^{2} \cdot -0.5\right)\right)}^{2}}} \]
    13. Step-by-step derivation
      1. metadata-eval15.8%

        \[\leadsto \sqrt{\color{blue}{\left(0.16666666666666666 \cdot 0.16666666666666666\right)} \cdot {\left(\mathsf{fma}\left(y, y, {\left(y \cdot x\right)}^{2} \cdot -0.5\right)\right)}^{2}} \]
      2. unpow215.8%

        \[\leadsto \sqrt{\left(0.16666666666666666 \cdot 0.16666666666666666\right) \cdot \color{blue}{\left(\mathsf{fma}\left(y, y, {\left(y \cdot x\right)}^{2} \cdot -0.5\right) \cdot \mathsf{fma}\left(y, y, {\left(y \cdot x\right)}^{2} \cdot -0.5\right)\right)}} \]
      3. swap-sqr15.8%

        \[\leadsto \sqrt{\color{blue}{\left(0.16666666666666666 \cdot \mathsf{fma}\left(y, y, {\left(y \cdot x\right)}^{2} \cdot -0.5\right)\right) \cdot \left(0.16666666666666666 \cdot \mathsf{fma}\left(y, y, {\left(y \cdot x\right)}^{2} \cdot -0.5\right)\right)}} \]
      4. rem-sqrt-square15.8%

        \[\leadsto \color{blue}{\left|0.16666666666666666 \cdot \mathsf{fma}\left(y, y, {\left(y \cdot x\right)}^{2} \cdot -0.5\right)\right|} \]
      5. fma-def15.8%

        \[\leadsto \left|0.16666666666666666 \cdot \color{blue}{\left(y \cdot y + {\left(y \cdot x\right)}^{2} \cdot -0.5\right)}\right| \]
      6. unpow215.8%

        \[\leadsto \left|0.16666666666666666 \cdot \left(\color{blue}{{y}^{2}} + {\left(y \cdot x\right)}^{2} \cdot -0.5\right)\right| \]
      7. distribute-lft-in15.8%

        \[\leadsto \left|\color{blue}{0.16666666666666666 \cdot {y}^{2} + 0.16666666666666666 \cdot \left({\left(y \cdot x\right)}^{2} \cdot -0.5\right)}\right| \]
      8. *-commutative15.8%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + 0.16666666666666666 \cdot \color{blue}{\left(-0.5 \cdot {\left(y \cdot x\right)}^{2}\right)}\right| \]
      9. associate-*r*15.8%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + \color{blue}{\left(0.16666666666666666 \cdot -0.5\right) \cdot {\left(y \cdot x\right)}^{2}}\right| \]
      10. metadata-eval15.8%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + \color{blue}{-0.08333333333333333} \cdot {\left(y \cdot x\right)}^{2}\right| \]
      11. unpow215.8%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left(\left(y \cdot x\right) \cdot \left(y \cdot x\right)\right)}\right| \]
      12. swap-sqr15.8%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left(\left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}\right| \]
      13. unpow215.8%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \left(\color{blue}{{y}^{2}} \cdot \left(x \cdot x\right)\right)\right| \]
      14. unpow215.8%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \left({y}^{2} \cdot \color{blue}{{x}^{2}}\right)\right| \]
      15. *-commutative15.8%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left({x}^{2} \cdot {y}^{2}\right)}\right| \]
      16. associate-*r*15.8%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + \color{blue}{\left(-0.08333333333333333 \cdot {x}^{2}\right) \cdot {y}^{2}}\right| \]
      17. distribute-rgt-out15.8%

        \[\leadsto \left|\color{blue}{{y}^{2} \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot {x}^{2}\right)}\right| \]
      18. unpow215.8%

        \[\leadsto \left|\color{blue}{\left(y \cdot y\right)} \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot {x}^{2}\right)\right| \]
    14. Simplified15.8%

      \[\leadsto \color{blue}{\left|\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\right|} \]

    if 2.3999999999999999e51 < y < 2.65e153

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 6.3%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow26.3%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified6.3%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in y around inf 6.3%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot {y}^{2}\right)} \]
    6. Step-by-step derivation
      1. unpow26.3%

        \[\leadsto 0.16666666666666666 \cdot \left(\cos x \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    7. Simplified6.3%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)} \]
    8. Taylor expanded in x around 0 4.3%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{{y}^{2}} \]
    9. Step-by-step derivation
      1. unpow24.3%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} \]
    10. Simplified4.3%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} \]
    11. Step-by-step derivation
      1. add-cbrt-cube70.8%

        \[\leadsto \color{blue}{\sqrt[3]{\left(\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)\right) \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}} \]
      2. pow370.8%

        \[\leadsto \sqrt[3]{\color{blue}{{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}^{3}}} \]
      3. *-commutative70.8%

        \[\leadsto \sqrt[3]{{\color{blue}{\left(\left(y \cdot y\right) \cdot 0.16666666666666666\right)}}^{3}} \]
      4. unpow-prod-down70.8%

        \[\leadsto \sqrt[3]{\color{blue}{{\left(y \cdot y\right)}^{3} \cdot {0.16666666666666666}^{3}}} \]
      5. pow-prod-down70.8%

        \[\leadsto \sqrt[3]{\color{blue}{\left({y}^{3} \cdot {y}^{3}\right)} \cdot {0.16666666666666666}^{3}} \]
      6. pow-prod-up70.8%

        \[\leadsto \sqrt[3]{\color{blue}{{y}^{\left(3 + 3\right)}} \cdot {0.16666666666666666}^{3}} \]
      7. metadata-eval70.8%

        \[\leadsto \sqrt[3]{{y}^{\color{blue}{6}} \cdot {0.16666666666666666}^{3}} \]
      8. metadata-eval70.8%

        \[\leadsto \sqrt[3]{{y}^{6} \cdot \color{blue}{0.004629629629629629}} \]
    12. Applied egg-rr70.8%

      \[\leadsto \color{blue}{\sqrt[3]{{y}^{6} \cdot 0.004629629629629629}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification85.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2600000000000:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{+51}:\\ \;\;\;\;\left(y \cdot y\right) \cdot \left|0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right|\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{+153}:\\ \;\;\;\;\sqrt[3]{{y}^{6} \cdot 0.004629629629629629}\\ \mathbf{else}:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \end{array} \]

Alternative 3: 81.3% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{if}\;y \leq 2.4 \cdot 10^{+16}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+77}:\\ \;\;\;\;\left(y \cdot y\right) \cdot \left|0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right|\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{+153}:\\ \;\;\;\;\frac{1 - 0.027777777777777776 \cdot {y}^{4}}{1 + \left(y \cdot y\right) \cdot -0.16666666666666666}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y))))))
   (if (<= y 2.4e+16)
     t_0
     (if (<= y 1.2e+77)
       (*
        (* y y)
        (fabs (+ 0.16666666666666666 (* -0.08333333333333333 (* x x)))))
       (if (<= y 2.65e+153)
         (/
          (- 1.0 (* 0.027777777777777776 (pow y 4.0)))
          (+ 1.0 (* (* y y) -0.16666666666666666)))
         t_0)))))
double code(double x, double y) {
	double t_0 = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	double tmp;
	if (y <= 2.4e+16) {
		tmp = t_0;
	} else if (y <= 1.2e+77) {
		tmp = (y * y) * fabs((0.16666666666666666 + (-0.08333333333333333 * (x * x))));
	} else if (y <= 2.65e+153) {
		tmp = (1.0 - (0.027777777777777776 * pow(y, 4.0))) / (1.0 + ((y * y) * -0.16666666666666666));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = cos(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
    if (y <= 2.4d+16) then
        tmp = t_0
    else if (y <= 1.2d+77) then
        tmp = (y * y) * abs((0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x))))
    else if (y <= 2.65d+153) then
        tmp = (1.0d0 - (0.027777777777777776d0 * (y ** 4.0d0))) / (1.0d0 + ((y * y) * (-0.16666666666666666d0)))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = Math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	double tmp;
	if (y <= 2.4e+16) {
		tmp = t_0;
	} else if (y <= 1.2e+77) {
		tmp = (y * y) * Math.abs((0.16666666666666666 + (-0.08333333333333333 * (x * x))));
	} else if (y <= 2.65e+153) {
		tmp = (1.0 - (0.027777777777777776 * Math.pow(y, 4.0))) / (1.0 + ((y * y) * -0.16666666666666666));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)))
	tmp = 0
	if y <= 2.4e+16:
		tmp = t_0
	elif y <= 1.2e+77:
		tmp = (y * y) * math.fabs((0.16666666666666666 + (-0.08333333333333333 * (x * x))))
	elif y <= 2.65e+153:
		tmp = (1.0 - (0.027777777777777776 * math.pow(y, 4.0))) / (1.0 + ((y * y) * -0.16666666666666666))
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))))
	tmp = 0.0
	if (y <= 2.4e+16)
		tmp = t_0;
	elseif (y <= 1.2e+77)
		tmp = Float64(Float64(y * y) * abs(Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x)))));
	elseif (y <= 2.65e+153)
		tmp = Float64(Float64(1.0 - Float64(0.027777777777777776 * (y ^ 4.0))) / Float64(1.0 + Float64(Float64(y * y) * -0.16666666666666666)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	tmp = 0.0;
	if (y <= 2.4e+16)
		tmp = t_0;
	elseif (y <= 1.2e+77)
		tmp = (y * y) * abs((0.16666666666666666 + (-0.08333333333333333 * (x * x))));
	elseif (y <= 2.65e+153)
		tmp = (1.0 - (0.027777777777777776 * (y ^ 4.0))) / (1.0 + ((y * y) * -0.16666666666666666));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[Cos[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 2.4e+16], t$95$0, If[LessEqual[y, 1.2e+77], N[(N[(y * y), $MachinePrecision] * N[Abs[N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.65e+153], N[(N[(1.0 - N[(0.027777777777777776 * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(N[(y * y), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{if}\;y \leq 2.4 \cdot 10^{+16}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 1.2 \cdot 10^{+77}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left|0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right|\\

\mathbf{elif}\;y \leq 2.65 \cdot 10^{+153}:\\
\;\;\;\;\frac{1 - 0.027777777777777776 \cdot {y}^{4}}{1 + \left(y \cdot y\right) \cdot -0.16666666666666666}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 2.4e16 or 2.65e153 < y

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 88.9%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow288.9%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified88.9%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]

    if 2.4e16 < y < 1.1999999999999999e77

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 4.1%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow24.1%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified4.1%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in y around inf 4.1%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot {y}^{2}\right)} \]
    6. Step-by-step derivation
      1. unpow24.1%

        \[\leadsto 0.16666666666666666 \cdot \left(\cos x \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    7. Simplified4.1%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)} \]
    8. Taylor expanded in x around 0 26.9%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(-0.5 \cdot \left({y}^{2} \cdot {x}^{2}\right) + {y}^{2}\right)} \]
    9. Step-by-step derivation
      1. fma-def26.9%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\mathsf{fma}\left(-0.5, {y}^{2} \cdot {x}^{2}, {y}^{2}\right)} \]
      2. unpow226.9%

        \[\leadsto 0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \color{blue}{\left(y \cdot y\right)} \cdot {x}^{2}, {y}^{2}\right) \]
      3. *-commutative26.9%

        \[\leadsto 0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \color{blue}{{x}^{2} \cdot \left(y \cdot y\right)}, {y}^{2}\right) \]
      4. unpow226.9%

        \[\leadsto 0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \color{blue}{\left(x \cdot x\right)} \cdot \left(y \cdot y\right), {y}^{2}\right) \]
      5. unpow226.9%

        \[\leadsto 0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), \color{blue}{y \cdot y}\right) \]
    10. Simplified26.9%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt1.8%

        \[\leadsto \color{blue}{\sqrt{0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)} \cdot \sqrt{0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)}} \]
      2. sqrt-unprod21.1%

        \[\leadsto \color{blue}{\sqrt{\left(0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)\right)}} \]
      3. swap-sqr21.1%

        \[\leadsto \sqrt{\color{blue}{\left(0.16666666666666666 \cdot 0.16666666666666666\right) \cdot \left(\mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right) \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)\right)}} \]
      4. metadata-eval21.1%

        \[\leadsto \sqrt{\color{blue}{0.027777777777777776} \cdot \left(\mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right) \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)\right)} \]
      5. pow221.1%

        \[\leadsto \sqrt{0.027777777777777776 \cdot \color{blue}{{\left(\mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)\right)}^{2}}} \]
      6. fma-udef21.1%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\color{blue}{\left(-0.5 \cdot \left(\left(x \cdot x\right) \cdot \left(y \cdot y\right)\right) + y \cdot y\right)}}^{2}} \]
      7. +-commutative21.1%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\color{blue}{\left(y \cdot y + -0.5 \cdot \left(\left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)\right)}}^{2}} \]
      8. fma-def21.1%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\color{blue}{\left(\mathsf{fma}\left(y, y, -0.5 \cdot \left(\left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)\right)\right)}}^{2}} \]
      9. *-commutative21.1%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\left(\mathsf{fma}\left(y, y, \color{blue}{\left(\left(x \cdot x\right) \cdot \left(y \cdot y\right)\right) \cdot -0.5}\right)\right)}^{2}} \]
      10. *-commutative21.1%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\left(\mathsf{fma}\left(y, y, \color{blue}{\left(\left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)} \cdot -0.5\right)\right)}^{2}} \]
      11. pow221.1%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\left(\mathsf{fma}\left(y, y, \left(\color{blue}{{y}^{2}} \cdot \left(x \cdot x\right)\right) \cdot -0.5\right)\right)}^{2}} \]
      12. pow221.1%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\left(\mathsf{fma}\left(y, y, \left({y}^{2} \cdot \color{blue}{{x}^{2}}\right) \cdot -0.5\right)\right)}^{2}} \]
      13. pow-prod-down21.1%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\left(\mathsf{fma}\left(y, y, \color{blue}{{\left(y \cdot x\right)}^{2}} \cdot -0.5\right)\right)}^{2}} \]
    12. Applied egg-rr21.1%

      \[\leadsto \color{blue}{\sqrt{0.027777777777777776 \cdot {\left(\mathsf{fma}\left(y, y, {\left(y \cdot x\right)}^{2} \cdot -0.5\right)\right)}^{2}}} \]
    13. Step-by-step derivation
      1. metadata-eval21.1%

        \[\leadsto \sqrt{\color{blue}{\left(0.16666666666666666 \cdot 0.16666666666666666\right)} \cdot {\left(\mathsf{fma}\left(y, y, {\left(y \cdot x\right)}^{2} \cdot -0.5\right)\right)}^{2}} \]
      2. unpow221.1%

        \[\leadsto \sqrt{\left(0.16666666666666666 \cdot 0.16666666666666666\right) \cdot \color{blue}{\left(\mathsf{fma}\left(y, y, {\left(y \cdot x\right)}^{2} \cdot -0.5\right) \cdot \mathsf{fma}\left(y, y, {\left(y \cdot x\right)}^{2} \cdot -0.5\right)\right)}} \]
      3. swap-sqr21.1%

        \[\leadsto \sqrt{\color{blue}{\left(0.16666666666666666 \cdot \mathsf{fma}\left(y, y, {\left(y \cdot x\right)}^{2} \cdot -0.5\right)\right) \cdot \left(0.16666666666666666 \cdot \mathsf{fma}\left(y, y, {\left(y \cdot x\right)}^{2} \cdot -0.5\right)\right)}} \]
      4. rem-sqrt-square15.2%

        \[\leadsto \color{blue}{\left|0.16666666666666666 \cdot \mathsf{fma}\left(y, y, {\left(y \cdot x\right)}^{2} \cdot -0.5\right)\right|} \]
      5. fma-def15.2%

        \[\leadsto \left|0.16666666666666666 \cdot \color{blue}{\left(y \cdot y + {\left(y \cdot x\right)}^{2} \cdot -0.5\right)}\right| \]
      6. unpow215.2%

        \[\leadsto \left|0.16666666666666666 \cdot \left(\color{blue}{{y}^{2}} + {\left(y \cdot x\right)}^{2} \cdot -0.5\right)\right| \]
      7. distribute-lft-in15.2%

        \[\leadsto \left|\color{blue}{0.16666666666666666 \cdot {y}^{2} + 0.16666666666666666 \cdot \left({\left(y \cdot x\right)}^{2} \cdot -0.5\right)}\right| \]
      8. *-commutative15.2%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + 0.16666666666666666 \cdot \color{blue}{\left(-0.5 \cdot {\left(y \cdot x\right)}^{2}\right)}\right| \]
      9. associate-*r*15.2%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + \color{blue}{\left(0.16666666666666666 \cdot -0.5\right) \cdot {\left(y \cdot x\right)}^{2}}\right| \]
      10. metadata-eval15.2%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + \color{blue}{-0.08333333333333333} \cdot {\left(y \cdot x\right)}^{2}\right| \]
      11. unpow215.2%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left(\left(y \cdot x\right) \cdot \left(y \cdot x\right)\right)}\right| \]
      12. swap-sqr15.2%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left(\left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}\right| \]
      13. unpow215.2%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \left(\color{blue}{{y}^{2}} \cdot \left(x \cdot x\right)\right)\right| \]
      14. unpow215.2%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \left({y}^{2} \cdot \color{blue}{{x}^{2}}\right)\right| \]
      15. *-commutative15.2%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left({x}^{2} \cdot {y}^{2}\right)}\right| \]
      16. associate-*r*15.2%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + \color{blue}{\left(-0.08333333333333333 \cdot {x}^{2}\right) \cdot {y}^{2}}\right| \]
      17. distribute-rgt-out15.2%

        \[\leadsto \left|\color{blue}{{y}^{2} \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot {x}^{2}\right)}\right| \]
      18. unpow215.2%

        \[\leadsto \left|\color{blue}{\left(y \cdot y\right)} \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot {x}^{2}\right)\right| \]
    14. Simplified15.2%

      \[\leadsto \color{blue}{\left|\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\right|} \]

    if 1.1999999999999999e77 < y < 2.65e153

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 7.5%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow27.5%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified7.5%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in x around 0 4.5%

      \[\leadsto \color{blue}{1 + 0.16666666666666666 \cdot {y}^{2}} \]
    6. Step-by-step derivation
      1. +-commutative4.5%

        \[\leadsto \color{blue}{0.16666666666666666 \cdot {y}^{2} + 1} \]
      2. unpow24.5%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} + 1 \]
      3. associate-*r*4.5%

        \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot y\right) \cdot y} + 1 \]
      4. *-commutative4.5%

        \[\leadsto \color{blue}{y \cdot \left(0.16666666666666666 \cdot y\right)} + 1 \]
      5. fma-udef4.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 0.16666666666666666 \cdot y, 1\right)} \]
    7. Simplified4.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 0.16666666666666666 \cdot y, 1\right)} \]
    8. Step-by-step derivation
      1. fma-udef4.5%

        \[\leadsto \color{blue}{y \cdot \left(0.16666666666666666 \cdot y\right) + 1} \]
      2. +-commutative4.5%

        \[\leadsto \color{blue}{1 + y \cdot \left(0.16666666666666666 \cdot y\right)} \]
      3. flip-+60.0%

        \[\leadsto \color{blue}{\frac{1 \cdot 1 - \left(y \cdot \left(0.16666666666666666 \cdot y\right)\right) \cdot \left(y \cdot \left(0.16666666666666666 \cdot y\right)\right)}{1 - y \cdot \left(0.16666666666666666 \cdot y\right)}} \]
      4. metadata-eval60.0%

        \[\leadsto \frac{\color{blue}{1} - \left(y \cdot \left(0.16666666666666666 \cdot y\right)\right) \cdot \left(y \cdot \left(0.16666666666666666 \cdot y\right)\right)}{1 - y \cdot \left(0.16666666666666666 \cdot y\right)} \]
      5. div-sub60.0%

        \[\leadsto \color{blue}{\frac{1}{1 - y \cdot \left(0.16666666666666666 \cdot y\right)} - \frac{\left(y \cdot \left(0.16666666666666666 \cdot y\right)\right) \cdot \left(y \cdot \left(0.16666666666666666 \cdot y\right)\right)}{1 - y \cdot \left(0.16666666666666666 \cdot y\right)}} \]
      6. *-commutative60.0%

        \[\leadsto \frac{1}{1 - \color{blue}{\left(0.16666666666666666 \cdot y\right) \cdot y}} - \frac{\left(y \cdot \left(0.16666666666666666 \cdot y\right)\right) \cdot \left(y \cdot \left(0.16666666666666666 \cdot y\right)\right)}{1 - y \cdot \left(0.16666666666666666 \cdot y\right)} \]
      7. associate-*l*60.0%

        \[\leadsto \frac{1}{1 - \color{blue}{0.16666666666666666 \cdot \left(y \cdot y\right)}} - \frac{\left(y \cdot \left(0.16666666666666666 \cdot y\right)\right) \cdot \left(y \cdot \left(0.16666666666666666 \cdot y\right)\right)}{1 - y \cdot \left(0.16666666666666666 \cdot y\right)} \]
      8. pow260.0%

        \[\leadsto \frac{1}{1 - 0.16666666666666666 \cdot \left(y \cdot y\right)} - \frac{\color{blue}{{\left(y \cdot \left(0.16666666666666666 \cdot y\right)\right)}^{2}}}{1 - y \cdot \left(0.16666666666666666 \cdot y\right)} \]
      9. *-commutative60.0%

        \[\leadsto \frac{1}{1 - 0.16666666666666666 \cdot \left(y \cdot y\right)} - \frac{{\color{blue}{\left(\left(0.16666666666666666 \cdot y\right) \cdot y\right)}}^{2}}{1 - y \cdot \left(0.16666666666666666 \cdot y\right)} \]
      10. associate-*l*60.0%

        \[\leadsto \frac{1}{1 - 0.16666666666666666 \cdot \left(y \cdot y\right)} - \frac{{\color{blue}{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}}^{2}}{1 - y \cdot \left(0.16666666666666666 \cdot y\right)} \]
      11. *-commutative60.0%

        \[\leadsto \frac{1}{1 - 0.16666666666666666 \cdot \left(y \cdot y\right)} - \frac{{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}^{2}}{1 - \color{blue}{\left(0.16666666666666666 \cdot y\right) \cdot y}} \]
      12. associate-*l*60.0%

        \[\leadsto \frac{1}{1 - 0.16666666666666666 \cdot \left(y \cdot y\right)} - \frac{{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}^{2}}{1 - \color{blue}{0.16666666666666666 \cdot \left(y \cdot y\right)}} \]
    9. Applied egg-rr60.0%

      \[\leadsto \color{blue}{\frac{1}{1 - 0.16666666666666666 \cdot \left(y \cdot y\right)} - \frac{{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}^{2}}{1 - 0.16666666666666666 \cdot \left(y \cdot y\right)}} \]
    10. Step-by-step derivation
      1. div-sub60.0%

        \[\leadsto \color{blue}{\frac{1 - {\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}^{2}}{1 - 0.16666666666666666 \cdot \left(y \cdot y\right)}} \]
      2. unpow260.0%

        \[\leadsto \frac{1 - \color{blue}{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}}{1 - 0.16666666666666666 \cdot \left(y \cdot y\right)} \]
      3. swap-sqr60.0%

        \[\leadsto \frac{1 - \color{blue}{\left(0.16666666666666666 \cdot 0.16666666666666666\right) \cdot \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right)\right)}}{1 - 0.16666666666666666 \cdot \left(y \cdot y\right)} \]
      4. metadata-eval60.0%

        \[\leadsto \frac{1 - \color{blue}{0.027777777777777776} \cdot \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right)\right)}{1 - 0.16666666666666666 \cdot \left(y \cdot y\right)} \]
      5. associate-*r*60.0%

        \[\leadsto \frac{1 - 0.027777777777777776 \cdot \color{blue}{\left(\left(\left(y \cdot y\right) \cdot y\right) \cdot y\right)}}{1 - 0.16666666666666666 \cdot \left(y \cdot y\right)} \]
      6. unpow360.0%

        \[\leadsto \frac{1 - 0.027777777777777776 \cdot \left(\color{blue}{{y}^{3}} \cdot y\right)}{1 - 0.16666666666666666 \cdot \left(y \cdot y\right)} \]
      7. pow-plus60.0%

        \[\leadsto \frac{1 - 0.027777777777777776 \cdot \color{blue}{{y}^{\left(3 + 1\right)}}}{1 - 0.16666666666666666 \cdot \left(y \cdot y\right)} \]
      8. metadata-eval60.0%

        \[\leadsto \frac{1 - 0.027777777777777776 \cdot {y}^{\color{blue}{4}}}{1 - 0.16666666666666666 \cdot \left(y \cdot y\right)} \]
      9. sub-neg60.0%

        \[\leadsto \frac{1 - 0.027777777777777776 \cdot {y}^{4}}{\color{blue}{1 + \left(-0.16666666666666666 \cdot \left(y \cdot y\right)\right)}} \]
      10. *-commutative60.0%

        \[\leadsto \frac{1 - 0.027777777777777776 \cdot {y}^{4}}{1 + \left(-\color{blue}{\left(y \cdot y\right) \cdot 0.16666666666666666}\right)} \]
      11. distribute-rgt-neg-in60.0%

        \[\leadsto \frac{1 - 0.027777777777777776 \cdot {y}^{4}}{1 + \color{blue}{\left(y \cdot y\right) \cdot \left(-0.16666666666666666\right)}} \]
      12. metadata-eval60.0%

        \[\leadsto \frac{1 - 0.027777777777777776 \cdot {y}^{4}}{1 + \left(y \cdot y\right) \cdot \color{blue}{-0.16666666666666666}} \]
    11. Simplified60.0%

      \[\leadsto \color{blue}{\frac{1 - 0.027777777777777776 \cdot {y}^{4}}{1 + \left(y \cdot y\right) \cdot -0.16666666666666666}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification82.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.4 \cdot 10^{+16}:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+77}:\\ \;\;\;\;\left(y \cdot y\right) \cdot \left|0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right|\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{+153}:\\ \;\;\;\;\frac{1 - 0.027777777777777776 \cdot {y}^{4}}{1 + \left(y \cdot y\right) \cdot -0.16666666666666666}\\ \mathbf{else}:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \end{array} \]

Alternative 4: 81.4% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{if}\;y \leq 2400000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+77}:\\ \;\;\;\;\left(y \cdot y\right) \cdot \left|0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right|\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{+153}:\\ \;\;\;\;1 + \frac{0.027777777777777776 \cdot {y}^{4}}{y \cdot \left(y \cdot 0.16666666666666666\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y))))))
   (if (<= y 2400000000000.0)
     t_0
     (if (<= y 1.2e+77)
       (*
        (* y y)
        (fabs (+ 0.16666666666666666 (* -0.08333333333333333 (* x x)))))
       (if (<= y 2.65e+153)
         (+
          1.0
          (/
           (* 0.027777777777777776 (pow y 4.0))
           (* y (* y 0.16666666666666666))))
         t_0)))))
double code(double x, double y) {
	double t_0 = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	double tmp;
	if (y <= 2400000000000.0) {
		tmp = t_0;
	} else if (y <= 1.2e+77) {
		tmp = (y * y) * fabs((0.16666666666666666 + (-0.08333333333333333 * (x * x))));
	} else if (y <= 2.65e+153) {
		tmp = 1.0 + ((0.027777777777777776 * pow(y, 4.0)) / (y * (y * 0.16666666666666666)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = cos(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
    if (y <= 2400000000000.0d0) then
        tmp = t_0
    else if (y <= 1.2d+77) then
        tmp = (y * y) * abs((0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x))))
    else if (y <= 2.65d+153) then
        tmp = 1.0d0 + ((0.027777777777777776d0 * (y ** 4.0d0)) / (y * (y * 0.16666666666666666d0)))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = Math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	double tmp;
	if (y <= 2400000000000.0) {
		tmp = t_0;
	} else if (y <= 1.2e+77) {
		tmp = (y * y) * Math.abs((0.16666666666666666 + (-0.08333333333333333 * (x * x))));
	} else if (y <= 2.65e+153) {
		tmp = 1.0 + ((0.027777777777777776 * Math.pow(y, 4.0)) / (y * (y * 0.16666666666666666)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)))
	tmp = 0
	if y <= 2400000000000.0:
		tmp = t_0
	elif y <= 1.2e+77:
		tmp = (y * y) * math.fabs((0.16666666666666666 + (-0.08333333333333333 * (x * x))))
	elif y <= 2.65e+153:
		tmp = 1.0 + ((0.027777777777777776 * math.pow(y, 4.0)) / (y * (y * 0.16666666666666666)))
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))))
	tmp = 0.0
	if (y <= 2400000000000.0)
		tmp = t_0;
	elseif (y <= 1.2e+77)
		tmp = Float64(Float64(y * y) * abs(Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x)))));
	elseif (y <= 2.65e+153)
		tmp = Float64(1.0 + Float64(Float64(0.027777777777777776 * (y ^ 4.0)) / Float64(y * Float64(y * 0.16666666666666666))));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	tmp = 0.0;
	if (y <= 2400000000000.0)
		tmp = t_0;
	elseif (y <= 1.2e+77)
		tmp = (y * y) * abs((0.16666666666666666 + (-0.08333333333333333 * (x * x))));
	elseif (y <= 2.65e+153)
		tmp = 1.0 + ((0.027777777777777776 * (y ^ 4.0)) / (y * (y * 0.16666666666666666)));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[Cos[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 2400000000000.0], t$95$0, If[LessEqual[y, 1.2e+77], N[(N[(y * y), $MachinePrecision] * N[Abs[N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.65e+153], N[(1.0 + N[(N[(0.027777777777777776 * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision] / N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{if}\;y \leq 2400000000000:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 1.2 \cdot 10^{+77}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left|0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right|\\

\mathbf{elif}\;y \leq 2.65 \cdot 10^{+153}:\\
\;\;\;\;1 + \frac{0.027777777777777776 \cdot {y}^{4}}{y \cdot \left(y \cdot 0.16666666666666666\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 2.4e12 or 2.65e153 < y

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 88.9%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow288.9%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified88.9%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]

    if 2.4e12 < y < 1.1999999999999999e77

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 4.1%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow24.1%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified4.1%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in y around inf 4.1%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot {y}^{2}\right)} \]
    6. Step-by-step derivation
      1. unpow24.1%

        \[\leadsto 0.16666666666666666 \cdot \left(\cos x \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    7. Simplified4.1%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)} \]
    8. Taylor expanded in x around 0 26.9%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(-0.5 \cdot \left({y}^{2} \cdot {x}^{2}\right) + {y}^{2}\right)} \]
    9. Step-by-step derivation
      1. fma-def26.9%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\mathsf{fma}\left(-0.5, {y}^{2} \cdot {x}^{2}, {y}^{2}\right)} \]
      2. unpow226.9%

        \[\leadsto 0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \color{blue}{\left(y \cdot y\right)} \cdot {x}^{2}, {y}^{2}\right) \]
      3. *-commutative26.9%

        \[\leadsto 0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \color{blue}{{x}^{2} \cdot \left(y \cdot y\right)}, {y}^{2}\right) \]
      4. unpow226.9%

        \[\leadsto 0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \color{blue}{\left(x \cdot x\right)} \cdot \left(y \cdot y\right), {y}^{2}\right) \]
      5. unpow226.9%

        \[\leadsto 0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), \color{blue}{y \cdot y}\right) \]
    10. Simplified26.9%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt1.8%

        \[\leadsto \color{blue}{\sqrt{0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)} \cdot \sqrt{0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)}} \]
      2. sqrt-unprod21.1%

        \[\leadsto \color{blue}{\sqrt{\left(0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)\right)}} \]
      3. swap-sqr21.1%

        \[\leadsto \sqrt{\color{blue}{\left(0.16666666666666666 \cdot 0.16666666666666666\right) \cdot \left(\mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right) \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)\right)}} \]
      4. metadata-eval21.1%

        \[\leadsto \sqrt{\color{blue}{0.027777777777777776} \cdot \left(\mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right) \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)\right)} \]
      5. pow221.1%

        \[\leadsto \sqrt{0.027777777777777776 \cdot \color{blue}{{\left(\mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)\right)}^{2}}} \]
      6. fma-udef21.1%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\color{blue}{\left(-0.5 \cdot \left(\left(x \cdot x\right) \cdot \left(y \cdot y\right)\right) + y \cdot y\right)}}^{2}} \]
      7. +-commutative21.1%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\color{blue}{\left(y \cdot y + -0.5 \cdot \left(\left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)\right)}}^{2}} \]
      8. fma-def21.1%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\color{blue}{\left(\mathsf{fma}\left(y, y, -0.5 \cdot \left(\left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)\right)\right)}}^{2}} \]
      9. *-commutative21.1%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\left(\mathsf{fma}\left(y, y, \color{blue}{\left(\left(x \cdot x\right) \cdot \left(y \cdot y\right)\right) \cdot -0.5}\right)\right)}^{2}} \]
      10. *-commutative21.1%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\left(\mathsf{fma}\left(y, y, \color{blue}{\left(\left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)} \cdot -0.5\right)\right)}^{2}} \]
      11. pow221.1%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\left(\mathsf{fma}\left(y, y, \left(\color{blue}{{y}^{2}} \cdot \left(x \cdot x\right)\right) \cdot -0.5\right)\right)}^{2}} \]
      12. pow221.1%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\left(\mathsf{fma}\left(y, y, \left({y}^{2} \cdot \color{blue}{{x}^{2}}\right) \cdot -0.5\right)\right)}^{2}} \]
      13. pow-prod-down21.1%

        \[\leadsto \sqrt{0.027777777777777776 \cdot {\left(\mathsf{fma}\left(y, y, \color{blue}{{\left(y \cdot x\right)}^{2}} \cdot -0.5\right)\right)}^{2}} \]
    12. Applied egg-rr21.1%

      \[\leadsto \color{blue}{\sqrt{0.027777777777777776 \cdot {\left(\mathsf{fma}\left(y, y, {\left(y \cdot x\right)}^{2} \cdot -0.5\right)\right)}^{2}}} \]
    13. Step-by-step derivation
      1. metadata-eval21.1%

        \[\leadsto \sqrt{\color{blue}{\left(0.16666666666666666 \cdot 0.16666666666666666\right)} \cdot {\left(\mathsf{fma}\left(y, y, {\left(y \cdot x\right)}^{2} \cdot -0.5\right)\right)}^{2}} \]
      2. unpow221.1%

        \[\leadsto \sqrt{\left(0.16666666666666666 \cdot 0.16666666666666666\right) \cdot \color{blue}{\left(\mathsf{fma}\left(y, y, {\left(y \cdot x\right)}^{2} \cdot -0.5\right) \cdot \mathsf{fma}\left(y, y, {\left(y \cdot x\right)}^{2} \cdot -0.5\right)\right)}} \]
      3. swap-sqr21.1%

        \[\leadsto \sqrt{\color{blue}{\left(0.16666666666666666 \cdot \mathsf{fma}\left(y, y, {\left(y \cdot x\right)}^{2} \cdot -0.5\right)\right) \cdot \left(0.16666666666666666 \cdot \mathsf{fma}\left(y, y, {\left(y \cdot x\right)}^{2} \cdot -0.5\right)\right)}} \]
      4. rem-sqrt-square15.2%

        \[\leadsto \color{blue}{\left|0.16666666666666666 \cdot \mathsf{fma}\left(y, y, {\left(y \cdot x\right)}^{2} \cdot -0.5\right)\right|} \]
      5. fma-def15.2%

        \[\leadsto \left|0.16666666666666666 \cdot \color{blue}{\left(y \cdot y + {\left(y \cdot x\right)}^{2} \cdot -0.5\right)}\right| \]
      6. unpow215.2%

        \[\leadsto \left|0.16666666666666666 \cdot \left(\color{blue}{{y}^{2}} + {\left(y \cdot x\right)}^{2} \cdot -0.5\right)\right| \]
      7. distribute-lft-in15.2%

        \[\leadsto \left|\color{blue}{0.16666666666666666 \cdot {y}^{2} + 0.16666666666666666 \cdot \left({\left(y \cdot x\right)}^{2} \cdot -0.5\right)}\right| \]
      8. *-commutative15.2%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + 0.16666666666666666 \cdot \color{blue}{\left(-0.5 \cdot {\left(y \cdot x\right)}^{2}\right)}\right| \]
      9. associate-*r*15.2%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + \color{blue}{\left(0.16666666666666666 \cdot -0.5\right) \cdot {\left(y \cdot x\right)}^{2}}\right| \]
      10. metadata-eval15.2%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + \color{blue}{-0.08333333333333333} \cdot {\left(y \cdot x\right)}^{2}\right| \]
      11. unpow215.2%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left(\left(y \cdot x\right) \cdot \left(y \cdot x\right)\right)}\right| \]
      12. swap-sqr15.2%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left(\left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}\right| \]
      13. unpow215.2%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \left(\color{blue}{{y}^{2}} \cdot \left(x \cdot x\right)\right)\right| \]
      14. unpow215.2%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \left({y}^{2} \cdot \color{blue}{{x}^{2}}\right)\right| \]
      15. *-commutative15.2%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left({x}^{2} \cdot {y}^{2}\right)}\right| \]
      16. associate-*r*15.2%

        \[\leadsto \left|0.16666666666666666 \cdot {y}^{2} + \color{blue}{\left(-0.08333333333333333 \cdot {x}^{2}\right) \cdot {y}^{2}}\right| \]
      17. distribute-rgt-out15.2%

        \[\leadsto \left|\color{blue}{{y}^{2} \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot {x}^{2}\right)}\right| \]
      18. unpow215.2%

        \[\leadsto \left|\color{blue}{\left(y \cdot y\right)} \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot {x}^{2}\right)\right| \]
    14. Simplified15.2%

      \[\leadsto \color{blue}{\left|\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\right|} \]

    if 1.1999999999999999e77 < y < 2.65e153

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 7.5%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow27.5%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified7.5%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in x around 0 4.5%

      \[\leadsto \color{blue}{1 + 0.16666666666666666 \cdot {y}^{2}} \]
    6. Step-by-step derivation
      1. +-commutative4.5%

        \[\leadsto \color{blue}{0.16666666666666666 \cdot {y}^{2} + 1} \]
      2. unpow24.5%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} + 1 \]
    7. Simplified4.5%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(y \cdot y\right) + 1} \]
    8. Step-by-step derivation
      1. add-log-exp60.0%

        \[\leadsto \color{blue}{\log \left(e^{0.16666666666666666 \cdot \left(y \cdot y\right)}\right)} + 1 \]
      2. *-un-lft-identity60.0%

        \[\leadsto \log \color{blue}{\left(1 \cdot e^{0.16666666666666666 \cdot \left(y \cdot y\right)}\right)} + 1 \]
      3. log-prod60.0%

        \[\leadsto \color{blue}{\left(\log 1 + \log \left(e^{0.16666666666666666 \cdot \left(y \cdot y\right)}\right)\right)} + 1 \]
      4. metadata-eval60.0%

        \[\leadsto \left(\color{blue}{0} + \log \left(e^{0.16666666666666666 \cdot \left(y \cdot y\right)}\right)\right) + 1 \]
      5. add-log-exp4.5%

        \[\leadsto \left(0 + \color{blue}{0.16666666666666666 \cdot \left(y \cdot y\right)}\right) + 1 \]
      6. associate-*r*4.5%

        \[\leadsto \left(0 + \color{blue}{\left(0.16666666666666666 \cdot y\right) \cdot y}\right) + 1 \]
      7. *-commutative4.5%

        \[\leadsto \left(0 + \color{blue}{y \cdot \left(0.16666666666666666 \cdot y\right)}\right) + 1 \]
    9. Applied egg-rr4.5%

      \[\leadsto \color{blue}{\left(0 + y \cdot \left(0.16666666666666666 \cdot y\right)\right)} + 1 \]
    10. Step-by-step derivation
      1. +-rgt-identity4.5%

        \[\leadsto \left(0 + \color{blue}{\left(y \cdot \left(0.16666666666666666 \cdot y\right) + 0\right)}\right) + 1 \]
      2. flip-+60.0%

        \[\leadsto \left(0 + \color{blue}{\frac{\left(y \cdot \left(0.16666666666666666 \cdot y\right)\right) \cdot \left(y \cdot \left(0.16666666666666666 \cdot y\right)\right) - 0 \cdot 0}{y \cdot \left(0.16666666666666666 \cdot y\right) - 0}}\right) + 1 \]
      3. metadata-eval60.0%

        \[\leadsto \left(0 + \frac{\left(y \cdot \left(0.16666666666666666 \cdot y\right)\right) \cdot \left(y \cdot \left(0.16666666666666666 \cdot y\right)\right) - \color{blue}{0}}{y \cdot \left(0.16666666666666666 \cdot y\right) - 0}\right) + 1 \]
      4. mul0-lft60.0%

        \[\leadsto \left(0 + \frac{\left(y \cdot \left(0.16666666666666666 \cdot y\right)\right) \cdot \left(y \cdot \left(0.16666666666666666 \cdot y\right)\right) - \color{blue}{0 \cdot \left(y \cdot \left(0.16666666666666666 \cdot y\right)\right)}}{y \cdot \left(0.16666666666666666 \cdot y\right) - 0}\right) + 1 \]
      5. cancel-sign-sub-inv60.0%

        \[\leadsto \left(0 + \frac{\color{blue}{\left(y \cdot \left(0.16666666666666666 \cdot y\right)\right) \cdot \left(y \cdot \left(0.16666666666666666 \cdot y\right)\right) + \left(-0\right) \cdot \left(y \cdot \left(0.16666666666666666 \cdot y\right)\right)}}{y \cdot \left(0.16666666666666666 \cdot y\right) - 0}\right) + 1 \]
      6. metadata-eval60.0%

        \[\leadsto \left(0 + \frac{\left(y \cdot \left(0.16666666666666666 \cdot y\right)\right) \cdot \left(y \cdot \left(0.16666666666666666 \cdot y\right)\right) + \color{blue}{0} \cdot \left(y \cdot \left(0.16666666666666666 \cdot y\right)\right)}{y \cdot \left(0.16666666666666666 \cdot y\right) - 0}\right) + 1 \]
      7. distribute-rgt-in60.0%

        \[\leadsto \left(0 + \frac{\color{blue}{\left(y \cdot \left(0.16666666666666666 \cdot y\right)\right) \cdot \left(y \cdot \left(0.16666666666666666 \cdot y\right) + 0\right)}}{y \cdot \left(0.16666666666666666 \cdot y\right) - 0}\right) + 1 \]
      8. +-rgt-identity60.0%

        \[\leadsto \left(0 + \frac{\left(y \cdot \left(0.16666666666666666 \cdot y\right)\right) \cdot \color{blue}{\left(y \cdot \left(0.16666666666666666 \cdot y\right)\right)}}{y \cdot \left(0.16666666666666666 \cdot y\right) - 0}\right) + 1 \]
      9. pow260.0%

        \[\leadsto \left(0 + \frac{\color{blue}{{\left(y \cdot \left(0.16666666666666666 \cdot y\right)\right)}^{2}}}{y \cdot \left(0.16666666666666666 \cdot y\right) - 0}\right) + 1 \]
      10. *-commutative60.0%

        \[\leadsto \left(0 + \frac{{\color{blue}{\left(\left(0.16666666666666666 \cdot y\right) \cdot y\right)}}^{2}}{y \cdot \left(0.16666666666666666 \cdot y\right) - 0}\right) + 1 \]
      11. associate-*l*60.0%

        \[\leadsto \left(0 + \frac{{\color{blue}{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}}^{2}}{y \cdot \left(0.16666666666666666 \cdot y\right) - 0}\right) + 1 \]
      12. fma-neg60.0%

        \[\leadsto \left(0 + \frac{{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}^{2}}{\color{blue}{\mathsf{fma}\left(y, 0.16666666666666666 \cdot y, -0\right)}}\right) + 1 \]
      13. metadata-eval60.0%

        \[\leadsto \left(0 + \frac{{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}^{2}}{\mathsf{fma}\left(y, 0.16666666666666666 \cdot y, \color{blue}{0}\right)}\right) + 1 \]
      14. fma-def60.0%

        \[\leadsto \left(0 + \frac{{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}^{2}}{\color{blue}{y \cdot \left(0.16666666666666666 \cdot y\right) + 0}}\right) + 1 \]
      15. +-rgt-identity60.0%

        \[\leadsto \left(0 + \frac{{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}^{2}}{\color{blue}{y \cdot \left(0.16666666666666666 \cdot y\right)}}\right) + 1 \]
      16. *-commutative60.0%

        \[\leadsto \left(0 + \frac{{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}^{2}}{\color{blue}{\left(0.16666666666666666 \cdot y\right) \cdot y}}\right) + 1 \]
      17. associate-*l*60.0%

        \[\leadsto \left(0 + \frac{{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}^{2}}{\color{blue}{0.16666666666666666 \cdot \left(y \cdot y\right)}}\right) + 1 \]
    11. Applied egg-rr60.0%

      \[\leadsto \left(0 + \color{blue}{\frac{{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}^{2}}{0.16666666666666666 \cdot \left(y \cdot y\right)}}\right) + 1 \]
    12. Step-by-step derivation
      1. unpow260.0%

        \[\leadsto \left(0 + \frac{\color{blue}{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}}{0.16666666666666666 \cdot \left(y \cdot y\right)}\right) + 1 \]
      2. swap-sqr60.0%

        \[\leadsto \left(0 + \frac{\color{blue}{\left(0.16666666666666666 \cdot 0.16666666666666666\right) \cdot \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right)\right)}}{0.16666666666666666 \cdot \left(y \cdot y\right)}\right) + 1 \]
      3. metadata-eval60.0%

        \[\leadsto \left(0 + \frac{\color{blue}{0.027777777777777776} \cdot \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right)\right)}{0.16666666666666666 \cdot \left(y \cdot y\right)}\right) + 1 \]
      4. associate-*r*60.0%

        \[\leadsto \left(0 + \frac{0.027777777777777776 \cdot \color{blue}{\left(\left(\left(y \cdot y\right) \cdot y\right) \cdot y\right)}}{0.16666666666666666 \cdot \left(y \cdot y\right)}\right) + 1 \]
      5. unpow360.0%

        \[\leadsto \left(0 + \frac{0.027777777777777776 \cdot \left(\color{blue}{{y}^{3}} \cdot y\right)}{0.16666666666666666 \cdot \left(y \cdot y\right)}\right) + 1 \]
      6. pow-plus60.0%

        \[\leadsto \left(0 + \frac{0.027777777777777776 \cdot \color{blue}{{y}^{\left(3 + 1\right)}}}{0.16666666666666666 \cdot \left(y \cdot y\right)}\right) + 1 \]
      7. metadata-eval60.0%

        \[\leadsto \left(0 + \frac{0.027777777777777776 \cdot {y}^{\color{blue}{4}}}{0.16666666666666666 \cdot \left(y \cdot y\right)}\right) + 1 \]
      8. associate-*r*60.0%

        \[\leadsto \left(0 + \frac{0.027777777777777776 \cdot {y}^{4}}{\color{blue}{\left(0.16666666666666666 \cdot y\right) \cdot y}}\right) + 1 \]
      9. *-commutative60.0%

        \[\leadsto \left(0 + \frac{0.027777777777777776 \cdot {y}^{4}}{\color{blue}{y \cdot \left(0.16666666666666666 \cdot y\right)}}\right) + 1 \]
    13. Simplified60.0%

      \[\leadsto \left(0 + \color{blue}{\frac{0.027777777777777776 \cdot {y}^{4}}{y \cdot \left(0.16666666666666666 \cdot y\right)}}\right) + 1 \]
  3. Recombined 3 regimes into one program.
  4. Final simplification82.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2400000000000:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+77}:\\ \;\;\;\;\left(y \cdot y\right) \cdot \left|0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right|\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{+153}:\\ \;\;\;\;1 + \frac{0.027777777777777776 \cdot {y}^{4}}{y \cdot \left(y \cdot 0.16666666666666666\right)}\\ \mathbf{else}:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \end{array} \]

Alternative 5: 78.1% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 2400:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+154}:\\ \;\;\;\;\mathsf{fma}\left(y, y \cdot 0.16666666666666666, 1\right) \cdot \left(1 + \left(x \cdot x\right) \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 2400.0)
   (* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y))))
   (if (<= y 1.4e+154)
     (* (fma y (* y 0.16666666666666666) 1.0) (+ 1.0 (* (* x x) -0.5)))
     (* 0.16666666666666666 (* (cos x) (* y y))))))
double code(double x, double y) {
	double tmp;
	if (y <= 2400.0) {
		tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	} else if (y <= 1.4e+154) {
		tmp = fma(y, (y * 0.16666666666666666), 1.0) * (1.0 + ((x * x) * -0.5));
	} else {
		tmp = 0.16666666666666666 * (cos(x) * (y * y));
	}
	return tmp;
}
function code(x, y)
	tmp = 0.0
	if (y <= 2400.0)
		tmp = Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))));
	elseif (y <= 1.4e+154)
		tmp = Float64(fma(y, Float64(y * 0.16666666666666666), 1.0) * Float64(1.0 + Float64(Float64(x * x) * -0.5)));
	else
		tmp = Float64(0.16666666666666666 * Float64(cos(x) * Float64(y * y)));
	end
	return tmp
end
code[x_, y_] := If[LessEqual[y, 2400.0], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e+154], N[(N[(y * N[(y * 0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision] * N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(N[Cos[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 2400:\\
\;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\

\mathbf{elif}\;y \leq 1.4 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{fma}\left(y, y \cdot 0.16666666666666666, 1\right) \cdot \left(1 + \left(x \cdot x\right) \cdot -0.5\right)\\

\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\


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

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 87.9%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow287.9%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified87.9%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]

    if 2400 < y < 1.4e154

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 5.8%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow25.8%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified5.8%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in x around 0 32.7%

      \[\leadsto \color{blue}{1 + \left(-0.5 \cdot \left(\left(1 + 0.16666666666666666 \cdot {y}^{2}\right) \cdot {x}^{2}\right) + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    6. Step-by-step derivation
      1. +-commutative32.7%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \left(\left(1 + 0.16666666666666666 \cdot {y}^{2}\right) \cdot {x}^{2}\right) + 0.16666666666666666 \cdot {y}^{2}\right) + 1} \]
      2. associate-+l+32.7%

        \[\leadsto \color{blue}{-0.5 \cdot \left(\left(1 + 0.16666666666666666 \cdot {y}^{2}\right) \cdot {x}^{2}\right) + \left(0.16666666666666666 \cdot {y}^{2} + 1\right)} \]
      3. *-commutative32.7%

        \[\leadsto \color{blue}{\left(\left(1 + 0.16666666666666666 \cdot {y}^{2}\right) \cdot {x}^{2}\right) \cdot -0.5} + \left(0.16666666666666666 \cdot {y}^{2} + 1\right) \]
      4. associate-*l*32.7%

        \[\leadsto \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right) \cdot \left({x}^{2} \cdot -0.5\right)} + \left(0.16666666666666666 \cdot {y}^{2} + 1\right) \]
      5. +-commutative32.7%

        \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot {y}^{2} + 1\right)} \cdot \left({x}^{2} \cdot -0.5\right) + \left(0.16666666666666666 \cdot {y}^{2} + 1\right) \]
      6. unpow232.7%

        \[\leadsto \left(0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} + 1\right) \cdot \left({x}^{2} \cdot -0.5\right) + \left(0.16666666666666666 \cdot {y}^{2} + 1\right) \]
      7. associate-*r*32.7%

        \[\leadsto \left(\color{blue}{\left(0.16666666666666666 \cdot y\right) \cdot y} + 1\right) \cdot \left({x}^{2} \cdot -0.5\right) + \left(0.16666666666666666 \cdot {y}^{2} + 1\right) \]
      8. *-commutative32.7%

        \[\leadsto \left(\color{blue}{y \cdot \left(0.16666666666666666 \cdot y\right)} + 1\right) \cdot \left({x}^{2} \cdot -0.5\right) + \left(0.16666666666666666 \cdot {y}^{2} + 1\right) \]
      9. fma-udef32.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 0.16666666666666666 \cdot y, 1\right)} \cdot \left({x}^{2} \cdot -0.5\right) + \left(0.16666666666666666 \cdot {y}^{2} + 1\right) \]
      10. unpow232.7%

        \[\leadsto \mathsf{fma}\left(y, 0.16666666666666666 \cdot y, 1\right) \cdot \left({x}^{2} \cdot -0.5\right) + \left(0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} + 1\right) \]
      11. associate-*r*32.7%

        \[\leadsto \mathsf{fma}\left(y, 0.16666666666666666 \cdot y, 1\right) \cdot \left({x}^{2} \cdot -0.5\right) + \left(\color{blue}{\left(0.16666666666666666 \cdot y\right) \cdot y} + 1\right) \]
      12. *-commutative32.7%

        \[\leadsto \mathsf{fma}\left(y, 0.16666666666666666 \cdot y, 1\right) \cdot \left({x}^{2} \cdot -0.5\right) + \left(\color{blue}{y \cdot \left(0.16666666666666666 \cdot y\right)} + 1\right) \]
      13. fma-udef32.7%

        \[\leadsto \mathsf{fma}\left(y, 0.16666666666666666 \cdot y, 1\right) \cdot \left({x}^{2} \cdot -0.5\right) + \color{blue}{\mathsf{fma}\left(y, 0.16666666666666666 \cdot y, 1\right)} \]
      14. *-rgt-identity32.7%

        \[\leadsto \mathsf{fma}\left(y, 0.16666666666666666 \cdot y, 1\right) \cdot \left({x}^{2} \cdot -0.5\right) + \color{blue}{\mathsf{fma}\left(y, 0.16666666666666666 \cdot y, 1\right) \cdot 1} \]
      15. distribute-lft-out32.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 0.16666666666666666 \cdot y, 1\right) \cdot \left({x}^{2} \cdot -0.5 + 1\right)} \]
      16. *-commutative32.7%

        \[\leadsto \mathsf{fma}\left(y, 0.16666666666666666 \cdot y, 1\right) \cdot \left(\color{blue}{-0.5 \cdot {x}^{2}} + 1\right) \]
      17. unpow232.7%

        \[\leadsto \mathsf{fma}\left(y, 0.16666666666666666 \cdot y, 1\right) \cdot \left(-0.5 \cdot \color{blue}{\left(x \cdot x\right)} + 1\right) \]
    7. Simplified32.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 0.16666666666666666 \cdot y, 1\right) \cdot \left(-0.5 \cdot \left(x \cdot x\right) + 1\right)} \]

    if 1.4e154 < y

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 100.0%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow2100.0%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified100.0%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in y around inf 100.0%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot {y}^{2}\right)} \]
    6. Step-by-step derivation
      1. unpow2100.0%

        \[\leadsto 0.16666666666666666 \cdot \left(\cos x \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification82.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2400:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+154}:\\ \;\;\;\;\mathsf{fma}\left(y, y \cdot 0.16666666666666666, 1\right) \cdot \left(1 + \left(x \cdot x\right) \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\ \end{array} \]

Alternative 6: 65.1% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 380:\\ \;\;\;\;\cos x\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+154}:\\ \;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 380.0)
   (cos x)
   (if (<= y 1.4e+154)
     (* (* y y) (+ 0.16666666666666666 (* -0.08333333333333333 (* x x))))
     (* 0.16666666666666666 (* (cos x) (* y y))))))
double code(double x, double y) {
	double tmp;
	if (y <= 380.0) {
		tmp = cos(x);
	} else if (y <= 1.4e+154) {
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
	} else {
		tmp = 0.16666666666666666 * (cos(x) * (y * y));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 380.0d0) then
        tmp = cos(x)
    else if (y <= 1.4d+154) then
        tmp = (y * y) * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x)))
    else
        tmp = 0.16666666666666666d0 * (cos(x) * (y * y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= 380.0) {
		tmp = Math.cos(x);
	} else if (y <= 1.4e+154) {
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
	} else {
		tmp = 0.16666666666666666 * (Math.cos(x) * (y * y));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 380.0:
		tmp = math.cos(x)
	elif y <= 1.4e+154:
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)))
	else:
		tmp = 0.16666666666666666 * (math.cos(x) * (y * y))
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 380.0)
		tmp = cos(x);
	elseif (y <= 1.4e+154)
		tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x))));
	else
		tmp = Float64(0.16666666666666666 * Float64(cos(x) * Float64(y * y)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 380.0)
		tmp = cos(x);
	elseif (y <= 1.4e+154)
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
	else
		tmp = 0.16666666666666666 * (cos(x) * (y * y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 380.0], N[Cos[x], $MachinePrecision], If[LessEqual[y, 1.4e+154], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(N[Cos[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 380:\\
\;\;\;\;\cos x\\

\mathbf{elif}\;y \leq 1.4 \cdot 10^{+154}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\


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

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 87.9%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow287.9%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified87.9%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in y around 0 70.2%

      \[\leadsto \color{blue}{\cos x} \]

    if 380 < y < 1.4e154

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 5.8%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow25.8%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified5.8%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in y around inf 5.8%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot {y}^{2}\right)} \]
    6. Step-by-step derivation
      1. unpow25.8%

        \[\leadsto 0.16666666666666666 \cdot \left(\cos x \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
      2. *-commutative5.8%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(\left(y \cdot y\right) \cdot \cos x\right)} \]
      3. associate-*l*5.8%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot \left(y \cdot \cos x\right)\right)} \]
      4. associate-*r*5.8%

        \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot y\right) \cdot \left(y \cdot \cos x\right)} \]
      5. *-commutative5.8%

        \[\leadsto \color{blue}{\left(y \cdot 0.16666666666666666\right)} \cdot \left(y \cdot \cos x\right) \]
      6. associate-*l*5.8%

        \[\leadsto \color{blue}{y \cdot \left(0.16666666666666666 \cdot \left(y \cdot \cos x\right)\right)} \]
    7. Simplified5.8%

      \[\leadsto \color{blue}{y \cdot \left(0.16666666666666666 \cdot \left(y \cdot \cos x\right)\right)} \]
    8. Taylor expanded in x around 0 32.7%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \left({y}^{2} \cdot {x}^{2}\right)} \]
    9. Step-by-step derivation
      1. *-commutative32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left({x}^{2} \cdot {y}^{2}\right)} \]
      2. metadata-eval32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \color{blue}{\left(0.16666666666666666 \cdot -0.5\right)} \cdot \left({x}^{2} \cdot {y}^{2}\right) \]
      3. *-commutative32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \left(0.16666666666666666 \cdot -0.5\right) \cdot \color{blue}{\left({y}^{2} \cdot {x}^{2}\right)} \]
      4. unpow232.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \left(0.16666666666666666 \cdot -0.5\right) \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot {x}^{2}\right) \]
      5. unpow232.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \left(0.16666666666666666 \cdot -0.5\right) \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(x \cdot x\right)}\right) \]
      6. swap-sqr32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \left(0.16666666666666666 \cdot -0.5\right) \cdot \color{blue}{\left(\left(y \cdot x\right) \cdot \left(y \cdot x\right)\right)} \]
      7. unpow232.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \left(0.16666666666666666 \cdot -0.5\right) \cdot \color{blue}{{\left(y \cdot x\right)}^{2}} \]
      8. associate-*r*32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \color{blue}{0.16666666666666666 \cdot \left(-0.5 \cdot {\left(y \cdot x\right)}^{2}\right)} \]
      9. *-commutative32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + 0.16666666666666666 \cdot \color{blue}{\left({\left(y \cdot x\right)}^{2} \cdot -0.5\right)} \]
      10. *-commutative32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + 0.16666666666666666 \cdot \color{blue}{\left(-0.5 \cdot {\left(y \cdot x\right)}^{2}\right)} \]
      11. associate-*r*32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \color{blue}{\left(0.16666666666666666 \cdot -0.5\right) \cdot {\left(y \cdot x\right)}^{2}} \]
      12. metadata-eval32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \color{blue}{-0.08333333333333333} \cdot {\left(y \cdot x\right)}^{2} \]
      13. unpow232.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left(\left(y \cdot x\right) \cdot \left(y \cdot x\right)\right)} \]
      14. swap-sqr32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left(\left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)} \]
      15. unpow232.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \left(\color{blue}{{y}^{2}} \cdot \left(x \cdot x\right)\right) \]
      16. unpow232.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \left({y}^{2} \cdot \color{blue}{{x}^{2}}\right) \]
      17. *-commutative32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left({x}^{2} \cdot {y}^{2}\right)} \]
      18. associate-*r*32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \color{blue}{\left(-0.08333333333333333 \cdot {x}^{2}\right) \cdot {y}^{2}} \]
      19. distribute-rgt-out32.7%

        \[\leadsto \color{blue}{{y}^{2} \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot {x}^{2}\right)} \]
      20. unpow232.7%

        \[\leadsto \color{blue}{\left(y \cdot y\right)} \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot {x}^{2}\right) \]
    10. Simplified32.7%

      \[\leadsto \color{blue}{\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)} \]

    if 1.4e154 < y

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 100.0%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow2100.0%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified100.0%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in y around inf 100.0%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot {y}^{2}\right)} \]
    6. Step-by-step derivation
      1. unpow2100.0%

        \[\leadsto 0.16666666666666666 \cdot \left(\cos x \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification69.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 380:\\ \;\;\;\;\cos x\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+154}:\\ \;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\ \end{array} \]

Alternative 7: 78.1% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 15000:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+154}:\\ \;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 15000.0)
   (* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y))))
   (if (<= y 1.4e+154)
     (* (* y y) (+ 0.16666666666666666 (* -0.08333333333333333 (* x x))))
     (* 0.16666666666666666 (* (cos x) (* y y))))))
double code(double x, double y) {
	double tmp;
	if (y <= 15000.0) {
		tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	} else if (y <= 1.4e+154) {
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
	} else {
		tmp = 0.16666666666666666 * (cos(x) * (y * y));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 15000.0d0) then
        tmp = cos(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
    else if (y <= 1.4d+154) then
        tmp = (y * y) * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x)))
    else
        tmp = 0.16666666666666666d0 * (cos(x) * (y * y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= 15000.0) {
		tmp = Math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	} else if (y <= 1.4e+154) {
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
	} else {
		tmp = 0.16666666666666666 * (Math.cos(x) * (y * y));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 15000.0:
		tmp = math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)))
	elif y <= 1.4e+154:
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)))
	else:
		tmp = 0.16666666666666666 * (math.cos(x) * (y * y))
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 15000.0)
		tmp = Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))));
	elseif (y <= 1.4e+154)
		tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x))));
	else
		tmp = Float64(0.16666666666666666 * Float64(cos(x) * Float64(y * y)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 15000.0)
		tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	elseif (y <= 1.4e+154)
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
	else
		tmp = 0.16666666666666666 * (cos(x) * (y * y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 15000.0], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e+154], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(N[Cos[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 15000:\\
\;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\

\mathbf{elif}\;y \leq 1.4 \cdot 10^{+154}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\


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

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 87.9%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow287.9%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified87.9%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]

    if 15000 < y < 1.4e154

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 5.8%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow25.8%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified5.8%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in y around inf 5.8%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot {y}^{2}\right)} \]
    6. Step-by-step derivation
      1. unpow25.8%

        \[\leadsto 0.16666666666666666 \cdot \left(\cos x \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
      2. *-commutative5.8%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(\left(y \cdot y\right) \cdot \cos x\right)} \]
      3. associate-*l*5.8%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot \left(y \cdot \cos x\right)\right)} \]
      4. associate-*r*5.8%

        \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot y\right) \cdot \left(y \cdot \cos x\right)} \]
      5. *-commutative5.8%

        \[\leadsto \color{blue}{\left(y \cdot 0.16666666666666666\right)} \cdot \left(y \cdot \cos x\right) \]
      6. associate-*l*5.8%

        \[\leadsto \color{blue}{y \cdot \left(0.16666666666666666 \cdot \left(y \cdot \cos x\right)\right)} \]
    7. Simplified5.8%

      \[\leadsto \color{blue}{y \cdot \left(0.16666666666666666 \cdot \left(y \cdot \cos x\right)\right)} \]
    8. Taylor expanded in x around 0 32.7%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \left({y}^{2} \cdot {x}^{2}\right)} \]
    9. Step-by-step derivation
      1. *-commutative32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left({x}^{2} \cdot {y}^{2}\right)} \]
      2. metadata-eval32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \color{blue}{\left(0.16666666666666666 \cdot -0.5\right)} \cdot \left({x}^{2} \cdot {y}^{2}\right) \]
      3. *-commutative32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \left(0.16666666666666666 \cdot -0.5\right) \cdot \color{blue}{\left({y}^{2} \cdot {x}^{2}\right)} \]
      4. unpow232.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \left(0.16666666666666666 \cdot -0.5\right) \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot {x}^{2}\right) \]
      5. unpow232.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \left(0.16666666666666666 \cdot -0.5\right) \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(x \cdot x\right)}\right) \]
      6. swap-sqr32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \left(0.16666666666666666 \cdot -0.5\right) \cdot \color{blue}{\left(\left(y \cdot x\right) \cdot \left(y \cdot x\right)\right)} \]
      7. unpow232.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \left(0.16666666666666666 \cdot -0.5\right) \cdot \color{blue}{{\left(y \cdot x\right)}^{2}} \]
      8. associate-*r*32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \color{blue}{0.16666666666666666 \cdot \left(-0.5 \cdot {\left(y \cdot x\right)}^{2}\right)} \]
      9. *-commutative32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + 0.16666666666666666 \cdot \color{blue}{\left({\left(y \cdot x\right)}^{2} \cdot -0.5\right)} \]
      10. *-commutative32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + 0.16666666666666666 \cdot \color{blue}{\left(-0.5 \cdot {\left(y \cdot x\right)}^{2}\right)} \]
      11. associate-*r*32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \color{blue}{\left(0.16666666666666666 \cdot -0.5\right) \cdot {\left(y \cdot x\right)}^{2}} \]
      12. metadata-eval32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \color{blue}{-0.08333333333333333} \cdot {\left(y \cdot x\right)}^{2} \]
      13. unpow232.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left(\left(y \cdot x\right) \cdot \left(y \cdot x\right)\right)} \]
      14. swap-sqr32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left(\left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)} \]
      15. unpow232.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \left(\color{blue}{{y}^{2}} \cdot \left(x \cdot x\right)\right) \]
      16. unpow232.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \left({y}^{2} \cdot \color{blue}{{x}^{2}}\right) \]
      17. *-commutative32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left({x}^{2} \cdot {y}^{2}\right)} \]
      18. associate-*r*32.7%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \color{blue}{\left(-0.08333333333333333 \cdot {x}^{2}\right) \cdot {y}^{2}} \]
      19. distribute-rgt-out32.7%

        \[\leadsto \color{blue}{{y}^{2} \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot {x}^{2}\right)} \]
      20. unpow232.7%

        \[\leadsto \color{blue}{\left(y \cdot y\right)} \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot {x}^{2}\right) \]
    10. Simplified32.7%

      \[\leadsto \color{blue}{\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)} \]

    if 1.4e154 < y

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 100.0%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow2100.0%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified100.0%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in y around inf 100.0%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot {y}^{2}\right)} \]
    6. Step-by-step derivation
      1. unpow2100.0%

        \[\leadsto 0.16666666666666666 \cdot \left(\cos x \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification82.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 15000:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+154}:\\ \;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\ \end{array} \]

Alternative 8: 62.0% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 920:\\ \;\;\;\;\cos x\\ \mathbf{elif}\;y \leq 10^{+165}:\\ \;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 920.0)
   (cos x)
   (if (<= y 1e+165)
     (* (* y y) (+ 0.16666666666666666 (* -0.08333333333333333 (* x x))))
     (+ 1.0 (* 0.16666666666666666 (* y y))))))
double code(double x, double y) {
	double tmp;
	if (y <= 920.0) {
		tmp = cos(x);
	} else if (y <= 1e+165) {
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
	} else {
		tmp = 1.0 + (0.16666666666666666 * (y * y));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 920.0d0) then
        tmp = cos(x)
    else if (y <= 1d+165) then
        tmp = (y * y) * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x)))
    else
        tmp = 1.0d0 + (0.16666666666666666d0 * (y * y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= 920.0) {
		tmp = Math.cos(x);
	} else if (y <= 1e+165) {
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
	} else {
		tmp = 1.0 + (0.16666666666666666 * (y * y));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 920.0:
		tmp = math.cos(x)
	elif y <= 1e+165:
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)))
	else:
		tmp = 1.0 + (0.16666666666666666 * (y * y))
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 920.0)
		tmp = cos(x);
	elseif (y <= 1e+165)
		tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x))));
	else
		tmp = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 920.0)
		tmp = cos(x);
	elseif (y <= 1e+165)
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
	else
		tmp = 1.0 + (0.16666666666666666 * (y * y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 920.0], N[Cos[x], $MachinePrecision], If[LessEqual[y, 1e+165], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 920:\\
\;\;\;\;\cos x\\

\mathbf{elif}\;y \leq 10^{+165}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\

\mathbf{else}:\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\


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

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 87.9%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow287.9%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified87.9%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in y around 0 70.2%

      \[\leadsto \color{blue}{\cos x} \]

    if 920 < y < 9.99999999999999899e164

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 17.9%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow217.9%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified17.9%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in y around inf 17.9%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot {y}^{2}\right)} \]
    6. Step-by-step derivation
      1. unpow217.9%

        \[\leadsto 0.16666666666666666 \cdot \left(\cos x \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
      2. *-commutative17.9%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(\left(y \cdot y\right) \cdot \cos x\right)} \]
      3. associate-*l*17.9%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot \left(y \cdot \cos x\right)\right)} \]
      4. associate-*r*17.9%

        \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot y\right) \cdot \left(y \cdot \cos x\right)} \]
      5. *-commutative17.9%

        \[\leadsto \color{blue}{\left(y \cdot 0.16666666666666666\right)} \cdot \left(y \cdot \cos x\right) \]
      6. associate-*l*17.9%

        \[\leadsto \color{blue}{y \cdot \left(0.16666666666666666 \cdot \left(y \cdot \cos x\right)\right)} \]
    7. Simplified17.9%

      \[\leadsto \color{blue}{y \cdot \left(0.16666666666666666 \cdot \left(y \cdot \cos x\right)\right)} \]
    8. Taylor expanded in x around 0 28.5%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \left({y}^{2} \cdot {x}^{2}\right)} \]
    9. Step-by-step derivation
      1. *-commutative28.5%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left({x}^{2} \cdot {y}^{2}\right)} \]
      2. metadata-eval28.5%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \color{blue}{\left(0.16666666666666666 \cdot -0.5\right)} \cdot \left({x}^{2} \cdot {y}^{2}\right) \]
      3. *-commutative28.5%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \left(0.16666666666666666 \cdot -0.5\right) \cdot \color{blue}{\left({y}^{2} \cdot {x}^{2}\right)} \]
      4. unpow228.5%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \left(0.16666666666666666 \cdot -0.5\right) \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot {x}^{2}\right) \]
      5. unpow228.5%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \left(0.16666666666666666 \cdot -0.5\right) \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(x \cdot x\right)}\right) \]
      6. swap-sqr33.6%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \left(0.16666666666666666 \cdot -0.5\right) \cdot \color{blue}{\left(\left(y \cdot x\right) \cdot \left(y \cdot x\right)\right)} \]
      7. unpow233.6%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \left(0.16666666666666666 \cdot -0.5\right) \cdot \color{blue}{{\left(y \cdot x\right)}^{2}} \]
      8. associate-*r*33.6%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \color{blue}{0.16666666666666666 \cdot \left(-0.5 \cdot {\left(y \cdot x\right)}^{2}\right)} \]
      9. *-commutative33.6%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + 0.16666666666666666 \cdot \color{blue}{\left({\left(y \cdot x\right)}^{2} \cdot -0.5\right)} \]
      10. *-commutative33.6%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + 0.16666666666666666 \cdot \color{blue}{\left(-0.5 \cdot {\left(y \cdot x\right)}^{2}\right)} \]
      11. associate-*r*33.6%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \color{blue}{\left(0.16666666666666666 \cdot -0.5\right) \cdot {\left(y \cdot x\right)}^{2}} \]
      12. metadata-eval33.6%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \color{blue}{-0.08333333333333333} \cdot {\left(y \cdot x\right)}^{2} \]
      13. unpow233.6%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left(\left(y \cdot x\right) \cdot \left(y \cdot x\right)\right)} \]
      14. swap-sqr28.5%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left(\left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)} \]
      15. unpow228.5%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \left(\color{blue}{{y}^{2}} \cdot \left(x \cdot x\right)\right) \]
      16. unpow228.5%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \left({y}^{2} \cdot \color{blue}{{x}^{2}}\right) \]
      17. *-commutative28.5%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left({x}^{2} \cdot {y}^{2}\right)} \]
      18. associate-*r*28.5%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \color{blue}{\left(-0.08333333333333333 \cdot {x}^{2}\right) \cdot {y}^{2}} \]
      19. distribute-rgt-out38.7%

        \[\leadsto \color{blue}{{y}^{2} \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot {x}^{2}\right)} \]
      20. unpow238.7%

        \[\leadsto \color{blue}{\left(y \cdot y\right)} \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot {x}^{2}\right) \]
    10. Simplified38.7%

      \[\leadsto \color{blue}{\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)} \]

    if 9.99999999999999899e164 < y

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 100.0%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow2100.0%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified100.0%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in x around 0 81.8%

      \[\leadsto \color{blue}{1 + 0.16666666666666666 \cdot {y}^{2}} \]
    6. Step-by-step derivation
      1. +-commutative81.8%

        \[\leadsto \color{blue}{0.16666666666666666 \cdot {y}^{2} + 1} \]
      2. unpow281.8%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} + 1 \]
    7. Simplified81.8%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(y \cdot y\right) + 1} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification66.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 920:\\ \;\;\;\;\cos x\\ \mathbf{elif}\;y \leq 10^{+165}:\\ \;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \end{array} \]

Alternative 9: 49.2% accurate, 13.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 84000 \lor \neg \left(y \leq 5 \cdot 10^{+164}\right):\\ \;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(y \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y 84000.0) (not (<= y 5e+164)))
   (+ 1.0 (* 0.16666666666666666 (* y y)))
   (* y (* y (+ 0.16666666666666666 (* -0.08333333333333333 (* x x)))))))
double code(double x, double y) {
	double tmp;
	if ((y <= 84000.0) || !(y <= 5e+164)) {
		tmp = 1.0 + (0.16666666666666666 * (y * y));
	} else {
		tmp = y * (y * (0.16666666666666666 + (-0.08333333333333333 * (x * x))));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y <= 84000.0d0) .or. (.not. (y <= 5d+164))) then
        tmp = 1.0d0 + (0.16666666666666666d0 * (y * y))
    else
        tmp = y * (y * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x))))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y <= 84000.0) || !(y <= 5e+164)) {
		tmp = 1.0 + (0.16666666666666666 * (y * y));
	} else {
		tmp = y * (y * (0.16666666666666666 + (-0.08333333333333333 * (x * x))));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= 84000.0) or not (y <= 5e+164):
		tmp = 1.0 + (0.16666666666666666 * (y * y))
	else:
		tmp = y * (y * (0.16666666666666666 + (-0.08333333333333333 * (x * x))))
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= 84000.0) || !(y <= 5e+164))
		tmp = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)));
	else
		tmp = Float64(y * Float64(y * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x)))));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y <= 84000.0) || ~((y <= 5e+164)))
		tmp = 1.0 + (0.16666666666666666 * (y * y));
	else
		tmp = y * (y * (0.16666666666666666 + (-0.08333333333333333 * (x * x))));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, 84000.0], N[Not[LessEqual[y, 5e+164]], $MachinePrecision]], N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(y * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 84000 \lor \neg \left(y \leq 5 \cdot 10^{+164}\right):\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\

\mathbf{else}:\\
\;\;\;\;y \cdot \left(y \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 84000 or 4.9999999999999995e164 < y

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 89.8%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow289.8%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified89.8%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in x around 0 57.1%

      \[\leadsto \color{blue}{1 + 0.16666666666666666 \cdot {y}^{2}} \]
    6. Step-by-step derivation
      1. +-commutative57.1%

        \[\leadsto \color{blue}{0.16666666666666666 \cdot {y}^{2} + 1} \]
      2. unpow257.1%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} + 1 \]
    7. Simplified57.1%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(y \cdot y\right) + 1} \]

    if 84000 < y < 4.9999999999999995e164

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 17.9%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow217.9%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified17.9%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in y around inf 17.9%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot {y}^{2}\right)} \]
    6. Step-by-step derivation
      1. unpow217.9%

        \[\leadsto 0.16666666666666666 \cdot \left(\cos x \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
      2. *-commutative17.9%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(\left(y \cdot y\right) \cdot \cos x\right)} \]
      3. associate-*l*17.9%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot \left(y \cdot \cos x\right)\right)} \]
      4. associate-*r*17.9%

        \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot y\right) \cdot \left(y \cdot \cos x\right)} \]
      5. *-commutative17.9%

        \[\leadsto \color{blue}{\left(y \cdot 0.16666666666666666\right)} \cdot \left(y \cdot \cos x\right) \]
      6. associate-*l*17.9%

        \[\leadsto \color{blue}{y \cdot \left(0.16666666666666666 \cdot \left(y \cdot \cos x\right)\right)} \]
    7. Simplified17.9%

      \[\leadsto \color{blue}{y \cdot \left(0.16666666666666666 \cdot \left(y \cdot \cos x\right)\right)} \]
    8. Taylor expanded in x around 0 38.7%

      \[\leadsto y \cdot \color{blue}{\left(-0.08333333333333333 \cdot \left(y \cdot {x}^{2}\right) + 0.16666666666666666 \cdot y\right)} \]
    9. Step-by-step derivation
      1. +-commutative38.7%

        \[\leadsto y \cdot \color{blue}{\left(0.16666666666666666 \cdot y + -0.08333333333333333 \cdot \left(y \cdot {x}^{2}\right)\right)} \]
      2. *-commutative38.7%

        \[\leadsto y \cdot \left(0.16666666666666666 \cdot y + -0.08333333333333333 \cdot \color{blue}{\left({x}^{2} \cdot y\right)}\right) \]
      3. associate-*r*38.7%

        \[\leadsto y \cdot \left(0.16666666666666666 \cdot y + \color{blue}{\left(-0.08333333333333333 \cdot {x}^{2}\right) \cdot y}\right) \]
      4. distribute-rgt-out38.7%

        \[\leadsto y \cdot \color{blue}{\left(y \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot {x}^{2}\right)\right)} \]
      5. unpow238.7%

        \[\leadsto y \cdot \left(y \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \color{blue}{\left(x \cdot x\right)}\right)\right) \]
    10. Simplified38.7%

      \[\leadsto y \cdot \color{blue}{\left(y \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification54.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 84000 \lor \neg \left(y \leq 5 \cdot 10^{+164}\right):\\ \;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(y \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\right)\\ \end{array} \]

Alternative 10: 49.2% accurate, 13.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 13800 \lor \neg \left(y \leq 7.8 \cdot 10^{+164}\right):\\ \;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y 13800.0) (not (<= y 7.8e+164)))
   (+ 1.0 (* 0.16666666666666666 (* y y)))
   (* (* y y) (+ 0.16666666666666666 (* -0.08333333333333333 (* x x))))))
double code(double x, double y) {
	double tmp;
	if ((y <= 13800.0) || !(y <= 7.8e+164)) {
		tmp = 1.0 + (0.16666666666666666 * (y * y));
	} else {
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y <= 13800.0d0) .or. (.not. (y <= 7.8d+164))) then
        tmp = 1.0d0 + (0.16666666666666666d0 * (y * y))
    else
        tmp = (y * y) * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x)))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y <= 13800.0) || !(y <= 7.8e+164)) {
		tmp = 1.0 + (0.16666666666666666 * (y * y));
	} else {
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= 13800.0) or not (y <= 7.8e+164):
		tmp = 1.0 + (0.16666666666666666 * (y * y))
	else:
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)))
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= 13800.0) || !(y <= 7.8e+164))
		tmp = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)));
	else
		tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x))));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y <= 13800.0) || ~((y <= 7.8e+164)))
		tmp = 1.0 + (0.16666666666666666 * (y * y));
	else
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, 13800.0], N[Not[LessEqual[y, 7.8e+164]], $MachinePrecision]], N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 13800 \lor \neg \left(y \leq 7.8 \cdot 10^{+164}\right):\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\

\mathbf{else}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 13800 or 7.79999999999999971e164 < y

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 89.8%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow289.8%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified89.8%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in x around 0 57.1%

      \[\leadsto \color{blue}{1 + 0.16666666666666666 \cdot {y}^{2}} \]
    6. Step-by-step derivation
      1. +-commutative57.1%

        \[\leadsto \color{blue}{0.16666666666666666 \cdot {y}^{2} + 1} \]
      2. unpow257.1%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} + 1 \]
    7. Simplified57.1%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(y \cdot y\right) + 1} \]

    if 13800 < y < 7.79999999999999971e164

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 17.9%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow217.9%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified17.9%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in y around inf 17.9%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot {y}^{2}\right)} \]
    6. Step-by-step derivation
      1. unpow217.9%

        \[\leadsto 0.16666666666666666 \cdot \left(\cos x \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
      2. *-commutative17.9%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(\left(y \cdot y\right) \cdot \cos x\right)} \]
      3. associate-*l*17.9%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot \left(y \cdot \cos x\right)\right)} \]
      4. associate-*r*17.9%

        \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot y\right) \cdot \left(y \cdot \cos x\right)} \]
      5. *-commutative17.9%

        \[\leadsto \color{blue}{\left(y \cdot 0.16666666666666666\right)} \cdot \left(y \cdot \cos x\right) \]
      6. associate-*l*17.9%

        \[\leadsto \color{blue}{y \cdot \left(0.16666666666666666 \cdot \left(y \cdot \cos x\right)\right)} \]
    7. Simplified17.9%

      \[\leadsto \color{blue}{y \cdot \left(0.16666666666666666 \cdot \left(y \cdot \cos x\right)\right)} \]
    8. Taylor expanded in x around 0 28.5%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \left({y}^{2} \cdot {x}^{2}\right)} \]
    9. Step-by-step derivation
      1. *-commutative28.5%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left({x}^{2} \cdot {y}^{2}\right)} \]
      2. metadata-eval28.5%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \color{blue}{\left(0.16666666666666666 \cdot -0.5\right)} \cdot \left({x}^{2} \cdot {y}^{2}\right) \]
      3. *-commutative28.5%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \left(0.16666666666666666 \cdot -0.5\right) \cdot \color{blue}{\left({y}^{2} \cdot {x}^{2}\right)} \]
      4. unpow228.5%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \left(0.16666666666666666 \cdot -0.5\right) \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot {x}^{2}\right) \]
      5. unpow228.5%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \left(0.16666666666666666 \cdot -0.5\right) \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(x \cdot x\right)}\right) \]
      6. swap-sqr33.6%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \left(0.16666666666666666 \cdot -0.5\right) \cdot \color{blue}{\left(\left(y \cdot x\right) \cdot \left(y \cdot x\right)\right)} \]
      7. unpow233.6%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \left(0.16666666666666666 \cdot -0.5\right) \cdot \color{blue}{{\left(y \cdot x\right)}^{2}} \]
      8. associate-*r*33.6%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \color{blue}{0.16666666666666666 \cdot \left(-0.5 \cdot {\left(y \cdot x\right)}^{2}\right)} \]
      9. *-commutative33.6%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + 0.16666666666666666 \cdot \color{blue}{\left({\left(y \cdot x\right)}^{2} \cdot -0.5\right)} \]
      10. *-commutative33.6%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + 0.16666666666666666 \cdot \color{blue}{\left(-0.5 \cdot {\left(y \cdot x\right)}^{2}\right)} \]
      11. associate-*r*33.6%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \color{blue}{\left(0.16666666666666666 \cdot -0.5\right) \cdot {\left(y \cdot x\right)}^{2}} \]
      12. metadata-eval33.6%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \color{blue}{-0.08333333333333333} \cdot {\left(y \cdot x\right)}^{2} \]
      13. unpow233.6%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left(\left(y \cdot x\right) \cdot \left(y \cdot x\right)\right)} \]
      14. swap-sqr28.5%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left(\left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)} \]
      15. unpow228.5%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \left(\color{blue}{{y}^{2}} \cdot \left(x \cdot x\right)\right) \]
      16. unpow228.5%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \left({y}^{2} \cdot \color{blue}{{x}^{2}}\right) \]
      17. *-commutative28.5%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + -0.08333333333333333 \cdot \color{blue}{\left({x}^{2} \cdot {y}^{2}\right)} \]
      18. associate-*r*28.5%

        \[\leadsto 0.16666666666666666 \cdot {y}^{2} + \color{blue}{\left(-0.08333333333333333 \cdot {x}^{2}\right) \cdot {y}^{2}} \]
      19. distribute-rgt-out38.7%

        \[\leadsto \color{blue}{{y}^{2} \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot {x}^{2}\right)} \]
      20. unpow238.7%

        \[\leadsto \color{blue}{\left(y \cdot y\right)} \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot {x}^{2}\right) \]
    10. Simplified38.7%

      \[\leadsto \color{blue}{\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification54.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 13800 \lor \neg \left(y \leq 7.8 \cdot 10^{+164}\right):\\ \;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\ \end{array} \]

Alternative 11: 48.9% accurate, 15.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 13800 \lor \neg \left(y \leq 1.4 \cdot 10^{+154}\right):\\ \;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;-0.08333333333333333 \cdot \left(\left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y 13800.0) (not (<= y 1.4e+154)))
   (+ 1.0 (* 0.16666666666666666 (* y y)))
   (* -0.08333333333333333 (* (* y y) (* x x)))))
double code(double x, double y) {
	double tmp;
	if ((y <= 13800.0) || !(y <= 1.4e+154)) {
		tmp = 1.0 + (0.16666666666666666 * (y * y));
	} else {
		tmp = -0.08333333333333333 * ((y * y) * (x * x));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y <= 13800.0d0) .or. (.not. (y <= 1.4d+154))) then
        tmp = 1.0d0 + (0.16666666666666666d0 * (y * y))
    else
        tmp = (-0.08333333333333333d0) * ((y * y) * (x * x))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y <= 13800.0) || !(y <= 1.4e+154)) {
		tmp = 1.0 + (0.16666666666666666 * (y * y));
	} else {
		tmp = -0.08333333333333333 * ((y * y) * (x * x));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= 13800.0) or not (y <= 1.4e+154):
		tmp = 1.0 + (0.16666666666666666 * (y * y))
	else:
		tmp = -0.08333333333333333 * ((y * y) * (x * x))
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= 13800.0) || !(y <= 1.4e+154))
		tmp = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)));
	else
		tmp = Float64(-0.08333333333333333 * Float64(Float64(y * y) * Float64(x * x)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y <= 13800.0) || ~((y <= 1.4e+154)))
		tmp = 1.0 + (0.16666666666666666 * (y * y));
	else
		tmp = -0.08333333333333333 * ((y * y) * (x * x));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, 13800.0], N[Not[LessEqual[y, 1.4e+154]], $MachinePrecision]], N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.08333333333333333 * N[(N[(y * y), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 13800 \lor \neg \left(y \leq 1.4 \cdot 10^{+154}\right):\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\

\mathbf{else}:\\
\;\;\;\;-0.08333333333333333 \cdot \left(\left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 13800 or 1.4e154 < y

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 90.0%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow290.0%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified90.0%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in x around 0 57.1%

      \[\leadsto \color{blue}{1 + 0.16666666666666666 \cdot {y}^{2}} \]
    6. Step-by-step derivation
      1. +-commutative57.1%

        \[\leadsto \color{blue}{0.16666666666666666 \cdot {y}^{2} + 1} \]
      2. unpow257.1%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} + 1 \]
    7. Simplified57.1%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(y \cdot y\right) + 1} \]

    if 13800 < y < 1.4e154

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 5.8%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow25.8%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified5.8%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in y around inf 5.8%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot {y}^{2}\right)} \]
    6. Step-by-step derivation
      1. unpow25.8%

        \[\leadsto 0.16666666666666666 \cdot \left(\cos x \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    7. Simplified5.8%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)} \]
    8. Taylor expanded in x around 0 32.7%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(-0.5 \cdot \left({y}^{2} \cdot {x}^{2}\right) + {y}^{2}\right)} \]
    9. Step-by-step derivation
      1. fma-def32.7%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\mathsf{fma}\left(-0.5, {y}^{2} \cdot {x}^{2}, {y}^{2}\right)} \]
      2. unpow232.7%

        \[\leadsto 0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \color{blue}{\left(y \cdot y\right)} \cdot {x}^{2}, {y}^{2}\right) \]
      3. *-commutative32.7%

        \[\leadsto 0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \color{blue}{{x}^{2} \cdot \left(y \cdot y\right)}, {y}^{2}\right) \]
      4. unpow232.7%

        \[\leadsto 0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \color{blue}{\left(x \cdot x\right)} \cdot \left(y \cdot y\right), {y}^{2}\right) \]
      5. unpow232.7%

        \[\leadsto 0.16666666666666666 \cdot \mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), \color{blue}{y \cdot y}\right) \]
    10. Simplified32.7%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\mathsf{fma}\left(-0.5, \left(x \cdot x\right) \cdot \left(y \cdot y\right), y \cdot y\right)} \]
    11. Taylor expanded in x around inf 30.7%

      \[\leadsto \color{blue}{-0.08333333333333333 \cdot \left({y}^{2} \cdot {x}^{2}\right)} \]
    12. Step-by-step derivation
      1. *-commutative30.7%

        \[\leadsto -0.08333333333333333 \cdot \color{blue}{\left({x}^{2} \cdot {y}^{2}\right)} \]
      2. unpow230.7%

        \[\leadsto -0.08333333333333333 \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot {y}^{2}\right) \]
      3. unpow230.7%

        \[\leadsto -0.08333333333333333 \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    13. Simplified30.7%

      \[\leadsto \color{blue}{-0.08333333333333333 \cdot \left(\left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification53.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 13800 \lor \neg \left(y \leq 1.4 \cdot 10^{+154}\right):\\ \;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;-0.08333333333333333 \cdot \left(\left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)\\ \end{array} \]

Alternative 12: 37.6% accurate, 29.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 2400000000000:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 2400000000000.0) 1.0 (* 0.16666666666666666 (* y y))))
double code(double x, double y) {
	double tmp;
	if (y <= 2400000000000.0) {
		tmp = 1.0;
	} else {
		tmp = 0.16666666666666666 * (y * y);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 2400000000000.0d0) then
        tmp = 1.0d0
    else
        tmp = 0.16666666666666666d0 * (y * y)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= 2400000000000.0) {
		tmp = 1.0;
	} else {
		tmp = 0.16666666666666666 * (y * y);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 2400000000000.0:
		tmp = 1.0
	else:
		tmp = 0.16666666666666666 * (y * y)
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 2400000000000.0)
		tmp = 1.0;
	else
		tmp = Float64(0.16666666666666666 * Float64(y * y));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 2400000000000.0)
		tmp = 1.0;
	else
		tmp = 0.16666666666666666 * (y * y);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 2400000000000.0], 1.0, N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 2400000000000:\\
\;\;\;\;1\\

\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\


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

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 87.0%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow287.0%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified87.0%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in x around 0 52.1%

      \[\leadsto \color{blue}{1 + 0.16666666666666666 \cdot {y}^{2}} \]
    6. Step-by-step derivation
      1. +-commutative52.1%

        \[\leadsto \color{blue}{0.16666666666666666 \cdot {y}^{2} + 1} \]
      2. unpow252.1%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} + 1 \]
      3. associate-*r*52.1%

        \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot y\right) \cdot y} + 1 \]
      4. *-commutative52.1%

        \[\leadsto \color{blue}{y \cdot \left(0.16666666666666666 \cdot y\right)} + 1 \]
      5. fma-udef52.1%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 0.16666666666666666 \cdot y, 1\right)} \]
    7. Simplified52.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 0.16666666666666666 \cdot y, 1\right)} \]
    8. Taylor expanded in y around 0 38.2%

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

    if 2.4e12 < y

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Taylor expanded in y around 0 57.0%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow257.0%

        \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified57.0%

      \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
    5. Taylor expanded in y around inf 57.0%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot {y}^{2}\right)} \]
    6. Step-by-step derivation
      1. unpow257.0%

        \[\leadsto 0.16666666666666666 \cdot \left(\cos x \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    7. Simplified57.0%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)} \]
    8. Taylor expanded in x around 0 44.5%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{{y}^{2}} \]
    9. Step-by-step derivation
      1. unpow244.5%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} \]
    10. Simplified44.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2400000000000:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\ \end{array} \]

Alternative 13: 47.0% accurate, 29.3× speedup?

\[\begin{array}{l} \\ 1 + 0.16666666666666666 \cdot \left(y \cdot y\right) \end{array} \]
(FPCore (x y) :precision binary64 (+ 1.0 (* 0.16666666666666666 (* y y))))
double code(double x, double y) {
	return 1.0 + (0.16666666666666666 * (y * y));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 1.0d0 + (0.16666666666666666d0 * (y * y))
end function
public static double code(double x, double y) {
	return 1.0 + (0.16666666666666666 * (y * y));
}
def code(x, y):
	return 1.0 + (0.16666666666666666 * (y * y))
function code(x, y)
	return Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))
end
function tmp = code(x, y)
	tmp = 1.0 + (0.16666666666666666 * (y * y));
end
code[x_, y_] := N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
1 + 0.16666666666666666 \cdot \left(y \cdot y\right)
\end{array}
Derivation
  1. Initial program 100.0%

    \[\cos x \cdot \frac{\sinh y}{y} \]
  2. Taylor expanded in y around 0 78.8%

    \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
  3. Step-by-step derivation
    1. unpow278.8%

      \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
  4. Simplified78.8%

    \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
  5. Taylor expanded in x around 0 50.0%

    \[\leadsto \color{blue}{1 + 0.16666666666666666 \cdot {y}^{2}} \]
  6. Step-by-step derivation
    1. +-commutative50.0%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot {y}^{2} + 1} \]
    2. unpow250.0%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} + 1 \]
  7. Simplified50.0%

    \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(y \cdot y\right) + 1} \]
  8. Final simplification50.0%

    \[\leadsto 1 + 0.16666666666666666 \cdot \left(y \cdot y\right) \]

Alternative 14: 28.2% accurate, 205.0× speedup?

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

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

    \[\cos x \cdot \frac{\sinh y}{y} \]
  2. Taylor expanded in y around 0 78.8%

    \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
  3. Step-by-step derivation
    1. unpow278.8%

      \[\leadsto \cos x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
  4. Simplified78.8%

    \[\leadsto \cos x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
  5. Taylor expanded in x around 0 50.0%

    \[\leadsto \color{blue}{1 + 0.16666666666666666 \cdot {y}^{2}} \]
  6. Step-by-step derivation
    1. +-commutative50.0%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot {y}^{2} + 1} \]
    2. unpow250.0%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} + 1 \]
    3. associate-*r*50.0%

      \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot y\right) \cdot y} + 1 \]
    4. *-commutative50.0%

      \[\leadsto \color{blue}{y \cdot \left(0.16666666666666666 \cdot y\right)} + 1 \]
    5. fma-udef50.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 0.16666666666666666 \cdot y, 1\right)} \]
  7. Simplified50.0%

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, 0.16666666666666666 \cdot y, 1\right)} \]
  8. Taylor expanded in y around 0 28.4%

    \[\leadsto \color{blue}{1} \]
  9. Final simplification28.4%

    \[\leadsto 1 \]

Reproduce

?
herbie shell --seed 2023229 
(FPCore (x y)
  :name "Linear.Quaternion:$csin from linear-1.19.1.3"
  :precision binary64
  (* (cos x) (/ (sinh y) y)))