Average Error: 35.4 → 0.1
Time: 24.0s
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(\frac{1}{6} - \frac{1}{120} \cdot \left(x \cdot x\right)\right) + \left(\left(\frac{1}{5040} \cdot \left(x \cdot x\right)\right)\right) \cdot \left(x \cdot x\right)\\ \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(\frac{1}{6} - \frac{1}{120} \cdot \left(x \cdot x\right)\right) + \left(\left(\frac{1}{5040} \cdot \left(x \cdot x\right)\right)\right) \cdot \left(x \cdot x\right)\\

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

\end{array}
double f(double x) {
        double r12123768 = x;
        double r12123769 = sin(r12123768);
        double r12123770 = r12123768 - r12123769;
        double r12123771 = 3.0;
        double r12123772 = pow(r12123768, r12123771);
        double r12123773 = r12123770 / r12123772;
        return r12123773;
}

double f(double x) {
        double r12123774 = x;
        double r12123775 = -0.010563289466323842;
        bool r12123776 = r12123774 <= r12123775;
        double r12123777 = sin(r12123774);
        double r12123778 = r12123774 - r12123777;
        double r12123779 = r12123778 / r12123774;
        double r12123780 = r12123779 / r12123774;
        double r12123781 = r12123780 / r12123774;
        double r12123782 = 0.009117179062309817;
        bool r12123783 = r12123774 <= r12123782;
        double r12123784 = 0.16666666666666666;
        double r12123785 = 0.008333333333333333;
        double r12123786 = r12123774 * r12123774;
        double r12123787 = r12123785 * r12123786;
        double r12123788 = r12123784 - r12123787;
        double r12123789 = 0.0001984126984126984;
        double r12123790 = r12123789 * r12123786;
        double r12123791 = /* ERROR: no posit support in C */;
        double r12123792 = /* ERROR: no posit support in C */;
        double r12123793 = r12123792 * r12123786;
        double r12123794 = r12123788 + r12123793;
        double r12123795 = r12123783 ? r12123794 : r12123781;
        double r12123796 = r12123776 ? r12123781 : r12123795;
        return r12123796;
}

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{\frac{\color{blue}{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}{\left(\frac{1}{6} - \frac{1}{120} \cdot \left(x \cdot x\right)\right) + \left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \frac{1}{5040}\right)}\]
    5. Using strategy rm
    6. Applied insert-posit160.1

      \[\leadsto \left(\frac{1}{6} - \frac{1}{120} \cdot \left(x \cdot x\right)\right) + \left(x \cdot x\right) \cdot \color{blue}{\left(\left(\left(x \cdot x\right) \cdot \frac{1}{5040}\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(\frac{1}{6} - \frac{1}{120} \cdot \left(x \cdot x\right)\right) + \left(\left(\frac{1}{5040} \cdot \left(x \cdot x\right)\right)\right) \cdot \left(x \cdot x\right)\\ \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)))