Average Error: 31.1 → 0.0
Time: 27.1s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.03379760502135154692782137431095179636031 \lor \neg \left(x \le 0.02912871703929049635450887478782533435151\right):\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\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.03379760502135154692782137431095179636031 \lor \neg \left(x \le 0.02912871703929049635450887478782533435151\right):\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\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 r27926 = x;
        double r27927 = sin(r27926);
        double r27928 = r27926 - r27927;
        double r27929 = tan(r27926);
        double r27930 = r27926 - r27929;
        double r27931 = r27928 / r27930;
        return r27931;
}

double f(double x) {
        double r27932 = x;
        double r27933 = -0.03379760502135155;
        bool r27934 = r27932 <= r27933;
        double r27935 = 0.029128717039290496;
        bool r27936 = r27932 <= r27935;
        double r27937 = !r27936;
        bool r27938 = r27934 || r27937;
        double r27939 = tan(r27932);
        double r27940 = r27932 - r27939;
        double r27941 = r27932 / r27940;
        double r27942 = sin(r27932);
        double r27943 = r27942 / r27940;
        double r27944 = r27941 - r27943;
        double r27945 = 0.225;
        double r27946 = 2.0;
        double r27947 = pow(r27932, r27946);
        double r27948 = r27945 * r27947;
        double r27949 = 0.009642857142857142;
        double r27950 = 4.0;
        double r27951 = pow(r27932, r27950);
        double r27952 = 0.5;
        double r27953 = fma(r27949, r27951, r27952);
        double r27954 = r27948 - r27953;
        double r27955 = r27938 ? r27944 : r27954;
        return r27955;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.03379760502135155 or 0.029128717039290496 < 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}}\]

    if -0.03379760502135155 < x < 0.029128717039290496

    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.03379760502135154692782137431095179636031 \lor \neg \left(x \le 0.02912871703929049635450887478782533435151\right):\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\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 2019209 +o rules:numerics
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))