Average Error: 30.5 → 0.3
Time: 26.8s
Precision: 64
\[\frac{1 - \frac{\sin x}{x}}{{x}^{2}}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.009272911760413088:\\ \;\;\;\;\left(\sqrt[3]{1 - \frac{\sin x}{x}} \cdot \frac{\sqrt[3]{1 - \frac{\sin x}{x}}}{x}\right) \cdot \frac{\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(x \cdot \left(\frac{1}{5040} \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:\\
\;\;\;\;\left(\sqrt[3]{1 - \frac{\sin x}{x}} \cdot \frac{\sqrt[3]{1 - \frac{\sin x}{x}}}{x}\right) \cdot \frac{\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(x \cdot \left(\frac{1}{5040} \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 r14531001 = 1.0;
        double r14531002 = x;
        double r14531003 = sin(r14531002);
        double r14531004 = r14531003 / r14531002;
        double r14531005 = r14531001 - r14531004;
        double r14531006 = 2.0;
        double r14531007 = pow(r14531002, r14531006);
        double r14531008 = r14531005 / r14531007;
        return r14531008;
}

double f(double x) {
        double r14531009 = x;
        double r14531010 = -0.009272911760413088;
        bool r14531011 = r14531009 <= r14531010;
        double r14531012 = 1.0;
        double r14531013 = sin(r14531009);
        double r14531014 = r14531013 / r14531009;
        double r14531015 = r14531012 - r14531014;
        double r14531016 = cbrt(r14531015);
        double r14531017 = r14531016 / r14531009;
        double r14531018 = r14531016 * r14531017;
        double r14531019 = r14531018 * r14531017;
        double r14531020 = 0.009462403866380574;
        bool r14531021 = r14531009 <= r14531020;
        double r14531022 = 0.16666666666666666;
        double r14531023 = r14531009 * r14531009;
        double r14531024 = 0.0001984126984126984;
        double r14531025 = r14531024 * r14531009;
        double r14531026 = r14531009 * r14531025;
        double r14531027 = /* ERROR: no posit support in C */;
        double r14531028 = /* ERROR: no posit support in C */;
        double r14531029 = 0.008333333333333333;
        double r14531030 = r14531028 - r14531029;
        double r14531031 = r14531023 * r14531030;
        double r14531032 = r14531022 + r14531031;
        double r14531033 = r14531015 / r14531023;
        double r14531034 = r14531021 ? r14531032 : r14531033;
        double r14531035 = r14531011 ? r14531019 : r14531034;
        return r14531035;
}

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}}\]
    6. Simplified0.4

      \[\leadsto \color{blue}{\left(\frac{\sqrt[3]{1 - \frac{\sin x}{x}}}{x} \cdot \sqrt[3]{1 - \frac{\sin x}{x}}\right)} \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(\left(x \cdot \frac{1}{5040}\right) \cdot x - \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(\left(x \cdot \frac{1}{5040}\right) \cdot x\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{\color{blue}{1 - \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:\\ \;\;\;\;\left(\sqrt[3]{1 - \frac{\sin x}{x}} \cdot \frac{\sqrt[3]{1 - \frac{\sin x}{x}}}{x}\right) \cdot \frac{\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(x \cdot \left(\frac{1}{5040} \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)))