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

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

\end{array}
double f(double x) {
        double r14506 = x;
        double r14507 = sin(r14506);
        double r14508 = r14506 - r14507;
        double r14509 = tan(r14506);
        double r14510 = r14506 - r14509;
        double r14511 = r14508 / r14510;
        return r14511;
}

double f(double x) {
        double r14512 = x;
        double r14513 = -0.028801687005274378;
        bool r14514 = r14512 <= r14513;
        double r14515 = 0.026533802681284316;
        bool r14516 = r14512 <= r14515;
        double r14517 = !r14516;
        bool r14518 = r14514 || r14517;
        double r14519 = tan(r14512);
        double r14520 = r14512 - r14519;
        double r14521 = r14512 / r14520;
        double r14522 = sin(r14512);
        double r14523 = r14522 / r14520;
        double r14524 = r14521 - r14523;
        double r14525 = 0.225;
        double r14526 = 2.0;
        double r14527 = pow(r14512, r14526);
        double r14528 = 4.0;
        double r14529 = pow(r14512, r14528);
        double r14530 = -0.009642857142857142;
        double r14531 = r14529 * r14530;
        double r14532 = fma(r14525, r14527, r14531);
        double r14533 = 0.5;
        double r14534 = r14532 - r14533;
        double r14535 = r14518 ? r14524 : r14534;
        return r14535;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.028801687005274378 or 0.026533802681284316 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied div-sub0.1

      \[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]

    if -0.028801687005274378 < x < 0.026533802681284316

    1. Initial program 63.4

      \[\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}{\frac{9}{40} \cdot {x}^{2} - \mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\]
    4. Using strategy rm
    5. Applied fma-udef0.0

      \[\leadsto \frac{9}{40} \cdot {x}^{2} - \color{blue}{\left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)}\]
    6. Applied associate--r+0.0

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

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

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

Reproduce

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