Average Error: 35.4 → 0.1
Time: 30.8s
Precision: 64
\[\frac{x - \sin x}{{x}^{3}}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.010563289466323842:\\ \;\;\;\;\frac{\frac{\frac{x - \sin x}{x}}{x}}{x}\\ \mathbf{elif}\;x \le 0.009117179062309817:\\ \;\;\;\;\left(\left(x \cdot x\right) \cdot \frac{-1}{120} + \left(\left(\frac{1}{5040} \cdot \left(x \cdot x\right)\right)\right) \cdot \left(x \cdot x\right)\right) + \frac{1}{6}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{x - \sin x}{x}}{x}}{x}\\ \end{array}\]
\frac{x - \sin x}{{x}^{3}}
\begin{array}{l}
\mathbf{if}\;x \le -0.010563289466323842:\\
\;\;\;\;\frac{\frac{\frac{x - \sin x}{x}}{x}}{x}\\

\mathbf{elif}\;x \le 0.009117179062309817:\\
\;\;\;\;\left(\left(x \cdot x\right) \cdot \frac{-1}{120} + \left(\left(\frac{1}{5040} \cdot \left(x \cdot x\right)\right)\right) \cdot \left(x \cdot x\right)\right) + \frac{1}{6}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{x - \sin x}{x}}{x}}{x}\\

\end{array}
double f(double x) {
        double r7338795 = x;
        double r7338796 = sin(r7338795);
        double r7338797 = r7338795 - r7338796;
        double r7338798 = 3.0;
        double r7338799 = pow(r7338795, r7338798);
        double r7338800 = r7338797 / r7338799;
        return r7338800;
}

double f(double x) {
        double r7338801 = x;
        double r7338802 = -0.010563289466323842;
        bool r7338803 = r7338801 <= r7338802;
        double r7338804 = sin(r7338801);
        double r7338805 = r7338801 - r7338804;
        double r7338806 = r7338805 / r7338801;
        double r7338807 = r7338806 / r7338801;
        double r7338808 = r7338807 / r7338801;
        double r7338809 = 0.009117179062309817;
        bool r7338810 = r7338801 <= r7338809;
        double r7338811 = r7338801 * r7338801;
        double r7338812 = -0.008333333333333333;
        double r7338813 = r7338811 * r7338812;
        double r7338814 = 0.0001984126984126984;
        double r7338815 = r7338814 * r7338811;
        double r7338816 = /* ERROR: no posit support in C */;
        double r7338817 = /* ERROR: no posit support in C */;
        double r7338818 = r7338817 * r7338811;
        double r7338819 = r7338813 + r7338818;
        double r7338820 = 0.16666666666666666;
        double r7338821 = r7338819 + r7338820;
        double r7338822 = r7338810 ? r7338821 : r7338808;
        double r7338823 = r7338803 ? r7338808 : r7338822;
        return r7338823;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.010563289466323842 or 0.009117179062309817 < x

    1. Initial program 10.5

      \[\frac{x - \sin x}{{x}^{3}}\]
    2. Simplified0.2

      \[\leadsto \color{blue}{\frac{\frac{\frac{x - \sin x}{x}}{x}}{x}}\]
    3. Taylor expanded around -inf 0.2

      \[\leadsto \frac{\frac{\color{blue}{1 - \frac{\sin x}{x}}}{x}}{x}\]
    4. Simplified0.2

      \[\leadsto \frac{\frac{\color{blue}{\frac{x - \sin x}{x}}}{x}}{x}\]

    if -0.010563289466323842 < x < 0.009117179062309817

    1. Initial program 61.3

      \[\frac{x - \sin x}{{x}^{3}}\]
    2. Simplified61.3

      \[\leadsto \color{blue}{\frac{\frac{\frac{x - \sin x}{x}}{x}}{x}}\]
    3. Taylor expanded around 0 0.0

      \[\leadsto \color{blue}{\left(\frac{1}{5040} \cdot {x}^{4} + \frac{1}{6}\right) - \frac{1}{120} \cdot {x}^{2}}\]
    4. Simplified0.0

      \[\leadsto \color{blue}{\frac{1}{6} + \left(\left(\frac{1}{5040} \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + \frac{-1}{120} \cdot \left(x \cdot x\right)\right)}\]
    5. Using strategy rm
    6. Applied insert-posit160.1

      \[\leadsto \frac{1}{6} + \left(\color{blue}{\left(\left(\frac{1}{5040} \cdot \left(x \cdot x\right)\right)\right)} \cdot \left(x \cdot x\right) + \frac{-1}{120} \cdot \left(x \cdot x\right)\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.010563289466323842:\\ \;\;\;\;\frac{\frac{\frac{x - \sin x}{x}}{x}}{x}\\ \mathbf{elif}\;x \le 0.009117179062309817:\\ \;\;\;\;\left(\left(x \cdot x\right) \cdot \frac{-1}{120} + \left(\left(\frac{1}{5040} \cdot \left(x \cdot x\right)\right)\right) \cdot \left(x \cdot x\right)\right) + \frac{1}{6}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{x - \sin x}{x}}{x}}{x}\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name "(x-sin(x))/x^3"
  (/ (- x (sin x)) (pow x 3)))