Linear.Quaternion:$csin from linear-1.19.1.3

Percentage Accurate: 100.0% → 100.0%
Time: 6.2s
Alternatives: 13
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 13 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: 81.1% accurate, 1.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;t_0 + 0.008333333333333333 \cdot {y}^{4}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (cos.f64 x) < 0.97599999999999998

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in y around 0 77.9%

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

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

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

    if 0.97599999999999998 < (cos.f64 x)

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in x around 0 88.4%

      \[\leadsto \color{blue}{\frac{y + \left(0.008333333333333333 \cdot {y}^{5} + 0.16666666666666666 \cdot {y}^{3}\right)}{y}} \]
    4. Taylor expanded in y around 0 87.8%

      \[\leadsto \color{blue}{1 + \left(0.16666666666666666 \cdot {y}^{2} + 0.008333333333333333 \cdot {y}^{4}\right)} \]
    5. Step-by-step derivation
      1. associate-+r+87.8%

        \[\leadsto \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right) + 0.008333333333333333 \cdot {y}^{4}} \]
      2. +-commutative87.8%

        \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot {y}^{2} + 1\right)} + 0.008333333333333333 \cdot {y}^{4} \]
      3. unpow287.8%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666 \cdot y, y, 1\right)} + 0.008333333333333333 \cdot {y}^{4} \]
    6. Simplified87.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666 \cdot y, y, 1\right) + 0.008333333333333333 \cdot {y}^{4}} \]
    7. Step-by-step derivation
      1. fma-udef74.3%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\cos x \leq 0.976:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right) + 0.008333333333333333 \cdot {y}^{4}\\ \end{array} \]

Alternative 3: 88.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.16666666666666666 \cdot \left(y \cdot \left(\cos x \cdot y\right)\right)\\ t_1 := \sqrt{6.944444444444444 \cdot 10^{-5} \cdot {y}^{8}}\\ \mathbf{if}\;y \leq -2.8 \cdot 10^{+156}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -1.28 \cdot 10^{+32}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{+44}:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{+144}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* 0.16666666666666666 (* y (* (cos x) y))))
        (t_1 (sqrt (* 6.944444444444444e-5 (pow y 8.0)))))
   (if (<= y -2.8e+156)
     t_0
     (if (<= y -1.28e+32)
       t_1
       (if (<= y 5.5e+44)
         (* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y))))
         (if (<= y 2.65e+144) t_1 t_0))))))
