Linear.Quaternion:$csin from linear-1.19.1.3

Percentage Accurate: 100.0% → 100.0%
Time: 18.7s
Alternatives: 22
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 22 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. Add Preprocessing
  3. Add Preprocessing

Alternative 2: 80.2% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
t_0 := \left(y \cdot y\right) \cdot \left(y \cdot y\right)\\
\mathbf{if}\;y \leq 8.6 \cdot 10^{-5}:\\
\;\;\;\;\frac{\left(1 - 0.027777777777777776 \cdot t\_0\right) \cdot \cos x}{1 + -0.16666666666666666 \cdot \left(y \cdot y\right)}\\

\mathbf{elif}\;y \leq 2.4 \cdot 10^{+51}:\\
\;\;\;\;\frac{\sinh y}{y}\\

\mathbf{else}:\\
\;\;\;\;\left(\left(y \cdot y\right) \cdot t\_0\right) \cdot \left(0.0001984126984126984 \cdot \cos x\right)\\


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

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]

    if 8.6000000000000003e-5 < y < 2.3999999999999999e51

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Applied egg-rr0

      \[\leadsto expr\]

    if 2.3999999999999999e51 < y

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 3: 86.9% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 8.6 \cdot 10^{-5}:\\
\;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\

\mathbf{elif}\;y \leq 2 \cdot 10^{+51}:\\
\;\;\;\;\frac{\sinh y}{y}\\

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


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

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]

    if 8.6000000000000003e-5 < y < 2e51

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Applied egg-rr0

      \[\leadsto expr\]

    if 2e51 < y

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 4: 86.5% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 8.6 \cdot 10^{-5}:\\
\;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\

\mathbf{elif}\;y \leq 3.8 \cdot 10^{+77}:\\
\;\;\;\;\frac{\left(1 + \left(x \cdot x\right) \cdot -0.5\right) \cdot \sinh y}{y}\\

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


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

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]

    if 8.6000000000000003e-5 < y < 3.8000000000000001e77

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]

    if 3.8000000000000001e77 < y

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 84.9% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
t_0 := \cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{if}\;y \leq 8.6 \cdot 10^{-5}:\\
\;\;\;\;t\_0\\

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 8.6000000000000003e-5 or 6.9999999999999998e153 < y

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]

    if 8.6000000000000003e-5 < y < 6.9999999999999998e153

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Applied egg-rr0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 72.5% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.8 \cdot 10^{-5}:\\
\;\;\;\;\cos x\\

\mathbf{elif}\;y \leq 3.3 \cdot 10^{+154}:\\
\;\;\;\;\frac{\sinh y}{y}\\

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


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

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]

    if 7.7999999999999999e-5 < y < 3.3e154

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Applied egg-rr0

      \[\leadsto expr\]

    if 3.3e154 < y

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 7: 69.4% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 1.1 \cdot 10^{-5}:\\ \;\;\;\;\cos x\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{+151}:\\ \;\;\;\;\frac{\sinh y}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot y\right) \cdot \left(\left(y \cdot y\right) \cdot \left(0.008333333333333333 + \left(x \cdot x\right) \cdot -0.004166666666666667\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 1.1e-5)
   (cos x)
   (if (<= y 1.5e+151)
     (/ (sinh y) y)
     (*
      (* y y)
      (*
       (* y y)
       (+ 0.008333333333333333 (* (* x x) -0.004166666666666667)))))))
