Average Error: 31.6 → 0.0
Time: 24.3s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02780120038993252190584470895373669918627 \lor \neg \left(x \le 0.02674499741262323024293401374507084256038\right):\\ \;\;\;\;\frac{x - \sin x}{x - \tan 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.02780120038993252190584470895373669918627 \lor \neg \left(x \le 0.02674499741262323024293401374507084256038\right):\\
\;\;\;\;\frac{x - \sin x}{x - \tan 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 r29629 = x;
        double r29630 = sin(r29629);
        double r29631 = r29629 - r29630;
        double r29632 = tan(r29629);
        double r29633 = r29629 - r29632;
        double r29634 = r29631 / r29633;
        return r29634;
}

double f(double x) {
        double r29635 = x;
        double r29636 = -0.027801200389932522;
        bool r29637 = r29635 <= r29636;
        double r29638 = 0.02674499741262323;
        bool r29639 = r29635 <= r29638;
        double r29640 = !r29639;
        bool r29641 = r29637 || r29640;
        double r29642 = sin(r29635);
        double r29643 = r29635 - r29642;
        double r29644 = tan(r29635);
        double r29645 = r29635 - r29644;
        double r29646 = r29643 / r29645;
        double r29647 = 0.225;
        double r29648 = 2.0;
        double r29649 = pow(r29635, r29648);
        double r29650 = r29647 * r29649;
        double r29651 = 0.009642857142857142;
        double r29652 = 4.0;
        double r29653 = pow(r29635, r29652);
        double r29654 = 0.5;
        double r29655 = fma(r29651, r29653, r29654);
        double r29656 = r29650 - r29655;
        double r29657 = r29641 ? r29646 : r29656;
        return r29657;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.027801200389932522 or 0.02674499741262323 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]

    if -0.027801200389932522 < x < 0.02674499741262323

    1. Initial program 63.1

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