Average Error: 31.7 → 0.0
Time: 31.9s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.029470951698575748:\\ \;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\ \mathbf{elif}\;x \le 0.06477336993094537:\\ \;\;\;\;\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} - \log \left(e^{\frac{\sin x}{x - \tan x}}\right)\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.029470951698575748:\\
\;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\

\mathbf{elif}\;x \le 0.06477336993094537:\\
\;\;\;\;\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} - \log \left(e^{\frac{\sin x}{x - \tan x}}\right)\\

\end{array}
double f(double x) {
        double r830414 = x;
        double r830415 = sin(r830414);
        double r830416 = r830414 - r830415;
        double r830417 = tan(r830414);
        double r830418 = r830414 - r830417;
        double r830419 = r830416 / r830418;
        return r830419;
}

double f(double x) {
        double r830420 = x;
        double r830421 = -0.029470951698575748;
        bool r830422 = r830420 <= r830421;
        double r830423 = sin(r830420);
        double r830424 = r830420 - r830423;
        double r830425 = tan(r830420);
        double r830426 = r830420 - r830425;
        double r830427 = r830424 / r830426;
        double r830428 = exp(r830427);
        double r830429 = log(r830428);
        double r830430 = 0.06477336993094537;
        bool r830431 = r830420 <= r830430;
        double r830432 = 0.225;
        double r830433 = r830420 * r830420;
        double r830434 = r830432 * r830433;
        double r830435 = 0.009642857142857142;
        double r830436 = r830433 * r830433;
        double r830437 = 0.5;
        double r830438 = fma(r830435, r830436, r830437);
        double r830439 = r830434 - r830438;
        double r830440 = r830420 / r830426;
        double r830441 = r830423 / r830426;
        double r830442 = exp(r830441);
        double r830443 = log(r830442);
        double r830444 = r830440 - r830443;
        double r830445 = r830431 ? r830439 : r830444;
        double r830446 = r830422 ? r830429 : r830445;
        return r830446;
}

Error

Bits error versus x

Derivation

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

    1. Initial program 0.1

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

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

    if -0.029470951698575748 < x < 0.06477336993094537

    1. Initial program 62.8

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied div-sub62.7

      \[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]
    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}{\left(x \cdot x\right) \cdot \frac{9}{40} - \mathsf{fma}\left(\frac{27}{2800}, \left(x \cdot x\right) \cdot \left(x \cdot x\right), \frac{1}{2}\right)}\]

    if 0.06477336993094537 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied div-sub0.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.029470951698575748:\\ \;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\ \mathbf{elif}\;x \le 0.06477336993094537:\\ \;\;\;\;\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} - \log \left(e^{\frac{\sin x}{x - \tan x}}\right)\\ \end{array}\]

Reproduce

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