Average Error: 30.8 → 0.0
Time: 31.9s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.027836888459983777:\\ \;\;\;\;\log \left(e^{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\right)\\ \mathbf{elif}\;x \le 0.02825639784178301:\\ \;\;\;\;\mathsf{fma}\left(x \cdot x, \frac{9}{40}, \frac{-1}{2}\right) - \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{27}{2800}\\ \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.027836888459983777:\\
\;\;\;\;\log \left(e^{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\right)\\

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

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

\end{array}
double f(double x) {
        double r903174 = x;
        double r903175 = sin(r903174);
        double r903176 = r903174 - r903175;
        double r903177 = tan(r903174);
        double r903178 = r903174 - r903177;
        double r903179 = r903176 / r903178;
        return r903179;
}

double f(double x) {
        double r903180 = x;
        double r903181 = -0.027836888459983777;
        bool r903182 = r903180 <= r903181;
        double r903183 = tan(r903180);
        double r903184 = r903180 - r903183;
        double r903185 = r903180 / r903184;
        double r903186 = sin(r903180);
        double r903187 = r903186 / r903184;
        double r903188 = r903185 - r903187;
        double r903189 = exp(r903188);
        double r903190 = log(r903189);
        double r903191 = 0.02825639784178301;
        bool r903192 = r903180 <= r903191;
        double r903193 = r903180 * r903180;
        double r903194 = 0.225;
        double r903195 = -0.5;
        double r903196 = fma(r903193, r903194, r903195);
        double r903197 = r903193 * r903193;
        double r903198 = 0.009642857142857142;
        double r903199 = r903197 * r903198;
        double r903200 = r903196 - r903199;
        double r903201 = r903180 - r903186;
        double r903202 = r903201 / r903184;
        double r903203 = r903192 ? r903200 : r903202;
        double r903204 = r903182 ? r903190 : r903203;
        return r903204;
}

Error

Bits error versus x

Derivation

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

    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}}\]
    4. Using strategy rm
    5. Applied add-log-exp0.1

      \[\leadsto \frac{x}{x - \tan x} - \color{blue}{\log \left(e^{\frac{\sin x}{x - \tan x}}\right)}\]
    6. Applied add-log-exp0.1

      \[\leadsto \color{blue}{\log \left(e^{\frac{x}{x - \tan x}}\right)} - \log \left(e^{\frac{\sin x}{x - \tan x}}\right)\]
    7. Applied diff-log0.1

      \[\leadsto \color{blue}{\log \left(\frac{e^{\frac{x}{x - \tan x}}}{e^{\frac{\sin x}{x - \tan x}}}\right)}\]
    8. Simplified0.1

      \[\leadsto \log \color{blue}{\left(e^{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\right)}\]

    if -0.027836888459983777 < x < 0.02825639784178301

    1. Initial program 62.8

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

    if 0.02825639784178301 < x

    1. Initial program 0.0

      \[\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.027836888459983777:\\ \;\;\;\;\log \left(e^{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\right)\\ \mathbf{elif}\;x \le 0.02825639784178301:\\ \;\;\;\;\mathsf{fma}\left(x \cdot x, \frac{9}{40}, \frac{-1}{2}\right) - \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{27}{2800}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \end{array}\]

Reproduce

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