Average Error: 31.2 → 0.1
Time: 9.8s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.584526220894006520722996356198564171791 \lor \neg \left(x \le 1.580791957268951719584038073662668466568\right):\\ \;\;\;\;\sqrt{\frac{x - \sin x}{x - \tan x}} \cdot \sqrt{\frac{x - \sin x}{x - \tan 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 -1.584526220894006520722996356198564171791 \lor \neg \left(x \le 1.580791957268951719584038073662668466568\right):\\
\;\;\;\;\sqrt{\frac{x - \sin x}{x - \tan x}} \cdot \sqrt{\frac{x - \sin x}{x - \tan 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 r12460 = x;
        double r12461 = sin(r12460);
        double r12462 = r12460 - r12461;
        double r12463 = tan(r12460);
        double r12464 = r12460 - r12463;
        double r12465 = r12462 / r12464;
        return r12465;
}

double f(double x) {
        double r12466 = x;
        double r12467 = -1.5845262208940065;
        bool r12468 = r12466 <= r12467;
        double r12469 = 1.5807919572689517;
        bool r12470 = r12466 <= r12469;
        double r12471 = !r12470;
        bool r12472 = r12468 || r12471;
        double r12473 = sin(r12466);
        double r12474 = r12466 - r12473;
        double r12475 = tan(r12466);
        double r12476 = r12466 - r12475;
        double r12477 = r12474 / r12476;
        double r12478 = sqrt(r12477);
        double r12479 = r12478 * r12478;
        double r12480 = 0.225;
        double r12481 = 2.0;
        double r12482 = pow(r12466, r12481);
        double r12483 = 0.009642857142857142;
        double r12484 = 4.0;
        double r12485 = pow(r12466, r12484);
        double r12486 = 0.5;
        double r12487 = fma(r12483, r12485, r12486);
        double r12488 = -r12487;
        double r12489 = fma(r12480, r12482, r12488);
        double r12490 = r12472 ? r12479 : r12489;
        return r12490;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -1.5845262208940065 or 1.5807919572689517 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt0.0

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

    if -1.5845262208940065 < x < 1.5807919572689517

    1. Initial program 63.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Taylor expanded around 0 0.1

      \[\leadsto \color{blue}{\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)}\]
    3. Simplified0.1

      \[\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.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.584526220894006520722996356198564171791 \lor \neg \left(x \le 1.580791957268951719584038073662668466568\right):\\ \;\;\;\;\sqrt{\frac{x - \sin x}{x - \tan x}} \cdot \sqrt{\frac{x - \sin x}{x - \tan 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 2019353 +o rules:numerics
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))