Linear.Quaternion:$csin from linear-1.19.1.3

Percentage Accurate: 100.0% → 100.0%
Time: 10.8s
Alternatives: 15
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 15 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.1% 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 820:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.15 \cdot 10^{+50}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot y + y \cdot \left({x}^{4} \cdot \left(y \cdot 0.041666666666666664\right)\right)\right)\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+153}:\\ \;\;\;\;\sqrt[3]{0.004629629629629629 \cdot {y}^{6}}\\ \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 820.0)
     t_0
     (if (<= y 2.15e+50)
       (*
        0.16666666666666666
        (+ (* y y) (* y (* (pow x 4.0) (* y 0.041666666666666664)))))
       (if (<= y 7e+153) (cbrt (* 0.004629629629629629 (pow y 6.0))) t_0)))))
double code(double x, double y) {
	double t_0 = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	double tmp;
	if (y <= 820.0) {
		tmp = t_0;
	} else if (y <= 2.15e+50) {
		tmp = 0.16666666666666666 * ((y * y) + (y * (pow(x, 4.0) * (y * 0.041666666666666664))));
	} else if (y <= 7e+153) {
		tmp = cbrt((0.004629629629629629 * pow(y, 6.0)));
	} 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 <= 820.0) {
		tmp = t_0;
	} else if (y <= 2.15e+50) {
		tmp = 0.16666666666666666 * ((y * y) + (y * (Math.pow(x, 4.0) * (y * 0.041666666666666664))));
	} else if (y <= 7e+153) {
		tmp = Math.cbrt((0.004629629629629629 * Math.pow(y, 6.0)));
	} 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 <= 820.0)
		tmp = t_0;
	elseif (y <= 2.15e+50)
		tmp = Float64(0.16666666666666666 * Float64(Float64(y * y) + Float64(y * Float64((x ^ 4.0) * Float64(y * 0.041666666666666664)))));
	elseif (y <= 7e+153)
		tmp = cbrt(Float64(0.004629629629629629 * (y ^ 6.0)));
	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, 820.0], t$95$0, If[LessEqual[y, 2.15e+50], N[(0.16666666666666666 * N[(N[(y * y), $MachinePrecision] + N[(y * N[(N[Power[x, 4.0], $MachinePrecision] * N[(y * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7e+153], N[Power[N[(0.004629629629629629 * N[Power[y, 6.0], $MachinePrecision]), $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 820:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 2.15 \cdot 10^{+50}:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot y + y \cdot \left({x}^{4} \cdot \left(y \cdot 0.041666666666666664\right)\right)\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 820 or 6.9999999999999998e153 < 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 \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around 0 85.7%

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

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

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

    if 820 < y < 2.1499999999999999e50

    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 \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around inf 3.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y + \left(y \cdot y\right) \cdot \left(\left(x \cdot x\right) \cdot -0.5 + {x}^{4} \cdot 0.041666666666666664\right)\right)} \]
    9. Taylor expanded in x around inf 25.8%

      \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + \color{blue}{0.041666666666666664 \cdot \left({y}^{2} \cdot {x}^{4}\right)}\right) \]
    10. Step-by-step derivation
      1. *-commutative25.8%

        \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + \color{blue}{\left({y}^{2} \cdot {x}^{4}\right) \cdot 0.041666666666666664}\right) \]
      2. unpow225.8%

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

        \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + \color{blue}{\left(y \cdot y\right) \cdot \left({x}^{4} \cdot 0.041666666666666664\right)}\right) \]
      4. associate-*r*25.8%

        \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + \color{blue}{y \cdot \left(y \cdot \left({x}^{4} \cdot 0.041666666666666664\right)\right)}\right) \]
      5. *-commutative25.8%

        \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + y \cdot \color{blue}{\left(\left({x}^{4} \cdot 0.041666666666666664\right) \cdot y\right)}\right) \]
      6. associate-*l*25.8%

        \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + y \cdot \color{blue}{\left({x}^{4} \cdot \left(0.041666666666666664 \cdot y\right)\right)}\right) \]
    11. Simplified25.8%

      \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + \color{blue}{y \cdot \left({x}^{4} \cdot \left(0.041666666666666664 \cdot y\right)\right)}\right) \]

    if 2.1499999999999999e50 < y < 6.9999999999999998e153

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around inf 6.0%

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

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

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

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

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

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

        \[\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. pow1/381.4%

        \[\leadsto \color{blue}{{\left(\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)\right)}^{0.3333333333333333}} \]
      3. pow381.4%

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

        \[\leadsto {\color{blue}{\left({0.16666666666666666}^{3} \cdot {\left(y \cdot y\right)}^{3}\right)}}^{0.3333333333333333} \]
      5. metadata-eval84.4%

        \[\leadsto {\left(\color{blue}{0.004629629629629629} \cdot {\left(y \cdot y\right)}^{3}\right)}^{0.3333333333333333} \]
    8. Applied egg-rr84.4%

      \[\leadsto \color{blue}{{\left(0.004629629629629629 \cdot {\left(y \cdot y\right)}^{3}\right)}^{0.3333333333333333}} \]
    9. Step-by-step derivation
      1. unpow1/384.4%

        \[\leadsto \color{blue}{\sqrt[3]{0.004629629629629629 \cdot {\left(y \cdot y\right)}^{3}}} \]
      2. cube-prod84.4%

        \[\leadsto \sqrt[3]{0.004629629629629629 \cdot \color{blue}{\left({y}^{3} \cdot {y}^{3}\right)}} \]
      3. pow-sqr84.4%

        \[\leadsto \sqrt[3]{0.004629629629629629 \cdot \color{blue}{{y}^{\left(2 \cdot 3\right)}}} \]
      4. metadata-eval84.4%

        \[\leadsto \sqrt[3]{0.004629629629629629 \cdot {y}^{\color{blue}{6}}} \]
    10. Simplified84.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 820:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 2.15 \cdot 10^{+50}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot y + y \cdot \left({x}^{4} \cdot \left(y \cdot 0.041666666666666664\right)\right)\right)\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+153}:\\ \;\;\;\;\sqrt[3]{0.004629629629629629 \cdot {y}^{6}}\\ \mathbf{else}:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \end{array} \]

Alternative 3: 82.0% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ t_1 := y \cdot \left(y \cdot 0.16666666666666666\right)\\ t_2 := t_1 \cdot t_1\\ \mathbf{if}\;y \leq 650:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{+51}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot y + y \cdot \left({x}^{4} \cdot \left(y \cdot 0.041666666666666664\right)\right)\right)\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{+77}:\\ \;\;\;\;\frac{1 + {t_1}^{3}}{t_2 + \left(1 - t_1\right)}\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+153}:\\ \;\;\;\;\frac{t_2 + -1}{t_1 + -1}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y)))))
        (t_1 (* y (* y 0.16666666666666666)))
        (t_2 (* t_1 t_1)))
   (if (<= y 650.0)
     t_0
     (if (<= y 5.8e+51)
       (*
        0.16666666666666666
        (+ (* y y) (* y (* (pow x 4.0) (* y 0.041666666666666664)))))
       (if (<= y 2.8e+77)
         (/ (+ 1.0 (pow t_1 3.0)) (+ t_2 (- 1.0 t_1)))
         (if (<= y 7e+153) (/ (+ t_2 -1.0) (+ t_1 -1.0)) t_0))))))
