Average Error: 0.1 → 0.1
Time: 3.6s
Precision: binary64
Cost: 7048
\[x \cdot \frac{\sin y}{y}\]
\[\begin{array}{l} \mathbf{if}\;y \leq -0.00038475853256956117 \lor \neg \left(y \leq 0.00022643016838745178\right):\\ \;\;\;\;\sin y \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;x - 0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\ \end{array}\]
x \cdot \frac{\sin y}{y}
\begin{array}{l}
\mathbf{if}\;y \leq -0.00038475853256956117 \lor \neg \left(y \leq 0.00022643016838745178\right):\\
\;\;\;\;\sin y \cdot \frac{x}{y}\\

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

\end{array}
(FPCore (x y) :precision binary64 (* x (/ (sin y) y)))
(FPCore (x y)
 :precision binary64
 (if (or (<= y -0.00038475853256956117) (not (<= y 0.00022643016838745178)))
   (* (sin y) (/ x y))
   (- x (* 0.16666666666666666 (* x (* y y))))))
double code(double x, double y) {
	return x * (sin(y) / y);
}
double code(double x, double y) {
	double tmp;
	if ((y <= -0.00038475853256956117) || !(y <= 0.00022643016838745178)) {
		tmp = sin(y) * (x / y);
	} else {
		tmp = x - (0.16666666666666666 * (x * (y * y)));
	}
	return tmp;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Alternatives

Alternative 1
Error0.2
Cost6720
\[\frac{x}{\frac{y}{\sin y}}\]
Alternative 2
Error23.2
Cost576
\[\frac{x}{1 + 0.16666666666666666 \cdot \left(y \cdot y\right)}\]
Alternative 3
Error23.5
Cost706
\[\begin{array}{l} \mathbf{if}\;y \leq -3.7580092184483376 \cdot 10^{+37}:\\ \;\;\;\;0\\ \mathbf{elif}\;y \leq 233902413342.02118:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
Alternative 4
Error54.1
Cost64
\[0\]
Alternative 5
Error61.7
Cost64
\[1\]

Error

Derivation

  1. Split input into 2 regimes
  2. if y < -3.8475853256956117e-4 or 2.2643016838745178e-4 < y

    1. Initial program 0.3

      \[x \cdot \frac{\sin y}{y}\]
    2. Using strategy rm
    3. Applied clear-num_binary64_31460.4

      \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{y}{\sin y}}}\]
    4. Using strategy rm
    5. Applied associate-/r/_binary64_30930.3

      \[\leadsto x \cdot \color{blue}{\left(\frac{1}{y} \cdot \sin y\right)}\]
    6. Applied associate-*r*_binary64_30870.3

      \[\leadsto \color{blue}{\left(x \cdot \frac{1}{y}\right) \cdot \sin y}\]
    7. Simplified0.3

      \[\leadsto \color{blue}{\frac{x}{y}} \cdot \sin y\]
    8. Simplified0.3

      \[\leadsto \color{blue}{\sin y \cdot \frac{x}{y}}\]

    if -3.8475853256956117e-4 < y < 2.2643016838745178e-4

    1. Initial program 0.0

      \[x \cdot \frac{\sin y}{y}\]
    2. Taylor expanded around 0 0.0

      \[\leadsto \color{blue}{x - 0.16666666666666666 \cdot \left(x \cdot {y}^{2}\right)}\]
    3. Simplified0.0

      \[\leadsto \color{blue}{x - 0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)}\]
    4. Simplified0.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.00038475853256956117 \lor \neg \left(y \leq 0.00022643016838745178\right):\\ \;\;\;\;\sin y \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;x - 0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\ \end{array}\]

Reproduce

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