Linear.Quaternion:$csin from linear-1.19.1.3

Percentage Accurate: 100.0% → 100.0%
Time: 7.8s
Alternatives: 15
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 15 alternatives:

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

Initial Program: 100.0% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 1.0× speedup?

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

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

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

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

Alternative 2: 84.5% accurate, 1.7× speedup?

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

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

\mathbf{elif}\;y \leq 5.4 \cdot 10^{+71}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 3.8 \cdot 10^{+129}:\\
\;\;\;\;\frac{0.027777777777777776 \cdot {y}^{4} + -1}{t_1 + -1}\\

\mathbf{elif}\;y \leq 1.9 \cdot 10^{+153}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 100.0%

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

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

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

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

    if 190 < y < 5.39999999999999993e71 or 3.80000000000000005e129 < y < 1.89999999999999983e153

    1. Initial program 100.0%

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

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

        \[\leadsto 1 + -0.5 \cdot \color{blue}{\left(x \cdot x\right)} \]
    4. Simplified76.5%

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

    if 5.39999999999999993e71 < y < 3.80000000000000005e129

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.89999999999999983e153 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 190:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{+71}:\\ \;\;\;\;\frac{\sinh y}{y} \cdot \left(1 + -0.5 \cdot \left(x \cdot x\right)\right)\\ \mathbf{elif}\;y \leq 3.8 \cdot 10^{+129}:\\ \;\;\;\;\frac{0.027777777777777776 \cdot {y}^{4} + -1}{0.16666666666666666 \cdot \left(y \cdot y\right) + -1}\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{+153}:\\ \;\;\;\;\frac{\sinh y}{y} \cdot \left(1 + -0.5 \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 3: 84.5% accurate, 1.7× speedup?

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

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

\mathbf{elif}\;y \leq 5.4 \cdot 10^{+71}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 2.55 \cdot 10^{+129}:\\
\;\;\;\;\frac{0.027777777777777776 \cdot {y}^{4}}{t_1 + -1}\\

\mathbf{elif}\;y \leq 1.9 \cdot 10^{+153}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 100.0%

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

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

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

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

    if 190 < y < 5.39999999999999993e71 or 2.54999999999999998e129 < y < 1.89999999999999983e153

    1. Initial program 100.0%

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

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

        \[\leadsto 1 + -0.5 \cdot \color{blue}{\left(x \cdot x\right)} \]
    4. Simplified76.5%

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

    if 5.39999999999999993e71 < y < 2.54999999999999998e129

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{0.027777777777777776 \cdot {y}^{4} - 1}{0.16666666666666666 \cdot \left(y \cdot y\right) - 1}} \]
    10. Taylor expanded in y around inf 80.0%

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

    if 1.89999999999999983e153 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 190:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{+71}:\\ \;\;\;\;\frac{\sinh y}{y} \cdot \left(1 + -0.5 \cdot \left(x \cdot x\right)\right)\\ \mathbf{elif}\;y \leq 2.55 \cdot 10^{+129}:\\ \;\;\;\;\frac{0.027777777777777776 \cdot {y}^{4}}{0.16666666666666666 \cdot \left(y \cdot y\right) + -1}\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{+153}:\\ \;\;\;\;\frac{\sinh y}{y} \cdot \left(1 + -0.5 \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: 84.8% accurate, 1.8× speedup?

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

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

\mathbf{elif}\;y \leq 1.9 \cdot 10^{+153}:\\
\;\;\;\;\frac{\sinh y}{y} \cdot \left(1 + -0.5 \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 < 190

    1. Initial program 100.0%

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

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

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

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

    if 190 < y < 1.89999999999999983e153

    1. Initial program 100.0%

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

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

        \[\leadsto 1 + -0.5 \cdot \color{blue}{\left(x \cdot x\right)} \]
    4. Simplified66.7%

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

    if 1.89999999999999983e153 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 190:\\ \;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{+153}:\\ \;\;\;\;\frac{\sinh y}{y} \cdot \left(1 + -0.5 \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: 65.5% accurate, 1.8× speedup?

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

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

\mathbf{elif}\;y \leq 1.9 \cdot 10^{+153}:\\
\;\;\;\;\left(1 + -0.5 \cdot \left(x \cdot x\right)\right) \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\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 < 1.3e13

    1. Initial program 100.0%

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

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

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

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

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

    if 1.3e13 < y < 1.89999999999999983e153

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto 1 + -0.5 \cdot \color{blue}{\left(x \cdot x\right)} \]
    7. Simplified15.1%

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

    if 1.89999999999999983e153 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 76.3% accurate, 1.9× speedup?

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

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

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

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

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

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

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

Alternative 7: 62.6% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{if}\;y \leq 13000000000000:\\ \;\;\;\;\cos x\\ \mathbf{elif}\;y \leq 2 \cdot 10^{+184} \lor \neg \left(y \leq 9.5 \cdot 10^{+232}\right):\\ \;\;\;\;\left(1 + -0.5 \cdot \left(x \cdot x\right)\right) \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ 1.0 (* 0.16666666666666666 (* y y)))))
   (if (<= y 13000000000000.0)
     (cos x)
     (if (or (<= y 2e+184) (not (<= y 9.5e+232)))
       (* (+ 1.0 (* -0.5 (* x x))) t_0)
       t_0))))
