Average Error: 31.7 → 0.1
Time: 29.4s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02805121074086329088781432972155016614124:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 1.586202501676462706114989487105049192905:\\ \;\;\;\;\frac{9}{40} \cdot {x}^{2} - \mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{x - \sin x}{x - \tan x}} \cdot \sqrt{\frac{x - \sin x}{x - \tan x}}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.02805121074086329088781432972155016614124:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

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

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{x - \sin x}{x - \tan x}} \cdot \sqrt{\frac{x - \sin x}{x - \tan x}}\\

\end{array}
double f(double x) {
        double r29626 = x;
        double r29627 = sin(r29626);
        double r29628 = r29626 - r29627;
        double r29629 = tan(r29626);
        double r29630 = r29626 - r29629;
        double r29631 = r29628 / r29630;
        return r29631;
}

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

Error

Bits error versus x

Derivation

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

    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 div-sub1.4

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

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

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

    if -0.02805121074086329 < x < 1.5862025016764627

    1. Initial program 62.9

      \[\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}{\frac{9}{40} \cdot {x}^{2} - \mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\]

    if 1.5862025016764627 < 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}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.1

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

Reproduce

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