double code(double x, double y) {
	double t_0 = 0.16666666666666666 * (y * (cos(x) * y));
	double t_1 = sqrt((6.944444444444444e-5 * pow(y, 8.0)));
	double tmp;
	if (y <= -2.8e+156) {
		tmp = t_0;
	} else if (y <= -1.28e+32) {
		tmp = t_1;
	} else if (y <= 5.5e+44) {
		tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	} else if (y <= 2.65e+144) {
		tmp = t_1;
	} 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 * (cos(x) * y))
    t_1 = sqrt((6.944444444444444d-5 * (y ** 8.0d0)))
    if (y <= (-2.8d+156)) then
        tmp = t_0
    else if (y <= (-1.28d+32)) then
        tmp = t_1
    else if (y <= 5.5d+44) then
        tmp = cos(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
    else if (y <= 2.65d+144) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = 0.16666666666666666 * (y * (Math.cos(x) * y));
	double t_1 = Math.sqrt((6.944444444444444e-5 * Math.pow(y, 8.0)));
	double tmp;
	if (y <= -2.8e+156) {
		tmp = t_0;
	} else if (y <= -1.28e+32) {
		tmp = t_1;
	} else if (y <= 5.5e+44) {
		tmp = Math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	} else if (y <= 2.65e+144) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = 0.16666666666666666 * (y * (math.cos(x) * y))
	t_1 = math.sqrt((6.944444444444444e-5 * math.pow(y, 8.0)))
	tmp = 0
	if y <= -2.8e+156:
		tmp = t_0
	elif y <= -1.28e+32:
		tmp = t_1
	elif y <= 5.5e+44:
		tmp = math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)))
	elif y <= 2.65e+144:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(0.16666666666666666 * Float64(y * Float64(cos(x) * y)))
	t_1 = sqrt(Float64(6.944444444444444e-5 * (y ^ 8.0)))
	tmp = 0.0
	if (y <= -2.8e+156)
		tmp = t_0;
	elseif (y <= -1.28e+32)
		tmp = t_1;
	elseif (y <= 5.5e+44)
		tmp = Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))));
	elseif (y <= 2.65e+144)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = 0.16666666666666666 * (y * (cos(x) * y));
	t_1 = sqrt((6.944444444444444e-5 * (y ^ 8.0)));
	tmp = 0.0;
	if (y <= -2.8e+156)
		tmp = t_0;
	elseif (y <= -1.28e+32)
		tmp = t_1;
	elseif (y <= 5.5e+44)
		tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
	elseif (y <= 2.65e+144)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(y * N[(N[Cos[x], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(6.944444444444444e-5 * N[Power[y, 8.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, -2.8e+156], t$95$0, If[LessEqual[y, -1.28e+32], t$95$1, If[LessEqual[y, 5.5e+44], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.65e+144], t$95$1, t$95$0]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(y \cdot \left(\cos x \cdot y\right)\right)\\
t_1 := \sqrt{6.944444444444444 \cdot 10^{-5} \cdot {y}^{8}}\\
\mathbf{if}\;y \leq -2.8 \cdot 10^{+156}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq -1.28 \cdot 10^{+32}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 5.5 \cdot 10^{+44}:\\
\;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\

\mathbf{elif}\;y \leq 2.65 \cdot 10^{+144}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.79999999999999988e156 or 2.6499999999999998e144 < y

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in y around 0 98.8%

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

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

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

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

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

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

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

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

    if -2.79999999999999988e156 < y < -1.28e32 or 5.5000000000000001e44 < y < 2.6499999999999998e144

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in x around 0 63.5%

      \[\leadsto \color{blue}{\frac{y + \left(0.008333333333333333 \cdot {y}^{5} + 0.16666666666666666 \cdot {y}^{3}\right)}{y}} \]
    4. Taylor expanded in y around inf 61.7%

      \[\leadsto \color{blue}{0.008333333333333333 \cdot {y}^{4}} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt61.7%

        \[\leadsto \color{blue}{\sqrt{0.008333333333333333 \cdot {y}^{4}} \cdot \sqrt{0.008333333333333333 \cdot {y}^{4}}} \]
      2. sqrt-unprod75.3%

        \[\leadsto \color{blue}{\sqrt{\left(0.008333333333333333 \cdot {y}^{4}\right) \cdot \left(0.008333333333333333 \cdot {y}^{4}\right)}} \]
      3. swap-sqr77.3%

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

        \[\leadsto \sqrt{\color{blue}{6.944444444444444 \cdot 10^{-5}} \cdot \left({y}^{4} \cdot {y}^{4}\right)} \]
      5. pow-prod-up77.3%

        \[\leadsto \sqrt{6.944444444444444 \cdot 10^{-5} \cdot \color{blue}{{y}^{\left(4 + 4\right)}}} \]
      6. metadata-eval77.3%

        \[\leadsto \sqrt{6.944444444444444 \cdot 10^{-5} \cdot {y}^{\color{blue}{8}}} \]
    6. Applied egg-rr77.3%

      \[\leadsto \color{blue}{\sqrt{6.944444444444444 \cdot 10^{-5} \cdot {y}^{8}}} \]

    if -1.28e32 < y < 5.5000000000000001e44

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in y around 0 88.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.8 \cdot 10^{+156}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot \left(\cos x \cdot y\right)\right)\\ \mathbf{elif}\;y \leq -1.28 \cdot 10^{+32}:\\ \;\;\;\;\sqrt{6.944444444444444 \cdot 10^{-5} \cdot {y}^{8}}\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{+44}:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{+144}:\\ \;\;\;\;\sqrt{6.944444444444444 \cdot 10^{-5} \cdot {y}^{8}}\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot \left(\cos x \cdot y\right)\right)\\ \end{array} \]

Alternative 4: 80.9% accurate, 1.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;1 + 0.008333333333333333 \cdot {y}^{4}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (cos.f64 x) < 0.97599999999999998

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in y around 0 77.9%

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

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

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

    if 0.97599999999999998 < (cos.f64 x)

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in x around 0 88.4%

      \[\leadsto \color{blue}{\frac{y + \left(0.008333333333333333 \cdot {y}^{5} + 0.16666666666666666 \cdot {y}^{3}\right)}{y}} \]
    4. Taylor expanded in y around 0 87.8%

      \[\leadsto \color{blue}{1 + \left(0.16666666666666666 \cdot {y}^{2} + 0.008333333333333333 \cdot {y}^{4}\right)} \]
    5. Step-by-step derivation
      1. associate-+r+87.8%

        \[\leadsto \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right) + 0.008333333333333333 \cdot {y}^{4}} \]
      2. +-commutative87.8%

        \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot {y}^{2} + 1\right)} + 0.008333333333333333 \cdot {y}^{4} \]
      3. unpow287.8%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666 \cdot y, y, 1\right)} + 0.008333333333333333 \cdot {y}^{4} \]
    6. Simplified87.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666 \cdot y, y, 1\right) + 0.008333333333333333 \cdot {y}^{4}} \]
    7. Taylor expanded in y around 0 87.5%

      \[\leadsto \color{blue}{1} + 0.008333333333333333 \cdot {y}^{4} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\cos x \leq 0.976:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;1 + 0.008333333333333333 \cdot {y}^{4}\\ \end{array} \]

