Average Error: 30.5 → 0.3
Time: 28.7s
Precision: 64
\[\frac{1 - \frac{\sin x}{x}}{{x}^{2}}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.009272911760413088:\\ \;\;\;\;\frac{\sqrt[3]{1 - \frac{\sin x}{x}}}{x} \cdot \frac{\sqrt[3]{1 - \frac{\sin x}{x}} \cdot \sqrt[3]{1 - \frac{\sin x}{x}}}{x}\\ \mathbf{elif}\;x \le 0.009462403866380574:\\ \;\;\;\;\frac{1}{6} + \left(x \cdot x\right) \cdot \left(\left(\left(\frac{1}{5040} \cdot \left(x \cdot x\right)\right)\right) - \frac{1}{120}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \frac{\sin x}{x}}{x \cdot x}\\ \end{array}\]
\frac{1 - \frac{\sin x}{x}}{{x}^{2}}
\begin{array}{l}
\mathbf{if}\;x \le -0.009272911760413088:\\
\;\;\;\;\frac{\sqrt[3]{1 - \frac{\sin x}{x}}}{x} \cdot \frac{\sqrt[3]{1 - \frac{\sin x}{x}} \cdot \sqrt[3]{1 - \frac{\sin x}{x}}}{x}\\

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

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

\end{array}
double f(double x) {
        double r13845362 = 1.0;
        double r13845363 = x;
        double r13845364 = sin(r13845363);
        double r13845365 = r13845364 / r13845363;
        double r13845366 = r13845362 - r13845365;
        double r13845367 = 2.0;
        double r13845368 = pow(r13845363, r13845367);
        double r13845369 = r13845366 / r13845368;
        return r13845369;
}

double f(double x) {
        double r13845370 = x;
        double r13845371 = -0.009272911760413088;
        bool r13845372 = r13845370 <= r13845371;
        double r13845373 = 1.0;
        double r13845374 = sin(r13845370);
        double r13845375 = r13845374 / r13845370;
        double r13845376 = r13845373 - r13845375;
        double r13845377 = cbrt(r13845376);
        double r13845378 = r13845377 / r13845370;
        double r13845379 = r13845377 * r13845377;
        double r13845380 = r13845379 / r13845370;
        double r13845381 = r13845378 * r13845380;
        double r13845382 = 0.009462403866380574;
        bool r13845383 = r13845370 <= r13845382;
        double r13845384 = 0.16666666666666666;
        double r13845385 = r13845370 * r13845370;
        double r13845386 = 0.0001984126984126984;
        double r13845387 = r13845386 * r13845385;
        double r13845388 = /* ERROR: no posit support in C */;
        double r13845389 = /* ERROR: no posit support in C */;
        double r13845390 = 0.008333333333333333;
        double r13845391 = r13845389 - r13845390;
        double r13845392 = r13845385 * r13845391;
        double r13845393 = r13845384 + r13845392;
        double r13845394 = r13845376 / r13845385;
        double r13845395 = r13845383 ? r13845393 : r13845394;
        double r13845396 = r13845372 ? r13845381 : r13845395;
        return r13845396;
}

Error

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if x < -0.009272911760413088

    1. Initial program 0.8

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

      \[\leadsto \color{blue}{\frac{1 - \frac{\sin x}{x}}{x \cdot x}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt0.9

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1 - \frac{\sin x}{x}} \cdot \sqrt[3]{1 - \frac{\sin x}{x}}\right) \cdot \sqrt[3]{1 - \frac{\sin x}{x}}}}{x \cdot x}\]
    5. Applied times-frac0.4

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1 - \frac{\sin x}{x}} \cdot \sqrt[3]{1 - \frac{\sin x}{x}}}{x} \cdot \frac{\sqrt[3]{1 - \frac{\sin x}{x}}}{x}}\]

    if -0.009272911760413088 < x < 0.009462403866380574

    1. Initial program 61.3

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

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

      \[\leadsto \frac{1}{6} + \left(x \cdot x\right) \cdot \left(\color{blue}{\left(\left(\frac{1}{5040} \cdot \left(x \cdot x\right)\right)\right)} - \frac{1}{120}\right)\]

    if 0.009462403866380574 < x

    1. Initial program 0.9

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

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

      \[\leadsto \frac{1 - \color{blue}{\frac{\sin x}{x}}}{x \cdot x}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.3

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

Reproduce

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