double code(double x, double y) {
	double t_0 = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	double t_1 = y * (y * 0.16666666666666666);
	double t_2 = t_1 * t_1;
	double tmp;
	if (y <= 650.0) {
		tmp = t_0;
	} else if (y <= 5.8e+51) {
		tmp = 0.16666666666666666 * ((y * y) + (y * (pow(x, 4.0) * (y * 0.041666666666666664))));
	} else if (y <= 2.8e+77) {
		tmp = (1.0 + pow(t_1, 3.0)) / (t_2 + (1.0 - t_1));
	} else if (y <= 7e+153) {
		tmp = (t_2 + -1.0) / (t_1 + -1.0);
	} 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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = cos(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
    t_1 = y * (y * 0.16666666666666666d0)
    t_2 = t_1 * t_1
    if (y <= 650.0d0) then
        tmp = t_0
    else if (y <= 5.8d+51) then
        tmp = 0.16666666666666666d0 * ((y * y) + (y * ((x ** 4.0d0) * (y * 0.041666666666666664d0))))
    else if (y <= 2.8d+77) then
        tmp = (1.0d0 + (t_1 ** 3.0d0)) / (t_2 + (1.0d0 - t_1))
    else if (y <= 7d+153) then
        tmp = (t_2 + (-1.0d0)) / (t_1 + (-1.0d0))
    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 t_1 = y * (y * 0.16666666666666666);
	double t_2 = t_1 * t_1;
	double tmp;
	if (y <= 650.0) {
		tmp = t_0;
	} else if (y <= 5.8e+51) {
		tmp = 0.16666666666666666 * ((y * y) + (y * (Math.pow(x, 4.0) * (y * 0.041666666666666664))));
	} else if (y <= 2.8e+77) {
		tmp = (1.0 + Math.pow(t_1, 3.0)) / (t_2 + (1.0 - t_1));
	} else if (y <= 7e+153) {
		tmp = (t_2 + -1.0) / (t_1 + -1.0);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)))
	t_1 = y * (y * 0.16666666666666666)
	t_2 = t_1 * t_1
	tmp = 0
	if y <= 650.0:
		tmp = t_0
	elif y <= 5.8e+51:
		tmp = 0.16666666666666666 * ((y * y) + (y * (math.pow(x, 4.0) * (y * 0.041666666666666664))))
	elif y <= 2.8e+77:
		tmp = (1.0 + math.pow(t_1, 3.0)) / (t_2 + (1.0 - t_1))
	elif y <= 7e+153:
		tmp = (t_2 + -1.0) / (t_1 + -1.0)
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))))
	t_1 = Float64(y * Float64(y * 0.16666666666666666))
	t_2 = Float64(t_1 * t_1)
	tmp = 0.0
	if (y <= 650.0)
		tmp = t_0;
	elseif (y <= 5.8e+51)
		tmp = Float64(0.16666666666666666 * Float64(Float64(y * y) + Float64(y * Float64((x ^ 4.0) * Float64(y * 0.041666666666666664)))));
	elseif (y <= 2.8e+77)
		tmp = Float64(Float64(1.0 + (t_1 ^ 3.0)) / Float64(t_2 + Float64(1.0 - t_1)));
	elseif (y <= 7e+153)
		tmp = Float64(Float64(t_2 + -1.0) / Float64(t_1 + -1.0));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	t_1 = y * (y * 0.16666666666666666);
	t_2 = t_1 * t_1;
	tmp = 0.0;
	if (y <= 650.0)
		tmp = t_0;
	elseif (y <= 5.8e+51)
		tmp = 0.16666666666666666 * ((y * y) + (y * ((x ^ 4.0) * (y * 0.041666666666666664))));
	elseif (y <= 2.8e+77)
		tmp = (1.0 + (t_1 ^ 3.0)) / (t_2 + (1.0 - t_1));
	elseif (y <= 7e+153)
		tmp = (t_2 + -1.0) / (t_1 + -1.0);
	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]}, Block[{t$95$1 = N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * t$95$1), $MachinePrecision]}, If[LessEqual[y, 650.0], t$95$0, If[LessEqual[y, 5.8e+51], N[(0.16666666666666666 * N[(N[(y * y), $MachinePrecision] + N[(y * N[(N[Power[x, 4.0], $MachinePrecision] * N[(y * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.8e+77], N[(N[(1.0 + N[Power[t$95$1, 3.0], $MachinePrecision]), $MachinePrecision] / N[(t$95$2 + N[(1.0 - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7e+153], N[(N[(t$95$2 + -1.0), $MachinePrecision] / N[(t$95$1 + -1.0), $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)\\
t_1 := y \cdot \left(y \cdot 0.16666666666666666\right)\\
t_2 := t_1 \cdot t_1\\
\mathbf{if}\;y \leq 650:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 5.8 \cdot 10^{+51}:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot y + y \cdot \left({x}^{4} \cdot \left(y \cdot 0.041666666666666664\right)\right)\right)\\

\mathbf{elif}\;y \leq 2.8 \cdot 10^{+77}:\\
\;\;\;\;\frac{1 + {t_1}^{3}}{t_2 + \left(1 - t_1\right)}\\

\mathbf{elif}\;y \leq 7 \cdot 10^{+153}:\\
\;\;\;\;\frac{t_2 + -1}{t_1 + -1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < 650 or 6.9999999999999998e153 < 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 \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around 0 85.7%

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

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

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

    if 650 < y < 5.7999999999999997e51

    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 \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around inf 3.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + \left(\left(y \cdot y\right) \cdot \left({x}^{2} \cdot -0.5\right) + \color{blue}{\left(y \cdot y\right) \cdot \left({x}^{4} \cdot 0.041666666666666664\right)}\right)\right) \]
      10. distribute-lft-out3.0%

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

        \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + \left(y \cdot y\right) \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot -0.5 + {x}^{4} \cdot 0.041666666666666664\right)\right) \]
    8. Simplified3.0%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y + \left(y \cdot y\right) \cdot \left(\left(x \cdot x\right) \cdot -0.5 + {x}^{4} \cdot 0.041666666666666664\right)\right)} \]
    9. Taylor expanded in x around inf 24.4%

      \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + \color{blue}{0.041666666666666664 \cdot \left({y}^{2} \cdot {x}^{4}\right)}\right) \]
    10. Step-by-step derivation
      1. *-commutative24.4%

        \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + \color{blue}{\left({y}^{2} \cdot {x}^{4}\right) \cdot 0.041666666666666664}\right) \]
      2. unpow224.4%

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

        \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + \color{blue}{\left(y \cdot y\right) \cdot \left({x}^{4} \cdot 0.041666666666666664\right)}\right) \]
      4. associate-*r*24.4%

        \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + \color{blue}{y \cdot \left(y \cdot \left({x}^{4} \cdot 0.041666666666666664\right)\right)}\right) \]
      5. *-commutative24.4%

        \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + y \cdot \color{blue}{\left(\left({x}^{4} \cdot 0.041666666666666664\right) \cdot y\right)}\right) \]
      6. associate-*l*24.4%

        \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + y \cdot \color{blue}{\left({x}^{4} \cdot \left(0.041666666666666664 \cdot y\right)\right)}\right) \]
    11. Simplified24.4%

      \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + \color{blue}{y \cdot \left({x}^{4} \cdot \left(0.041666666666666664 \cdot y\right)\right)}\right) \]

    if 5.7999999999999997e51 < y < 2.8e77

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around 0 4.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.8e77 < y < 6.9999999999999998e153

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around 0 6.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) \cdot \left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) - 1}{y \cdot \color{blue}{\left(y \cdot 0.16666666666666666\right)} - 1} \]
    10. Applied egg-rr80.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 650:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{+51}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot y + y \cdot \left({x}^{4} \cdot \left(y \cdot 0.041666666666666664\right)\right)\right)\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{+77}:\\ \;\;\;\;\frac{1 + {\left(y \cdot \left(y \cdot 0.16666666666666666\right)\right)}^{3}}{\left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) \cdot \left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) + \left(1 - y \cdot \left(y \cdot 0.16666666666666666\right)\right)}\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+153}:\\ \;\;\;\;\frac{\left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) \cdot \left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) + -1}{y \cdot \left(y \cdot 0.16666666666666666\right) + -1}\\ \mathbf{else}:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \end{array} \]

