Average Error: 31.5 → 30.1
Time: 12.5s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x - \sin x}{x - \tan x} \le 1.000000010707638997686785842233803123236:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\sqrt{x}, \sqrt{x}, -\sin x\right)}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt{\sqrt[3]{x}} \cdot \sqrt{\sqrt[3]{x}}, -\tan x\right)}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;\frac{x - \sin x}{x - \tan x} \le 1.000000010707638997686785842233803123236:\\
\;\;\;\;\frac{x - \sin x}{x - \tan x}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\sqrt{x}, \sqrt{x}, -\sin x\right)}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt{\sqrt[3]{x}} \cdot \sqrt{\sqrt[3]{x}}, -\tan x\right)}\\

\end{array}
double f(double x) {
        double r26592 = x;
        double r26593 = sin(r26592);
        double r26594 = r26592 - r26593;
        double r26595 = tan(r26592);
        double r26596 = r26592 - r26595;
        double r26597 = r26594 / r26596;
        return r26597;
}

double f(double x) {
        double r26598 = x;
        double r26599 = sin(r26598);
        double r26600 = r26598 - r26599;
        double r26601 = tan(r26598);
        double r26602 = r26598 - r26601;
        double r26603 = r26600 / r26602;
        double r26604 = 1.000000010707639;
        bool r26605 = r26603 <= r26604;
        double r26606 = sqrt(r26598);
        double r26607 = -r26599;
        double r26608 = fma(r26606, r26606, r26607);
        double r26609 = cbrt(r26598);
        double r26610 = r26609 * r26609;
        double r26611 = sqrt(r26609);
        double r26612 = r26611 * r26611;
        double r26613 = -r26601;
        double r26614 = fma(r26610, r26612, r26613);
        double r26615 = r26608 / r26614;
        double r26616 = r26605 ? r26603 : r26615;
        return r26616;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if (/ (- x (sin x)) (- x (tan x))) < 1.000000010707639

    1. Initial program 0.6

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

    if 1.000000010707639 < (/ (- x (sin x)) (- x (tan x)))

    1. Initial program 63.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt61.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-neg61.1

      \[\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 add-sqr-sqrt61.3

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

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\sqrt{x}, \sqrt{x}, -\sin x\right)}}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\tan x\right)}\]
    8. Using strategy rm
    9. Applied add-sqr-sqrt60.3

      \[\leadsto \frac{\mathsf{fma}\left(\sqrt{x}, \sqrt{x}, -\sin x\right)}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \color{blue}{\sqrt{\sqrt[3]{x}} \cdot \sqrt{\sqrt[3]{x}}}, -\tan x\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification30.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x - \sin x}{x - \tan x} \le 1.000000010707638997686785842233803123236:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\sqrt{x}, \sqrt{x}, -\sin x\right)}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt{\sqrt[3]{x}} \cdot \sqrt{\sqrt[3]{x}}, -\tan x\right)}\\ \end{array}\]

Reproduce

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