Linear.Quaternion:$csin from linear-1.19.1.3

Percentage Accurate: 100.0% → 100.0%
Time: 7.1s
Alternatives: 10
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 10 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, 0.5× speedup?

\[\begin{array}{l} y = |y|\\ \\ \cos x \cdot \frac{\mathsf{expm1}\left(\mathsf{log1p}\left(\sinh y\right)\right)}{y} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y) :precision binary64 (* (cos x) (/ (expm1 (log1p (sinh y))) y)))
y = abs(y);
double code(double x, double y) {
	return cos(x) * (expm1(log1p(sinh(y))) / y);
}
y = Math.abs(y);
public static double code(double x, double y) {
	return Math.cos(x) * (Math.expm1(Math.log1p(Math.sinh(y))) / y);
}
y = abs(y)
def code(x, y):
	return math.cos(x) * (math.expm1(math.log1p(math.sinh(y))) / y)
y = abs(y)
function code(x, y)
	return Float64(cos(x) * Float64(expm1(log1p(sinh(y))) / y))
end
NOTE: y should be positive before calling this function
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[(Exp[N[Log[1 + N[Sinh[y], $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y = |y|\\
\\
\cos x \cdot \frac{\mathsf{expm1}\left(\mathsf{log1p}\left(\sinh y\right)\right)}{y}
\end{array}
Derivation
  1. Initial program 100.0%

    \[\cos x \cdot \frac{\sinh y}{y} \]
  2. Step-by-step derivation
    1. expm1-log1p-u77.3%

      \[\leadsto \cos x \cdot \frac{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sinh y\right)\right)}}{y} \]
  3. Applied egg-rr77.3%

    \[\leadsto \cos x \cdot \frac{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sinh y\right)\right)}}{y} \]
  4. Final simplification77.3%

    \[\leadsto \cos x \cdot \frac{\mathsf{expm1}\left(\mathsf{log1p}\left(\sinh y\right)\right)}{y} \]

Alternative 2: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} y = |y|\\ \\ \cos x \cdot \frac{\sinh y}{y} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
y = abs(y);
double code(double x, double y) {
	return cos(x) * (sinh(y) / y);
}
NOTE: y should be positive before calling this function
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = cos(x) * (sinh(y) / y)
end function
y = Math.abs(y);
public static double code(double x, double y) {
	return Math.cos(x) * (Math.sinh(y) / y);
}
y = abs(y)
def code(x, y):
	return math.cos(x) * (math.sinh(y) / y)
y = abs(y)
function code(x, y)
	return Float64(cos(x) * Float64(sinh(y) / y))
end
y = abs(y)
function tmp = code(x, y)
	tmp = cos(x) * (sinh(y) / y);
end
NOTE: y should be positive before calling this function
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y = |y|\\
\\
\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 3: 78.6% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

    if 640 < y < 7.9999999999999994e125

    1. Initial program 100.0%

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

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

        \[\leadsto \cos x + \color{blue}{\left(0.16666666666666666 \cdot {y}^{2}\right) \cdot \cos x} \]
      2. distribute-rgt1-in4.5%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666, {y}^{2}, 1\right)} \cdot \cos x \]
      4. unpow24.5%

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

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

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

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} \]
      2. associate-*r*3.1%

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

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

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

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

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

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

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

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

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

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

    if 7.9999999999999994e125 < y

    1. Initial program 100.0%

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

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

        \[\leadsto \cos x + \color{blue}{\left(0.16666666666666666 \cdot {y}^{2}\right) \cdot \cos x} \]
      2. distribute-rgt1-in88.9%

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

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

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

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

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

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} \]
      2. associate-*r*66.9%

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

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

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

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

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

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

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

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

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

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