Alternative 4: 80.8% 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)\\ t_1 := y \cdot \left(y \cdot 0.16666666666666666\right)\\ \mathbf{if}\;y \leq 600:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{+66}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot y + y \cdot \left({x}^{4} \cdot \left(y \cdot 0.041666666666666664\right)\right)\right)\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+153}:\\ \;\;\;\;\frac{t_1 \cdot t_1 + -1}{t_1 + -1}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y)))))
        (t_1 (* y (* y 0.16666666666666666))))
   (if (<= y 600.0)
     t_0
     (if (<= y 2.2e+66)
       (*
        0.16666666666666666
        (+ (* y y) (* y (* (pow x 4.0) (* y 0.041666666666666664)))))
       (if (<= y 7e+153) (/ (+ (* t_1 t_1) -1.0) (+ t_1 -1.0)) t_0)))))
double code(double x, double y) {
	double t_0 = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	double t_1 = y * (y * 0.16666666666666666);
	double tmp;
	if (y <= 600.0) {
		tmp = t_0;
	} else if (y <= 2.2e+66) {
		tmp = 0.16666666666666666 * ((y * y) + (y * (pow(x, 4.0) * (y * 0.041666666666666664))));
	} else if (y <= 7e+153) {
		tmp = ((t_1 * t_1) + -1.0) / (t_1 + -1.0);
	} 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) :: t_1
    real(8) :: tmp
    t_0 = cos(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
    t_1 = y * (y * 0.16666666666666666d0)
    if (y <= 600.0d0) then
        tmp = t_0
    else if (y <= 2.2d+66) then
        tmp = 0.16666666666666666d0 * ((y * y) + (y * ((x ** 4.0d0) * (y * 0.041666666666666664d0))))
    else if (y <= 7d+153) then
        tmp = ((t_1 * t_1) + (-1.0d0)) / (t_1 + (-1.0d0))
    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 t_1 = y * (y * 0.16666666666666666);
	double tmp;
	if (y <= 600.0) {
		tmp = t_0;
	} else if (y <= 2.2e+66) {
		tmp = 0.16666666666666666 * ((y * y) + (y * (Math.pow(x, 4.0) * (y * 0.041666666666666664))));
	} else if (y <= 7e+153) {
		tmp = ((t_1 * t_1) + -1.0) / (t_1 + -1.0);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)))
	t_1 = y * (y * 0.16666666666666666)
	tmp = 0
	if y <= 600.0:
		tmp = t_0
	elif y <= 2.2e+66:
		tmp = 0.16666666666666666 * ((y * y) + (y * (math.pow(x, 4.0) * (y * 0.041666666666666664))))
	elif y <= 7e+153:
		tmp = ((t_1 * t_1) + -1.0) / (t_1 + -1.0)
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))))
	t_1 = Float64(y * Float64(y * 0.16666666666666666))
	tmp = 0.0
	if (y <= 600.0)
		tmp = t_0;
	elseif (y <= 2.2e+66)
		tmp = Float64(0.16666666666666666 * Float64(Float64(y * y) + Float64(y * Float64((x ^ 4.0) * Float64(y * 0.041666666666666664)))));
	elseif (y <= 7e+153)
		tmp = Float64(Float64(Float64(t_1 * t_1) + -1.0) / Float64(t_1 + -1.0));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	t_1 = y * (y * 0.16666666666666666);
	tmp = 0.0;
	if (y <= 600.0)
		tmp = t_0;
	elseif (y <= 2.2e+66)
		tmp = 0.16666666666666666 * ((y * y) + (y * ((x ^ 4.0) * (y * 0.041666666666666664))));
	elseif (y <= 7e+153)
		tmp = ((t_1 * t_1) + -1.0) / (t_1 + -1.0);
	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]}, Block[{t$95$1 = N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 600.0], t$95$0, If[LessEqual[y, 2.2e+66], N[(0.16666666666666666 * N[(N[(y * y), $MachinePrecision] + N[(y * N[(N[Power[x, 4.0], $MachinePrecision] * N[(y * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7e+153], N[(N[(N[(t$95$1 * t$95$1), $MachinePrecision] + -1.0), $MachinePrecision] / N[(t$95$1 + -1.0), $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)\\
t_1 := y \cdot \left(y \cdot 0.16666666666666666\right)\\
\mathbf{if}\;y \leq 600:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 2.2 \cdot 10^{+66}:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot y + y \cdot \left({x}^{4} \cdot \left(y \cdot 0.041666666666666664\right)\right)\right)\\

\mathbf{elif}\;y \leq 7 \cdot 10^{+153}:\\
\;\;\;\;\frac{t_1 \cdot t_1 + -1}{t_1 + -1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 600 or 6.9999999999999998e153 < 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 \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around 0 85.7%

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

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

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

    if 600 < y < 2.1999999999999998e66

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around inf 3.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y + \left(y \cdot y\right) \cdot \left(\left(x \cdot x\right) \cdot -0.5 + {x}^{4} \cdot 0.041666666666666664\right)\right)} \]
    9. Taylor expanded in x around inf 32.1%

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

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

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

        \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + \color{blue}{\left(y \cdot y\right) \cdot \left({x}^{4} \cdot 0.041666666666666664\right)}\right) \]
      4. associate-*r*32.1%

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

        \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + y \cdot \color{blue}{\left(\left({x}^{4} \cdot 0.041666666666666664\right) \cdot y\right)}\right) \]
      6. associate-*l*32.1%

        \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + y \cdot \color{blue}{\left({x}^{4} \cdot \left(0.041666666666666664 \cdot y\right)\right)}\right) \]
    11. Simplified32.1%

      \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + \color{blue}{y \cdot \left({x}^{4} \cdot \left(0.041666666666666664 \cdot y\right)\right)}\right) \]

    if 2.1999999999999998e66 < y < 6.9999999999999998e153

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around 0 6.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(y \cdot \color{blue}{\left(y \cdot 0.16666666666666666\right)}\right) \cdot \left(\left(0.16666666666666666 \cdot y\right) \cdot y\right) - 1 \cdot 1}{\left(0.16666666666666666 \cdot y\right) \cdot y - 1} \]
      5. *-commutative75.3%

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

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

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

        \[\leadsto \frac{\left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) \cdot \left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) - 1}{\color{blue}{y \cdot \left(0.16666666666666666 \cdot y\right)} - 1} \]
      9. *-commutative75.3%

        \[\leadsto \frac{\left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) \cdot \left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) - 1}{y \cdot \color{blue}{\left(y \cdot 0.16666666666666666\right)} - 1} \]
    10. Applied egg-rr75.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 600:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{+66}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot y + y \cdot \left({x}^{4} \cdot \left(y \cdot 0.041666666666666664\right)\right)\right)\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+153}:\\ \;\;\;\;\frac{\left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) \cdot \left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) + -1}{y \cdot \left(y \cdot 0.16666666666666666\right) + -1}\\ \mathbf{else}:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \end{array} \]

