Average Error: 30.4 → 0.0
Time: 37.5s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02935110025381627:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.030835078313604224:\\ \;\;\;\;\left(x \cdot x\right) \cdot \frac{9}{40} - \mathsf{fma}\left(\frac{27}{2800}, \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right), \frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right) \cdot \left(\left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right) \cdot \left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right)\right)}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.02935110025381627:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

\mathbf{elif}\;x \le 0.030835078313604224:\\
\;\;\;\;\left(x \cdot x\right) \cdot \frac{9}{40} - \mathsf{fma}\left(\frac{27}{2800}, \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right), \frac{1}{2}\right)\\

\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right) \cdot \left(\left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right) \cdot \left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right)\right)}\\

\end{array}
double f(double x) {
        double r746929 = x;
        double r746930 = sin(r746929);
        double r746931 = r746929 - r746930;
        double r746932 = tan(r746929);
        double r746933 = r746929 - r746932;
        double r746934 = r746931 / r746933;
        return r746934;
}

double f(double x) {
        double r746935 = x;
        double r746936 = -0.02935110025381627;
        bool r746937 = r746935 <= r746936;
        double r746938 = tan(r746935);
        double r746939 = r746935 - r746938;
        double r746940 = r746935 / r746939;
        double r746941 = sin(r746935);
        double r746942 = r746941 / r746939;
        double r746943 = r746940 - r746942;
        double r746944 = 0.030835078313604224;
        bool r746945 = r746935 <= r746944;
        double r746946 = r746935 * r746935;
        double r746947 = 0.225;
        double r746948 = r746946 * r746947;
        double r746949 = 0.009642857142857142;
        double r746950 = r746946 * r746946;
        double r746951 = 0.5;
        double r746952 = fma(r746949, r746950, r746951);
        double r746953 = r746948 - r746952;
        double r746954 = r746943 * r746943;
        double r746955 = r746943 * r746954;
        double r746956 = cbrt(r746955);
        double r746957 = r746945 ? r746953 : r746956;
        double r746958 = r746937 ? r746943 : r746957;
        return r746958;
}

Error

Bits error versus x

Derivation

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

    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}}\]

    if -0.02935110025381627 < x < 0.030835078313604224

    1. Initial program 62.6

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

      \[\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(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right), \frac{1}{2}\right)}\]

    if 0.030835078313604224 < 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-cbrt-cube0.0

      \[\leadsto \color{blue}{\sqrt[3]{\left(\left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right) \cdot \left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right)\right) \cdot \left(\frac{x}{x - \tan x} - \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.02935110025381627:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.030835078313604224:\\ \;\;\;\;\left(x \cdot x\right) \cdot \frac{9}{40} - \mathsf{fma}\left(\frac{27}{2800}, \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right), \frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right) \cdot \left(\left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right) \cdot \left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right)\right)}\\ \end{array}\]

Reproduce

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