double code(double x, double y) {
	double tmp;
	if (y <= 1.1e-5) {
		tmp = cos(x);
	} else if (y <= 1.5e+151) {
		tmp = sinh(y) / y;
	} else {
		tmp = (y * y) * ((y * y) * (0.008333333333333333 + ((x * x) * -0.004166666666666667)));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 1.1d-5) then
        tmp = cos(x)
    else if (y <= 1.5d+151) then
        tmp = sinh(y) / y
    else
        tmp = (y * y) * ((y * y) * (0.008333333333333333d0 + ((x * x) * (-0.004166666666666667d0))))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= 1.1e-5) {
		tmp = Math.cos(x);
	} else if (y <= 1.5e+151) {
		tmp = Math.sinh(y) / y;
	} else {
		tmp = (y * y) * ((y * y) * (0.008333333333333333 + ((x * x) * -0.004166666666666667)));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 1.1e-5:
		tmp = math.cos(x)
	elif y <= 1.5e+151:
		tmp = math.sinh(y) / y
	else:
		tmp = (y * y) * ((y * y) * (0.008333333333333333 + ((x * x) * -0.004166666666666667)))
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 1.1e-5)
		tmp = cos(x);
	elseif (y <= 1.5e+151)
		tmp = Float64(sinh(y) / y);
	else
		tmp = Float64(Float64(y * y) * Float64(Float64(y * y) * Float64(0.008333333333333333 + Float64(Float64(x * x) * -0.004166666666666667))));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 1.1e-5)
		tmp = cos(x);
	elseif (y <= 1.5e+151)
		tmp = sinh(y) / y;
	else
		tmp = (y * y) * ((y * y) * (0.008333333333333333 + ((x * x) * -0.004166666666666667)));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 1.1e-5], N[Cos[x], $MachinePrecision], If[LessEqual[y, 1.5e+151], N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision], N[(N[(y * y), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * N[(0.008333333333333333 + N[(N[(x * x), $MachinePrecision] * -0.004166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.1 \cdot 10^{-5}:\\
\;\;\;\;\cos x\\

\mathbf{elif}\;y \leq 1.5 \cdot 10^{+151}:\\
\;\;\;\;\frac{\sinh y}{y}\\

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


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

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]

    if 1.1e-5 < y < 1.5e151

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Applied egg-rr0

      \[\leadsto expr\]

    if 1.5e151 < y

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 8: 68.7% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.008333333333333333 + \left(y \cdot y\right) \cdot 0.0001984126984126984\\ t_1 := y \cdot \left(y \cdot y\right)\\ t_2 := \left(y \cdot y\right) \cdot \left(y \cdot 0.008333333333333333\right)\\ t_3 := \left(y \cdot y\right) \cdot t\_0\\ t_4 := \left(y \cdot y\right) \cdot \left(y \cdot y\right)\\ t_5 := \left(y \cdot y\right) \cdot t\_4\\ \mathbf{if}\;y \leq 1.6 \cdot 10^{-5}:\\ \;\;\;\;\cos x\\ \mathbf{elif}\;y \leq 10^{+34}:\\ \;\;\;\;\left(1 + \left(x \cdot x\right) \cdot \left(-0.5 + x \cdot \left(x \cdot \left(0.041666666666666664 + \left(x \cdot x\right) \cdot -0.001388888888888889\right)\right)\right)\right) \cdot \left(1 + \frac{\left(0.004629629629629629 + t\_3 \cdot \left(\left(t\_4 \cdot t\_0\right) \cdot t\_0\right)\right) \cdot \left(y \cdot y\right)}{0.027777777777777776 + t\_3 \cdot \left(t\_3 - 0.16666666666666666\right)}\right)\\ \mathbf{elif}\;y \leq 6 \cdot 10^{+51}:\\ \;\;\;\;y \cdot \frac{\left(5.787037037037037 \cdot 10^{-7} \cdot t\_5\right) \cdot t\_1 + 0.004629629629629629 \cdot t\_1}{t\_2 \cdot t\_2 + \left(\left(y \cdot 0.16666666666666666\right) \cdot \left(y \cdot 0.16666666666666666\right) - t\_2 \cdot \left(y \cdot 0.16666666666666666\right)\right)} + 1\\ \mathbf{elif}\;y \leq 4 \cdot 10^{+79}:\\ \;\;\;\;t\_5 \cdot \left(0.0001984126984126984 + \left(-0.5 + \left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot -0.001388888888888889\right) + 0.041666666666666664\right)\right) \cdot \left(\left(x \cdot x\right) \cdot 0.0001984126984126984\right)\right)\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{+151}:\\ \;\;\;\;\left(\left(y \cdot y\right) \cdot \left(0.16666666666666666 + y \cdot \left(y \cdot \left(0.0001984126984126984 \cdot \left(y \cdot y\right) + 0.008333333333333333\right)\right)\right) + 1\right) \cdot \left(1 + \left(x \cdot x\right) \cdot \left(-0.5 + \left(x \cdot x\right) \cdot 0.041666666666666664\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot y\right) \cdot \left(\left(y \cdot y\right) \cdot \left(0.008333333333333333 + \left(x \cdot x\right) \cdot -0.004166666666666667\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ 0.008333333333333333 (* (* y y) 0.0001984126984126984)))
        (t_1 (* y (* y y)))
        (t_2 (* (* y y) (* y 0.008333333333333333)))
        (t_3 (* (* y y) t_0))
        (t_4 (* (* y y) (* y y)))
        (t_5 (* (* y y) t_4)))
   (if (<= y 1.6e-5)
     (cos x)
     (if (<= y 1e+34)
       (*
        (+
         1.0
         (*
          (* x x)
          (+
           -0.5
           (*
            x
            (*
             x
             (+ 0.041666666666666664 (* (* x x) -0.001388888888888889)))))))
        (+
         1.0
         (/
          (* (+ 0.004629629629629629 (* t_3 (* (* t_4 t_0) t_0))) (* y y))
          (+ 0.027777777777777776 (* t_3 (- t_3 0.16666666666666666))))))
       (if (<= y 6e+51)
         (+
          (*
           y
           (/
            (+
             (* (* 5.787037037037037e-7 t_5) t_1)
             (* 0.004629629629629629 t_1))
            (+
             (* t_2 t_2)
             (-
              (* (* y 0.16666666666666666) (* y 0.16666666666666666))
              (* t_2 (* y 0.16666666666666666))))))
          1.0)
         (if (<= y 4e+79)
           (*
            t_5
            (+
             0.0001984126984126984
             (*
              (+
               -0.5
               (*
                (* x x)
                (+ (* x (* x -0.001388888888888889)) 0.041666666666666664)))
              (* (* x x) 0.0001984126984126984))))
           (if (<= y 3.6e+151)
             (*
              (+
               (*
                (* y y)
                (+
                 0.16666666666666666
                 (*
                  y
                  (*
                   y
                   (+
                    (* 0.0001984126984126984 (* y y))
                    0.008333333333333333)))))
               1.0)
              (+ 1.0 (* (* x x) (+ -0.5 (* (* x x) 0.041666666666666664)))))
             (*
              (* y y)
              (*
               (* y y)
               (+
                0.008333333333333333
                (* (* x x) -0.004166666666666667)))))))))))
double code(double x, double y) {
	double t_0 = 0.008333333333333333 + ((y * y) * 0.0001984126984126984);
	double t_1 = y * (y * y);
	double t_2 = (y * y) * (y * 0.008333333333333333);
	double t_3 = (y * y) * t_0;
	double t_4 = (y * y) * (y * y);
	double t_5 = (y * y) * t_4;
	double tmp;
	if (y <= 1.6e-5) {
		tmp = cos(x);
	} else if (y <= 1e+34) {
		tmp = (1.0 + ((x * x) * (-0.5 + (x * (x * (0.041666666666666664 + ((x * x) * -0.001388888888888889))))))) * (1.0 + (((0.004629629629629629 + (t_3 * ((t_4 * t_0) * t_0))) * (y * y)) / (0.027777777777777776 + (t_3 * (t_3 - 0.16666666666666666)))));
	} else if (y <= 6e+51) {
		tmp = (y * ((((5.787037037037037e-7 * t_5) * t_1) + (0.004629629629629629 * t_1)) / ((t_2 * t_2) + (((y * 0.16666666666666666) * (y * 0.16666666666666666)) - (t_2 * (y * 0.16666666666666666)))))) + 1.0;
	} else if (y <= 4e+79) {
		tmp = t_5 * (0.0001984126984126984 + ((-0.5 + ((x * x) * ((x * (x * -0.001388888888888889)) + 0.041666666666666664))) * ((x * x) * 0.0001984126984126984)));
	} else if (y <= 3.6e+151) {
		tmp = (((y * y) * (0.16666666666666666 + (y * (y * ((0.0001984126984126984 * (y * y)) + 0.008333333333333333))))) + 1.0) * (1.0 + ((x * x) * (-0.5 + ((x * x) * 0.041666666666666664))));
	} else {
		tmp = (y * y) * ((y * y) * (0.008333333333333333 + ((x * x) * -0.004166666666666667)));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_0 = 0.008333333333333333d0 + ((y * y) * 0.0001984126984126984d0)
    t_1 = y * (y * y)
    t_2 = (y * y) * (y * 0.008333333333333333d0)
    t_3 = (y * y) * t_0
    t_4 = (y * y) * (y * y)
    t_5 = (y * y) * t_4
    if (y <= 1.6d-5) then
        tmp = cos(x)
    else if (y <= 1d+34) then
        tmp = (1.0d0 + ((x * x) * ((-0.5d0) + (x * (x * (0.041666666666666664d0 + ((x * x) * (-0.001388888888888889d0)))))))) * (1.0d0 + (((0.004629629629629629d0 + (t_3 * ((t_4 * t_0) * t_0))) * (y * y)) / (0.027777777777777776d0 + (t_3 * (t_3 - 0.16666666666666666d0)))))
    else if (y <= 6d+51) then
        tmp = (y * ((((5.787037037037037d-7 * t_5) * t_1) + (0.004629629629629629d0 * t_1)) / ((t_2 * t_2) + (((y * 0.16666666666666666d0) * (y * 0.16666666666666666d0)) - (t_2 * (y * 0.16666666666666666d0)))))) + 1.0d0
    else if (y <= 4d+79) then
        tmp = t_5 * (0.0001984126984126984d0 + (((-0.5d0) + ((x * x) * ((x * (x * (-0.001388888888888889d0))) + 0.041666666666666664d0))) * ((x * x) * 0.0001984126984126984d0)))
    else if (y <= 3.6d+151) then
        tmp = (((y * y) * (0.16666666666666666d0 + (y * (y * ((0.0001984126984126984d0 * (y * y)) + 0.008333333333333333d0))))) + 1.0d0) * (1.0d0 + ((x * x) * ((-0.5d0) + ((x * x) * 0.041666666666666664d0))))
    else
        tmp = (y * y) * ((y * y) * (0.008333333333333333d0 + ((x * x) * (-0.004166666666666667d0))))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = 0.008333333333333333 + ((y * y) * 0.0001984126984126984);
	double t_1 = y * (y * y);
	double t_2 = (y * y) * (y * 0.008333333333333333);
	double t_3 = (y * y) * t_0;
	double t_4 = (y * y) * (y * y);
	double t_5 = (y * y) * t_4;
	double tmp;
	if (y <= 1.6e-5) {
		tmp = Math.cos(x);
	} else if (y <= 1e+34) {
		tmp = (1.0 + ((x * x) * (-0.5 + (x * (x * (0.041666666666666664 + ((x * x) * -0.001388888888888889))))))) * (1.0 + (((0.004629629629629629 + (t_3 * ((t_4 * t_0) * t_0))) * (y * y)) / (0.027777777777777776 + (t_3 * (t_3 - 0.16666666666666666)))));
	} else if (y <= 6e+51) {
		tmp = (y * ((((5.787037037037037e-7 * t_5) * t_1) + (0.004629629629629629 * t_1)) / ((t_2 * t_2) + (((y * 0.16666666666666666) * (y * 0.16666666666666666)) - (t_2 * (y * 0.16666666666666666)))))) + 1.0;
	} else if (y <= 4e+79) {
		tmp = t_5 * (0.0001984126984126984 + ((-0.5 + ((x * x) * ((x * (x * -0.001388888888888889)) + 0.041666666666666664))) * ((x * x) * 0.0001984126984126984)));
	} else if (y <= 3.6e+151) {
		tmp = (((y * y) * (0.16666666666666666 + (y * (y * ((0.0001984126984126984 * (y * y)) + 0.008333333333333333))))) + 1.0) * (1.0 + ((x * x) * (-0.5 + ((x * x) * 0.041666666666666664))));
	} else {
		tmp = (y * y) * ((y * y) * (0.008333333333333333 + ((x * x) * -0.004166666666666667)));
	}
	return tmp;
}
def code(x, y):
	t_0 = 0.008333333333333333 + ((y * y) * 0.0001984126984126984)
	t_1 = y * (y * y)
	t_2 = (y * y) * (y * 0.008333333333333333)
	t_3 = (y * y) * t_0
	t_4 = (y * y) * (y * y)
	t_5 = (y * y) * t_4
	tmp = 0
	if y <= 1.6e-5:
		tmp = math.cos(x)
	elif y <= 1e+34:
		tmp = (1.0 + ((x * x) * (-0.5 + (x * (x * (0.041666666666666664 + ((x * x) * -0.001388888888888889))))))) * (1.0 + (((0.004629629629629629 + (t_3 * ((t_4 * t_0) * t_0))) * (y * y)) / (0.027777777777777776 + (t_3 * (t_3 - 0.16666666666666666)))))
	elif y <= 6e+51:
		tmp = (y * ((((5.787037037037037e-7 * t_5) * t_1) + (0.004629629629629629 * t_1)) / ((t_2 * t_2) + (((y * 0.16666666666666666) * (y * 0.16666666666666666)) - (t_2 * (y * 0.16666666666666666)))))) + 1.0
	elif y <= 4e+79:
		tmp = t_5 * (0.0001984126984126984 + ((-0.5 + ((x * x) * ((x * (x * -0.001388888888888889)) + 0.041666666666666664))) * ((x * x) * 0.0001984126984126984)))
	elif y <= 3.6e+151:
		tmp = (((y * y) * (0.16666666666666666 + (y * (y * ((0.0001984126984126984 * (y * y)) + 0.008333333333333333))))) + 1.0) * (1.0 + ((x * x) * (-0.5 + ((x * x) * 0.041666666666666664))))
	else:
		tmp = (y * y) * ((y * y) * (0.008333333333333333 + ((x * x) * -0.004166666666666667)))
	return tmp
function code(x, y)
	t_0 = Float64(0.008333333333333333 + Float64(Float64(y * y) * 0.0001984126984126984))
	t_1 = Float64(y * Float64(y * y))
	t_2 = Float64(Float64(y * y) * Float64(y * 0.008333333333333333))
	t_3 = Float64(Float64(y * y) * t_0)
	t_4 = Float64(Float64(y * y) * Float64(y * y))
	t_5 = Float64(Float64(y * y) * t_4)
	tmp = 0.0
	if (y <= 1.6e-5)
		tmp = cos(x);
	elseif (y <= 1e+34)
		tmp = Float64(Float64(1.0 + Float64(Float64(x * x) * Float64(-0.5 + Float64(x * Float64(x * Float64(0.041666666666666664 + Float64(Float64(x * x) * -0.001388888888888889))))))) * Float64(1.0 + Float64(Float64(Float64(0.004629629629629629 + Float64(t_3 * Float64(Float64(t_4 * t_0) * t_0))) * Float64(y * y)) / Float64(0.027777777777777776 + Float64(t_3 * Float64(t_3 - 0.16666666666666666))))));
	elseif (y <= 6e+51)
		tmp = Float64(Float64(y * Float64(Float64(Float64(Float64(5.787037037037037e-7 * t_5) * t_1) + Float64(0.004629629629629629 * t_1)) / Float64(Float64(t_2 * t_2) + Float64(Float64(Float64(y * 0.16666666666666666) * Float64(y * 0.16666666666666666)) - Float64(t_2 * Float64(y * 0.16666666666666666)))))) + 1.0);
	elseif (y <= 4e+79)
		tmp = Float64(t_5 * Float64(0.0001984126984126984 + Float64(Float64(-0.5 + Float64(Float64(x * x) * Float64(Float64(x * Float64(x * -0.001388888888888889)) + 0.041666666666666664))) * Float64(Float64(x * x) * 0.0001984126984126984))));
	elseif (y <= 3.6e+151)
		tmp = Float64(Float64(Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(y * Float64(y * Float64(Float64(0.0001984126984126984 * Float64(y * y)) + 0.008333333333333333))))) + 1.0) * Float64(1.0 + Float64(Float64(x * x) * Float64(-0.5 + Float64(Float64(x * x) * 0.041666666666666664)))));
	else
		tmp = Float64(Float64(y * y) * Float64(Float64(y * y) * Float64(0.008333333333333333 + Float64(Float64(x * x) * -0.004166666666666667))));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = 0.008333333333333333 + ((y * y) * 0.0001984126984126984);
	t_1 = y * (y * y);
	t_2 = (y * y) * (y * 0.008333333333333333);
	t_3 = (y * y) * t_0;
	t_4 = (y * y) * (y * y);
	t_5 = (y * y) * t_4;
	tmp = 0.0;
	if (y <= 1.6e-5)
		tmp = cos(x);
	elseif (y <= 1e+34)
		tmp = (1.0 + ((x * x) * (-0.5 + (x * (x * (0.041666666666666664 + ((x * x) * -0.001388888888888889))))))) * (1.0 + (((0.004629629629629629 + (t_3 * ((t_4 * t_0) * t_0))) * (y * y)) / (0.027777777777777776 + (t_3 * (t_3 - 0.16666666666666666)))));
	elseif (y <= 6e+51)
		tmp = (y * ((((5.787037037037037e-7 * t_5) * t_1) + (0.004629629629629629 * t_1)) / ((t_2 * t_2) + (((y * 0.16666666666666666) * (y * 0.16666666666666666)) - (t_2 * (y * 0.16666666666666666)))))) + 1.0;
	elseif (y <= 4e+79)
		tmp = t_5 * (0.0001984126984126984 + ((-0.5 + ((x * x) * ((x * (x * -0.001388888888888889)) + 0.041666666666666664))) * ((x * x) * 0.0001984126984126984)));
	elseif (y <= 3.6e+151)
		tmp = (((y * y) * (0.16666666666666666 + (y * (y * ((0.0001984126984126984 * (y * y)) + 0.008333333333333333))))) + 1.0) * (1.0 + ((x * x) * (-0.5 + ((x * x) * 0.041666666666666664))));
	else
		tmp = (y * y) * ((y * y) * (0.008333333333333333 + ((x * x) * -0.004166666666666667)));
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(0.008333333333333333 + N[(N[(y * y), $MachinePrecision] * 0.0001984126984126984), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y * N[(y * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * y), $MachinePrecision] * N[(y * 0.008333333333333333), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y * y), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$4 = N[(N[(y * y), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[(y * y), $MachinePrecision] * t$95$4), $MachinePrecision]}, If[LessEqual[y, 1.6e-5], N[Cos[x], $MachinePrecision], If[LessEqual[y, 1e+34], N[(N[(1.0 + N[(N[(x * x), $MachinePrecision] * N[(-0.5 + N[(x * N[(x * N[(0.041666666666666664 + N[(N[(x * x), $MachinePrecision] * -0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(0.004629629629629629 + N[(t$95$3 * N[(N[(t$95$4 * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision] / N[(0.027777777777777776 + N[(t$95$3 * N[(t$95$3 - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6e+51], N[(N[(y * N[(N[(N[(N[(5.787037037037037e-7 * t$95$5), $MachinePrecision] * t$95$1), $MachinePrecision] + N[(0.004629629629629629 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(N[(t$95$2 * t$95$2), $MachinePrecision] + N[(N[(N[(y * 0.16666666666666666), $MachinePrecision] * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] - N[(t$95$2 * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[y, 4e+79], N[(t$95$5 * N[(0.0001984126984126984 + N[(N[(-0.5 + N[(N[(x * x), $MachinePrecision] * N[(N[(x * N[(x * -0.001388888888888889), $MachinePrecision]), $MachinePrecision] + 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.0001984126984126984), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.6e+151], N[(N[(N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(y * N[(y * N[(N[(0.0001984126984126984 * N[(y * y), $MachinePrecision]), $MachinePrecision] + 0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(1.0 + N[(N[(x * x), $MachinePrecision] * N[(-0.5 + N[(N[(x * x), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * y), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * N[(0.008333333333333333 + N[(N[(x * x), $MachinePrecision] * -0.004166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.008333333333333333 + \left(y \cdot y\right) \cdot 0.0001984126984126984\\
t_1 := y \cdot \left(y \cdot y\right)\\
t_2 := \left(y \cdot y\right) \cdot \left(y \cdot 0.008333333333333333\right)\\
t_3 := \left(y \cdot y\right) \cdot t\_0\\
t_4 := \left(y \cdot y\right) \cdot \left(y \cdot y\right)\\
t_5 := \left(y \cdot y\right) \cdot t\_4\\
\mathbf{if}\;y \leq 1.6 \cdot 10^{-5}:\\
\;\;\;\;\cos x\\

\mathbf{elif}\;y \leq 10^{+34}:\\
\;\;\;\;\left(1 + \left(x \cdot x\right) \cdot \left(-0.5 + x \cdot \left(x \cdot \left(0.041666666666666664 + \left(x \cdot x\right) \cdot -0.001388888888888889\right)\right)\right)\right) \cdot \left(1 + \frac{\left(0.004629629629629629 + t\_3 \cdot \left(\left(t\_4 \cdot t\_0\right) \cdot t\_0\right)\right) \cdot \left(y \cdot y\right)}{0.027777777777777776 + t\_3 \cdot \left(t\_3 - 0.16666666666666666\right)}\right)\\

\mathbf{elif}\;y \leq 6 \cdot 10^{+51}:\\
\;\;\;\;y \cdot \frac{\left(5.787037037037037 \cdot 10^{-7} \cdot t\_5\right) \cdot t\_1 + 0.004629629629629629 \cdot t\_1}{t\_2 \cdot t\_2 + \left(\left(y \cdot 0.16666666666666666\right) \cdot \left(y \cdot 0.16666666666666666\right) - t\_2 \cdot \left(y \cdot 0.16666666666666666\right)\right)} + 1\\

\mathbf{elif}\;y \leq 4 \cdot 10^{+79}:\\
\;\;\;\;t\_5 \cdot \left(0.0001984126984126984 + \left(-0.5 + \left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot -0.001388888888888889\right) + 0.041666666666666664\right)\right) \cdot \left(\left(x \cdot x\right) \cdot 0.0001984126984126984\right)\right)\\

\mathbf{elif}\;y \leq 3.6 \cdot 10^{+151}:\\
\;\;\;\;\left(\left(y \cdot y\right) \cdot \left(0.16666666666666666 + y \cdot \left(y \cdot \left(0.0001984126984126984 \cdot \left(y \cdot y\right) + 0.008333333333333333\right)\right)\right) + 1\right) \cdot \left(1 + \left(x \cdot x\right) \cdot \left(-0.5 + \left(x \cdot x\right) \cdot 0.041666666666666664\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if y < 1.59999999999999993e-5

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]

    if 1.59999999999999993e-5 < y < 9.99999999999999946e33

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Applied egg-rr0

      \[\leadsto expr\]

    if 9.99999999999999946e33 < y < 6e51

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Applied egg-rr0

      \[\leadsto expr\]

    if 6e51 < y < 3.99999999999999987e79

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]

    if 3.99999999999999987e79 < y < 3.6e151

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]

    if 3.6e151 < y

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]
  3. Recombined 6 regimes into one program.
  4. Add Preprocessing

Alternative 9: 59.2% accurate, 5.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.1 \cdot 10^{+213}:\\
\;\;\;\;\left(\left(y \cdot y\right) \cdot \left(0.16666666666666666 + y \cdot \left(y \cdot \left(0.0001984126984126984 \cdot \left(y \cdot y\right) + 0.008333333333333333\right)\right)\right) + 1\right) \cdot \left(1 + \left(x \cdot x\right) \cdot \left(-0.5 + \left(x \cdot x\right) \cdot 0.041666666666666664\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 4.0999999999999997e213

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]

    if 4.0999999999999997e213 < x

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 60.3% accurate, 7.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.1 \cdot 10^{+213}:\\
\;\;\;\;\frac{y \cdot \left(\left(y \cdot y\right) \cdot \left(0.16666666666666666 + y \cdot \left(y \cdot \left(0.0001984126984126984 \cdot \left(y \cdot y\right) + 0.008333333333333333\right)\right)\right) + 1\right)}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 4.0999999999999997e213

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if 4.0999999999999997e213 < x

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 59.3% accurate, 7.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 4.1 \cdot 10^{+213}:\\ \;\;\;\;1 + y \cdot \left(y \cdot \left(0.16666666666666666 + \frac{\left(y \cdot y\right) \cdot \left(y \cdot y\right)}{5040 + \frac{-211680}{y \cdot y}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(x \cdot -0.5\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x 4.1e+213)
   (+
    1.0
    (*
     y
     (*
      y
      (+
       0.16666666666666666
       (/ (* (* y y) (* y y)) (+ 5040.0 (/ -211680.0 (* y y))))))))
   (* x (* x -0.5))))
double code(double x, double y) {
	double tmp;
	if (x <= 4.1e+213) {
		tmp = 1.0 + (y * (y * (0.16666666666666666 + (((y * y) * (y * y)) / (5040.0 + (-211680.0 / (y * y)))))));
	} else {
		tmp = x * (x * -0.5);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= 4.1d+213) then
        tmp = 1.0d0 + (y * (y * (0.16666666666666666d0 + (((y * y) * (y * y)) / (5040.0d0 + ((-211680.0d0) / (y * y)))))))
    else
        tmp = x * (x * (-0.5d0))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= 4.1e+213) {
		tmp = 1.0 + (y * (y * (0.16666666666666666 + (((y * y) * (y * y)) / (5040.0 + (-211680.0 / (y * y)))))));
	} else {
		tmp = x * (x * -0.5);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= 4.1e+213:
		tmp = 1.0 + (y * (y * (0.16666666666666666 + (((y * y) * (y * y)) / (5040.0 + (-211680.0 / (y * y)))))))
	else:
		tmp = x * (x * -0.5)
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= 4.1e+213)
		tmp = Float64(1.0 + Float64(y * Float64(y * Float64(0.16666666666666666 + Float64(Float64(Float64(y * y) * Float64(y * y)) / Float64(5040.0 + Float64(-211680.0 / Float64(y * y))))))));
	else
		tmp = Float64(x * Float64(x * -0.5));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= 4.1e+213)
		tmp = 1.0 + (y * (y * (0.16666666666666666 + (((y * y) * (y * y)) / (5040.0 + (-211680.0 / (y * y)))))));
	else
		tmp = x * (x * -0.5);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, 4.1e+213], N[(1.0 + N[(y * N[(y * N[(0.16666666666666666 + N[(N[(N[(y * y), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision] / N[(5040.0 + N[(-211680.0 / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(x * -0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.1 \cdot 10^{+213}:\\
\;\;\;\;1 + y \cdot \left(y \cdot \left(0.16666666666666666 + \frac{\left(y \cdot y\right) \cdot \left(y \cdot y\right)}{5040 + \frac{-211680}{y \cdot y}}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 4.0999999999999997e213

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]

    if 4.0999999999999997e213 < x

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 12: 53.1% accurate, 7.9× speedup?

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

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

\mathbf{elif}\;y \leq 6.8 \cdot 10^{+78}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 7 \cdot 10^{+153}:\\
\;\;\;\;y \cdot \left(y \cdot \left(\left(y \cdot y\right) \cdot 0.008333333333333333\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


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

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if 4.5e7 < y < 6.80000000000000014e78 or 6.9999999999999998e153 < y

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]

    if 6.80000000000000014e78 < y < 6.9999999999999998e153

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 13: 59.3% accurate, 8.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.1 \cdot 10^{+213}:\\
\;\;\;\;1 + y \cdot \left(y \cdot \left(0.16666666666666666 + y \cdot \left(y \cdot \left(0.008333333333333333 + \left(y \cdot y\right) \cdot 0.0001984126984126984\right)\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 4.0999999999999997e213

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]

    if 4.0999999999999997e213 < x

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 14: 58.3% accurate, 9.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.1 \cdot 10^{+213}:\\
\;\;\;\;\frac{y \cdot \left(y \cdot \left(y \cdot \left(0.16666666666666666 + y \cdot \left(y \cdot 0.008333333333333333\right)\right)\right) + 1\right)}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 4.0999999999999997e213

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if 4.0999999999999997e213 < x

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 15: 56.8% accurate, 11.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.1 \cdot 10^{+213}:\\
\;\;\;\;y \cdot \left(y \cdot \left(0.16666666666666666 + y \cdot \left(y \cdot 0.008333333333333333\right)\right)\right) + 1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 4.0999999999999997e213

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if 4.0999999999999997e213 < x

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 16: 56.7% accurate, 12.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.1 \cdot 10^{+213}:\\
\;\;\;\;y \cdot \left(y \cdot \left(\left(y \cdot y\right) \cdot 0.008333333333333333\right)\right) + 1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 4.0999999999999997e213

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]

    if 4.0999999999999997e213 < x

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 17: 52.0% accurate, 14.6× speedup?

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

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

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


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

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if 5 < y

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 18: 48.6% accurate, 17.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.4 \cdot 10^{+159}:\\
\;\;\;\;\left(y \cdot y\right) \cdot 0.16666666666666666 + 1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 3.39999999999999991e159

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]

    if 3.39999999999999991e159 < x

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 19: 48.6% accurate, 17.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.4 \cdot 10^{+159}:\\
\;\;\;\;y \cdot \left(y \cdot 0.16666666666666666\right) + 1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 3.39999999999999991e159

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if 3.39999999999999991e159 < x

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 20: 32.3% accurate, 20.5× speedup?

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

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

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


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

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]

    if 8.6e7 < y

    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 21: 33.3% accurate, 29.3× speedup?

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

\\
1 + -0.5 \cdot \left(x \cdot x\right)
\end{array}
Derivation
  1. Initial program 100.0%

    \[\cos x \cdot \frac{\sinh y}{y} \]
  2. Add Preprocessing
  3. Taylor expanded in y around 0 0

    \[\leadsto expr\]
  4. Simplified0

    \[\leadsto expr\]
  5. Taylor expanded in x around 0 0

    \[\leadsto expr\]
  6. Simplified0

    \[\leadsto expr\]
  7. Add Preprocessing

Alternative 22: 29.4% 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. Add Preprocessing
  3. Taylor expanded in y around 0 0

    \[\leadsto expr\]
  4. Simplified0

    \[\leadsto expr\]
  5. Taylor expanded in x around 0 0

    \[\leadsto expr\]
  6. Simplified0

    \[\leadsto expr\]
  7. Add Preprocessing

Reproduce

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