Alternative 5: 80.7% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ t_1 := y \cdot \left(y \cdot 0.16666666666666666\right)\\ \mathbf{if}\;y \leq 550:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+65}:\\ \;\;\;\;{x}^{4} \cdot \left(y \cdot \left(y \cdot 0.006944444444444444\right)\right)\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+153}:\\ \;\;\;\;\frac{t_1 \cdot t_1 + -1}{t_1 + -1}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y)))))
        (t_1 (* y (* y 0.16666666666666666))))
   (if (<= y 550.0)
     t_0
     (if (<= y 1.2e+65)
       (* (pow x 4.0) (* y (* y 0.006944444444444444)))
       (if (<= y 7e+153) (/ (+ (* t_1 t_1) -1.0) (+ t_1 -1.0)) t_0)))))
double code(double x, double y) {
	double t_0 = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	double t_1 = y * (y * 0.16666666666666666);
	double tmp;
	if (y <= 550.0) {
		tmp = t_0;
	} else if (y <= 1.2e+65) {
		tmp = pow(x, 4.0) * (y * (y * 0.006944444444444444));
	} else if (y <= 7e+153) {
		tmp = ((t_1 * t_1) + -1.0) / (t_1 + -1.0);
	} 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) :: t_1
    real(8) :: tmp
    t_0 = cos(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
    t_1 = y * (y * 0.16666666666666666d0)
    if (y <= 550.0d0) then
        tmp = t_0
    else if (y <= 1.2d+65) then
        tmp = (x ** 4.0d0) * (y * (y * 0.006944444444444444d0))
    else if (y <= 7d+153) then
        tmp = ((t_1 * t_1) + (-1.0d0)) / (t_1 + (-1.0d0))
    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 t_1 = y * (y * 0.16666666666666666);
	double tmp;
	if (y <= 550.0) {
		tmp = t_0;
	} else if (y <= 1.2e+65) {
		tmp = Math.pow(x, 4.0) * (y * (y * 0.006944444444444444));
	} else if (y <= 7e+153) {
		tmp = ((t_1 * t_1) + -1.0) / (t_1 + -1.0);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)))
	t_1 = y * (y * 0.16666666666666666)
	tmp = 0
	if y <= 550.0:
		tmp = t_0
	elif y <= 1.2e+65:
		tmp = math.pow(x, 4.0) * (y * (y * 0.006944444444444444))
	elif y <= 7e+153:
		tmp = ((t_1 * t_1) + -1.0) / (t_1 + -1.0)
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))))
	t_1 = Float64(y * Float64(y * 0.16666666666666666))
	tmp = 0.0
	if (y <= 550.0)
		tmp = t_0;
	elseif (y <= 1.2e+65)
		tmp = Float64((x ^ 4.0) * Float64(y * Float64(y * 0.006944444444444444)));
	elseif (y <= 7e+153)
		tmp = Float64(Float64(Float64(t_1 * t_1) + -1.0) / Float64(t_1 + -1.0));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	t_1 = y * (y * 0.16666666666666666);
	tmp = 0.0;
	if (y <= 550.0)
		tmp = t_0;
	elseif (y <= 1.2e+65)
		tmp = (x ^ 4.0) * (y * (y * 0.006944444444444444));
	elseif (y <= 7e+153)
		tmp = ((t_1 * t_1) + -1.0) / (t_1 + -1.0);
	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]}, Block[{t$95$1 = N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 550.0], t$95$0, If[LessEqual[y, 1.2e+65], N[(N[Power[x, 4.0], $MachinePrecision] * N[(y * N[(y * 0.006944444444444444), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7e+153], N[(N[(N[(t$95$1 * t$95$1), $MachinePrecision] + -1.0), $MachinePrecision] / N[(t$95$1 + -1.0), $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)\\
t_1 := y \cdot \left(y \cdot 0.16666666666666666\right)\\
\mathbf{if}\;y \leq 550:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 1.2 \cdot 10^{+65}:\\
\;\;\;\;{x}^{4} \cdot \left(y \cdot \left(y \cdot 0.006944444444444444\right)\right)\\

\mathbf{elif}\;y \leq 7 \cdot 10^{+153}:\\
\;\;\;\;\frac{t_1 \cdot t_1 + -1}{t_1 + -1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 550 or 6.9999999999999998e153 < 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 \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around 0 85.7%

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

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

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

    if 550 < y < 1.2000000000000001e65

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around inf 3.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + \left(\left(y \cdot y\right) \cdot \left({x}^{2} \cdot -0.5\right) + \color{blue}{\left(y \cdot y\right) \cdot \left({x}^{4} \cdot 0.041666666666666664\right)}\right)\right) \]
      10. distribute-lft-out15.1%

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

        \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + \left(y \cdot y\right) \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot -0.5 + {x}^{4} \cdot 0.041666666666666664\right)\right) \]
    8. Simplified15.1%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y + \left(y \cdot y\right) \cdot \left(\left(x \cdot x\right) \cdot -0.5 + {x}^{4} \cdot 0.041666666666666664\right)\right)} \]
    9. Taylor expanded in x around inf 32.9%

      \[\leadsto \color{blue}{0.006944444444444444 \cdot \left({y}^{2} \cdot {x}^{4}\right)} \]
    10. Step-by-step derivation
      1. unpow232.9%

        \[\leadsto 0.006944444444444444 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot {x}^{4}\right) \]
      2. associate-*r*32.9%

        \[\leadsto \color{blue}{\left(0.006944444444444444 \cdot \left(y \cdot y\right)\right) \cdot {x}^{4}} \]
      3. *-commutative32.9%

        \[\leadsto \color{blue}{{x}^{4} \cdot \left(0.006944444444444444 \cdot \left(y \cdot y\right)\right)} \]
      4. associate-*r*32.9%

        \[\leadsto {x}^{4} \cdot \color{blue}{\left(\left(0.006944444444444444 \cdot y\right) \cdot y\right)} \]
    11. Simplified32.9%

      \[\leadsto \color{blue}{{x}^{4} \cdot \left(\left(0.006944444444444444 \cdot y\right) \cdot y\right)} \]

    if 1.2000000000000001e65 < y < 6.9999999999999998e153

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around 0 6.2%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\left(\left(0.16666666666666666 \cdot y\right) \cdot y\right) \cdot \left(\left(0.16666666666666666 \cdot y\right) \cdot y\right) - 1 \cdot 1}{\left(0.16666666666666666 \cdot y\right) \cdot y - 1}} \]
      3. *-commutative72.9%

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

        \[\leadsto \frac{\left(y \cdot \color{blue}{\left(y \cdot 0.16666666666666666\right)}\right) \cdot \left(\left(0.16666666666666666 \cdot y\right) \cdot y\right) - 1 \cdot 1}{\left(0.16666666666666666 \cdot y\right) \cdot y - 1} \]
      5. *-commutative72.9%

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

        \[\leadsto \frac{\left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) \cdot \left(y \cdot \color{blue}{\left(y \cdot 0.16666666666666666\right)}\right) - 1 \cdot 1}{\left(0.16666666666666666 \cdot y\right) \cdot y - 1} \]
      7. metadata-eval72.9%

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

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

        \[\leadsto \frac{\left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) \cdot \left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) - 1}{y \cdot \color{blue}{\left(y \cdot 0.16666666666666666\right)} - 1} \]
    10. Applied egg-rr72.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 550:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+65}:\\ \;\;\;\;{x}^{4} \cdot \left(y \cdot \left(y \cdot 0.006944444444444444\right)\right)\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+153}:\\ \;\;\;\;\frac{\left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) \cdot \left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) + -1}{y \cdot \left(y \cdot 0.16666666666666666\right) + -1}\\ \mathbf{else}:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \end{array} \]

