Linear.Quaternion:$csin from linear-1.19.1.3

Percentage Accurate: 100.0% → 100.0%
Time: 6.5s
Alternatives: 11
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 11 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.4% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + \left(x \cdot x\right) \cdot -0.5\\ t_1 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{if}\;y \leq 370:\\ \;\;\;\;\cos x \cdot \left(1 + t_1\right)\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{+77}:\\ \;\;\;\;\frac{1 + {t_1}^{3}}{t_1 \cdot t_1 + \left(1 - t_1\right)} \cdot t_0\\ \mathbf{elif}\;y \leq 1.32 \cdot 10^{+154}:\\ \;\;\;\;t_0 \cdot \frac{0.027777777777777776 \cdot {y}^{4} + -1}{t_1 + -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 (+ 1.0 (* (* x x) -0.5))) (t_1 (* 0.16666666666666666 (* y y))))
   (if (<= y 370.0)
     (* (cos x) (+ 1.0 t_1))
     (if (<= y 1.5e+77)
       (* (/ (+ 1.0 (pow t_1 3.0)) (+ (* t_1 t_1) (- 1.0 t_1))) t_0)
       (if (<= y 1.32e+154)
         (* t_0 (/ (+ (* 0.027777777777777776 (pow y 4.0)) -1.0) (+ t_1 -1.0)))
         (* 0.16666666666666666 (* y (* (cos x) y))))))))
