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

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

\end{array}
double f(double x) {
        double r16378 = x;
        double r16379 = sin(r16378);
        double r16380 = r16378 - r16379;
        double r16381 = tan(r16378);
        double r16382 = r16378 - r16381;
        double r16383 = r16380 / r16382;
        return r16383;
}

double f(double x) {
        double r16384 = x;
        double r16385 = -0.02582917538591079;
        bool r16386 = r16384 <= r16385;
        double r16387 = 0.02844105962587155;
        bool r16388 = r16384 <= r16387;
        double r16389 = !r16388;
        bool r16390 = r16386 || r16389;
        double r16391 = sin(r16384);
        double r16392 = r16384 - r16391;
        double r16393 = tan(r16384);
        double r16394 = r16384 - r16393;
        double r16395 = r16392 / r16394;
        double r16396 = 0.225;
        double r16397 = 2.0;
        double r16398 = pow(r16384, r16397);
        double r16399 = r16396 * r16398;
        double r16400 = 0.009642857142857142;
        double r16401 = 4.0;
        double r16402 = pow(r16384, r16401);
        double r16403 = 0.5;
        double r16404 = fma(r16400, r16402, r16403);
        double r16405 = r16399 - r16404;
        double r16406 = r16390 ? r16395 : r16405;
        return r16406;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.02582917538591079 or 0.02844105962587155 < x

    1. Initial program 0.0

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

    if -0.02582917538591079 < x < 0.02844105962587155

    1. Initial program 63.0

      \[\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)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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