Average Error: 30.9 → 0.0
Time: 29.8s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.028213729881585915:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.031240215431948184:\\ \;\;\;\;\frac{9}{40} \cdot \left(x \cdot x\right) - \mathsf{fma}\left(\frac{27}{2800}, \left(x \cdot x\right) \cdot \left(x \cdot x\right), \frac{1}{2}\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.028213729881585915:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

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

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

\end{array}
double f(double x) {
        double r422297 = x;
        double r422298 = sin(r422297);
        double r422299 = r422297 - r422298;
        double r422300 = tan(r422297);
        double r422301 = r422297 - r422300;
        double r422302 = r422299 / r422301;
        return r422302;
}

double f(double x) {
        double r422303 = x;
        double r422304 = -0.028213729881585915;
        bool r422305 = r422303 <= r422304;
        double r422306 = tan(r422303);
        double r422307 = r422303 - r422306;
        double r422308 = r422303 / r422307;
        double r422309 = sin(r422303);
        double r422310 = r422309 / r422307;
        double r422311 = r422308 - r422310;
        double r422312 = 0.031240215431948184;
        bool r422313 = r422303 <= r422312;
        double r422314 = 0.225;
        double r422315 = r422303 * r422303;
        double r422316 = r422314 * r422315;
        double r422317 = 0.009642857142857142;
        double r422318 = r422315 * r422315;
        double r422319 = 0.5;
        double r422320 = fma(r422317, r422318, r422319);
        double r422321 = r422316 - r422320;
        double r422322 = r422313 ? r422321 : r422311;
        double r422323 = r422305 ? r422311 : r422322;
        return r422323;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.028213729881585915 or 0.031240215431948184 < 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.028213729881585915 < x < 0.031240215431948184

    1. Initial program 62.8

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied add-log-exp62.8

      \[\leadsto \color{blue}{\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)}\]
    4. 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)}\]
    5. Simplified0.0

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

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

Reproduce

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