Alternative 6: 67.6% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(y \cdot 0.16666666666666666\right)\\ \mathbf{if}\;y \leq 550:\\ \;\;\;\;\cos x\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+65}:\\ \;\;\;\;{x}^{4} \cdot \left(y \cdot \left(y \cdot 0.006944444444444444\right)\right)\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+153}:\\ \;\;\;\;\frac{t_0 \cdot t_0 + -1}{t_0 + -1}\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot \left(\cos x \cdot y\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* y (* y 0.16666666666666666))))
   (if (<= y 550.0)
     (cos x)
     (if (<= y 1.2e+65)
       (* (pow x 4.0) (* y (* y 0.006944444444444444)))
       (if (<= y 7e+153)
         (/ (+ (* t_0 t_0) -1.0) (+ t_0 -1.0))
         (* 0.16666666666666666 (* y (* (cos x) y))))))))
double code(double x, double y) {
	double t_0 = y * (y * 0.16666666666666666);
	double tmp;
	if (y <= 550.0) {
		tmp = cos(x);
	} else if (y <= 1.2e+65) {
		tmp = pow(x, 4.0) * (y * (y * 0.006944444444444444));
	} else if (y <= 7e+153) {
		tmp = ((t_0 * t_0) + -1.0) / (t_0 + -1.0);
	} else {
		tmp = 0.16666666666666666 * (y * (cos(x) * y));
	}
	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 = y * (y * 0.16666666666666666d0)
    if (y <= 550.0d0) then
        tmp = cos(x)
    else if (y <= 1.2d+65) then
        tmp = (x ** 4.0d0) * (y * (y * 0.006944444444444444d0))
    else if (y <= 7d+153) then
        tmp = ((t_0 * t_0) + (-1.0d0)) / (t_0 + (-1.0d0))
    else
        tmp = 0.16666666666666666d0 * (y * (cos(x) * y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = y * (y * 0.16666666666666666);
	double tmp;
	if (y <= 550.0) {
		tmp = Math.cos(x);
	} else if (y <= 1.2e+65) {
		tmp = Math.pow(x, 4.0) * (y * (y * 0.006944444444444444));
	} else if (y <= 7e+153) {
		tmp = ((t_0 * t_0) + -1.0) / (t_0 + -1.0);
	} else {
		tmp = 0.16666666666666666 * (y * (Math.cos(x) * y));
	}
	return tmp;
}
def code(x, y):
	t_0 = y * (y * 0.16666666666666666)
	tmp = 0
	if y <= 550.0:
		tmp = math.cos(x)
	elif y <= 1.2e+65:
		tmp = math.pow(x, 4.0) * (y * (y * 0.006944444444444444))
	elif y <= 7e+153:
		tmp = ((t_0 * t_0) + -1.0) / (t_0 + -1.0)
	else:
		tmp = 0.16666666666666666 * (y * (math.cos(x) * y))
	return tmp
function code(x, y)
	t_0 = Float64(y * Float64(y * 0.16666666666666666))
	tmp = 0.0
	if (y <= 550.0)
		tmp = cos(x);
	elseif (y <= 1.2e+65)
		tmp = Float64((x ^ 4.0) * Float64(y * Float64(y * 0.006944444444444444)));
	elseif (y <= 7e+153)
		tmp = Float64(Float64(Float64(t_0 * t_0) + -1.0) / Float64(t_0 + -1.0));
	else
		tmp = Float64(0.16666666666666666 * Float64(y * Float64(cos(x) * y)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = y * (y * 0.16666666666666666);
	tmp = 0.0;
	if (y <= 550.0)
		tmp = cos(x);
	elseif (y <= 1.2e+65)
		tmp = (x ^ 4.0) * (y * (y * 0.006944444444444444));
	elseif (y <= 7e+153)
		tmp = ((t_0 * t_0) + -1.0) / (t_0 + -1.0);
	else
		tmp = 0.16666666666666666 * (y * (cos(x) * y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 550.0], N[Cos[x], $MachinePrecision], If[LessEqual[y, 1.2e+65], N[(N[Power[x, 4.0], $MachinePrecision] * N[(y * N[(y * 0.006944444444444444), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7e+153], N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] + -1.0), $MachinePrecision] / N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(y * N[(N[Cos[x], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 1.2 \cdot 10^{+65}:\\
\;\;\;\;{x}^{4} \cdot \left(y \cdot \left(y \cdot 0.006944444444444444\right)\right)\\

\mathbf{elif}\;y \leq 7 \cdot 10^{+153}:\\
\;\;\;\;\frac{t_0 \cdot t_0 + -1}{t_0 + -1}\\

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


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

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around 0 65.9%

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

    if 550 < y < 1.2000000000000001e65

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around inf 3.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + \left(\left(y \cdot y\right) \cdot \left({x}^{2} \cdot -0.5\right) + \color{blue}{\left(y \cdot y\right) \cdot \left({x}^{4} \cdot 0.041666666666666664\right)}\right)\right) \]
      10. distribute-lft-out15.1%

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

        \[\leadsto 0.16666666666666666 \cdot \left(y \cdot y + \left(y \cdot y\right) \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot -0.5 + {x}^{4} \cdot 0.041666666666666664\right)\right) \]
    8. Simplified15.1%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y + \left(y \cdot y\right) \cdot \left(\left(x \cdot x\right) \cdot -0.5 + {x}^{4} \cdot 0.041666666666666664\right)\right)} \]
    9. Taylor expanded in x around inf 32.9%

      \[\leadsto \color{blue}{0.006944444444444444 \cdot \left({y}^{2} \cdot {x}^{4}\right)} \]
    10. Step-by-step derivation
      1. unpow232.9%

        \[\leadsto 0.006944444444444444 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot {x}^{4}\right) \]
      2. associate-*r*32.9%

        \[\leadsto \color{blue}{\left(0.006944444444444444 \cdot \left(y \cdot y\right)\right) \cdot {x}^{4}} \]
      3. *-commutative32.9%

        \[\leadsto \color{blue}{{x}^{4} \cdot \left(0.006944444444444444 \cdot \left(y \cdot y\right)\right)} \]
      4. associate-*r*32.9%

        \[\leadsto {x}^{4} \cdot \color{blue}{\left(\left(0.006944444444444444 \cdot y\right) \cdot y\right)} \]
    11. Simplified32.9%

      \[\leadsto \color{blue}{{x}^{4} \cdot \left(\left(0.006944444444444444 \cdot y\right) \cdot y\right)} \]

    if 1.2000000000000001e65 < y < 6.9999999999999998e153

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around 0 6.2%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\left(\left(0.16666666666666666 \cdot y\right) \cdot y\right) \cdot \left(\left(0.16666666666666666 \cdot y\right) \cdot y\right) - 1 \cdot 1}{\left(0.16666666666666666 \cdot y\right) \cdot y - 1}} \]
      3. *-commutative72.9%

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

        \[\leadsto \frac{\left(y \cdot \color{blue}{\left(y \cdot 0.16666666666666666\right)}\right) \cdot \left(\left(0.16666666666666666 \cdot y\right) \cdot y\right) - 1 \cdot 1}{\left(0.16666666666666666 \cdot y\right) \cdot y - 1} \]
      5. *-commutative72.9%

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

        \[\leadsto \frac{\left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) \cdot \left(y \cdot \color{blue}{\left(y \cdot 0.16666666666666666\right)}\right) - 1 \cdot 1}{\left(0.16666666666666666 \cdot y\right) \cdot y - 1} \]
      7. metadata-eval72.9%

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

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

        \[\leadsto \frac{\left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) \cdot \left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) - 1}{y \cdot \color{blue}{\left(y \cdot 0.16666666666666666\right)} - 1} \]
    10. Applied egg-rr72.9%

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

    if 6.9999999999999998e153 < 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 \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around inf 97.3%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 550:\\ \;\;\;\;\cos x\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+65}:\\ \;\;\;\;{x}^{4} \cdot \left(y \cdot \left(y \cdot 0.006944444444444444\right)\right)\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+153}:\\ \;\;\;\;\frac{\left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) \cdot \left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) + -1}{y \cdot \left(y \cdot 0.16666666666666666\right) + -1}\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot \left(\cos x \cdot y\right)\right)\\ \end{array} \]