Alternative 4: 78.9% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

        \[\leadsto \cos x + \color{blue}{\left(0.16666666666666666 \cdot {y}^{2}\right) \cdot \cos x} \]
      2. distribute-rgt1-in86.5%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666, {y}^{2}, 1\right)} \cdot \cos x \]
      4. unpow286.5%

        \[\leadsto \mathsf{fma}\left(0.16666666666666666, \color{blue}{y \cdot y}, 1\right) \cdot \cos x \]
    4. Simplified86.5%

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

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

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

    if 540 < y < 6.7999999999999998e125

    1. Initial program 100.0%

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

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

        \[\leadsto \cos x + \color{blue}{\left(0.16666666666666666 \cdot {y}^{2}\right) \cdot \cos x} \]
      2. distribute-rgt1-in4.5%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666, {y}^{2}, 1\right)} \cdot \cos x \]
      4. unpow24.5%

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

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

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

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} \]
      2. associate-*r*3.1%

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

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

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

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

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

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

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

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

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

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

    if 6.7999999999999998e125 < y

    1. Initial program 100.0%

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

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

        \[\leadsto \cos x + \color{blue}{\left(0.16666666666666666 \cdot {y}^{2}\right) \cdot \cos x} \]
      2. distribute-rgt1-in88.9%

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

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

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

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

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

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} \]
      2. associate-*r*66.9%

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

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

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

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

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

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

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

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

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

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

Alternative 5: 73.2% accurate, 2.0× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 52000:\\ \;\;\;\;\cos x\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\ \end{array} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y)
 :precision binary64
 (if (<= y 52000.0)
   (cos x)
   (* (* y y) (+ 0.16666666666666666 (* -0.08333333333333333 (* x x))))))
y = abs(y);
double code(double x, double y) {
	double tmp;
	if (y <= 52000.0) {
		tmp = cos(x);
	} else {
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
	}
	return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 52000.0d0) then
        tmp = cos(x)
    else
        tmp = (y * y) * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x)))
    end if
    code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y) {
	double tmp;
	if (y <= 52000.0) {
		tmp = Math.cos(x);
	} else {
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
	}
	return tmp;
}
y = abs(y)
def code(x, y):
	tmp = 0
	if y <= 52000.0:
		tmp = math.cos(x)
	else:
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)))
	return tmp
y = abs(y)
function code(x, y)
	tmp = 0.0
	if (y <= 52000.0)
		tmp = cos(x);
	else
		tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x))));
	end
	return tmp
end
y = abs(y)
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 52000.0)
		tmp = cos(x);
	else
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
	end
	tmp_2 = tmp;
end
NOTE: y should be positive before calling this function
code[x_, y_] := If[LessEqual[y, 52000.0], N[Cos[x], $MachinePrecision], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 52000:\\
\;\;\;\;\cos x\\

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


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

    1. Initial program 100.0%

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

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

    if 52000 < y

    1. Initial program 100.0%

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

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

        \[\leadsto \cos x + \color{blue}{\left(0.16666666666666666 \cdot {y}^{2}\right) \cdot \cos x} \]
      2. distribute-rgt1-in56.1%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666, {y}^{2}, 1\right)} \cdot \cos x \]
      4. unpow256.1%

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

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

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

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} \]
      2. associate-*r*42.1%

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 50.8% accurate, 15.6× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 7.29999999999999982 or 7.9999999999999994e125 < y

    1. Initial program 100.0%

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

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

        \[\leadsto \cos x + \color{blue}{\left(0.16666666666666666 \cdot {y}^{2}\right) \cdot \cos x} \]
      2. distribute-rgt1-in87.0%

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

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

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

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

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

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

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

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

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

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

    if 7.29999999999999982 < y < 7.9999999999999994e125

    1. Initial program 100.0%

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

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

        \[\leadsto \cos x + \color{blue}{\left(0.16666666666666666 \cdot {y}^{2}\right) \cdot \cos x} \]
      2. distribute-rgt1-in4.5%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666, {y}^{2}, 1\right)} \cdot \cos x \]
      4. unpow24.5%

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

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

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

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} \]
      2. associate-*r*3.1%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)} \]
    11. Taylor expanded in x around inf 35.1%

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

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

        \[\leadsto -0.08333333333333333 \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
      3. *-commutative35.1%

        \[\leadsto -0.08333333333333333 \cdot \color{blue}{\left(\left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)} \]
      4. associate-*l*35.1%

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

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

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

Alternative 7: 52.2% accurate, 15.7× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 7.3:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right) + 1\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\ \end{array} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y)
 :precision binary64
 (if (<= y 7.3)
   (+ (* 0.16666666666666666 (* y y)) 1.0)
   (* (* y y) (+ 0.16666666666666666 (* -0.08333333333333333 (* x x))))))
