Average Error: 30.4 → 0.0
Time: 37.2s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02980072122437864:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.02756155658182702:\\ \;\;\;\;\mathsf{fma}\left(\frac{9}{40}, x \cdot x, \frac{-27}{2800} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) - \frac{1}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.02980072122437864:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

\mathbf{elif}\;x \le 0.02756155658182702:\\
\;\;\;\;\mathsf{fma}\left(\frac{9}{40}, x \cdot x, \frac{-27}{2800} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) - \frac{1}{2}\\

\mathbf{else}:\\
\;\;\;\;\frac{x - \sin x}{x - \tan x}\\

\end{array}
double f(double x) {
        double r464484 = x;
        double r464485 = sin(r464484);
        double r464486 = r464484 - r464485;
        double r464487 = tan(r464484);
        double r464488 = r464484 - r464487;
        double r464489 = r464486 / r464488;
        return r464489;
}

double f(double x) {
        double r464490 = x;
        double r464491 = -0.02980072122437864;
        bool r464492 = r464490 <= r464491;
        double r464493 = tan(r464490);
        double r464494 = r464490 - r464493;
        double r464495 = r464490 / r464494;
        double r464496 = sin(r464490);
        double r464497 = r464496 / r464494;
        double r464498 = r464495 - r464497;
        double r464499 = 0.02756155658182702;
        bool r464500 = r464490 <= r464499;
        double r464501 = 0.225;
        double r464502 = r464490 * r464490;
        double r464503 = -0.009642857142857142;
        double r464504 = r464502 * r464502;
        double r464505 = r464503 * r464504;
        double r464506 = fma(r464501, r464502, r464505);
        double r464507 = 0.5;
        double r464508 = r464506 - r464507;
        double r464509 = r464490 - r464496;
        double r464510 = r464509 / r464494;
        double r464511 = r464500 ? r464508 : r464510;
        double r464512 = r464492 ? r464498 : r464511;
        return r464512;
}

Error

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if x < -0.02980072122437864

    1. Initial program 0.1

      \[\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.02980072122437864 < x < 0.02756155658182702

    1. Initial program 62.7

      \[\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 \cdot x, \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{-27}{2800}\right) - \frac{1}{2}}\]

    if 0.02756155658182702 < x

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.02980072122437864:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.02756155658182702:\\ \;\;\;\;\mathsf{fma}\left(\frac{9}{40}, x \cdot x, \frac{-27}{2800} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) - \frac{1}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \end{array}\]

Reproduce

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