Average Error: 30.9 → 0.0
Time: 12.7s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0448174138573504618 \lor \neg \left(x \le 0.0393537385253853664\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.0448174138573504618 \lor \neg \left(x \le 0.0393537385253853664\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 r37500 = x;
        double r37501 = sin(r37500);
        double r37502 = r37500 - r37501;
        double r37503 = tan(r37500);
        double r37504 = r37500 - r37503;
        double r37505 = r37502 / r37504;
        return r37505;
}

double f(double x) {
        double r37506 = x;
        double r37507 = -0.04481741385735046;
        bool r37508 = r37506 <= r37507;
        double r37509 = 0.039353738525385366;
        bool r37510 = r37506 <= r37509;
        double r37511 = !r37510;
        bool r37512 = r37508 || r37511;
        double r37513 = cbrt(r37506);
        double r37514 = r37513 * r37513;
        double r37515 = sin(r37506);
        double r37516 = -r37515;
        double r37517 = fma(r37514, r37513, r37516);
        double r37518 = tan(r37506);
        double r37519 = -r37518;
        double r37520 = fma(r37514, r37513, r37519);
        double r37521 = r37517 / r37520;
        double r37522 = 0.225;
        double r37523 = 2.0;
        double r37524 = pow(r37506, r37523);
        double r37525 = 0.009642857142857142;
        double r37526 = 4.0;
        double r37527 = pow(r37506, r37526);
        double r37528 = 0.5;
        double r37529 = fma(r37525, r37527, r37528);
        double r37530 = -r37529;
        double r37531 = fma(r37522, r37524, r37530);
        double r37532 = r37512 ? r37521 : r37531;
        return r37532;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.04481741385735046 or 0.039353738525385366 < 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.04481741385735046 < x < 0.039353738525385366

    1. Initial program 63.3

      \[\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.0448174138573504618 \lor \neg \left(x \le 0.0393537385253853664\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 2020018 +o rules:numerics
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))