Average Error: 31.2 → 0.0
Time: 45.5s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.026771669741893454:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.023506914341673683:\\ \;\;\;\;(\left(x \cdot x\right) \cdot \frac{9}{40} + \left((\frac{-27}{2800} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) + \frac{-1}{2})_*\right))_*\\ \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.026771669741893454:\\
\;\;\;\;\frac{x - \sin x}{x - \tan x}\\

\mathbf{elif}\;x \le 0.023506914341673683:\\
\;\;\;\;(\left(x \cdot x\right) \cdot \frac{9}{40} + \left((\frac{-27}{2800} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) + \frac{-1}{2})_*\right))_*\\

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

\end{array}
double f(double x) {
        double r761939 = x;
        double r761940 = sin(r761939);
        double r761941 = r761939 - r761940;
        double r761942 = tan(r761939);
        double r761943 = r761939 - r761942;
        double r761944 = r761941 / r761943;
        return r761944;
}

double f(double x) {
        double r761945 = x;
        double r761946 = -0.026771669741893454;
        bool r761947 = r761945 <= r761946;
        double r761948 = sin(r761945);
        double r761949 = r761945 - r761948;
        double r761950 = tan(r761945);
        double r761951 = r761945 - r761950;
        double r761952 = r761949 / r761951;
        double r761953 = 0.023506914341673683;
        bool r761954 = r761945 <= r761953;
        double r761955 = r761945 * r761945;
        double r761956 = 0.225;
        double r761957 = -0.009642857142857142;
        double r761958 = r761955 * r761955;
        double r761959 = -0.5;
        double r761960 = fma(r761957, r761958, r761959);
        double r761961 = fma(r761955, r761956, r761960);
        double r761962 = r761954 ? r761961 : r761952;
        double r761963 = r761947 ? r761952 : r761962;
        return r761963;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.026771669741893454 or 0.023506914341673683 < x

    1. Initial program 0.1

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

    if -0.026771669741893454 < x < 0.023506914341673683

    1. Initial program 62.9

      \[\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} + \left((\frac{-27}{2800} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\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.026771669741893454:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.023506914341673683:\\ \;\;\;\;(\left(x \cdot x\right) \cdot \frac{9}{40} + \left((\frac{-27}{2800} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) + \frac{-1}{2})_*\right))_*\\ \mathbf{else}:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \end{array}\]

Reproduce

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