double code(double x, double y) {
	double t_0 = 1.0 + (0.16666666666666666 * (y * y));
	double tmp;
	if (y <= 13000000000000.0) {
		tmp = cos(x);
	} else if ((y <= 2e+184) || !(y <= 9.5e+232)) {
		tmp = (1.0 + (-0.5 * (x * x))) * t_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 = 1.0d0 + (0.16666666666666666d0 * (y * y))
    if (y <= 13000000000000.0d0) then
        tmp = cos(x)
    else if ((y <= 2d+184) .or. (.not. (y <= 9.5d+232))) then
        tmp = (1.0d0 + ((-0.5d0) * (x * x))) * t_0
    else
        tmp = t_0
    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 (y <= 13000000000000.0) {
		tmp = Math.cos(x);
	} else if ((y <= 2e+184) || !(y <= 9.5e+232)) {
		tmp = (1.0 + (-0.5 * (x * x))) * t_0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = 1.0 + (0.16666666666666666 * (y * y))
	tmp = 0
	if y <= 13000000000000.0:
		tmp = math.cos(x)
	elif (y <= 2e+184) or not (y <= 9.5e+232):
		tmp = (1.0 + (-0.5 * (x * x))) * t_0
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))
	tmp = 0.0
	if (y <= 13000000000000.0)
		tmp = cos(x);
	elseif ((y <= 2e+184) || !(y <= 9.5e+232))
		tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(x * x))) * t_0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = 1.0 + (0.16666666666666666 * (y * y));
	tmp = 0.0;
	if (y <= 13000000000000.0)
		tmp = cos(x);
	elseif ((y <= 2e+184) || ~((y <= 9.5e+232)))
		tmp = (1.0 + (-0.5 * (x * x))) * t_0;
	else
		tmp = t_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[y, 13000000000000.0], N[Cos[x], $MachinePrecision], If[Or[LessEqual[y, 2e+184], N[Not[LessEqual[y, 9.5e+232]], $MachinePrecision]], N[(N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], t$95$0]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 2 \cdot 10^{+184} \lor \neg \left(y \leq 9.5 \cdot 10^{+232}\right):\\
\;\;\;\;\left(1 + -0.5 \cdot \left(x \cdot x\right)\right) \cdot t_0\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

    if 1.3e13 < y < 2.00000000000000003e184 or 9.4999999999999996e232 < y

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto 1 + -0.5 \cdot \color{blue}{\left(x \cdot x\right)} \]
    7. Simplified46.3%

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

    if 2.00000000000000003e184 < y < 9.4999999999999996e232

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 13000000000000:\\ \;\;\;\;\cos x\\ \mathbf{elif}\;y \leq 2 \cdot 10^{+184} \lor \neg \left(y \leq 9.5 \cdot 10^{+232}\right):\\ \;\;\;\;\left(1 + -0.5 \cdot \left(x \cdot x\right)\right) \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \end{array} \]

Alternative 8: 49.4% accurate, 11.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 122 \lor \neg \left(y \leq 5.3 \cdot 10^{+184}\right) \land y \leq 4.8 \cdot 10^{+246}:\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 122 or 5.30000000000000022e184 < y < 4.8e246

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if 122 < y < 5.30000000000000022e184 or 4.8e246 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 122 \lor \neg \left(y \leq 5.3 \cdot 10^{+184}\right) \land y \leq 4.8 \cdot 10^{+246}:\\ \;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(y \cdot \left(0.16666666666666666 + \left(x \cdot x\right) \cdot -0.08333333333333333\right)\right)\\ \end{array} \]

Alternative 9: 49.4% accurate, 12.0× speedup?

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

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