Alternative 7: 66.7% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(y \cdot 0.16666666666666666\right)\\ \mathbf{if}\;y \leq 8 \cdot 10^{-9}:\\ \;\;\;\;\cos x\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+153}:\\ \;\;\;\;\frac{t_0 \cdot t_0 + -1}{t_0 + -1}\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot \left(\cos x \cdot y\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* y (* y 0.16666666666666666))))
   (if (<= y 8e-9)
     (cos x)
     (if (<= y 7e+153)
       (/ (+ (* t_0 t_0) -1.0) (+ t_0 -1.0))
       (* 0.16666666666666666 (* y (* (cos x) y)))))))
double code(double x, double y) {
	double t_0 = y * (y * 0.16666666666666666);
	double tmp;
	if (y <= 8e-9) {
		tmp = cos(x);
	} else if (y <= 7e+153) {
		tmp = ((t_0 * t_0) + -1.0) / (t_0 + -1.0);
	} else {
		tmp = 0.16666666666666666 * (y * (cos(x) * y));
	}
	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 = y * (y * 0.16666666666666666d0)
    if (y <= 8d-9) then
        tmp = cos(x)
    else if (y <= 7d+153) then
        tmp = ((t_0 * t_0) + (-1.0d0)) / (t_0 + (-1.0d0))
    else
        tmp = 0.16666666666666666d0 * (y * (cos(x) * y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = y * (y * 0.16666666666666666);
	double tmp;
	if (y <= 8e-9) {
		tmp = Math.cos(x);
	} else if (y <= 7e+153) {
		tmp = ((t_0 * t_0) + -1.0) / (t_0 + -1.0);
	} else {
		tmp = 0.16666666666666666 * (y * (Math.cos(x) * y));
	}
	return tmp;
}
def code(x, y):
	t_0 = y * (y * 0.16666666666666666)
	tmp = 0
	if y <= 8e-9:
		tmp = math.cos(x)
	elif y <= 7e+153:
		tmp = ((t_0 * t_0) + -1.0) / (t_0 + -1.0)
	else:
		tmp = 0.16666666666666666 * (y * (math.cos(x) * y))
	return tmp
function code(x, y)
	t_0 = Float64(y * Float64(y * 0.16666666666666666))
	tmp = 0.0
	if (y <= 8e-9)
		tmp = cos(x);
	elseif (y <= 7e+153)
		tmp = Float64(Float64(Float64(t_0 * t_0) + -1.0) / Float64(t_0 + -1.0));
	else
		tmp = Float64(0.16666666666666666 * Float64(y * Float64(cos(x) * y)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = y * (y * 0.16666666666666666);
	tmp = 0.0;
	if (y <= 8e-9)
		tmp = cos(x);
	elseif (y <= 7e+153)
		tmp = ((t_0 * t_0) + -1.0) / (t_0 + -1.0);
	else
		tmp = 0.16666666666666666 * (y * (cos(x) * y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 8e-9], N[Cos[x], $MachinePrecision], If[LessEqual[y, 7e+153], N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] + -1.0), $MachinePrecision] / N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(y * N[(N[Cos[x], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 0.16666666666666666\right)\\
\mathbf{if}\;y \leq 8 \cdot 10^{-9}:\\
\;\;\;\;\cos x\\

\mathbf{elif}\;y \leq 7 \cdot 10^{+153}:\\
\;\;\;\;\frac{t_0 \cdot t_0 + -1}{t_0 + -1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 8.0000000000000005e-9

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around 0 65.8%

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

    if 8.0000000000000005e-9 < y < 6.9999999999999998e153

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around 0 7.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) \cdot \left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) - 1}{y \cdot \color{blue}{\left(y \cdot 0.16666666666666666\right)} - 1} \]
    10. Applied egg-rr49.4%

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

    if 6.9999999999999998e153 < 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 \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around inf 97.3%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 8 \cdot 10^{-9}:\\ \;\;\;\;\cos x\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+153}:\\ \;\;\;\;\frac{\left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) \cdot \left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) + -1}{y \cdot \left(y \cdot 0.16666666666666666\right) + -1}\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot \left(\cos x \cdot y\right)\right)\\ \end{array} \]

Alternative 8: 63.3% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(y \cdot 0.16666666666666666\right)\\ \mathbf{if}\;y \leq 8 \cdot 10^{-9}:\\ \;\;\;\;\cos x\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+153}:\\ \;\;\;\;\frac{t_0 \cdot t_0 + -1}{t_0 + -1}\\ \mathbf{else}:\\ \;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* y (* y 0.16666666666666666))))
   (if (<= y 8e-9)
     (cos x)
     (if (<= y 7e+153)
       (/ (+ (* t_0 t_0) -1.0) (+ t_0 -1.0))
       (+ 1.0 (* 0.16666666666666666 (* y y)))))))
double code(double x, double y) {
	double t_0 = y * (y * 0.16666666666666666);
	double tmp;
	if (y <= 8e-9) {
		tmp = cos(x);
	} else if (y <= 7e+153) {
		tmp = ((t_0 * t_0) + -1.0) / (t_0 + -1.0);
	} 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) :: t_0
    real(8) :: tmp
    t_0 = y * (y * 0.16666666666666666d0)
    if (y <= 8d-9) then
        tmp = cos(x)
    else if (y <= 7d+153) then
        tmp = ((t_0 * t_0) + (-1.0d0)) / (t_0 + (-1.0d0))
    else
        tmp = 1.0d0 + (0.16666666666666666d0 * (y * y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = y * (y * 0.16666666666666666);
	double tmp;
	if (y <= 8e-9) {
		tmp = Math.cos(x);
	} else if (y <= 7e+153) {
		tmp = ((t_0 * t_0) + -1.0) / (t_0 + -1.0);
	} else {
		tmp = 1.0 + (0.16666666666666666 * (y * y));
	}
	return tmp;
}
def code(x, y):
	t_0 = y * (y * 0.16666666666666666)
	tmp = 0
	if y <= 8e-9:
		tmp = math.cos(x)
	elif y <= 7e+153:
		tmp = ((t_0 * t_0) + -1.0) / (t_0 + -1.0)
	else:
		tmp = 1.0 + (0.16666666666666666 * (y * y))
	return tmp
function code(x, y)
	t_0 = Float64(y * Float64(y * 0.16666666666666666))
	tmp = 0.0
	if (y <= 8e-9)
		tmp = cos(x);
	elseif (y <= 7e+153)
		tmp = Float64(Float64(Float64(t_0 * t_0) + -1.0) / Float64(t_0 + -1.0));
	else
		tmp = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = y * (y * 0.16666666666666666);
	tmp = 0.0;
	if (y <= 8e-9)
		tmp = cos(x);
	elseif (y <= 7e+153)
		tmp = ((t_0 * t_0) + -1.0) / (t_0 + -1.0);
	else
		tmp = 1.0 + (0.16666666666666666 * (y * y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 8e-9], N[Cos[x], $MachinePrecision], If[LessEqual[y, 7e+153], N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] + -1.0), $MachinePrecision] / N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 0.16666666666666666\right)\\
