Average Error: 31.3 → 0.0
Time: 9.9s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0264956549454682354 \lor \neg \left(x \le 0.029859806300954833\right):\\ \;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.0264956549454682354 \lor \neg \left(x \le 0.029859806300954833\right):\\
\;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\

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

\end{array}
double f(double x) {
        double r11954 = x;
        double r11955 = sin(r11954);
        double r11956 = r11954 - r11955;
        double r11957 = tan(r11954);
        double r11958 = r11954 - r11957;
        double r11959 = r11956 / r11958;
        return r11959;
}

double f(double x) {
        double r11960 = x;
        double r11961 = -0.026495654945468235;
        bool r11962 = r11960 <= r11961;
        double r11963 = 0.029859806300954833;
        bool r11964 = r11960 <= r11963;
        double r11965 = !r11964;
        bool r11966 = r11962 || r11965;
        double r11967 = sin(r11960);
        double r11968 = r11960 - r11967;
        double r11969 = tan(r11960);
        double r11970 = r11960 - r11969;
        double r11971 = r11968 / r11970;
        double r11972 = exp(r11971);
        double r11973 = log(r11972);
        double r11974 = 0.225;
        double r11975 = 2.0;
        double r11976 = pow(r11960, r11975);
        double r11977 = 0.009642857142857142;
        double r11978 = 4.0;
        double r11979 = pow(r11960, r11978);
        double r11980 = 0.5;
        double r11981 = fma(r11977, r11979, r11980);
        double r11982 = -r11981;
        double r11983 = fma(r11974, r11976, r11982);
        double r11984 = r11966 ? r11973 : r11983;
        return r11984;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.026495654945468235 or 0.029859806300954833 < x

    1. Initial program 0.0

      \[\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.026495654945468235 < x < 0.029859806300954833

    1. Initial program 63.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.0264956549454682354 \lor \neg \left(x \le 0.029859806300954833\right):\\ \;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)\\ \end{array}\]

Reproduce

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