Average Error: 31.2 → 0.1
Time: 10.0s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.036269821600860841 \lor \neg \left(x \le 0.0386831041855637339\right):\\ \;\;\;\;\frac{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\sin x\right)}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\tan x\right)}\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}\right)\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.036269821600860841 \lor \neg \left(x \le 0.0386831041855637339\right):\\
\;\;\;\;\frac{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\sin x\right)}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\tan x\right)}\\

\mathbf{else}:\\
\;\;\;\;\log \left(e^{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}\right)\\

\end{array}
double f(double x) {
        double r16085 = x;
        double r16086 = sin(r16085);
        double r16087 = r16085 - r16086;
        double r16088 = tan(r16085);
        double r16089 = r16085 - r16088;
        double r16090 = r16087 / r16089;
        return r16090;
}

double f(double x) {
        double r16091 = x;
        double r16092 = -0.03626982160086084;
        bool r16093 = r16091 <= r16092;
        double r16094 = 0.038683104185563734;
        bool r16095 = r16091 <= r16094;
        double r16096 = !r16095;
        bool r16097 = r16093 || r16096;
        double r16098 = cbrt(r16091);
        double r16099 = r16098 * r16098;
        double r16100 = sin(r16091);
        double r16101 = -r16100;
        double r16102 = fma(r16099, r16098, r16101);
        double r16103 = tan(r16091);
        double r16104 = -r16103;
        double r16105 = fma(r16099, r16098, r16104);
        double r16106 = r16102 / r16105;
        double r16107 = 0.225;
        double r16108 = 2.0;
        double r16109 = pow(r16091, r16108);
        double r16110 = 0.009642857142857142;
        double r16111 = 4.0;
        double r16112 = pow(r16091, r16111);
        double r16113 = 0.5;
        double r16114 = fma(r16110, r16112, r16113);
        double r16115 = -r16114;
        double r16116 = fma(r16107, r16109, r16115);
        double r16117 = exp(r16116);
        double r16118 = log(r16117);
        double r16119 = r16097 ? r16106 : r16118;
        return r16119;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.03626982160086084 or 0.038683104185563734 < x

    1. Initial program 0.1

      \[\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. Using strategy rm
    6. Applied add-cube-cbrt0.1

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}} - \sin x}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\tan x\right)}\]
    7. Applied fma-neg0.1

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\sin x\right)}}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\tan x\right)}\]

    if -0.03626982160086084 < x < 0.038683104185563734

    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}{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}\]
    4. Using strategy rm
    5. Applied add-log-exp0.0

      \[\leadsto \color{blue}{\log \left(e^{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.036269821600860841 \lor \neg \left(x \le 0.0386831041855637339\right):\\ \;\;\;\;\frac{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\sin x\right)}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\tan x\right)}\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}\right)\\ \end{array}\]

Reproduce

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