Average Error: 31.8 → 0.0
Time: 29.0s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02987918099695829540762836984413297614083 \lor \neg \left(x \le 0.03077723303441503785449206986868375679478\right):\\ \;\;\;\;\frac{x}{x - \frac{\sin x}{\cos x}} - \frac{\sin x}{x - \frac{\sin x}{\cos 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.02987918099695829540762836984413297614083 \lor \neg \left(x \le 0.03077723303441503785449206986868375679478\right):\\
\;\;\;\;\frac{x}{x - \frac{\sin x}{\cos x}} - \frac{\sin x}{x - \frac{\sin x}{\cos 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 r34932 = x;
        double r34933 = sin(r34932);
        double r34934 = r34932 - r34933;
        double r34935 = tan(r34932);
        double r34936 = r34932 - r34935;
        double r34937 = r34934 / r34936;
        return r34937;
}

double f(double x) {
        double r34938 = x;
        double r34939 = -0.029879180996958295;
        bool r34940 = r34938 <= r34939;
        double r34941 = 0.030777233034415038;
        bool r34942 = r34938 <= r34941;
        double r34943 = !r34942;
        bool r34944 = r34940 || r34943;
        double r34945 = sin(r34938);
        double r34946 = cos(r34938);
        double r34947 = r34945 / r34946;
        double r34948 = r34938 - r34947;
        double r34949 = r34938 / r34948;
        double r34950 = r34945 / r34948;
        double r34951 = r34949 - r34950;
        double r34952 = 0.225;
        double r34953 = 2.0;
        double r34954 = pow(r34938, r34953);
        double r34955 = r34952 * r34954;
        double r34956 = 0.009642857142857142;
        double r34957 = 4.0;
        double r34958 = pow(r34938, r34957);
        double r34959 = 0.5;
        double r34960 = fma(r34956, r34958, r34959);
        double r34961 = r34955 - r34960;
        double r34962 = r34944 ? r34951 : r34961;
        return r34962;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.029879180996958295 or 0.030777233034415038 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt1.4

      \[\leadsto \frac{x - \sin x}{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}} - \tan x}\]
    4. Applied fma-neg1.4

      \[\leadsto \frac{x - \sin x}{\color{blue}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\tan x\right)}}\]
    5. Taylor expanded around inf 0.0

      \[\leadsto \color{blue}{\frac{x}{x - \frac{\sin x}{\cos x}} - \frac{\sin x}{x - \frac{\sin x}{\cos x}}}\]

    if -0.029879180996958295 < x < 0.030777233034415038

    1. Initial program 63.2

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