Alternative 5: 84.8% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.16666666666666666 \cdot \left(y \cdot \left(\cos x \cdot y\right)\right)\\ \mathbf{if}\;y \leq -2.8 \cdot 10^{+156}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -2.7 \cdot 10^{+31}:\\ \;\;\;\;\frac{0.008333333333333333 \cdot {y}^{5}}{y}\\ \mathbf{elif}\;y \leq 7.2 \cdot 10^{+50}:\\ \;\;\;\;\cos x\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{+144}:\\ \;\;\;\;1 + 0.008333333333333333 \cdot {y}^{4}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* 0.16666666666666666 (* y (* (cos x) y)))))
   (if (<= y -2.8e+156)
     t_0
     (if (<= y -2.7e+31)
       (/ (* 0.008333333333333333 (pow y 5.0)) y)
       (if (<= y 7.2e+50)
         (cos x)
         (if (<= y 2.65e+144)
           (+ 1.0 (* 0.008333333333333333 (pow y 4.0)))
           t_0))))))
double code(double x, double y) {
	double t_0 = 0.16666666666666666 * (y * (cos(x) * y));
	double tmp;
	if (y <= -2.8e+156) {
		tmp = t_0;
	} else if (y <= -2.7e+31) {
		tmp = (0.008333333333333333 * pow(y, 5.0)) / y;
	} else if (y <= 7.2e+50) {
		tmp = cos(x);
	} else if (y <= 2.65e+144) {
		tmp = 1.0 + (0.008333333333333333 * pow(y, 4.0));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 0.16666666666666666d0 * (y * (cos(x) * y))
    if (y <= (-2.8d+156)) then
        tmp = t_0
    else if (y <= (-2.7d+31)) then
        tmp = (0.008333333333333333d0 * (y ** 5.0d0)) / y
    else if (y <= 7.2d+50) then
        tmp = cos(x)
    else if (y <= 2.65d+144) then
        tmp = 1.0d0 + (0.008333333333333333d0 * (y ** 4.0d0))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = 0.16666666666666666 * (y * (Math.cos(x) * y));
	double tmp;
	if (y <= -2.8e+156) {
		tmp = t_0;
	} else if (y <= -2.7e+31) {
		tmp = (0.008333333333333333 * Math.pow(y, 5.0)) / y;
	} else if (y <= 7.2e+50) {
		tmp = Math.cos(x);
	} else if (y <= 2.65e+144) {
		tmp = 1.0 + (0.008333333333333333 * Math.pow(y, 4.0));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = 0.16666666666666666 * (y * (math.cos(x) * y))
	tmp = 0
	if y <= -2.8e+156:
		tmp = t_0
	elif y <= -2.7e+31:
		tmp = (0.008333333333333333 * math.pow(y, 5.0)) / y
	elif y <= 7.2e+50:
		tmp = math.cos(x)
	elif y <= 2.65e+144:
		tmp = 1.0 + (0.008333333333333333 * math.pow(y, 4.0))
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(0.16666666666666666 * Float64(y * Float64(cos(x) * y)))
	tmp = 0.0
	if (y <= -2.8e+156)
		tmp = t_0;
	elseif (y <= -2.7e+31)
		tmp = Float64(Float64(0.008333333333333333 * (y ^ 5.0)) / y);
	elseif (y <= 7.2e+50)
		tmp = cos(x);
	elseif (y <= 2.65e+144)
		tmp = Float64(1.0 + Float64(0.008333333333333333 * (y ^ 4.0)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = 0.16666666666666666 * (y * (cos(x) * y));
	tmp = 0.0;
	if (y <= -2.8e+156)
		tmp = t_0;
	elseif (y <= -2.7e+31)
		tmp = (0.008333333333333333 * (y ^ 5.0)) / y;
	elseif (y <= 7.2e+50)
		tmp = cos(x);
	elseif (y <= 2.65e+144)
		tmp = 1.0 + (0.008333333333333333 * (y ^ 4.0));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(y * N[(N[Cos[x], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.8e+156], t$95$0, If[LessEqual[y, -2.7e+31], N[(N[(0.008333333333333333 * N[Power[y, 5.0], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 7.2e+50], N[Cos[x], $MachinePrecision], If[LessEqual[y, 2.65e+144], N[(1.0 + N[(0.008333333333333333 * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -2.7 \cdot 10^{+31}:\\
\;\;\;\;\frac{0.008333333333333333 \cdot {y}^{5}}{y}\\

\mathbf{elif}\;y \leq 7.2 \cdot 10^{+50}:\\
\;\;\;\;\cos x\\

\mathbf{elif}\;y \leq 2.65 \cdot 10^{+144}:\\
\;\;\;\;1 + 0.008333333333333333 \cdot {y}^{4}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -2.79999999999999988e156 or 2.6499999999999998e144 < y

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in y around 0 98.8%

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

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

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

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

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

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

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

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

    if -2.79999999999999988e156 < y < -2.69999999999999986e31

    1. Initial program 100.0%

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

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

      \[\leadsto \color{blue}{\frac{y + \left(0.008333333333333333 \cdot {y}^{5} + 0.16666666666666666 \cdot {y}^{3}\right)}{y}} \]
    4. Taylor expanded in y around inf 65.9%

      \[\leadsto \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5}}}{y} \]

    if -2.69999999999999986e31 < y < 7.19999999999999972e50

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in y around 0 88.6%

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

    if 7.19999999999999972e50 < y < 2.6499999999999998e144

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in x around 0 59.2%

      \[\leadsto \color{blue}{\frac{y + \left(0.008333333333333333 \cdot {y}^{5} + 0.16666666666666666 \cdot {y}^{3}\right)}{y}} \]
    4. Taylor expanded in y around 0 59.2%

      \[\leadsto \color{blue}{1 + \left(0.16666666666666666 \cdot {y}^{2} + 0.008333333333333333 \cdot {y}^{4}\right)} \]
    5. Step-by-step derivation
      1. associate-+r+59.2%

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

        \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot {y}^{2} + 1\right)} + 0.008333333333333333 \cdot {y}^{4} \]
      3. unpow259.2%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666 \cdot y, y, 1\right)} + 0.008333333333333333 \cdot {y}^{4} \]
    6. Simplified59.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666 \cdot y, y, 1\right) + 0.008333333333333333 \cdot {y}^{4}} \]
    7. Taylor expanded in y around 0 59.2%

      \[\leadsto \color{blue}{1} + 0.008333333333333333 \cdot {y}^{4} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification87.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.8 \cdot 10^{+156}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot \left(\cos x \cdot y\right)\right)\\ \mathbf{elif}\;y \leq -2.7 \cdot 10^{+31}:\\ \;\;\;\;\frac{0.008333333333333333 \cdot {y}^{5}}{y}\\ \mathbf{elif}\;y \leq 7.2 \cdot 10^{+50}:\\ \;\;\;\;\cos x\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{+144}:\\ \;\;\;\;1 + 0.008333333333333333 \cdot {y}^{4}\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot \left(\cos x \cdot y\right)\right)\\ \end{array} \]

Alternative 6: 78.0% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
t_0 := 0.008333333333333333 \cdot {y}^{4}\\
\mathbf{if}\;y \leq -4.5 \cdot 10^{+30}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 5.5 \cdot 10^{+44}:\\
\;\;\;\;\cos x\\

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


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

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in x around 0 71.9%

      \[\leadsto \color{blue}{\frac{y + \left(0.008333333333333333 \cdot {y}^{5} + 0.16666666666666666 \cdot {y}^{3}\right)}{y}} \]
    4. Taylor expanded in y around inf 70.6%

      \[\leadsto \color{blue}{0.008333333333333333 \cdot {y}^{4}} \]

    if -4.49999999999999995e30 < y < 5.5000000000000001e44

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in y around 0 88.6%

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

    if 5.5000000000000001e44 < y

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in x around 0 66.2%

      \[\leadsto \color{blue}{\frac{y + \left(0.008333333333333333 \cdot {y}^{5} + 0.16666666666666666 \cdot {y}^{3}\right)}{y}} \]
    4. Taylor expanded in y around 0 66.2%

      \[\leadsto \color{blue}{1 + \left(0.16666666666666666 \cdot {y}^{2} + 0.008333333333333333 \cdot {y}^{4}\right)} \]
    5. Step-by-step derivation
      1. associate-+r+66.2%

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

        \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot {y}^{2} + 1\right)} + 0.008333333333333333 \cdot {y}^{4} \]
      3. unpow266.2%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666 \cdot y, y, 1\right)} + 0.008333333333333333 \cdot {y}^{4} \]
    6. Simplified66.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666 \cdot y, y, 1\right) + 0.008333333333333333 \cdot {y}^{4}} \]
    7. Taylor expanded in y around 0 66.2%

      \[\leadsto \color{blue}{1} + 0.008333333333333333 \cdot {y}^{4} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification78.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{+30}:\\ \;\;\;\;0.008333333333333333 \cdot {y}^{4}\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{+44}:\\ \;\;\;\;\cos x\\ \mathbf{else}:\\ \;\;\;\;1 + 0.008333333333333333 \cdot {y}^{4}\\ \end{array} \]