\mathbf{if}\;y \leq 8 \cdot 10^{-9}:\\
\;\;\;\;\cos x\\

\mathbf{elif}\;y \leq 7 \cdot 10^{+153}:\\
\;\;\;\;\frac{t_0 \cdot t_0 + -1}{t_0 + -1}\\

\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 < 8.0000000000000005e-9

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around 0 65.8%

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

    if 8.0000000000000005e-9 < y < 6.9999999999999998e153

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around 0 7.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) \cdot \left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) - 1}{y \cdot \color{blue}{\left(y \cdot 0.16666666666666666\right)} - 1} \]
    10. Applied egg-rr49.4%

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

    if 6.9999999999999998e153 < 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 \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in x around 0 84.4%

      \[\leadsto \color{blue}{\frac{y + 0.16666666666666666 \cdot {y}^{3}}{y}} \]
    4. Taylor expanded in y around 0 84.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 8 \cdot 10^{-9}:\\ \;\;\;\;\cos x\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+153}:\\ \;\;\;\;\frac{\left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) \cdot \left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) + -1}{y \cdot \left(y \cdot 0.16666666666666666\right) + -1}\\ \mathbf{else}:\\ \;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \end{array} \]

Alternative 9: 46.2% accurate, 8.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(y \cdot 0.16666666666666666\right)\\ \mathbf{if}\;y \leq 7 \cdot 10^{+153}:\\ \;\;\;\;\frac{t_0 \cdot t_0 + -1}{t_0 + -1}\\ \mathbf{else}:\\ \;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* y (* y 0.16666666666666666))))
   (if (<= y 7e+153)
     (/ (+ (* t_0 t_0) -1.0) (+ t_0 -1.0))
     (+ 1.0 (* 0.16666666666666666 (* y y))))))
double code(double x, double y) {
	double t_0 = y * (y * 0.16666666666666666);
	double tmp;
	if (y <= 7e+153) {
		tmp = ((t_0 * t_0) + -1.0) / (t_0 + -1.0);
	} 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) :: t_0
    real(8) :: tmp
    t_0 = y * (y * 0.16666666666666666d0)
    if (y <= 7d+153) then
        tmp = ((t_0 * t_0) + (-1.0d0)) / (t_0 + (-1.0d0))
    else
        tmp = 1.0d0 + (0.16666666666666666d0 * (y * y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = y * (y * 0.16666666666666666);
	double tmp;
	if (y <= 7e+153) {
		tmp = ((t_0 * t_0) + -1.0) / (t_0 + -1.0);
	} else {
		tmp = 1.0 + (0.16666666666666666 * (y * y));
	}
	return tmp;
}
def code(x, y):
	t_0 = y * (y * 0.16666666666666666)
	tmp = 0
	if y <= 7e+153:
		tmp = ((t_0 * t_0) + -1.0) / (t_0 + -1.0)
	else:
		tmp = 1.0 + (0.16666666666666666 * (y * y))
	return tmp
function code(x, y)
	t_0 = Float64(y * Float64(y * 0.16666666666666666))
	tmp = 0.0
	if (y <= 7e+153)
		tmp = Float64(Float64(Float64(t_0 * t_0) + -1.0) / Float64(t_0 + -1.0));
	else
		tmp = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = y * (y * 0.16666666666666666);
	tmp = 0.0;
	if (y <= 7e+153)
		tmp = ((t_0 * t_0) + -1.0) / (t_0 + -1.0);
	else
		tmp = 1.0 + (0.16666666666666666 * (y * y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 7e+153], N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] + -1.0), $MachinePrecision] / N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 0.16666666666666666\right)\\
\mathbf{if}\;y \leq 7 \cdot 10^{+153}:\\
\;\;\;\;\frac{t_0 \cdot t_0 + -1}{t_0 + -1}\\

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


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

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around 0 67.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) \cdot \left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) - 1}{y \cdot \color{blue}{\left(y \cdot 0.16666666666666666\right)} - 1} \]
    10. Applied egg-rr42.0%

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

    if 6.9999999999999998e153 < 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 \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in x around 0 84.4%

      \[\leadsto \color{blue}{\frac{y + 0.16666666666666666 \cdot {y}^{3}}{y}} \]
    4. Taylor expanded in y around 0 84.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 7 \cdot 10^{+153}:\\ \;\;\;\;\frac{\left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) \cdot \left(y \cdot \left(y \cdot 0.16666666666666666\right)\right) + -1}{y \cdot \left(y \cdot 0.16666666666666666\right) + -1}\\ \mathbf{else}:\\ \;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \end{array} \]

Alternative 10: 49.1% accurate, 13.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{if}\;y \leq 5.1 \cdot 10^{+14}:\\ \;\;\;\;1 + t_0\\ \mathbf{elif}\;y \leq 3.7 \cdot 10^{+160}:\\ \;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + \left(x \cdot x\right) \cdot -0.08333333333333333\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* 0.16666666666666666 (* y y))))
   (if (<= y 5.1e+14)
     (+ 1.0 t_0)
     (if (<= y 3.7e+160)
       (* (* y y) (+ 0.16666666666666666 (* (* x x) -0.08333333333333333)))
       t_0))))
double code(double x, double y) {
	double t_0 = 0.16666666666666666 * (y * y);
	double tmp;
	if (y <= 5.1e+14) {
		tmp = 1.0 + t_0;
	} else if (y <= 3.7e+160) {
		tmp = (y * y) * (0.16666666666666666 + ((x * x) * -0.08333333333333333));
	} 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 = 0.16666666666666666d0 * (y * y)
    if (y <= 5.1d+14) then
        tmp = 1.0d0 + t_0
    else if (y <= 3.7d+160) then
        tmp = (y * y) * (0.16666666666666666d0 + ((x * x) * (-0.08333333333333333d0)))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = 0.16666666666666666 * (y * y);
	double tmp;
	if (y <= 5.1e+14) {
		tmp = 1.0 + t_0;
	} else if (y <= 3.7e+160) {
		tmp = (y * y) * (0.16666666666666666 + ((x * x) * -0.08333333333333333));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = 0.16666666666666666 * (y * y)
	tmp = 0
	if y <= 5.1e+14:
		tmp = 1.0 + t_0
	elif y <= 3.7e+160:
		tmp = (y * y) * (0.16666666666666666 + ((x * x) * -0.08333333333333333))
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(0.16666666666666666 * Float64(y * y))
	tmp = 0.0
	if (y <= 5.1e+14)
		tmp = Float64(1.0 + t_0);
	elseif (y <= 3.7e+160)
		tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(Float64(x * x) * -0.08333333333333333)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = 0.16666666666666666 * (y * y);
	tmp = 0.0;
	if (y <= 5.1e+14)
		tmp = 1.0 + t_0;
	elseif (y <= 3.7e+160)
		tmp = (y * y) * (0.16666666666666666 + ((x * x) * -0.08333333333333333));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 5.1e+14], N[(1.0 + t$95$0), $MachinePrecision], If[LessEqual[y, 3.7e+160], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(N[(x * x), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in x around 0 53.3%

      \[\leadsto \color{blue}{\frac{y + 0.16666666666666666 \cdot {y}^{3}}{y}} \]
    4. Taylor expanded in y around 0 49.7%

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

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

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

    if 5.1e14 < y < 3.70000000000000016e160

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around inf 11.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(y \cdot y\right) \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot -0.08333333333333333 + 0.16666666666666666\right) \]
    8. Simplified23.0%

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

    if 3.70000000000000016e160 < 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 \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around inf 100.0%

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

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

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

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

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

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

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

Alternative 11: 48.9% accurate, 15.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 4.7 \cdot 10^{+14} \lor \neg \left(y \leq 1.32 \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 4.7e+14) (not (<= y 1.32e+154)))
   (+ 1.0 (* 0.16666666666666666 (* y y)))
   (* -0.08333333333333333 (* (* y y) (* x x)))))
