Average Error: 31.5 → 0.0
Time: 11.0s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0271178395183582742 \lor \neg \left(x \le 0.0281382092260209458\right):\\ \;\;\;\;\frac{1}{\frac{x}{x - \sin x} - \frac{\tan x}{x - \sin x}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.0271178395183582742 \lor \neg \left(x \le 0.0281382092260209458\right):\\
\;\;\;\;\frac{1}{\frac{x}{x - \sin x} - \frac{\tan x}{x - \sin x}}\\

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

\end{array}
double f(double x) {
        double r21682 = x;
        double r21683 = sin(r21682);
        double r21684 = r21682 - r21683;
        double r21685 = tan(r21682);
        double r21686 = r21682 - r21685;
        double r21687 = r21684 / r21686;
        return r21687;
}

double f(double x) {
        double r21688 = x;
        double r21689 = -0.027117839518358274;
        bool r21690 = r21688 <= r21689;
        double r21691 = 0.028138209226020946;
        bool r21692 = r21688 <= r21691;
        double r21693 = !r21692;
        bool r21694 = r21690 || r21693;
        double r21695 = 1.0;
        double r21696 = sin(r21688);
        double r21697 = r21688 - r21696;
        double r21698 = r21688 / r21697;
        double r21699 = tan(r21688);
        double r21700 = r21699 / r21697;
        double r21701 = r21698 - r21700;
        double r21702 = r21695 / r21701;
        double r21703 = 0.225;
        double r21704 = 2.0;
        double r21705 = pow(r21688, r21704);
        double r21706 = 0.009642857142857142;
        double r21707 = 4.0;
        double r21708 = pow(r21688, r21707);
        double r21709 = 0.5;
        double r21710 = fma(r21706, r21708, r21709);
        double r21711 = -r21710;
        double r21712 = fma(r21703, r21705, r21711);
        double r21713 = r21694 ? r21702 : r21712;
        return r21713;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.027117839518358274 or 0.028138209226020946 < 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. Using strategy rm
    6. Applied clear-num1.5

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

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

    if -0.027117839518358274 < x < 0.028138209226020946

    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}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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