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

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

\end{array}
double f(double x) {
        double r568336 = x;
        double r568337 = sin(r568336);
        double r568338 = r568336 - r568337;
        double r568339 = tan(r568336);
        double r568340 = r568336 - r568339;
        double r568341 = r568338 / r568340;
        return r568341;
}

double f(double x) {
        double r568342 = x;
        double r568343 = -0.029811193700198836;
        bool r568344 = r568342 <= r568343;
        double r568345 = sin(r568342);
        double r568346 = r568342 - r568345;
        double r568347 = tan(r568342);
        double r568348 = r568342 - r568347;
        double r568349 = r568346 / r568348;
        double r568350 = exp(r568349);
        double r568351 = log(r568350);
        double r568352 = 0.02832423247032738;
        bool r568353 = r568342 <= r568352;
        double r568354 = 0.225;
        double r568355 = r568342 * r568342;
        double r568356 = r568354 * r568355;
        double r568357 = 0.009642857142857142;
        double r568358 = r568355 * r568355;
        double r568359 = 0.5;
        double r568360 = fma(r568357, r568358, r568359);
        double r568361 = r568356 - r568360;
        double r568362 = r568353 ? r568361 : r568351;
        double r568363 = r568344 ? r568351 : r568362;
        return r568363;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.029811193700198836 or 0.02832423247032738 < x

    1. Initial program 0.0

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

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

    if -0.029811193700198836 < x < 0.02832423247032738

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

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

Reproduce

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