double code(double x, double y) {
	double tmp;
	if ((y <= 4.7e+14) || !(y <= 1.32e+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 <= 4.7d+14) .or. (.not. (y <= 1.32d+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 <= 4.7e+14) || !(y <= 1.32e+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 <= 4.7e+14) or not (y <= 1.32e+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 <= 4.7e+14) || !(y <= 1.32e+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 <= 4.7e+14) || ~((y <= 1.32e+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, 4.7e+14], N[Not[LessEqual[y, 1.32e+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 4.7 \cdot 10^{+14} \lor \neg \left(y \leq 1.32 \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 < 4.7e14 or 1.31999999999999998e154 < 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 \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in x around 0 58.3%

      \[\leadsto \color{blue}{\frac{y + 0.16666666666666666 \cdot {y}^{3}}{y}} \]
    4. Taylor expanded in y around 0 55.3%

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

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

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

    if 4.7e14 < y < 1.31999999999999998e154

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around inf 5.6%

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

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left({y}^{2} \cdot \cos x\right)} \]
      2. unpow25.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.16666666666666666 \cdot \left(\left(-0.5 \cdot \color{blue}{\left(x \cdot x\right)} + 1\right) \cdot \left(y \cdot y\right)\right) \]
    8. Simplified18.0%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(\left(-0.5 \cdot \left(x \cdot x\right) + 1\right) \cdot \left(y \cdot y\right)\right)} \]
    9. Taylor expanded in x around inf 15.8%

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

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

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

        \[\leadsto \left(\left(y \cdot y\right) \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot -0.08333333333333333 \]
    11. Simplified15.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4.7 \cdot 10^{+14} \lor \neg \left(y \leq 1.32 \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: 48.6% accurate, 15.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{if}\;y \leq 2.05 \cdot 10^{+15}:\\ \;\;\;\;1 + t_0\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{+160}:\\ \;\;\;\;-0.08333333333333333 \cdot \left(\left(x \cdot y\right) \cdot \left(x \cdot y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* 0.16666666666666666 (* y y))))
   (if (<= y 2.05e+15)
     (+ 1.0 t_0)
     (if (<= y 2.65e+160) (* -0.08333333333333333 (* (* x y) (* x y))) t_0))))
double code(double x, double y) {
	double t_0 = 0.16666666666666666 * (y * y);
	double tmp;
	if (y <= 2.05e+15) {
		tmp = 1.0 + t_0;
	} else if (y <= 2.65e+160) {
		tmp = -0.08333333333333333 * ((x * y) * (x * y));
	} 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 = 0.16666666666666666d0 * (y * y)
    if (y <= 2.05d+15) then
        tmp = 1.0d0 + t_0
    else if (y <= 2.65d+160) then
        tmp = (-0.08333333333333333d0) * ((x * y) * (x * y))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = 0.16666666666666666 * (y * y);
	double tmp;
	if (y <= 2.05e+15) {
		tmp = 1.0 + t_0;
	} else if (y <= 2.65e+160) {
		tmp = -0.08333333333333333 * ((x * y) * (x * y));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = 0.16666666666666666 * (y * y)
	tmp = 0
	if y <= 2.05e+15:
		tmp = 1.0 + t_0
	elif y <= 2.65e+160:
		tmp = -0.08333333333333333 * ((x * y) * (x * y))
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(0.16666666666666666 * Float64(y * y))
	tmp = 0.0
	if (y <= 2.05e+15)
		tmp = Float64(1.0 + t_0);
	elseif (y <= 2.65e+160)
		tmp = Float64(-0.08333333333333333 * Float64(Float64(x * y) * Float64(x * y)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = 0.16666666666666666 * (y * y);
	tmp = 0.0;
	if (y <= 2.05e+15)
		tmp = 1.0 + t_0;
	elseif (y <= 2.65e+160)
		tmp = -0.08333333333333333 * ((x * y) * (x * y));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 2.05e+15], N[(1.0 + t$95$0), $MachinePrecision], If[LessEqual[y, 2.65e+160], N[(-0.08333333333333333 * N[(N[(x * y), $MachinePrecision] * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in x around 0 53.3%

      \[\leadsto \color{blue}{\frac{y + 0.16666666666666666 \cdot {y}^{3}}{y}} \]
    4. Taylor expanded in y around 0 49.7%

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

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

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

    if 2.05e15 < y < 2.65e160

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around inf 11.3%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.16666666666666666 \cdot \left(\left(-0.5 \cdot \color{blue}{\left(x \cdot x\right)} + 1\right) \cdot \left(y \cdot y\right)\right) \]
    8. Simplified23.0%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(\left(-0.5 \cdot \left(x \cdot x\right) + 1\right) \cdot \left(y \cdot y\right)\right)} \]
    9. Taylor expanded in x around inf 19.0%

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

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

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

        \[\leadsto \left(\left(y \cdot y\right) \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot -0.08333333333333333 \]
      4. unswap-sqr18.9%

        \[\leadsto \color{blue}{\left(\left(y \cdot x\right) \cdot \left(y \cdot x\right)\right)} \cdot -0.08333333333333333 \]
    11. Simplified18.9%

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

    if 2.65e160 < 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 \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around inf 100.0%

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

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

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

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

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

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

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

Alternative 13: 37.4% accurate, 29.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 2.4:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 2.4) 1.0 (* 0.16666666666666666 (* y y))))
double code(double x, double y) {
	double tmp;
	if (y <= 2.4) {
		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 <= 2.4d0) 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 <= 2.4) {
		tmp = 1.0;
	} else {
		tmp = 0.16666666666666666 * (y * y);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 2.4:
		tmp = 1.0
	else:
		tmp = 0.16666666666666666 * (y * y)
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 2.4)
		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 <= 2.4)
		tmp = 1.0;
	else
		tmp = 0.16666666666666666 * (y * y);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 2.4], 1.0, N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.4:\\
\;\;\;\;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.39999999999999991

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around 0 83.6%

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

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

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

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

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

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

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

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

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

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

    if 2.39999999999999991 < y

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
    3. Taylor expanded in y around inf 43.6%

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

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left({y}^{2} \cdot \cos x\right)} \]
      2. unpow243.6%

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

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot \left(y \cdot \cos x\right)\right)} \]
    5. Simplified43.6%

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

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

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

Alternative 14: 47.1% 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 80.6%

    \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
  3. Taylor expanded in x around 0 53.4%

    \[\leadsto \color{blue}{\frac{y + 0.16666666666666666 \cdot {y}^{3}}{y}} \]
  4. Taylor expanded in y around 0 46.2%

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

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

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

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

Alternative 15: 28.7% 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 80.6%

    \[\leadsto \cos x \cdot \frac{\color{blue}{y + 0.16666666666666666 \cdot {y}^{3}}}{y} \]
  3. Taylor expanded in y around 0 71.6%

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{1} \]
  10. Final simplification25.6%

    \[\leadsto 1 \]

Reproduce

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