double code(double x, double y) {
	double t_0 = 1.0 + ((x * x) * -0.5);
	double t_1 = 0.16666666666666666 * (y * y);
	double tmp;
	if (y <= 370.0) {
		tmp = cos(x) * (1.0 + t_1);
	} else if (y <= 1.5e+77) {
		tmp = ((1.0 + pow(t_1, 3.0)) / ((t_1 * t_1) + (1.0 - t_1))) * t_0;
	} else if (y <= 1.32e+154) {
		tmp = t_0 * (((0.027777777777777776 * pow(y, 4.0)) + -1.0) / (t_1 + -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) :: t_1
    real(8) :: tmp
    t_0 = 1.0d0 + ((x * x) * (-0.5d0))
    t_1 = 0.16666666666666666d0 * (y * y)
    if (y <= 370.0d0) then
        tmp = cos(x) * (1.0d0 + t_1)
    else if (y <= 1.5d+77) then
        tmp = ((1.0d0 + (t_1 ** 3.0d0)) / ((t_1 * t_1) + (1.0d0 - t_1))) * t_0
    else if (y <= 1.32d+154) then
        tmp = t_0 * (((0.027777777777777776d0 * (y ** 4.0d0)) + (-1.0d0)) / (t_1 + (-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 = 1.0 + ((x * x) * -0.5);
	double t_1 = 0.16666666666666666 * (y * y);
	double tmp;
	if (y <= 370.0) {
		tmp = Math.cos(x) * (1.0 + t_1);
	} else if (y <= 1.5e+77) {
		tmp = ((1.0 + Math.pow(t_1, 3.0)) / ((t_1 * t_1) + (1.0 - t_1))) * t_0;
	} else if (y <= 1.32e+154) {
		tmp = t_0 * (((0.027777777777777776 * Math.pow(y, 4.0)) + -1.0) / (t_1 + -1.0));
	} else {
		tmp = 0.16666666666666666 * (y * (Math.cos(x) * y));
	}
	return tmp;
}
def code(x, y):
	t_0 = 1.0 + ((x * x) * -0.5)
	t_1 = 0.16666666666666666 * (y * y)
	tmp = 0
	if y <= 370.0:
		tmp = math.cos(x) * (1.0 + t_1)
	elif y <= 1.5e+77:
		tmp = ((1.0 + math.pow(t_1, 3.0)) / ((t_1 * t_1) + (1.0 - t_1))) * t_0
	elif y <= 1.32e+154:
		tmp = t_0 * (((0.027777777777777776 * math.pow(y, 4.0)) + -1.0) / (t_1 + -1.0))
	else:
		tmp = 0.16666666666666666 * (y * (math.cos(x) * y))
	return tmp
function code(x, y)
	t_0 = Float64(1.0 + Float64(Float64(x * x) * -0.5))
	t_1 = Float64(0.16666666666666666 * Float64(y * y))
	tmp = 0.0
	if (y <= 370.0)
		tmp = Float64(cos(x) * Float64(1.0 + t_1));
	elseif (y <= 1.5e+77)
		tmp = Float64(Float64(Float64(1.0 + (t_1 ^ 3.0)) / Float64(Float64(t_1 * t_1) + Float64(1.0 - t_1))) * t_0);
	elseif (y <= 1.32e+154)
		tmp = Float64(t_0 * Float64(Float64(Float64(0.027777777777777776 * (y ^ 4.0)) + -1.0) / Float64(t_1 + -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 = 1.0 + ((x * x) * -0.5);
	t_1 = 0.16666666666666666 * (y * y);
	tmp = 0.0;
	if (y <= 370.0)
		tmp = cos(x) * (1.0 + t_1);
	elseif (y <= 1.5e+77)
		tmp = ((1.0 + (t_1 ^ 3.0)) / ((t_1 * t_1) + (1.0 - t_1))) * t_0;
	elseif (y <= 1.32e+154)
		tmp = t_0 * (((0.027777777777777776 * (y ^ 4.0)) + -1.0) / (t_1 + -1.0));
	else
		tmp = 0.16666666666666666 * (y * (cos(x) * y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 370.0], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.5e+77], N[(N[(N[(1.0 + N[Power[t$95$1, 3.0], $MachinePrecision]), $MachinePrecision] / N[(N[(t$95$1 * t$95$1), $MachinePrecision] + N[(1.0 - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[y, 1.32e+154], N[(t$95$0 * N[(N[(N[(0.027777777777777776 * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision] / N[(t$95$1 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(y * N[(N[Cos[x], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;y \leq 1.32 \cdot 10^{+154}:\\
\;\;\;\;t_0 \cdot \frac{0.027777777777777776 \cdot {y}^{4} + -1}{t_1 + -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 < 370

    1. Initial program 100.0%

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

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

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

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

    if 370 < y < 1.4999999999999999e77

    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 \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow23.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}^{3} + {1}^{3}}{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) + \left(1 \cdot 1 - \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot 1\right)}} \cdot \left(\left(x \cdot x\right) \cdot -0.5 + 1\right) \]
      3. metadata-eval39.6%

        \[\leadsto \frac{{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}^{3} + \color{blue}{1}}{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) + \left(1 \cdot 1 - \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot 1\right)} \cdot \left(\left(x \cdot x\right) \cdot -0.5 + 1\right) \]
      4. metadata-eval39.6%

        \[\leadsto \frac{{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}^{3} + 1}{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) + \left(\color{blue}{1} - \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot 1\right)} \cdot \left(\left(x \cdot x\right) \cdot -0.5 + 1\right) \]
    9. Applied egg-rr39.6%

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

    if 1.4999999999999999e77 < y < 1.31999999999999998e154

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) - 1}{0.16666666666666666 \cdot \left(y \cdot y\right) - 1}} \cdot \left(\left(x \cdot x\right) \cdot -0.5 + 1\right) \]
    10. Taylor expanded in y around 0 87.5%

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

    if 1.31999999999999998e154 < y

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(\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)} \]
    7. Simplified100.0%

      \[\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 simplification83.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 370:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{+77}:\\ \;\;\;\;\frac{1 + {\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}^{3}}{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) + \left(1 - 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \cdot \left(1 + \left(x \cdot x\right) \cdot -0.5\right)\\ \mathbf{elif}\;y \leq 1.32 \cdot 10^{+154}:\\ \;\;\;\;\left(1 + \left(x \cdot x\right) \cdot -0.5\right) \cdot \frac{0.027777777777777776 \cdot {y}^{4} + -1}{0.16666666666666666 \cdot \left(y \cdot y\right) + -1}\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot \left(\cos x \cdot y\right)\right)\\ \end{array} \]

Alternative 3: 81.3% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{if}\;y \leq 440:\\ \;\;\;\;\cos x \cdot \left(1 + t_0\right)\\ \mathbf{elif}\;y \leq 1.32 \cdot 10^{+154}:\\ \;\;\;\;\left(1 + \left(x \cdot x\right) \cdot -0.5\right) \cdot \frac{0.027777777777777776 \cdot {y}^{4} + -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 (* 0.16666666666666666 (* y y))))
   (if (<= y 440.0)
     (* (cos x) (+ 1.0 t_0))
     (if (<= y 1.32e+154)
       (*
        (+ 1.0 (* (* x x) -0.5))
        (/ (+ (* 0.027777777777777776 (pow y 4.0)) -1.0) (+ t_0 -1.0)))
       (* 0.16666666666666666 (* y (* (cos x) y)))))))
double code(double x, double y) {
	double t_0 = 0.16666666666666666 * (y * y);
	double tmp;
	if (y <= 440.0) {
		tmp = cos(x) * (1.0 + t_0);
	} else if (y <= 1.32e+154) {
		tmp = (1.0 + ((x * x) * -0.5)) * (((0.027777777777777776 * pow(y, 4.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 = 0.16666666666666666d0 * (y * y)
    if (y <= 440.0d0) then
        tmp = cos(x) * (1.0d0 + t_0)
    else if (y <= 1.32d+154) then
        tmp = (1.0d0 + ((x * x) * (-0.5d0))) * (((0.027777777777777776d0 * (y ** 4.0d0)) + (-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 = 0.16666666666666666 * (y * y);
	double tmp;
	if (y <= 440.0) {
		tmp = Math.cos(x) * (1.0 + t_0);
	} else if (y <= 1.32e+154) {
		tmp = (1.0 + ((x * x) * -0.5)) * (((0.027777777777777776 * Math.pow(y, 4.0)) + -1.0) / (t_0 + -1.0));
	} else {
		tmp = 0.16666666666666666 * (y * (Math.cos(x) * y));
	}
	return tmp;
}
def code(x, y):
	t_0 = 0.16666666666666666 * (y * y)
	tmp = 0
	if y <= 440.0:
		tmp = math.cos(x) * (1.0 + t_0)
	elif y <= 1.32e+154:
		tmp = (1.0 + ((x * x) * -0.5)) * (((0.027777777777777776 * math.pow(y, 4.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(0.16666666666666666 * Float64(y * y))
	tmp = 0.0
	if (y <= 440.0)
		tmp = Float64(cos(x) * Float64(1.0 + t_0));
	elseif (y <= 1.32e+154)
		tmp = Float64(Float64(1.0 + Float64(Float64(x * x) * -0.5)) * Float64(Float64(Float64(0.027777777777777776 * (y ^ 4.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 = 0.16666666666666666 * (y * y);
	tmp = 0.0;
	if (y <= 440.0)
		tmp = cos(x) * (1.0 + t_0);
	elseif (y <= 1.32e+154)
		tmp = (1.0 + ((x * x) * -0.5)) * (((0.027777777777777776 * (y ^ 4.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[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 440.0], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.32e+154], N[(N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(0.027777777777777776 * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision] / N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(y * N[(N[Cos[x], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 1.32 \cdot 10^{+154}:\\
\;\;\;\;\left(1 + \left(x \cdot x\right) \cdot -0.5\right) \cdot \frac{0.027777777777777776 \cdot {y}^{4} + -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 < 440

    1. Initial program 100.0%

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

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

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

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

    if 440 < y < 1.31999999999999998e154

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) - 1 \cdot 1}{0.16666666666666666 \cdot \left(y \cdot y\right) - 1}} \cdot \left(\left(x \cdot x\right) \cdot -0.5 + 1\right) \]
      3. metadata-eval54.6%

        \[\leadsto \frac{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) - \color{blue}{1}}{0.16666666666666666 \cdot \left(y \cdot y\right) - 1} \cdot \left(\left(x \cdot x\right) \cdot -0.5 + 1\right) \]
    9. Applied egg-rr54.6%

      \[\leadsto \color{blue}{\frac{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) - 1}{0.16666666666666666 \cdot \left(y \cdot y\right) - 1}} \cdot \left(\left(x \cdot x\right) \cdot -0.5 + 1\right) \]
    10. Taylor expanded in y around 0 57.5%

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

    if 1.31999999999999998e154 < y

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(\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)} \]
    7. Simplified100.0%

      \[\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 simplification82.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 440:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 1.32 \cdot 10^{+154}:\\ \;\;\;\;\left(1 + \left(x \cdot x\right) \cdot -0.5\right) \cdot \frac{0.027777777777777776 \cdot {y}^{4} + -1}{0.16666666666666666 \cdot \left(y \cdot y\right) + -1}\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot \left(\cos x \cdot y\right)\right)\\ \end{array} \]

Alternative 4: 68.3% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{if}\;y \leq 66:\\ \;\;\;\;\cos x\\ \mathbf{elif}\;y \leq 1.32 \cdot 10^{+154}:\\ \;\;\;\;\left(1 + \left(x \cdot x\right) \cdot -0.5\right) \cdot \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 (* 0.16666666666666666 (* y y))))
   (if (<= y 66.0)
     (cos x)
     (if (<= y 1.32e+154)
       (* (+ 1.0 (* (* x x) -0.5)) (/ (+ (* 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 = 0.16666666666666666 * (y * y);
	double tmp;
	if (y <= 66.0) {
		tmp = cos(x);
	} else if (y <= 1.32e+154) {
		tmp = (1.0 + ((x * x) * -0.5)) * (((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 = 0.16666666666666666d0 * (y * y)
    if (y <= 66.0d0) then
        tmp = cos(x)
    else if (y <= 1.32d+154) then
        tmp = (1.0d0 + ((x * x) * (-0.5d0))) * (((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 = 0.16666666666666666 * (y * y);
	double tmp;
	if (y <= 66.0) {
		tmp = Math.cos(x);
	} else if (y <= 1.32e+154) {
		tmp = (1.0 + ((x * x) * -0.5)) * (((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 = 0.16666666666666666 * (y * y)
	tmp = 0
	if y <= 66.0:
		tmp = math.cos(x)
	elif y <= 1.32e+154:
		tmp = (1.0 + ((x * x) * -0.5)) * (((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(0.16666666666666666 * Float64(y * y))
	tmp = 0.0
	if (y <= 66.0)
		tmp = cos(x);
	elseif (y <= 1.32e+154)
		tmp = Float64(Float64(1.0 + Float64(Float64(x * x) * -0.5)) * 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 = 0.16666666666666666 * (y * y);
	tmp = 0.0;
	if (y <= 66.0)
		tmp = cos(x);
	elseif (y <= 1.32e+154)
		tmp = (1.0 + ((x * x) * -0.5)) * (((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[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 66.0], N[Cos[x], $MachinePrecision], If[LessEqual[y, 1.32e+154], N[(N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] + -1.0), $MachinePrecision] / N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(y * N[(N[Cos[x], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 1.32 \cdot 10^{+154}:\\
\;\;\;\;\left(1 + \left(x \cdot x\right) \cdot -0.5\right) \cdot \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 < 66

    1. Initial program 100.0%

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

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

    if 66 < y < 1.31999999999999998e154

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) - 1 \cdot 1}{0.16666666666666666 \cdot \left(y \cdot y\right) - 1}} \cdot \left(\left(x \cdot x\right) \cdot -0.5 + 1\right) \]
      3. metadata-eval54.6%

        \[\leadsto \frac{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) - \color{blue}{1}}{0.16666666666666666 \cdot \left(y \cdot y\right) - 1} \cdot \left(\left(x \cdot x\right) \cdot -0.5 + 1\right) \]
    9. Applied egg-rr54.6%

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

    if 1.31999999999999998e154 < y

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(\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)} \]
    7. Simplified100.0%

      \[\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 simplification68.3%

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

Alternative 5: 81.3% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{if}\;y \leq 370:\\ \;\;\;\;\cos x \cdot \left(1 + t_0\right)\\ \mathbf{elif}\;y \leq 1.32 \cdot 10^{+154}:\\ \;\;\;\;\left(1 + \left(x \cdot x\right) \cdot -0.5\right) \cdot \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 (* 0.16666666666666666 (* y y))))
   (if (<= y 370.0)
     (* (cos x) (+ 1.0 t_0))
     (if (<= y 1.32e+154)
       (* (+ 1.0 (* (* x x) -0.5)) (/ (+ (* 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 = 0.16666666666666666 * (y * y);
	double tmp;
	if (y <= 370.0) {
		tmp = cos(x) * (1.0 + t_0);
	} else if (y <= 1.32e+154) {
		tmp = (1.0 + ((x * x) * -0.5)) * (((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 = 0.16666666666666666d0 * (y * y)
    if (y <= 370.0d0) then
        tmp = cos(x) * (1.0d0 + t_0)
    else if (y <= 1.32d+154) then
        tmp = (1.0d0 + ((x * x) * (-0.5d0))) * (((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 = 0.16666666666666666 * (y * y);
	double tmp;
	if (y <= 370.0) {
		tmp = Math.cos(x) * (1.0 + t_0);
	} else if (y <= 1.32e+154) {
		tmp = (1.0 + ((x * x) * -0.5)) * (((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 = 0.16666666666666666 * (y * y)
	tmp = 0
	if y <= 370.0:
		tmp = math.cos(x) * (1.0 + t_0)
	elif y <= 1.32e+154:
		tmp = (1.0 + ((x * x) * -0.5)) * (((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(0.16666666666666666 * Float64(y * y))
	tmp = 0.0
	if (y <= 370.0)
		tmp = Float64(cos(x) * Float64(1.0 + t_0));
	elseif (y <= 1.32e+154)
		tmp = Float64(Float64(1.0 + Float64(Float64(x * x) * -0.5)) * 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 = 0.16666666666666666 * (y * y);
	tmp = 0.0;
	if (y <= 370.0)
		tmp = cos(x) * (1.0 + t_0);
	elseif (y <= 1.32e+154)
		tmp = (1.0 + ((x * x) * -0.5)) * (((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[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 370.0], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.32e+154], N[(N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] + -1.0), $MachinePrecision] / N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(y * N[(N[Cos[x], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 1.32 \cdot 10^{+154}:\\
\;\;\;\;\left(1 + \left(x \cdot x\right) \cdot -0.5\right) \cdot \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 < 370

    1. Initial program 100.0%

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

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

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

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

    if 370 < y < 1.31999999999999998e154

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) - 1 \cdot 1}{0.16666666666666666 \cdot \left(y \cdot y\right) - 1}} \cdot \left(\left(x \cdot x\right) \cdot -0.5 + 1\right) \]
      3. metadata-eval54.6%

        \[\leadsto \frac{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) - \color{blue}{1}}{0.16666666666666666 \cdot \left(y \cdot y\right) - 1} \cdot \left(\left(x \cdot x\right) \cdot -0.5 + 1\right) \]
    9. Applied egg-rr54.6%

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

    if 1.31999999999999998e154 < y

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(\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)} \]
    7. Simplified100.0%

      \[\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 simplification82.6%

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

Alternative 6: 65.0% accurate, 2.0× speedup?

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

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

\mathbf{elif}\;y \leq 1.32 \cdot 10^{+154}:\\
\;\;\;\;\left(1 + \left(x \cdot x\right) \cdot -0.5\right) \cdot \frac{t_0 \cdot t_0 + -1}{t_0 + -1}\\

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


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

    1. Initial program 100.0%

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

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

    if 66 < y < 1.31999999999999998e154

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) - 1 \cdot 1}{0.16666666666666666 \cdot \left(y \cdot y\right) - 1}} \cdot \left(\left(x \cdot x\right) \cdot -0.5 + 1\right) \]
      3. metadata-eval54.6%

        \[\leadsto \frac{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) - \color{blue}{1}}{0.16666666666666666 \cdot \left(y \cdot y\right) - 1} \cdot \left(\left(x \cdot x\right) \cdot -0.5 + 1\right) \]
    9. Applied egg-rr54.6%

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

    if 1.31999999999999998e154 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

Alternative 7: 52.4% accurate, 6.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{if}\;y \leq 0.21 \lor \neg \left(y \leq 1.32 \cdot 10^{+154}\right):\\ \;\;\;\;1 + t_0\\ \mathbf{else}:\\ \;\;\;\;\left(1 + \left(x \cdot x\right) \cdot -0.5\right) \cdot \frac{t_0 \cdot t_0 + -1}{t_0 + -1}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* 0.16666666666666666 (* y y))))
   (if (or (<= y 0.21) (not (<= y 1.32e+154)))
     (+ 1.0 t_0)
     (* (+ 1.0 (* (* x x) -0.5)) (/ (+ (* t_0 t_0) -1.0) (+ t_0 -1.0))))))
double code(double x, double y) {
	double t_0 = 0.16666666666666666 * (y * y);
	double tmp;
	if ((y <= 0.21) || !(y <= 1.32e+154)) {
		tmp = 1.0 + t_0;
	} else {
		tmp = (1.0 + ((x * x) * -0.5)) * (((t_0 * t_0) + -1.0) / (t_0 + -1.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 <= 0.21d0) .or. (.not. (y <= 1.32d+154))) then
        tmp = 1.0d0 + t_0
    else
        tmp = (1.0d0 + ((x * x) * (-0.5d0))) * (((t_0 * t_0) + (-1.0d0)) / (t_0 + (-1.0d0)))
    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 <= 0.21) || !(y <= 1.32e+154)) {
		tmp = 1.0 + t_0;
	} else {
		tmp = (1.0 + ((x * x) * -0.5)) * (((t_0 * t_0) + -1.0) / (t_0 + -1.0));
	}
	return tmp;
}
def code(x, y):
	t_0 = 0.16666666666666666 * (y * y)
	tmp = 0
	if (y <= 0.21) or not (y <= 1.32e+154):
		tmp = 1.0 + t_0
	else:
		tmp = (1.0 + ((x * x) * -0.5)) * (((t_0 * t_0) + -1.0) / (t_0 + -1.0))
	return tmp
function code(x, y)
	t_0 = Float64(0.16666666666666666 * Float64(y * y))
	tmp = 0.0
	if ((y <= 0.21) || !(y <= 1.32e+154))
		tmp = Float64(1.0 + t_0);
	else
		tmp = Float64(Float64(1.0 + Float64(Float64(x * x) * -0.5)) * Float64(Float64(Float64(t_0 * t_0) + -1.0) / Float64(t_0 + -1.0)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = 0.16666666666666666 * (y * y);
	tmp = 0.0;
	if ((y <= 0.21) || ~((y <= 1.32e+154)))
		tmp = 1.0 + t_0;
	else
		tmp = (1.0 + ((x * x) * -0.5)) * (((t_0 * t_0) + -1.0) / (t_0 + -1.0));
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[y, 0.21], N[Not[LessEqual[y, 1.32e+154]], $MachinePrecision]], N[(1.0 + t$95$0), $MachinePrecision], N[(N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] + -1.0), $MachinePrecision] / N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\left(1 + \left(x \cdot x\right) \cdot -0.5\right) \cdot \frac{t_0 \cdot t_0 + -1}{t_0 + -1}\\


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if 0.209999999999999992 < y < 1.31999999999999998e154

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) - \color{blue}{1}}{0.16666666666666666 \cdot \left(y \cdot y\right) - 1} \cdot \left(\left(x \cdot x\right) \cdot -0.5 + 1\right) \]
    9. Applied egg-rr53.1%

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

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

Alternative 8: 49.4% accurate, 10.7× speedup?

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

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

\mathbf{elif}\;y \leq 2 \cdot 10^{+221}:\\
\;\;\;\;t_1 \cdot \left(1 + \left(x \cdot x\right) \cdot -0.5\right)\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if 0.619999999999999996 < y < 2.0000000000000001e221

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot \left(y \cdot y\right) + 1\right)} \cdot \left(\left(x \cdot x\right) \cdot -0.5 + 1\right) \]
    9. Applied egg-rr44.7%

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

    if 2.0000000000000001e221 < y

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(\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)} \]
    7. Simplified100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 0.62:\\ \;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{elif}\;y \leq 2 \cdot 10^{+221}:\\ \;\;\;\;\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(1 + \left(x \cdot x\right) \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\ \end{array} \]

Alternative 9: 37.5% accurate, 29.0× speedup?

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

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

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Step-by-step derivation
      1. associate-*r/99.9%

        \[\leadsto \color{blue}{\frac{\cos x \cdot \sinh y}{y}} \]
    3. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{\cos x \cdot \sinh y}{y}} \]
    4. Taylor expanded in y around 0 66.0%

      \[\leadsto \frac{\color{blue}{\cos x \cdot y}}{y} \]
    5. Taylor expanded in x around 0 33.9%

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

    if 0.619999999999999996 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 47.2% 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 76.4%

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

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

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

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

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

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

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

Alternative 11: 28.2% accurate, 205.0× speedup?

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

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

    \[\cos x \cdot \frac{\sinh y}{y} \]
  2. Step-by-step derivation
    1. associate-*r/99.9%

      \[\leadsto \color{blue}{\frac{\cos x \cdot \sinh y}{y}} \]
  3. Applied egg-rr99.9%

    \[\leadsto \color{blue}{\frac{\cos x \cdot \sinh y}{y}} \]
  4. Taylor expanded in y around 0 50.9%

    \[\leadsto \frac{\color{blue}{\cos x \cdot y}}{y} \]
  5. Taylor expanded in x around 0 26.3%

    \[\leadsto \color{blue}{1} \]
  6. Final simplification26.3%

    \[\leadsto 1 \]

Reproduce

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