Average Error: 30.9 → 0.0
Time: 29.1s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02778090518414558:\\ \;\;\;\;\frac{x - \sin x}{x - \frac{\sin x}{\cos x}}\\ \mathbf{elif}\;x \le 0.02961693412874807:\\ \;\;\;\;\mathsf{fma}\left(\frac{9}{40}, x \cdot x, -\mathsf{fma}\left(\frac{27}{2800}, \left(x \cdot x\right) \cdot \left(x \cdot x\right), \frac{1}{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x - \sin x}{x - \frac{\sin x}{\cos x}}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.02778090518414558:\\
\;\;\;\;\frac{x - \sin x}{x - \frac{\sin x}{\cos x}}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{x - \sin x}{x - \frac{\sin x}{\cos x}}\\

\end{array}
double f(double x) {
        double r327631 = x;
        double r327632 = sin(r327631);
        double r327633 = r327631 - r327632;
        double r327634 = tan(r327631);
        double r327635 = r327631 - r327634;
        double r327636 = r327633 / r327635;
        return r327636;
}

double f(double x) {
        double r327637 = x;
        double r327638 = -0.02778090518414558;
        bool r327639 = r327637 <= r327638;
        double r327640 = sin(r327637);
        double r327641 = r327637 - r327640;
        double r327642 = cos(r327637);
        double r327643 = r327640 / r327642;
        double r327644 = r327637 - r327643;
        double r327645 = r327641 / r327644;
        double r327646 = 0.02961693412874807;
        bool r327647 = r327637 <= r327646;
        double r327648 = 0.225;
        double r327649 = r327637 * r327637;
        double r327650 = 0.009642857142857142;
        double r327651 = r327649 * r327649;
        double r327652 = 0.5;
        double r327653 = fma(r327650, r327651, r327652);
        double r327654 = -r327653;
        double r327655 = fma(r327648, r327649, r327654);
        double r327656 = r327647 ? r327655 : r327645;
        double r327657 = r327639 ? r327645 : r327656;
        return r327657;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.02778090518414558 or 0.02961693412874807 < 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. Taylor expanded around inf 0.0

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

    if -0.02778090518414558 < x < 0.02961693412874807

    1. Initial program 62.7

      \[\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 \cdot x, -\mathsf{fma}\left(\frac{27}{2800}, \left(x \cdot x\right) \cdot \left(x \cdot x\right), \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.02778090518414558:\\ \;\;\;\;\frac{x - \sin x}{x - \frac{\sin x}{\cos x}}\\ \mathbf{elif}\;x \le 0.02961693412874807:\\ \;\;\;\;\mathsf{fma}\left(\frac{9}{40}, x \cdot x, -\mathsf{fma}\left(\frac{27}{2800}, \left(x \cdot x\right) \cdot \left(x \cdot x\right), \frac{1}{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x - \sin x}{x - \frac{\sin x}{\cos x}}\\ \end{array}\]

Reproduce

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