\mathbf{elif}\;x \leq 2.8 \cdot 10^{+277}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 2.80000000000000015e219

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

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

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

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

        \[\leadsto 1 + -0.5 \cdot \color{blue}{\left(x \cdot x\right)} \]
    7. Simplified54.4%

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

    if 2.80000000000000015e219 < x < 2.79999999999999985e277

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

    if 2.79999999999999985e277 < x

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto \color{blue}{\cos x} \]
    6. Taylor expanded in x around 0 60.6%

      \[\leadsto \color{blue}{1 + -0.5 \cdot {x}^{2}} \]
    7. Step-by-step derivation
      1. unpow260.6%

        \[\leadsto 1 + -0.5 \cdot \color{blue}{\left(x \cdot x\right)} \]
    8. Simplified60.6%

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

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

Alternative 10: 36.9% accurate, 15.5× speedup?

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

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

\mathbf{elif}\;y \leq 1.9 \cdot 10^{+170} \lor \neg \left(y \leq 2.05 \cdot 10^{+183}\right):\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\

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


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

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto \color{blue}{1 + 0.16666666666666666 \cdot {y}^{2}} \]
    6. 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-udef50.3%

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

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

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

    if 2.39999999999999991 < y < 1.8999999999999999e170 or 2.05000000000000007e183 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.8999999999999999e170 < y < 2.05000000000000007e183

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto \color{blue}{\cos x} \]
    6. Taylor expanded in x around 0 75.8%

      \[\leadsto \color{blue}{1 + -0.5 \cdot {x}^{2}} \]
    7. Step-by-step derivation
      1. unpow275.8%

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

      \[\leadsto \color{blue}{1 + -0.5 \cdot \left(x \cdot x\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification43.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.4:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{+170} \lor \neg \left(y \leq 2.05 \cdot 10^{+183}\right):\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;1 + -0.5 \cdot \left(x \cdot x\right)\\ \end{array} \]

Alternative 11: 47.2% accurate, 15.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.12 \cdot 10^{+164} \lor \neg \left(x \leq 2.8 \cdot 10^{+219}\right) \land x \leq 2.8 \cdot 10^{+277}:\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 2.11999999999999993e164 or 2.80000000000000015e219 < x < 2.79999999999999985e277

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if 2.11999999999999993e164 < x < 2.80000000000000015e219 or 2.79999999999999985e277 < x

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto \color{blue}{\cos x} \]
    6. Taylor expanded in x around 0 32.8%

      \[\leadsto \color{blue}{1 + -0.5 \cdot {x}^{2}} \]
    7. Step-by-step derivation
      1. unpow232.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2.12 \cdot 10^{+164} \lor \neg \left(x \leq 2.8 \cdot 10^{+219}\right) \land x \leq 2.8 \cdot 10^{+277}:\\ \;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;1 + -0.5 \cdot \left(x \cdot x\right)\\ \end{array} \]

Alternative 12: 47.8% accurate, 15.5× speedup?

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

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

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

\mathbf{elif}\;x \leq 2.8 \cdot 10^{+277}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 2.65e20 or 2.80000000000000015e219 < x < 2.79999999999999985e277

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if 2.65e20 < x < 2.80000000000000015e219

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.79999999999999985e277 < x

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto \color{blue}{\cos x} \]
    6. Taylor expanded in x around 0 60.6%

      \[\leadsto \color{blue}{1 + -0.5 \cdot {x}^{2}} \]
    7. Step-by-step derivation
      1. unpow260.6%

        \[\leadsto 1 + -0.5 \cdot \color{blue}{\left(x \cdot x\right)} \]
    8. Simplified60.6%

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

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

Alternative 13: 47.8% accurate, 15.5× speedup?

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

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

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

\mathbf{elif}\;x \leq 2.8 \cdot 10^{+277}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 2.65e20 or 2.80000000000000015e219 < x < 2.79999999999999985e277

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if 2.65e20 < x < 2.80000000000000015e219

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.79999999999999985e277 < x

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto \color{blue}{\cos x} \]
    6. Taylor expanded in x around 0 60.6%

      \[\leadsto \color{blue}{1 + -0.5 \cdot {x}^{2}} \]
    7. Step-by-step derivation
      1. unpow260.6%

        \[\leadsto 1 + -0.5 \cdot \color{blue}{\left(x \cdot x\right)} \]
    8. Simplified60.6%

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

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

Alternative 14: 37.6% accurate, 29.0× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto \color{blue}{1 + 0.16666666666666666 \cdot {y}^{2}} \]
    6. 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-udef50.3%

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

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

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

    if 2.25 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 28.5% accurate, 205.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 1 \]

Reproduce

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