Average Error: 30.7 → 0.0
Time: 41.6s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02724167706585072:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.030074814014808618:\\ \;\;\;\;\mathsf{log1p}\left(\left(\mathsf{expm1}\left(\left(\mathsf{fma}\left(\left(x \cdot x\right), \frac{9}{40}, \left(\mathsf{fma}\left(\frac{-27}{2800}, \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right), \frac{-1}{2}\right)\right)\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\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)}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.02724167706585072:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

\mathbf{elif}\;x \le 0.030074814014808618:\\
\;\;\;\;\mathsf{log1p}\left(\left(\mathsf{expm1}\left(\left(\mathsf{fma}\left(\left(x \cdot x\right), \frac{9}{40}, \left(\mathsf{fma}\left(\frac{-27}{2800}, \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right), \frac{-1}{2}\right)\right)\right)\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\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)}\\

\end{array}
double f(double x) {
        double r984261 = x;
        double r984262 = sin(r984261);
        double r984263 = r984261 - r984262;
        double r984264 = tan(r984261);
        double r984265 = r984261 - r984264;
        double r984266 = r984263 / r984265;
        return r984266;
}

double f(double x) {
        double r984267 = x;
        double r984268 = -0.02724167706585072;
        bool r984269 = r984267 <= r984268;
        double r984270 = tan(r984267);
        double r984271 = r984267 - r984270;
        double r984272 = r984267 / r984271;
        double r984273 = sin(r984267);
        double r984274 = r984273 / r984271;
        double r984275 = r984272 - r984274;
        double r984276 = 0.030074814014808618;
        bool r984277 = r984267 <= r984276;
        double r984278 = r984267 * r984267;
        double r984279 = 0.225;
        double r984280 = -0.009642857142857142;
        double r984281 = r984278 * r984278;
        double r984282 = -0.5;
        double r984283 = fma(r984280, r984281, r984282);
        double r984284 = fma(r984278, r984279, r984283);
        double r984285 = expm1(r984284);
        double r984286 = log1p(r984285);
        double r984287 = r984267 - r984273;
        double r984288 = r984287 / r984271;
        double r984289 = r984288 * r984288;
        double r984290 = r984288 * r984289;
        double r984291 = cbrt(r984290);
        double r984292 = r984277 ? r984286 : r984291;
        double r984293 = r984269 ? r984275 : r984292;
        return r984293;
}

Error

Bits error versus x

Derivation

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

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied div-sub0.1

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

    if -0.02724167706585072 < x < 0.030074814014808618

    1. Initial program 62.6

      \[\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(\left(x \cdot x\right), \frac{9}{40}, \left(\mathsf{fma}\left(\frac{-27}{2800}, \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right), \frac{-1}{2}\right)\right)\right)}\]
    4. Using strategy rm
    5. Applied log1p-expm1-u0.0

      \[\leadsto \color{blue}{\mathsf{log1p}\left(\left(\mathsf{expm1}\left(\left(\mathsf{fma}\left(\left(x \cdot x\right), \frac{9}{40}, \left(\mathsf{fma}\left(\frac{-27}{2800}, \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right), \frac{-1}{2}\right)\right)\right)\right)\right)\right)\right)}\]

    if 0.030074814014808618 < x

    1. Initial program 0.0

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

      \[\leadsto \color{blue}{\sqrt[3]{\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}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.02724167706585072:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.030074814014808618:\\ \;\;\;\;\mathsf{log1p}\left(\left(\mathsf{expm1}\left(\left(\mathsf{fma}\left(\left(x \cdot x\right), \frac{9}{40}, \left(\mathsf{fma}\left(\frac{-27}{2800}, \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right), \frac{-1}{2}\right)\right)\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\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)}\\ \end{array}\]

Reproduce

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