Average Error: 0.0 → 0.3
Time: 5.3s
Precision: binary64
Cost: 25920
\[\cos x \cdot \frac{\sinh y}{y} \]
\[\frac{\cos x}{\frac{y}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sinh y\right)\right)}} \]
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
(FPCore (x y) :precision binary64 (/ (cos x) (/ y (expm1 (log1p (sinh y))))))
double code(double x, double y) {
	return cos(x) * (sinh(y) / y);
}
double code(double x, double y) {
	return cos(x) / (y / expm1(log1p(sinh(y))));
}
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) / (y / Math.expm1(Math.log1p(Math.sinh(y))));
}
def code(x, y):
	return math.cos(x) * (math.sinh(y) / y)
def code(x, y):
	return math.cos(x) / (y / math.expm1(math.log1p(math.sinh(y))))
function code(x, y)
	return Float64(cos(x) * Float64(sinh(y) / y))
end
function code(x, y)
	return Float64(cos(x) / Float64(y / expm1(log1p(sinh(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[(y / N[(Exp[N[Log[1 + N[Sinh[y], $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\cos x \cdot \frac{\sinh y}{y}
\frac{\cos x}{\frac{y}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sinh y\right)\right)}}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

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

    \[\leadsto \color{blue}{\frac{\cos x}{\frac{y}{\sinh y}}} \]
    Proof
    (/.f64 (cos.f64 x) (/.f64 y (sinh.f64 y))): 0 points increase in error, 0 points decrease in error
    (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 (cos.f64 x) (sinh.f64 y)) y)): 17 points increase in error, 0 points decrease in error
    (Rewrite<= associate-*r/_binary64 (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y))): 1 points increase in error, 15 points decrease in error
  3. Applied egg-rr0.3

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

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

Alternatives

Alternative 1
Error0.0
Cost13120
\[\cos x \cdot \frac{\sinh y}{y} \]
Alternative 2
Error0.0
Cost13120
\[\frac{\cos x}{\frac{y}{\sinh y}} \]
Alternative 3
Error0.7
Cost6976
\[\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right) \]
Alternative 4
Error1.1
Cost6464
\[\cos x \]
Alternative 5
Error29.6
Cost1344
\[\begin{array}{l} t_0 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\ \frac{t_0 \cdot t_0 + -1}{t_0 + -1} \end{array} \]
Alternative 6
Error29.6
Cost448
\[1 + 0.16666666666666666 \cdot \left(y \cdot y\right) \]
Alternative 7
Error29.8
Cost64
\[1 \]

Error

Reproduce

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