Alternative 7: 79.0% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.9 \cdot 10^{+30}:\\ \;\;\;\;\frac{0.008333333333333333 \cdot {y}^{5}}{y}\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{+44}:\\ \;\;\;\;\cos x\\ \mathbf{else}:\\ \;\;\;\;1 + 0.008333333333333333 \cdot {y}^{4}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -2.9e+30)
   (/ (* 0.008333333333333333 (pow y 5.0)) y)
   (if (<= y 5.5e+44) (cos x) (+ 1.0 (* 0.008333333333333333 (pow y 4.0))))))
double code(double x, double y) {
	double tmp;
	if (y <= -2.9e+30) {
		tmp = (0.008333333333333333 * pow(y, 5.0)) / y;
	} else if (y <= 5.5e+44) {
		tmp = cos(x);
	} else {
		tmp = 1.0 + (0.008333333333333333 * pow(y, 4.0));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-2.9d+30)) then
        tmp = (0.008333333333333333d0 * (y ** 5.0d0)) / y
    else if (y <= 5.5d+44) then
        tmp = cos(x)
    else
        tmp = 1.0d0 + (0.008333333333333333d0 * (y ** 4.0d0))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -2.9e+30) {
		tmp = (0.008333333333333333 * Math.pow(y, 5.0)) / y;
	} else if (y <= 5.5e+44) {
		tmp = Math.cos(x);
	} else {
		tmp = 1.0 + (0.008333333333333333 * Math.pow(y, 4.0));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -2.9e+30:
		tmp = (0.008333333333333333 * math.pow(y, 5.0)) / y
	elif y <= 5.5e+44:
		tmp = math.cos(x)
	else:
		tmp = 1.0 + (0.008333333333333333 * math.pow(y, 4.0))
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -2.9e+30)
		tmp = Float64(Float64(0.008333333333333333 * (y ^ 5.0)) / y);
	elseif (y <= 5.5e+44)
		tmp = cos(x);
	else
		tmp = Float64(1.0 + Float64(0.008333333333333333 * (y ^ 4.0)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -2.9e+30)
		tmp = (0.008333333333333333 * (y ^ 5.0)) / y;
	elseif (y <= 5.5e+44)
		tmp = cos(x);
	else
		tmp = 1.0 + (0.008333333333333333 * (y ^ 4.0));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -2.9e+30], N[(N[(0.008333333333333333 * N[Power[y, 5.0], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 5.5e+44], N[Cos[x], $MachinePrecision], N[(1.0 + N[(0.008333333333333333 * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{+30}:\\
\;\;\;\;\frac{0.008333333333333333 \cdot {y}^{5}}{y}\\

\mathbf{elif}\;y \leq 5.5 \cdot 10^{+44}:\\
\;\;\;\;\cos x\\

\mathbf{else}:\\
\;\;\;\;1 + 0.008333333333333333 \cdot {y}^{4}\\


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

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in x around 0 71.9%

      \[\leadsto \color{blue}{\frac{y + \left(0.008333333333333333 \cdot {y}^{5} + 0.16666666666666666 \cdot {y}^{3}\right)}{y}} \]
    4. Taylor expanded in y around inf 71.9%

      \[\leadsto \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5}}}{y} \]

    if -2.8999999999999998e30 < y < 5.5000000000000001e44

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in y around 0 88.6%

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

    if 5.5000000000000001e44 < y

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in x around 0 66.2%

      \[\leadsto \color{blue}{\frac{y + \left(0.008333333333333333 \cdot {y}^{5} + 0.16666666666666666 \cdot {y}^{3}\right)}{y}} \]
    4. Taylor expanded in y around 0 66.2%

      \[\leadsto \color{blue}{1 + \left(0.16666666666666666 \cdot {y}^{2} + 0.008333333333333333 \cdot {y}^{4}\right)} \]
    5. Step-by-step derivation
      1. associate-+r+66.2%

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

        \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot {y}^{2} + 1\right)} + 0.008333333333333333 \cdot {y}^{4} \]
      3. unpow266.2%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666 \cdot y, y, 1\right)} + 0.008333333333333333 \cdot {y}^{4} \]
    6. Simplified66.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666 \cdot y, y, 1\right) + 0.008333333333333333 \cdot {y}^{4}} \]
    7. Taylor expanded in y around 0 66.2%

      \[\leadsto \color{blue}{1} + 0.008333333333333333 \cdot {y}^{4} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification79.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.9 \cdot 10^{+30}:\\ \;\;\;\;\frac{0.008333333333333333 \cdot {y}^{5}}{y}\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{+44}:\\ \;\;\;\;\cos x\\ \mathbf{else}:\\ \;\;\;\;1 + 0.008333333333333333 \cdot {y}^{4}\\ \end{array} \]

