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

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

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

\end{array}
double f(double x) {
        double r483750 = x;
        double r483751 = sin(r483750);
        double r483752 = r483750 - r483751;
        double r483753 = tan(r483750);
        double r483754 = r483750 - r483753;
        double r483755 = r483752 / r483754;
        return r483755;
}

double f(double x) {
        double r483756 = x;
        double r483757 = -0.025621427997812182;
        bool r483758 = r483756 <= r483757;
        double r483759 = tan(r483756);
        double r483760 = r483756 - r483759;
        double r483761 = r483756 / r483760;
        double r483762 = sin(r483756);
        double r483763 = r483762 / r483760;
        double r483764 = r483761 - r483763;
        double r483765 = 0.03210649578243009;
        bool r483766 = r483756 <= r483765;
        double r483767 = r483756 * r483756;
        double r483768 = 0.225;
        double r483769 = r483767 * r483768;
        double r483770 = 0.009642857142857142;
        double r483771 = r483767 * r483767;
        double r483772 = 0.5;
        double r483773 = fma(r483770, r483771, r483772);
        double r483774 = r483769 - r483773;
        double r483775 = r483766 ? r483774 : r483764;
        double r483776 = r483758 ? r483764 : r483775;
        return r483776;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.025621427997812182 or 0.03210649578243009 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied div-sub0.0

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

    if -0.025621427997812182 < x < 0.03210649578243009

    1. Initial program 62.8

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied div-sub62.7

      \[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]
    4. 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)}\]
    5. Simplified0.0

      \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot \frac{9}{40} - \mathsf{fma}\left(\frac{27}{2800}, \left(x \cdot x\right) \cdot \left(x \cdot x\right), \frac{1}{2}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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