Average Error: 31.4 → 0.0
Time: 27.5s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02674820254090811560976348459917062427849:\\ \;\;\;\;\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)}\\ \mathbf{elif}\;x \le 0.02985439976441333839729530552631331374869:\\ \;\;\;\;\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}:\\ \;\;\;\;\frac{1}{\frac{x - \tan x}{x - \sin x}}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.02674820254090811560976348459917062427849:\\
\;\;\;\;\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)}\\

\mathbf{elif}\;x \le 0.02985439976441333839729530552631331374869:\\
\;\;\;\;\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}:\\
\;\;\;\;\frac{1}{\frac{x - \tan x}{x - \sin x}}\\

\end{array}
double f(double x) {
        double r560107 = x;
        double r560108 = sin(r560107);
        double r560109 = r560107 - r560108;
        double r560110 = tan(r560107);
        double r560111 = r560107 - r560110;
        double r560112 = r560109 / r560111;
        return r560112;
}

double f(double x) {
        double r560113 = x;
        double r560114 = -0.026748202540908116;
        bool r560115 = r560113 <= r560114;
        double r560116 = sin(r560113);
        double r560117 = r560113 - r560116;
        double r560118 = tan(r560113);
        double r560119 = r560113 - r560118;
        double r560120 = r560117 / r560119;
        double r560121 = r560120 * r560120;
        double r560122 = r560120 * r560121;
        double r560123 = cbrt(r560122);
        double r560124 = 0.02985439976441334;
        bool r560125 = r560113 <= r560124;
        double r560126 = 0.225;
        double r560127 = r560113 * r560113;
        double r560128 = -0.009642857142857142;
        double r560129 = r560127 * r560127;
        double r560130 = -0.5;
        double r560131 = fma(r560128, r560129, r560130);
        double r560132 = fma(r560126, r560127, r560131);
        double r560133 = 1.0;
        double r560134 = r560119 / r560117;
        double r560135 = r560133 / r560134;
        double r560136 = r560125 ? r560132 : r560135;
        double r560137 = r560115 ? r560123 : r560136;
        return r560137;
}

Error

Bits error versus x

Derivation

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

    1. Initial program 0.1

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

      \[\leadsto \frac{x - \sin x}{\color{blue}{\sqrt[3]{\left(\left(x - \tan x\right) \cdot \left(x - \tan x\right)\right) \cdot \left(x - \tan x\right)}}}\]
    4. Applied add-cbrt-cube42.0

      \[\leadsto \frac{\color{blue}{\sqrt[3]{\left(\left(x - \sin x\right) \cdot \left(x - \sin x\right)\right) \cdot \left(x - \sin x\right)}}}{\sqrt[3]{\left(\left(x - \tan x\right) \cdot \left(x - \tan x\right)\right) \cdot \left(x - \tan x\right)}}\]
    5. Applied cbrt-undiv42.0

      \[\leadsto \color{blue}{\sqrt[3]{\frac{\left(\left(x - \sin x\right) \cdot \left(x - \sin x\right)\right) \cdot \left(x - \sin x\right)}{\left(\left(x - \tan x\right) \cdot \left(x - \tan x\right)\right) \cdot \left(x - \tan x\right)}}}\]
    6. Simplified0.1

      \[\leadsto \sqrt[3]{\color{blue}{\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}}}\]

    if -0.026748202540908116 < x < 0.02985439976441334

    1. Initial program 63.3

      \[\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.02985439976441334 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied clear-num0.0

      \[\leadsto \color{blue}{\frac{1}{\frac{x - \tan x}{x - \sin x}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.02674820254090811560976348459917062427849:\\ \;\;\;\;\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)}\\ \mathbf{elif}\;x \le 0.02985439976441333839729530552631331374869:\\ \;\;\;\;\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}:\\ \;\;\;\;\frac{1}{\frac{x - \tan x}{x - \sin x}}\\ \end{array}\]

Reproduce

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