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

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

\end{array}
double f(double x) {
        double r14079 = x;
        double r14080 = sin(r14079);
        double r14081 = r14079 - r14080;
        double r14082 = tan(r14079);
        double r14083 = r14079 - r14082;
        double r14084 = r14081 / r14083;
        return r14084;
}

double f(double x) {
        double r14085 = x;
        double r14086 = -0.02908178396942002;
        bool r14087 = r14085 <= r14086;
        double r14088 = 0.03214934687220063;
        bool r14089 = r14085 <= r14088;
        double r14090 = !r14089;
        bool r14091 = r14087 || r14090;
        double r14092 = sin(r14085);
        double r14093 = r14085 - r14092;
        double r14094 = tan(r14085);
        double r14095 = r14085 - r14094;
        double r14096 = r14093 / r14095;
        double r14097 = 0.225;
        double r14098 = 2.0;
        double r14099 = pow(r14085, r14098);
        double r14100 = r14097 * r14099;
        double r14101 = 0.009642857142857142;
        double r14102 = 4.0;
        double r14103 = pow(r14085, r14102);
        double r14104 = 0.5;
        double r14105 = fma(r14101, r14103, r14104);
        double r14106 = r14100 - r14105;
        double r14107 = r14091 ? r14096 : r14106;
        return r14107;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.02908178396942002 or 0.03214934687220063 < x

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x}\]

    if -0.02908178396942002 < x < 0.03214934687220063

    1. Initial program 63.1

      \[\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}{\frac{9}{40} \cdot {x}^{2} - \mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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