y = abs(y);
double code(double x, double y) {
	double tmp;
	if (y <= 7.3) {
		tmp = (0.16666666666666666 * (y * y)) + 1.0;
	} else {
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
	}
	return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 7.3d0) then
        tmp = (0.16666666666666666d0 * (y * y)) + 1.0d0
    else
        tmp = (y * y) * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x)))
    end if
    code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y) {
	double tmp;
	if (y <= 7.3) {
		tmp = (0.16666666666666666 * (y * y)) + 1.0;
	} else {
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
	}
	return tmp;
}
y = abs(y)
def code(x, y):
	tmp = 0
	if y <= 7.3:
		tmp = (0.16666666666666666 * (y * y)) + 1.0
	else:
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)))
	return tmp
y = abs(y)
function code(x, y)
	tmp = 0.0
	if (y <= 7.3)
		tmp = Float64(Float64(0.16666666666666666 * Float64(y * y)) + 1.0);
	else
		tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x))));
	end
	return tmp
end
y = abs(y)
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 7.3)
		tmp = (0.16666666666666666 * (y * y)) + 1.0;
	else
		tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
	end
	tmp_2 = tmp;
end
NOTE: y should be positive before calling this function
code[x_, y_] := If[LessEqual[y, 7.3], N[(N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.3:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right) + 1\\

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


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

    1. Initial program 100.0%

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

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

        \[\leadsto \cos x + \color{blue}{\left(0.16666666666666666 \cdot {y}^{2}\right) \cdot \cos x} \]
      2. distribute-rgt1-in86.5%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666, {y}^{2}, 1\right)} \cdot \cos x \]
      4. unpow286.5%

        \[\leadsto \mathsf{fma}\left(0.16666666666666666, \color{blue}{y \cdot y}, 1\right) \cdot \cos x \]
    4. Simplified86.5%

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

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

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

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

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

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

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

    if 7.29999999999999982 < y

    1. Initial program 100.0%

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

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

        \[\leadsto \cos x + \color{blue}{\left(0.16666666666666666 \cdot {y}^{2}\right) \cdot \cos x} \]
      2. distribute-rgt1-in56.1%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666, {y}^{2}, 1\right)} \cdot \cos x \]
      4. unpow256.1%

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

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

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

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} \]
      2. associate-*r*42.1%

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 47.3% accurate, 29.0× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 10200000000000:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(y \cdot 0.16666666666666666\right)\\ \end{array} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y)
 :precision binary64
 (if (<= y 10200000000000.0) 1.0 (* y (* y 0.16666666666666666))))
y = abs(y);
double code(double x, double y) {
	double tmp;
	if (y <= 10200000000000.0) {
		tmp = 1.0;
	} else {
		tmp = y * (y * 0.16666666666666666);
	}
	return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 10200000000000.0d0) then
        tmp = 1.0d0
    else
        tmp = y * (y * 0.16666666666666666d0)
    end if
    code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y) {
	double tmp;
	if (y <= 10200000000000.0) {
		tmp = 1.0;
	} else {
		tmp = y * (y * 0.16666666666666666);
	}
	return tmp;
}
y = abs(y)
def code(x, y):
	tmp = 0
	if y <= 10200000000000.0:
		tmp = 1.0
	else:
		tmp = y * (y * 0.16666666666666666)
	return tmp
y = abs(y)
function code(x, y)
	tmp = 0.0
	if (y <= 10200000000000.0)
		tmp = 1.0;
	else
		tmp = Float64(y * Float64(y * 0.16666666666666666));
	end
	return tmp
