Average Error: 31.5 → 0.0
Time: 12.1s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.036940832627954695 \lor \neg \left(x \le 0.035858247003072323\right):\\ \;\;\;\;\frac{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\sin x\right)}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\tan x\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.036940832627954695 \lor \neg \left(x \le 0.035858247003072323\right):\\
\;\;\;\;\frac{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\sin x\right)}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\tan x\right)}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)\\

\end{array}
double f(double x) {
        double r27681 = x;
        double r27682 = sin(r27681);
        double r27683 = r27681 - r27682;
        double r27684 = tan(r27681);
        double r27685 = r27681 - r27684;
        double r27686 = r27683 / r27685;
        return r27686;
}

double f(double x) {
        double r27687 = x;
        double r27688 = -0.036940832627954695;
        bool r27689 = r27687 <= r27688;
        double r27690 = 0.03585824700307232;
        bool r27691 = r27687 <= r27690;
        double r27692 = !r27691;
        bool r27693 = r27689 || r27692;
        double r27694 = cbrt(r27687);
        double r27695 = r27694 * r27694;
        double r27696 = sin(r27687);
        double r27697 = -r27696;
        double r27698 = fma(r27695, r27694, r27697);
        double r27699 = tan(r27687);
        double r27700 = -r27699;
        double r27701 = fma(r27695, r27694, r27700);
        double r27702 = r27698 / r27701;
        double r27703 = 0.225;
        double r27704 = 2.0;
        double r27705 = pow(r27687, r27704);
        double r27706 = 0.009642857142857142;
        double r27707 = 4.0;
        double r27708 = pow(r27687, r27707);
        double r27709 = 0.5;
        double r27710 = fma(r27706, r27708, r27709);
        double r27711 = -r27710;
        double r27712 = fma(r27703, r27705, r27711);
        double r27713 = r27693 ? r27702 : r27712;
        return r27713;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.036940832627954695 or 0.03585824700307232 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt1.4

      \[\leadsto \frac{x - \sin x}{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}} - \tan x}\]
    4. Applied fma-neg1.4

      \[\leadsto \frac{x - \sin x}{\color{blue}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\tan x\right)}}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt0.1

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}} - \sin x}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\tan x\right)}\]
    7. Applied fma-neg0.1

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\sin x\right)}}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\tan x\right)}\]

    if -0.036940832627954695 < x < 0.03585824700307232

    1. Initial program 63.1

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Taylor expanded around 0 0.0

      \[\leadsto \color{blue}{\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)}\]
    3. Simplified0.0

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.036940832627954695 \lor \neg \left(x \le 0.035858247003072323\right):\\ \;\;\;\;\frac{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\sin x\right)}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\tan x\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020089 +o rules:numerics
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))