Average Error: 31.6 → 0.0
Time: 24.5s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.028431537088381868:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.025242037778536456:\\ \;\;\;\;\mathsf{fma}\left(\frac{9}{40}, x \cdot x, -\mathsf{fma}\left(\frac{27}{2800}, \left(x \cdot x\right) \cdot \left(x \cdot x\right), \frac{1}{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\frac{x - \sin x}{x - \tan x} \cdot \left(\frac{x - \sin x}{x - \tan x} \cdot \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.028431537088381868:\\
\;\;\;\;\frac{x - \sin x}{x - \tan x}\\

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

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

\end{array}
double f(double x) {
        double r186861 = x;
        double r186862 = sin(r186861);
        double r186863 = r186861 - r186862;
        double r186864 = tan(r186861);
        double r186865 = r186861 - r186864;
        double r186866 = r186863 / r186865;
        return r186866;
}

double f(double x) {
        double r186867 = x;
        double r186868 = -0.028431537088381868;
        bool r186869 = r186867 <= r186868;
        double r186870 = sin(r186867);
        double r186871 = r186867 - r186870;
        double r186872 = tan(r186867);
        double r186873 = r186867 - r186872;
        double r186874 = r186871 / r186873;
        double r186875 = 0.025242037778536456;
        bool r186876 = r186867 <= r186875;
        double r186877 = 0.225;
        double r186878 = r186867 * r186867;
        double r186879 = 0.009642857142857142;
        double r186880 = r186878 * r186878;
        double r186881 = 0.5;
        double r186882 = fma(r186879, r186880, r186881);
        double r186883 = -r186882;
        double r186884 = fma(r186877, r186878, r186883);
        double r186885 = r186874 * r186874;
        double r186886 = r186874 * r186885;
        double r186887 = cbrt(r186886);
        double r186888 = r186876 ? r186884 : r186887;
        double r186889 = r186869 ? r186874 : r186888;
        return r186889;
}

Error

Bits error versus x

Derivation

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

    1. Initial program 0.0

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

    if -0.028431537088381868 < x < 0.025242037778536456

    1. Initial program 63.0

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

    if 0.025242037778536456 < x

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied add-cbrt-cube0.1

      \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{x - \sin x}{x - \tan x} \cdot \frac{x - \sin x}{x - \tan x}\right) \cdot \frac{x - \sin x}{x - \tan x}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.028431537088381868:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.025242037778536456:\\ \;\;\;\;\mathsf{fma}\left(\frac{9}{40}, x \cdot x, -\mathsf{fma}\left(\frac{27}{2800}, \left(x \cdot x\right) \cdot \left(x \cdot x\right), \frac{1}{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\frac{x - \sin x}{x - \tan x} \cdot \left(\frac{x - \sin x}{x - \tan x} \cdot \frac{x - \sin x}{x - \tan x}\right)}\\ \end{array}\]

Reproduce

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