end
y = abs(y)
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 10200000000000.0)
		tmp = 1.0;
	else
		tmp = y * (y * 0.16666666666666666);
	end
	tmp_2 = tmp;
end
NOTE: y should be positive before calling this function
code[x_, y_] := If[LessEqual[y, 10200000000000.0], 1.0, N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 10200000000000:\\
\;\;\;\;1\\

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


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

    1. Initial program 100.0%

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

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

        \[\leadsto \cos x + \color{blue}{\left(0.16666666666666666 \cdot {y}^{2}\right) \cdot \cos x} \]
      2. distribute-rgt1-in85.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.02e13 < y

    1. Initial program 100.0%

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

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

        \[\leadsto \cos x + \color{blue}{\left(0.16666666666666666 \cdot {y}^{2}\right) \cdot \cos x} \]
      2. distribute-rgt1-in57.8%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666, {y}^{2}, 1\right)} \cdot \cos x \]
      4. unpow257.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)} \]
      2. associate-*r*43.4%

        \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot y\right) \cdot y} \]
    12. Simplified43.4%

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

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

Alternative 9: 47.6% accurate, 29.3× speedup?

\[\begin{array}{l} y = |y|\\ \\ 0.16666666666666666 \cdot \left(y \cdot y\right) + 1 \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y) :precision binary64 (+ (* 0.16666666666666666 (* y y)) 1.0))
y = abs(y);
double code(double x, double y) {
	return (0.16666666666666666 * (y * y)) + 1.0;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (0.16666666666666666d0 * (y * y)) + 1.0d0
end function
y = Math.abs(y);
public static double code(double x, double y) {
	return (0.16666666666666666 * (y * y)) + 1.0;
}
y = abs(y)
def code(x, y):
	return (0.16666666666666666 * (y * y)) + 1.0
y = abs(y)
function code(x, y)
	return Float64(Float64(0.16666666666666666 * Float64(y * y)) + 1.0)
end
y = abs(y)
function tmp = code(x, y)
	tmp = (0.16666666666666666 * (y * y)) + 1.0;
end
NOTE: y should be positive before calling this function
code[x_, y_] := N[(N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]
\begin{array}{l}
y = |y|\\
\\
0.16666666666666666 \cdot \left(y \cdot y\right) + 1
\end{array}
Derivation
  1. Initial program 100.0%

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

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

      \[\leadsto \cos x + \color{blue}{\left(0.16666666666666666 \cdot {y}^{2}\right) \cdot \cos x} \]
    2. distribute-rgt1-in78.6%

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

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

      \[\leadsto \mathsf{fma}\left(0.16666666666666666, \color{blue}{y \cdot y}, 1\right) \cdot \cos x \]
  4. Simplified78.6%

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

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

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

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

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

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

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

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

Alternative 10: 28.4% accurate, 205.0× speedup?

\[\begin{array}{l} y = |y|\\ \\ 1 \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y) :precision binary64 1.0)
y = abs(y);
double code(double x, double y) {
	return 1.0;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 1.0d0
end function
y = Math.abs(y);
public static double code(double x, double y) {
	return 1.0;
}
y = abs(y)
def code(x, y):
	return 1.0
y = abs(y)
function code(x, y)
	return 1.0
end
y = abs(y)
function tmp = code(x, y)
	tmp = 1.0;
end
NOTE: y should be positive before calling this function
code[x_, y_] := 1.0
\begin{array}{l}
y = |y|\\
\\
1
\end{array}
Derivation
  1. Initial program 100.0%

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

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

      \[\leadsto \cos x + \color{blue}{\left(0.16666666666666666 \cdot {y}^{2}\right) \cdot \cos x} \]
    2. distribute-rgt1-in78.6%

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

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

      \[\leadsto \mathsf{fma}\left(0.16666666666666666, \color{blue}{y \cdot y}, 1\right) \cdot \cos x \]
  4. Simplified78.6%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{1} \]
  11. Final simplification30.6%

    \[\leadsto 1 \]

Reproduce

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