Average Error: 31.6 → 0.0
Time: 13.2s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0258291753859107888 \lor \neg \left(x \le 0.0284410596258715502\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.0258291753859107888 \lor \neg \left(x \le 0.0284410596258715502\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 r15967 = x;
        double r15968 = sin(r15967);
        double r15969 = r15967 - r15968;
        double r15970 = tan(r15967);
        double r15971 = r15967 - r15970;
        double r15972 = r15969 / r15971;
        return r15972;
}

double f(double x) {
        double r15973 = x;
        double r15974 = -0.02582917538591079;
        bool r15975 = r15973 <= r15974;
        double r15976 = 0.02844105962587155;
        bool r15977 = r15973 <= r15976;
        double r15978 = !r15977;
        bool r15979 = r15975 || r15978;
        double r15980 = sin(r15973);
        double r15981 = r15973 - r15980;
        double r15982 = tan(r15973);
        double r15983 = r15973 - r15982;
        double r15984 = r15981 / r15983;
        double r15985 = 0.225;
        double r15986 = 2.0;
        double r15987 = pow(r15973, r15986);
        double r15988 = r15985 * r15987;
        double r15989 = 0.009642857142857142;
        double r15990 = 4.0;
        double r15991 = pow(r15973, r15990);
        double r15992 = 0.5;
        double r15993 = fma(r15989, r15991, r15992);
        double r15994 = r15988 - r15993;
        double r15995 = r15979 ? r15984 : r15994;
        return r15995;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.02582917538591079 or 0.02844105962587155 < x

    1. Initial program 0.0

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

    if -0.02582917538591079 < x < 0.02844105962587155

    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}{\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.0258291753859107888 \lor \neg \left(x \le 0.0284410596258715502\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 2020046 +o rules:numerics
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))