Average Error: 31.8 → 0.0
Time: 27.5s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02818082991146234062007636111957253888249 \lor \neg \left(x \le 0.02588411381903582553221099260554183274508\right):\\ \;\;\;\;\frac{x - \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.02818082991146234062007636111957253888249 \lor \neg \left(x \le 0.02588411381903582553221099260554183274508\right):\\
\;\;\;\;\frac{x - \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 r22456 = x;
        double r22457 = sin(r22456);
        double r22458 = r22456 - r22457;
        double r22459 = tan(r22456);
        double r22460 = r22456 - r22459;
        double r22461 = r22458 / r22460;
        return r22461;
}

double f(double x) {
        double r22462 = x;
        double r22463 = -0.02818082991146234;
        bool r22464 = r22462 <= r22463;
        double r22465 = 0.025884113819035826;
        bool r22466 = r22462 <= r22465;
        double r22467 = !r22466;
        bool r22468 = r22464 || r22467;
        double r22469 = sin(r22462);
        double r22470 = r22462 - r22469;
        double r22471 = tan(r22462);
        double r22472 = r22462 - r22471;
        double r22473 = r22470 / r22472;
        double r22474 = 0.225;
        double r22475 = 2.0;
        double r22476 = pow(r22462, r22475);
        double r22477 = 4.0;
        double r22478 = pow(r22462, r22477);
        double r22479 = -0.009642857142857142;
        double r22480 = r22478 * r22479;
        double r22481 = fma(r22474, r22476, r22480);
        double r22482 = 0.5;
        double r22483 = r22481 - r22482;
        double r22484 = r22468 ? r22473 : r22483;
        return r22484;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.02818082991146234 or 0.025884113819035826 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]

    if -0.02818082991146234 < x < 0.025884113819035826

    1. Initial program 63.2

      \[\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.02818082991146234062007636111957253888249 \lor \neg \left(x \le 0.02588411381903582553221099260554183274508\right):\\ \;\;\;\;\frac{x - \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 2019304 +o rules:numerics
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))