Average Error: 0.1 → 0.1
Time: 3.8s
Precision: 64
\[x \cdot \frac{\sin y}{y}\]
\[x \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\sin y}{y}\right)\right)\]
x \cdot \frac{\sin y}{y}
x \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\sin y}{y}\right)\right)
double code(double x, double y) {
	return (x * (sin(y) / y));
}
double code(double x, double y) {
	return (x * expm1(log1p((sin(y) / y))));
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.1

    \[x \cdot \frac{\sin y}{y}\]
  2. Using strategy rm
  3. Applied expm1-log1p-u0.1

    \[\leadsto x \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\sin y}{y}\right)\right)}\]
  4. Final simplification0.1

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

Reproduce

herbie shell --seed 2020057 +o rules:numerics
(FPCore (x y)
  :name "Linear.Quaternion:$cexp from linear-1.19.1.3"
  :precision binary64
  (* x (/ (sin y) y)))