Average Error: 31.4 → 0.0
Time: 11.6s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02679764477988002754904606206309836125001:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(x, \frac{x}{x - \tan x}, \frac{-{\left(\sin x\right)}^{2}}{x - \tan x}\right)}{x - \tan x}}{\frac{x}{x - \tan x} + \frac{\sin x}{\frac{x \cdot x - \tan x \cdot \tan x}{x + \tan x}}}\\ \mathbf{elif}\;x \le 0.02671164277294657204975258935064630350098:\\ \;\;\;\;\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.02679764477988002754904606206309836125001:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(x, \frac{x}{x - \tan x}, \frac{-{\left(\sin x\right)}^{2}}{x - \tan x}\right)}{x - \tan x}}{\frac{x}{x - \tan x} + \frac{\sin x}{\frac{x \cdot x - \tan x \cdot \tan x}{x + \tan x}}}\\

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

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

\end{array}
double f(double x) {
        double r22031 = x;
        double r22032 = sin(r22031);
        double r22033 = r22031 - r22032;
        double r22034 = tan(r22031);
        double r22035 = r22031 - r22034;
        double r22036 = r22033 / r22035;
        return r22036;
}

double f(double x) {
        double r22037 = x;
        double r22038 = -0.026797644779880028;
        bool r22039 = r22037 <= r22038;
        double r22040 = tan(r22037);
        double r22041 = r22037 - r22040;
        double r22042 = r22037 / r22041;
        double r22043 = sin(r22037);
        double r22044 = 2.0;
        double r22045 = pow(r22043, r22044);
        double r22046 = -r22045;
        double r22047 = r22046 / r22041;
        double r22048 = fma(r22037, r22042, r22047);
        double r22049 = r22048 / r22041;
        double r22050 = r22037 * r22037;
        double r22051 = r22040 * r22040;
        double r22052 = r22050 - r22051;
        double r22053 = r22037 + r22040;
        double r22054 = r22052 / r22053;
        double r22055 = r22043 / r22054;
        double r22056 = r22042 + r22055;
        double r22057 = r22049 / r22056;
        double r22058 = 0.026711642772946572;
        bool r22059 = r22037 <= r22058;
        double r22060 = 0.225;
        double r22061 = pow(r22037, r22044);
        double r22062 = 0.009642857142857142;
        double r22063 = 4.0;
        double r22064 = pow(r22037, r22063);
        double r22065 = 0.5;
        double r22066 = fma(r22062, r22064, r22065);
        double r22067 = -r22066;
        double r22068 = fma(r22060, r22061, r22067);
        double r22069 = r22043 / r22041;
        double r22070 = r22042 - r22069;
        double r22071 = r22059 ? r22068 : r22070;
        double r22072 = r22039 ? r22057 : r22071;
        return r22072;
}

Error

Bits error versus x

Derivation

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

    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}}\]
    4. Using strategy rm
    5. Applied flip--0.1

      \[\leadsto \color{blue}{\frac{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x} \cdot \frac{\sin x}{x - \tan x}}{\frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x}}}\]
    6. Using strategy rm
    7. Applied associate-*r/0.1

      \[\leadsto \frac{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} - \color{blue}{\frac{\frac{\sin x}{x - \tan x} \cdot \sin x}{x - \tan x}}}{\frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x}}\]
    8. Applied associate-*r/0.1

      \[\leadsto \frac{\color{blue}{\frac{\frac{x}{x - \tan x} \cdot x}{x - \tan x}} - \frac{\frac{\sin x}{x - \tan x} \cdot \sin x}{x - \tan x}}{\frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x}}\]
    9. Applied sub-div0.1

      \[\leadsto \frac{\color{blue}{\frac{\frac{x}{x - \tan x} \cdot x - \frac{\sin x}{x - \tan x} \cdot \sin x}{x - \tan x}}}{\frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x}}\]
    10. Simplified0.0

      \[\leadsto \frac{\frac{\color{blue}{\mathsf{fma}\left(x, \frac{x}{x - \tan x}, \frac{-{\left(\sin x\right)}^{2}}{x - \tan x}\right)}}{x - \tan x}}{\frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x}}\]
    11. Using strategy rm
    12. Applied flip--0.0

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x, \frac{x}{x - \tan x}, \frac{-{\left(\sin x\right)}^{2}}{x - \tan x}\right)}{x - \tan x}}{\frac{x}{x - \tan x} + \frac{\sin x}{\color{blue}{\frac{x \cdot x - \tan x \cdot \tan x}{x + \tan x}}}}\]

    if -0.026797644779880028 < x < 0.026711642772946572

    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)}\]

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

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

Reproduce

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