Average Error: 31.2 → 0.0
Time: 1.6m
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.030253797076063252:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.025797202571043447:\\ \;\;\;\;\left(x \cdot x\right) \cdot \frac{9}{40} - \left(\frac{27}{2800} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) + \frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \end{array}\]
double f(double x) {
        double r4636077 = x;
        double r4636078 = sin(r4636077);
        double r4636079 = r4636077 - r4636078;
        double r4636080 = tan(r4636077);
        double r4636081 = r4636077 - r4636080;
        double r4636082 = r4636079 / r4636081;
        return r4636082;
}

double f(double x) {
        double r4636083 = x;
        double r4636084 = -0.030253797076063252;
        bool r4636085 = r4636083 <= r4636084;
        double r4636086 = sin(r4636083);
        double r4636087 = r4636083 - r4636086;
        double r4636088 = tan(r4636083);
        double r4636089 = r4636083 - r4636088;
        double r4636090 = r4636087 / r4636089;
        double r4636091 = 0.025797202571043447;
        bool r4636092 = r4636083 <= r4636091;
        double r4636093 = r4636083 * r4636083;
        double r4636094 = 0.225;
        double r4636095 = r4636093 * r4636094;
        double r4636096 = 0.009642857142857142;
        double r4636097 = r4636093 * r4636093;
        double r4636098 = r4636096 * r4636097;
        double r4636099 = 0.5;
        double r4636100 = r4636098 + r4636099;
        double r4636101 = r4636095 - r4636100;
        double r4636102 = r4636092 ? r4636101 : r4636090;
        double r4636103 = r4636085 ? r4636090 : r4636102;
        return r4636103;
}

\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.030253797076063252:\\
\;\;\;\;\frac{x - \sin x}{x - \tan x}\\

\mathbf{elif}\;x \le 0.025797202571043447:\\
\;\;\;\;\left(x \cdot x\right) \cdot \frac{9}{40} - \left(\frac{27}{2800} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) + \frac{1}{2}\right)\\

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

\end{array}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.030253797076063252 or 0.025797202571043447 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied flip3--40.4

      \[\leadsto \frac{\color{blue}{\frac{{x}^{3} - {\left(\sin x\right)}^{3}}{x \cdot x + \left(\sin x \cdot \sin x + x \cdot \sin x\right)}}}{x - \tan x}\]
    4. Taylor expanded around -inf 0.0

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

    if -0.030253797076063252 < x < 0.025797202571043447

    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}{\left(x \cdot x\right) \cdot \frac{9}{40} - \left(\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{27}{2800} + \frac{1}{2}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

herbie shell --seed 2019101 
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  (/ (- x (sin x)) (- x (tan x))))