Linear.Quaternion:$csin from linear-1.19.1.3

?

Percentage Accurate: 100.0% → 100.0%
Time: 9.9s
Precision: binary64
Cost: 13120

?

\[\cos x \cdot \frac{\sinh y}{y} \]
\[\cos x \cdot \frac{\sinh y}{y} \]
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
	return 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
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);
}
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)
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 code(x, y)
	return Float64(cos(x) * Float64(sinh(y) / y))
end
function tmp = code(x, y)
	tmp = cos(x) * (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]
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\cos x \cdot \frac{\sinh y}{y}
\cos x \cdot \frac{\sinh y}{y}

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.

Herbie found 11 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

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.

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 100.0%

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

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

Alternatives

Alternative 1
Accuracy100.0%
Cost13120
\[\cos x \cdot \frac{\sinh y}{y} \]
Alternative 2
Accuracy83.2%
Cost13452
\[\begin{array}{l} t_0 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\ t_1 := \sqrt[3]{{y}^{6} \cdot 0.004629629629629629}\\ \mathbf{if}\;y \leq -1 \cdot 10^{+55}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5 \cdot 10^{+54}:\\ \;\;\;\;\cos x \cdot \left(1 + t_0\right)\\ \mathbf{elif}\;y \leq 2.25 \cdot 10^{+101}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{+133}:\\ \;\;\;\;y \cdot \mathsf{fma}\left(-0.08333333333333333, y \cdot \left(x \cdot x\right), y \cdot 0.16666666666666666\right)\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+154}:\\ \;\;\;\;\left(1 - \left(y \cdot y\right) \cdot \left(\left(y \cdot y\right) \cdot 0.027777777777777776\right)\right) \cdot \frac{1}{1 - t_0}\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot \left(\cos x \cdot y\right)\right)\\ \end{array} \]
Alternative 3
Accuracy84.3%
Cost7508
\[\begin{array}{l} t_0 := 0.16666666666666666 \cdot \left(y \cdot \left(\cos x \cdot y\right)\right)\\ t_1 := \left(1 - \left(y \cdot y\right) \cdot \left(\left(y \cdot y\right) \cdot 0.027777777777777776\right)\right) \cdot \frac{1}{1 - 0.16666666666666666 \cdot \left(y \cdot y\right)}\\ \mathbf{if}\;y \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -7.5 \cdot 10^{+85}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -270000000000:\\ \;\;\;\;y \cdot \left(-0.08333333333333333 \cdot \left(y \cdot \left(x \cdot x\right)\right)\right)\\ \mathbf{elif}\;y \leq 4.9 \cdot 10^{+30}:\\ \;\;\;\;\cos x\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+154}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Accuracy84.7%
Cost7508
\[\begin{array}{l} t_0 := 0.16666666666666666 \cdot \left(y \cdot \left(\cos x \cdot y\right)\right)\\ t_1 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\ t_2 := \left(1 - \left(y \cdot y\right) \cdot \left(\left(y \cdot y\right) \cdot 0.027777777777777776\right)\right) \cdot \frac{1}{1 - t_1}\\ \mathbf{if}\;y \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -4.6 \cdot 10^{+85}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -150000000000:\\ \;\;\;\;y \cdot \left(-0.08333333333333333 \cdot \left(y \cdot \left(x \cdot x\right)\right)\right)\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{+60}:\\ \;\;\;\;\cos x \cdot \left(1 + t_1\right)\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+154}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Accuracy84.7%
Cost7508
\[\begin{array}{l} t_0 := 0.16666666666666666 \cdot \left(y \cdot \left(\cos x \cdot y\right)\right)\\ t_1 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\ t_2 := \left(1 - \left(y \cdot y\right) \cdot \left(\left(y \cdot y\right) \cdot 0.027777777777777776\right)\right) \cdot \frac{1}{1 - t_1}\\ \mathbf{if}\;y \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -4.6 \cdot 10^{+85}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -270000000000:\\ \;\;\;\;y \cdot \mathsf{fma}\left(-0.08333333333333333, y \cdot \left(x \cdot x\right), y \cdot 0.16666666666666666\right)\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{+60}:\\ \;\;\;\;\cos x \cdot \left(1 + t_1\right)\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+154}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Accuracy78.4%
Cost6992
\[\begin{array}{l} t_0 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\ t_1 := \left(1 - \left(y \cdot y\right) \cdot \left(\left(y \cdot y\right) \cdot 0.027777777777777776\right)\right) \cdot \frac{1}{1 - t_0}\\ \mathbf{if}\;y \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -4.6 \cdot 10^{+85}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -180000000000:\\ \;\;\;\;y \cdot \left(-0.08333333333333333 \cdot \left(y \cdot \left(x \cdot x\right)\right)\right)\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{+30}:\\ \;\;\;\;\cos x\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+154}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Accuracy55.1%
Cost2136
\[\begin{array}{l} t_0 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\ t_1 := y \cdot \left(-0.08333333333333333 \cdot \left(y \cdot \left(x \cdot x\right)\right)\right)\\ t_2 := \left(1 - \left(y \cdot y\right) \cdot \left(\left(y \cdot y\right) \cdot 0.027777777777777776\right)\right) \cdot \frac{1}{1 - t_0}\\ \mathbf{if}\;y \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -4.6 \cdot 10^{+85}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -210000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.25 \cdot 10^{+101}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{+133}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+154}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Accuracy48.1%
Cost708
\[\begin{array}{l} \mathbf{if}\;x \leq 3.9 \cdot 10^{+118}:\\ \;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-0.08333333333333333 \cdot \left(y \cdot \left(x \cdot x\right)\right)\right)\\ \end{array} \]
Alternative 9
Accuracy47.0%
Cost585
\[\begin{array}{l} \mathbf{if}\;y \leq -9.2 \cdot 10^{-7} \lor \neg \left(y \leq 235000000000\right):\\ \;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 10
Accuracy47.2%
Cost448
\[1 + 0.16666666666666666 \cdot \left(y \cdot y\right) \]
Alternative 11
Accuracy28.5%
Cost64
\[1 \]

Reproduce?

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