Alternative 8: 78.0% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.15 \cdot 10^{+31} \lor \neg \left(y \leq 5.5 \cdot 10^{+44}\right):\\ \;\;\;\;0.008333333333333333 \cdot {y}^{4}\\ \mathbf{else}:\\ \;\;\;\;\cos x\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y -3.15e+31) (not (<= y 5.5e+44)))
   (* 0.008333333333333333 (pow y 4.0))
   (cos x)))
double code(double x, double y) {
	double tmp;
	if ((y <= -3.15e+31) || !(y <= 5.5e+44)) {
		tmp = 0.008333333333333333 * pow(y, 4.0);
	} else {
		tmp = cos(x);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y <= (-3.15d+31)) .or. (.not. (y <= 5.5d+44))) then
        tmp = 0.008333333333333333d0 * (y ** 4.0d0)
    else
        tmp = cos(x)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y <= -3.15e+31) || !(y <= 5.5e+44)) {
		tmp = 0.008333333333333333 * Math.pow(y, 4.0);
	} else {
		tmp = Math.cos(x);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= -3.15e+31) or not (y <= 5.5e+44):
		tmp = 0.008333333333333333 * math.pow(y, 4.0)
	else:
		tmp = math.cos(x)
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= -3.15e+31) || !(y <= 5.5e+44))
		tmp = Float64(0.008333333333333333 * (y ^ 4.0));
	else
		tmp = cos(x);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y <= -3.15e+31) || ~((y <= 5.5e+44)))
		tmp = 0.008333333333333333 * (y ^ 4.0);
	else
		tmp = cos(x);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, -3.15e+31], N[Not[LessEqual[y, 5.5e+44]], $MachinePrecision]], N[(0.008333333333333333 * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision], N[Cos[x], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.15 \cdot 10^{+31} \lor \neg \left(y \leq 5.5 \cdot 10^{+44}\right):\\
\;\;\;\;0.008333333333333333 \cdot {y}^{4}\\

\mathbf{else}:\\
\;\;\;\;\cos x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.1499999999999999e31 or 5.5000000000000001e44 < y

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in x around 0 69.2%

      \[\leadsto \color{blue}{\frac{y + \left(0.008333333333333333 \cdot {y}^{5} + 0.16666666666666666 \cdot {y}^{3}\right)}{y}} \]
    4. Taylor expanded in y around inf 68.5%

      \[\leadsto \color{blue}{0.008333333333333333 \cdot {y}^{4}} \]

    if -3.1499999999999999e31 < y < 5.5000000000000001e44

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in y around 0 88.6%

      \[\leadsto \color{blue}{\cos x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification78.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.15 \cdot 10^{+31} \lor \neg \left(y \leq 5.5 \cdot 10^{+44}\right):\\ \;\;\;\;0.008333333333333333 \cdot {y}^{4}\\ \mathbf{else}:\\ \;\;\;\;\cos x\\ \end{array} \]

Alternative 9: 77.3% accurate, 1.9× speedup?

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

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

\mathbf{elif}\;y \leq -0.00045:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 7.5 \cdot 10^{+70}:\\
\;\;\;\;\cos x\\

\mathbf{elif}\;y \leq 2.65 \cdot 10^{+144}:\\
\;\;\;\;t_1\\

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


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

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in y around 0 100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} \]
    11. Simplified77.8%

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

    if -1.35000000000000003e154 < y < -4.4999999999999999e-4 or 7.50000000000000031e70 < y < 2.6499999999999998e144

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in y around 0 7.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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}}{\left(0.16666666666666666 \cdot y\right) \cdot y - 1} \]
      6. associate-*l*54.7%

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

      \[\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}} \]

    if -4.4999999999999999e-4 < y < 7.50000000000000031e70

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in y around 0 93.0%

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

    if 2.6499999999999998e144 < y

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in y around 0 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{elif}\;y \leq -0.00045:\\ \;\;\;\;\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{elif}\;y \leq 7.5 \cdot 10^{+70}:\\ \;\;\;\;\cos x\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{+144}:\\ \;\;\;\;\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 10: 55.2% accurate, 8.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{if}\;y \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{+144}:\\ \;\;\;\;\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 -1.35e+154)
     t_0
     (if (<= y 2.65e+144) (/ (+ (* 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 <= -1.35e+154) {
		tmp = t_0;
	} else if (y <= 2.65e+144) {
		tmp = ((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 <= (-1.35d+154)) then
        tmp = t_0
    else if (y <= 2.65d+144) then
        tmp = ((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 <= -1.35e+154) {
		tmp = t_0;
	} else if (y <= 2.65e+144) {
		tmp = ((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 <= -1.35e+154:
		tmp = t_0
	elif y <= 2.65e+144:
		tmp = ((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 <= -1.35e+154)
		tmp = t_0;
	elseif (y <= 2.65e+144)
		tmp = 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 <= -1.35e+154)
		tmp = t_0;
	elseif (y <= 2.65e+144)
		tmp = ((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, -1.35e+154], t$95$0, If[LessEqual[y, 2.65e+144], N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] + -1.0), $MachinePrecision] / N[(t$95$0 + -1.0), $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 -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 2.65 \cdot 10^{+144}:\\
\;\;\;\;\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 < -1.35000000000000003e154

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in y around 0 100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} \]
    11. Simplified77.8%

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

    if -1.35000000000000003e154 < y < 2.6499999999999998e144

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in y around 0 67.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \color{blue}{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)} - 1 \cdot 1}{\left(0.16666666666666666 \cdot y\right) \cdot y - 1} \]
      5. metadata-eval52.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}}{\left(0.16666666666666666 \cdot y\right) \cdot y - 1} \]
      6. associate-*l*52.6%

        \[\leadsto \frac{\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) - 1}{\color{blue}{0.16666666666666666 \cdot \left(y \cdot y\right)} - 1} \]
    10. Applied egg-rr52.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}} \]

    if 2.6499999999999998e144 < y

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in y around 0 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{+144}:\\ \;\;\;\;\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 11: 46.5% accurate, 22.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \lor \neg \left(y \leq 2.6\right):\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.5 or 2.60000000000000009 < y

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in y around 0 57.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.5 < y < 2.60000000000000009

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
    3. Taylor expanded in x around 0 55.9%

      \[\leadsto \color{blue}{\frac{y + \left(0.008333333333333333 \cdot {y}^{5} + 0.16666666666666666 \cdot {y}^{3}\right)}{y}} \]
    4. Taylor expanded in y around 0 55.5%

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

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

Alternative 12: 46.7% 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 90.3%

    \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
  3. Taylor expanded in y around 0 76.7%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(y \cdot y\right)} + 1 \]
  10. Applied egg-rr48.6%

    \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(y \cdot y\right) + 1} \]
  11. Final simplification48.6%

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

Alternative 13: 28.3% accurate, 205.0× speedup?

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

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

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

    \[\leadsto \cos x \cdot \frac{\color{blue}{0.008333333333333333 \cdot {y}^{5} + \left(y + 0.16666666666666666 \cdot {y}^{3}\right)}}{y} \]
  3. Taylor expanded in x around 0 59.3%

    \[\leadsto \color{blue}{\frac{y + \left(0.008333333333333333 \cdot {y}^{5} + 0.16666666666666666 \cdot {y}^{3}\right)}{y}} \]
  4. Taylor expanded in y around 0 26.5%

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

    \[\leadsto 1 \]

Reproduce

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